summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLGeometry_Private.h
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-04-06 08:28:28 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-06 09:22:51 -0700
commitab6185fdc343448d3b6cbfc5e2bc91b5242fdf9f (patch)
tree71bf3a090c01570dc7f28899928dade0ed1424f0 /platform/darwin/src/MGLGeometry_Private.h
parent16a2839e23d42d4640ef028d62dc01322a0d2e5a (diff)
downloadqtlocation-mapboxgl-ab6185fdc343448d3b6cbfc5e2bc91b5242fdf9f.tar.gz
[ios, macos] Streamlined coordinate validation
Replaced preflight checks in MGLLatLngFromLocationCoordinate2D() with a try-catch block that relays exceptions raised by mbgl. De-inlined the function because it’s no longer trivial.
Diffstat (limited to 'platform/darwin/src/MGLGeometry_Private.h')
-rw-r--r--platform/darwin/src/MGLGeometry_Private.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h
index d72e4959c9..3e029e8ee0 100644
--- a/platform/darwin/src/MGLGeometry_Private.h
+++ b/platform/darwin/src/MGLGeometry_Private.h
@@ -12,21 +12,7 @@
/// the given point.
CGRect MGLExtendRect(CGRect rect, CGPoint point);
-NS_INLINE mbgl::LatLng MGLLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
- if (std::isnan(coordinate.latitude)) {
- [NSException raise:NSInvalidArgumentException format:@"latitude must not be NaN"];
- }
- if (std::isnan(coordinate.longitude)) {
- [NSException raise:NSInvalidArgumentException format:@"longitude must not be NaN"];
- }
- if (std::abs(coordinate.latitude) > 90.0) {
- [NSException raise:NSInvalidArgumentException format:@"latitude must be between -90 and 90"];
- }
- if (!std::isfinite(coordinate.longitude)) {
- [NSException raise:NSInvalidArgumentException format:@"longitude must not be infinite"];
- }
- return mbgl::LatLng(coordinate.latitude, coordinate.longitude);
-}
+mbgl::LatLng MGLLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate);
NS_INLINE mbgl::Point<double> MGLPointFromLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
return mbgl::Point<double>(coordinate.longitude, coordinate.latitude);