summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLShape.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLShape.h')
-rw-r--r--platform/darwin/src/MGLShape.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h
index ce9375c910..af815da0e9 100644
--- a/platform/darwin/src/MGLShape.h
+++ b/platform/darwin/src/MGLShape.h
@@ -13,6 +13,30 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface MGLShape : NSObject <MGLAnnotation>
+#pragma mark Creating a Shape
+
+/**
+ Returns an `MGLShape` object initialized with the given data interpreted as a
+ string containing a GeoJSON object.
+
+ If the GeoJSON object is a geometry, the returned value is a kind of
+ `MGLShape`. If it is a feature object, the returned value is a kind of
+ `MGLShape` that conforms to the `MGLFeature` protocol. If it is a feature
+ collection object, the returned value is an instance of
+ `MGLShapeCollectionFeature`.
+
+ @param data String data containing GeoJSON source code.
+ @param encoding The encoding used by `data`.
+ @param outError Upon return, if an error has occurred, a pointer to an
+ `NSError` object describing the error. Pass in `NULL` to ignore any error.
+ @return An `MGLShape` object representation of `data`, or `nil` if `data` could
+ not be parsed as valid GeoJSON source code. If `nil`, `outError` contains an
+ `NSError` object describing the problem.
+ */
++ (nullable MGLShape *)shapeWithData:(NSData *)data encoding:(NSStringEncoding)encoding error:(NSError * _Nullable *)outError;
+
+#pragma mark Accessing the Shape Attributes
+
/**
The title of the shape annotation. The default value of this property is `nil`.
*/
@@ -34,6 +58,17 @@ NS_ASSUME_NONNULL_BEGIN
#endif
+#pragma mark Creating GeoJSON Data
+
+/**
+ Returns the GeoJSON string representation of the shape encapsulated in a data
+ object.
+
+ @param encoding The string encoding to use.
+ @return A data object containing the shape’s GeoJSON string representation.
+ */
+- (NSData *)geoJSONDataUsingEncoding:(NSStringEncoding)encoding;
+
@end
NS_ASSUME_NONNULL_END