[core] Do annotation longitude wrapping together with latitude clamping

This commit is contained in:
John Firebaugh
2016-05-26 15:59:23 -07:00
parent efaf6461aa
commit aa1a54c577
2 changed files with 4 additions and 17 deletions

View File

@@ -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 &&