summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-06-15 15:58:22 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-06-15 15:58:22 -0700
commit714b68f7b325c30d0646c8b237d65b013fb12f04 (patch)
tree7e8105e4a081879fba37e5fd6725ed0148ec9adf /platform
parenta08bcb6d0ee71d6709f6cc0c019b346155d49c0b (diff)
downloadqtlocation-mapboxgl-714b68f7b325c30d0646c8b237d65b013fb12f04.tar.gz
Revert "use array of structs rather than parallel arrays for annotations"
This reverts commit 2435c1ad2603432186ee61eb4c423244a088bc51 (#1710), which needs to be revisited in light of #1655, which is a much higher priority at the moment.
Diffstat (limited to 'platform')
-rw-r--r--platform/default/glfw_view.cpp9
-rw-r--r--platform/ios/MGLMapView.mm14
2 files changed, 14 insertions, 9 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index e9da752909..0f063e5925 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -1,4 +1,3 @@
-#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/platform/default/glfw_view.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>
@@ -131,7 +130,8 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
}
void GLFWView::addRandomPointAnnotations(int count) {
- std::vector<mbgl::PointAnnotation> points;
+ std::vector<mbgl::LatLng> points;
+ std::vector<std::string> markers;
const auto sw = map->latLngForPixel({ 0, 0 });
const auto ne = map->latLngForPixel({ double(width), double(height) });
@@ -140,10 +140,11 @@ void GLFWView::addRandomPointAnnotations(int count) {
const double lon = sw.longitude + (ne.longitude - sw.longitude) * (double(std::rand()) / RAND_MAX);
const double lat = sw.latitude + (ne.latitude - sw.latitude) * (double(std::rand()) / RAND_MAX);
- points.emplace_back(mbgl::LatLng{ lat, lon }, "default_marker");
+ points.push_back({ lat, lon });
+ markers.push_back("default_marker");
}
- map->addPointAnnotations(points);
+ map->addPointAnnotations(points, markers);
}
void GLFWView::onScroll(GLFWwindow *window, double /*xOffset*/, double yOffset) {
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 793363b638..4ef63d4bf8 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -8,7 +8,6 @@
#import <OpenGLES/EAGL.h>
#include <mbgl/mbgl.hpp>
-#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/platform/darwin/reachability.h>
#include <mbgl/storage/default_file_source.hpp>
@@ -1670,8 +1669,11 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
{
if ( ! annotations) return;
- std::vector<mbgl::PointAnnotation> points;
- points.reserve(annotations.count);
+ std::vector<mbgl::LatLng> latLngs;
+ latLngs.reserve(annotations.count);
+
+ std::vector<std::string> symbols;
+ symbols.reserve(annotations.count);
BOOL delegateImplementsSymbolLookup = [self.delegate respondsToSelector:@selector(mapView:symbolNameForAnnotation:)];
@@ -1679,6 +1681,8 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
{
assert([annotation conformsToProtocol:@protocol(MGLAnnotation)]);
+ latLngs.push_back(MGLLatLngFromLocationCoordinate2D(annotation.coordinate));
+
NSString *symbolName = nil;
if (delegateImplementsSymbolLookup)
@@ -1686,10 +1690,10 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
symbolName = [self.delegate mapView:self symbolNameForAnnotation:annotation];
}
- points.emplace_back(MGLLatLngFromLocationCoordinate2D(annotation.coordinate), (symbolName ? [symbolName UTF8String] : ""));
+ symbols.push_back((symbolName ? [symbolName UTF8String] : ""));
}
- std::vector<uint32_t> annotationIDs = _mbglMap->addPointAnnotations(points);
+ std::vector<uint32_t> annotationIDs = _mbglMap->addPointAnnotations(latLngs, symbols);
for (size_t i = 0; i < annotationIDs.size(); ++i)
{