summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation/shape_annotation_impl.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-10 19:49:09 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-18 00:53:14 +0200
commitac70ada2d3e9b842a1fd3f46361d323ddb20d232 (patch)
treed1dedaf12bee23241b55622210378981299a567c /src/mbgl/annotation/shape_annotation_impl.cpp
parentcfcccb94a10c60444438049c078b066ea9a08463 (diff)
downloadqtlocation-mapboxgl-ac70ada2d3e9b842a1fd3f46361d323ddb20d232.tar.gz
[core] Check for NaNs in mbgl::util::{min,max,clamp}
Diffstat (limited to 'src/mbgl/annotation/shape_annotation_impl.cpp')
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index a9277ee0a7..9adebf177b 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -4,6 +4,7 @@
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/annotation/annotation_tile.hpp>
#include <mbgl/util/constants.hpp>
+#include <mbgl/util/math.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/layer/line_layer.hpp>
@@ -90,8 +91,8 @@ void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile)
std::vector<geojsonvt::LonLat> points;
for (size_t i = 0; i < shape.segments[0].size(); ++i) { // first segment for now (no holes)
- const double constraintedLatitude = ::fmin(::fmax(shape.segments[0][i].latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
- points.push_back(geojsonvt::LonLat(shape.segments[0][i].longitude, constraintedLatitude));
+ const double constrainedLatitude = util::clamp(shape.segments[0][i].latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX);
+ points.push_back(geojsonvt::LonLat(shape.segments[0][i].longitude, constrainedLatitude));
}
if (type == geojsonvt::ProjectedFeatureType::Polygon &&