diff options
-rw-r--r-- | include/mbgl/annotation/shape_annotation.hpp | 16 | ||||
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 5 |
2 files changed, 4 insertions, 17 deletions
diff --git a/include/mbgl/annotation/shape_annotation.hpp b/include/mbgl/annotation/shape_annotation.hpp index 6e3fe95dd4..c5d4c42d87 100644 --- a/include/mbgl/annotation/shape_annotation.hpp +++ b/include/mbgl/annotation/shape_annotation.hpp @@ -31,24 +31,10 @@ public: std::string>; // creates an annotation whose type and properties are sourced from a style layer ShapeAnnotation(const AnnotationSegments& segments_, const Properties& properties_) - : segments(wrapCoordinates(segments_)), properties(properties_) {} + : segments(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 diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 1da2e4ea9f..76a237bfc2 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -91,8 +91,9 @@ void ShapeAnnotationImpl::updateTile(const CanonicalTileID& tileID, AnnotationTi for (auto& segment : shape.segments) { std::vector<geojsonvt::LonLat> points; for (auto& latLng : segment) { - const double constrainedLatitude = util::clamp(latLng.latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX); - points.push_back(geojsonvt::LonLat(latLng.longitude, constrainedLatitude)); + const double wrappedLongitude = util::wrap(latLng.longitude, -util::LONGITUDE_MAX, util::LONGITUDE_MAX); + const double clampedLatitude = util::clamp(latLng.latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX); + points.push_back(geojsonvt::LonLat(wrappedLongitude, clampedLatitude)); } if (type == geojsonvt::ProjectedFeatureType::Polygon && |