summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLPolyline.mm
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-05-26 16:35:55 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-01 17:36:50 -0700
commit8985b1311b7d00cf761752bd9291566325ae207a (patch)
treeaa42e0a0f5e0dc592d6dcafdf5ff54013ccc7a25 /platform/darwin/src/MGLPolyline.mm
parentaa1a54c577a95082824f2a5a6bdf4948506fcaa9 (diff)
downloadqtlocation-mapboxgl-8985b1311b7d00cf761752bd9291566325ae207a.tar.gz
[core] Use geometry.hpp types for shape annotations
Diffstat (limited to 'platform/darwin/src/MGLPolyline.mm')
-rw-r--r--platform/darwin/src/MGLPolyline.mm19
1 files changed, 12 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm
index 810b359bb0..ebba5c862e 100644
--- a/platform/darwin/src/MGLPolyline.mm
+++ b/platform/darwin/src/MGLPolyline.mm
@@ -13,17 +13,22 @@
return [[self alloc] initWithCoordinates:coords count:count];
}
-- (mbgl::ShapeAnnotation::Properties)shapeAnnotationPropertiesObjectWithDelegate:(id <MGLMultiPointDelegate>)delegate {
- mbgl::ShapeAnnotation::Properties shapeProperties = [super shapeAnnotationPropertiesObjectWithDelegate:delegate];
-
+- (mbgl::ShapeAnnotation)shapeAnnotationObjectWithDelegate:(id <MGLMultiPointDelegate>)delegate {
mbgl::LineAnnotationProperties lineProperties;
lineProperties.opacity = [delegate alphaForShapeAnnotation:self];
lineProperties.color = [delegate strokeColorForShapeAnnotation:self];
lineProperties.width = [delegate lineWidthForPolylineAnnotation:self];
-
- shapeProperties.set<mbgl::LineAnnotationProperties>(lineProperties);
-
- return shapeProperties;
+
+ NSUInteger count = self.pointCount;
+ CLLocationCoordinate2D *coordinates = self.coordinates;
+
+ mbgl::LineString<double> geometry;
+ geometry.reserve(self.pointCount);
+ for (NSUInteger i = 0; i < count; i++) {
+ geometry.push_back(mbgl::Point<double>(coordinates[i].longitude, coordinates[i].latitude));
+ }
+
+ return mbgl::ShapeAnnotation(geometry, lineProperties);
}
@end