Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[Qt] Use geometry.hpp internally for shape annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpsantos committed Jun 1, 2016
1 parent 98b9946 commit b2bab79
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions platform/qt/src/qmapboxgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,22 +413,21 @@ mbgl::ShapeAnnotation fromQMapboxGLShapeAnnotation(const ShapeAnnotation &shapeA
const CoordinateSegments &segments = shapeAnnotation.first;
const QString &styleLayer = shapeAnnotation.second;

mbgl::AnnotationSegments mbglAnnotationSegments;
mbglAnnotationSegments.reserve(segments.size());
mbgl::Polygon<double> polygon;
polygon.reserve(segments.size());

for (const Coordinates &coordinates : segments) {
mbgl::AnnotationSegment mbglAnnotationSegment;
mbglAnnotationSegment.reserve(coordinates.size());
mbgl::LinearRing<double> linearRing;
linearRing.reserve(coordinates.size());

for (const Coordinate &coordinate : coordinates) {
mbgl::LatLng mbglCoordinate(coordinate.first, coordinate.second);
mbglAnnotationSegment.emplace_back(mbglCoordinate);
linearRing.emplace_back(mbgl::Point<double>(coordinate.first, coordinate.second));
}

mbglAnnotationSegments.emplace_back(mbglAnnotationSegment);
polygon.emplace_back(linearRing);
}

return { mbglAnnotationSegments, styleLayer.toStdString() };
return { polygon, styleLayer.toStdString() };
}

AnnotationID QMapboxGL::addShapeAnnotation(const ShapeAnnotation &shapeAnnotation)
Expand Down

0 comments on commit b2bab79

Please sign in to comment.