diff options
Diffstat (limited to 'include/mbgl/annotation')
-rw-r--r-- | include/mbgl/annotation/point_annotation.hpp | 5 | ||||
-rw-r--r-- | include/mbgl/annotation/shape_annotation.hpp | 17 |
2 files changed, 17 insertions, 5 deletions
diff --git a/include/mbgl/annotation/point_annotation.hpp b/include/mbgl/annotation/point_annotation.hpp index e226673997..3dea9a3e3e 100644 --- a/include/mbgl/annotation/point_annotation.hpp +++ b/include/mbgl/annotation/point_annotation.hpp @@ -9,9 +9,8 @@ namespace mbgl { class PointAnnotation { public: - inline PointAnnotation(const LatLng& position_, const std::string& icon_ = "") - : position(position_), icon(icon_) { - } + PointAnnotation(const LatLng& position_, const std::string& icon_ = "") + : position(position_.wrapped()), icon(icon_) {} const LatLng position; const std::string icon; diff --git a/include/mbgl/annotation/shape_annotation.hpp b/include/mbgl/annotation/shape_annotation.hpp index fffa7dab6e..121cb7f1d7 100644 --- a/include/mbgl/annotation/shape_annotation.hpp +++ b/include/mbgl/annotation/shape_annotation.hpp @@ -33,11 +33,24 @@ public: std::string>; // creates an annotation whose type and properties are sourced from a style layer ShapeAnnotation(const AnnotationSegments& segments_, const Properties& properties_) - : segments(segments_), properties(properties_) { - } + : segments(wrapCoordinates(segments_)), properties(properties_) {} const AnnotationSegments segments; const Properties properties; + +private: + AnnotationSegments wrapCoordinates(const AnnotationSegments& segments_) { + AnnotationSegments wrappedSegments; + // Wrap all segments coordinates. + for (const auto& segment_ : segments_) { + AnnotationSegment wrappedSegment; + for (const auto& latLng_ : segment_) { + wrappedSegment.push_back(latLng_.wrapped()); + } + wrappedSegments.push_back(wrappedSegment); + } + return wrappedSegments; + } }; } // namespace mbgl |