summaryrefslogtreecommitdiff
path: root/platform/darwin/include
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-21 22:07:03 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-22 11:13:02 -0700
commita852ee24fbf6c883b7f64bad9883937eb7b8d80d (patch)
treecee2f80a7ca11160f04a24d1d705de15b7fc0388 /platform/darwin/include
parent34a2f142e0bdaf488443dc34185f791eba0e94b9 (diff)
downloadqtlocation-mapboxgl-a852ee24fbf6c883b7f64bad9883937eb7b8d80d.tar.gz
[ios, osx] Geometry value methods
Added category methods on NSValue for converting to and from the structure types defined in MGLGeometry.h. Fixes #4485.
Diffstat (limited to 'platform/darwin/include')
-rw-r--r--platform/darwin/include/MGLGeometry.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/platform/darwin/include/MGLGeometry.h b/platform/darwin/include/MGLGeometry.h
index 8231eed442..1c1bf65efb 100644
--- a/platform/darwin/include/MGLGeometry.h
+++ b/platform/darwin/include/MGLGeometry.h
@@ -95,4 +95,53 @@ NS_INLINE CLLocationDegrees MGLDegreesFromRadians(CGFloat radians) {
return radians * 180 / M_PI;
}
+/**
+ Methods for round-tripping Mapbox geometry structure values.
+ */
+@interface NSValue (MGLGeometryAdditions)
+
+/**
+ Creates a new value object containing the specified Core Location geographic
+ coordinate structure.
+
+ @param coordinate The value for the new object.
+ @return A new value object that contains the geographic coordinate information.
+ */
++ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate;
+
+/**
+ The Core Location geographic coordinate structure representation of the value.
+ */
+@property (readonly) CLLocationCoordinate2D MGLCoordinateValue;
+
+/**
+ Creates a new value object containing the specified Mapbox coordinate span
+ structure.
+
+ @param span The value for the new object.
+ @return A new value object that contains the coordinate span information.
+ */
++ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span;
+
+/**
+ The Mapbox coordinate span structure representation of the value.
+ */
+@property (readonly) MGLCoordinateSpan MGLCoordinateSpanValue;
+
+/**
+ Creates a new value object containing the specified Mapbox coordinate bounds
+ structure.
+
+ @param bounds The value for the new object.
+ @return A new value object that contains the coordinate bounds information.
+ */
++ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds;
+
+/**
+ The Mapbox coordinate bounds structure representation of the value.
+ */
+@property (readonly) MGLCoordinateBounds MGLCoordinateBoundsValue;
+
+@end
+
NS_ASSUME_NONNULL_END