diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-26 16:35:55 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-01 17:36:50 -0700 |
commit | 8985b1311b7d00cf761752bd9291566325ae207a (patch) | |
tree | aa42e0a0f5e0dc592d6dcafdf5ff54013ccc7a25 /platform/darwin/src/MGLPolygon.mm | |
parent | aa1a54c577a95082824f2a5a6bdf4948506fcaa9 (diff) | |
download | qtlocation-mapboxgl-8985b1311b7d00cf761752bd9291566325ae207a.tar.gz |
[core] Use geometry.hpp types for shape annotations
Diffstat (limited to 'platform/darwin/src/MGLPolygon.mm')
-rw-r--r-- | platform/darwin/src/MGLPolygon.mm | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/platform/darwin/src/MGLPolygon.mm b/platform/darwin/src/MGLPolygon.mm index 5a24cb0791..47be070246 100644 --- a/platform/darwin/src/MGLPolygon.mm +++ b/platform/darwin/src/MGLPolygon.mm @@ -24,26 +24,31 @@ return self; } -- (mbgl::AnnotationSegments)annotationSegments { - auto segments = super.annotationSegments; - for (MGLPolygon *polygon in self.interiorPolygons) { - auto interiorSegments = polygon.annotationSegments; - segments.push_back(interiorSegments.front()); +- (mbgl::LinearRing<double>)ring { + NSUInteger count = self.pointCount; + CLLocationCoordinate2D *coordinates = self.coordinates; + + mbgl::LinearRing<double> result; + result.reserve(self.pointCount); + for (NSUInteger i = 0; i < count; i++) { + result.push_back(mbgl::Point<double>(coordinates[i].longitude, coordinates[i].latitude)); } - return segments; + return result; } -- (mbgl::ShapeAnnotation::Properties)shapeAnnotationPropertiesObjectWithDelegate:(id <MGLMultiPointDelegate>)delegate { - mbgl::ShapeAnnotation::Properties shapeProperties = [super shapeAnnotationPropertiesObjectWithDelegate:delegate]; - +- (mbgl::ShapeAnnotation)shapeAnnotationObjectWithDelegate:(id <MGLMultiPointDelegate>)delegate { mbgl::FillAnnotationProperties fillProperties; fillProperties.opacity = [delegate alphaForShapeAnnotation:self]; fillProperties.outlineColor = [delegate strokeColorForShapeAnnotation:self]; fillProperties.color = [delegate fillColorForPolygonAnnotation:self]; - - shapeProperties.set<mbgl::FillAnnotationProperties>(fillProperties); - - return shapeProperties; + + mbgl::Polygon<double> geometry; + geometry.push_back(self.ring); + for (MGLPolygon *polygon in self.interiorPolygons) { + geometry.push_back(polygon.ring); + } + + return mbgl::ShapeAnnotation(geometry, fillProperties); } @end |