MLNShape class

MLNShape is an abstract class that represents a shape or annotation. Shapes constitute the content of a map — not only the overlays atop the map, but also the content that forms the base map.

Create instances of MLNPointAnnotation, MLNPointAnnotation, MLNPointAnnotation, MLNMultiPolyline, MLNMultiPolyline, MLNMultiPolyline, or MLNMultiPolyline in order to use MLNShape's methods. Do not create instances of MLNShape directly, and do not create your own subclasses of this class. The shape classes correspond to the Geometry object types in the GeoJSON standard, but some have nonstandard names for backwards compatibility.

Although you do not create instances of this class directly, you can use its MLNShape/shapeWithData:encoding:error: factory method to create one of the concrete subclasses of MLNShape noted above from GeoJSON data. To access a shape’s attributes, use the corresponding MLNFeature class instead.

You can add shapes to the map by adding them to an MLNShapeSource object. Configure the appearance of an MLNShapeSource’s or MLNShapeSource’s shapes collectively using a concrete instance of MLNVectorStyleLayer. Alternatively, you can add some kinds of shapes directly to a map view as annotations or overlays.

You can filter the features in a MLNVectorStyleLayer or vary their layout or paint attributes based on the features’ geographies. Pass an MLNShape into an NSPredicate with the format SELF IN %@ or %@ CONTAINS SELF and set the MLNVectorStyleLayer/predicate property to that predicate, or set a layout or paint attribute to a similarly formatted NSExpression.

Implemented types
Implementers

Constructors

MLNShape()
Returns a new instance of MLNShape constructed with the default new method.
factory
MLNShape.castFrom(ObjCObjectBase other)
Constructs a MLNShape that points to the same underlying object as other.
MLNShape.castFromPointer(Pointer<ObjCObject> other, {bool retain = false, bool release = false})
Constructs a MLNShape that wraps the given raw object pointer.

Properties

coordinate CLLocationCoordinate2D
The center point (specified as a map coordinate) of the annotation. (required) (read-only)
no setter
debugDescription$1 → NSString
debugDescription
no setterinherited
description$1 → NSString
description
no setterinherited
hash$1 int
hash
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isProxy bool
isProxy
no setterinherited
ref → ObjCObjectRef
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtitle ↔ NSString?
The subtitle of the shape annotation. The default value of this property is nil.
getter/setter pair
superclass$1 → ObjCObjectBase
superclass
no setterinherited
title ↔ NSString?
The title of the shape annotation.
getter/setter pair

Methods

autorelease() MLNShape
autorelease
class$1() → ObjCObjectBase
class
inherited
conformsToProtocol$1(Protocol aProtocol) bool
conformsToProtocol:
inherited
copy() → ObjCObjectBase
copy
inherited
dealloc() → void
dealloc
inherited
doesNotRecognizeSelector(Pointer<ObjCSelector> aSelector) → void
doesNotRecognizeSelector:
inherited
encodeWithCoder(NSCoder coder) → void
encodeWithCoder:
forwardingTargetForSelector(Pointer<ObjCSelector> aSelector) → ObjCObjectBase
forwardingTargetForSelector:
inherited
forwardInvocation(NSInvocation anInvocation) → void
forwardInvocation:
inherited
geoJSONDataUsingEncoding(int encoding) → NSData
Returns the GeoJSON string representation of the shape encapsulated in a data object.
init() MLNShape
init
initWithCoder(NSCoder coder) MLNShape?
initWithCoder:
isEqual(ObjCObjectBase object) bool
isEqual:
inherited
isKindOfClass(ObjCObjectBase aClass) bool
isKindOfClass:
inherited
isMemberOfClass(ObjCObjectBase aClass) bool
isMemberOfClass:
inherited
methodForSelector(Pointer<ObjCSelector> aSelector) Pointer<NativeFunction<Void Function()>>
methodForSelector:
inherited
methodSignatureForSelector(Pointer<ObjCSelector> aSelector) → NSMethodSignature
methodSignatureForSelector:
inherited
mutableCopy() → ObjCObjectBase
mutableCopy
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performSelector(Pointer<ObjCSelector> aSelector) → ObjCObjectBase
performSelector:
inherited
performSelector$1(Pointer<ObjCSelector> aSelector, {required ObjCObjectBase withObject}) → ObjCObjectBase
performSelector:withObject:
inherited
performSelector$2(Pointer<ObjCSelector> aSelector, {required ObjCObjectBase withObject, required ObjCObjectBase withObject$1}) → ObjCObjectBase
performSelector:withObject:withObject:
inherited
release() → void
release
inherited
respondsToSelector(Pointer<ObjCSelector> aSelector) bool
respondsToSelector:
inherited
retain() MLNShape
retain
retainCount() int
retainCount
inherited
self$1() MLNShape
self
toString() String
A string representation of this object.
inherited
zone() Pointer<NSZone>
zone
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

alloc() MLNShape
alloc
allocWithZone(Pointer<NSZone> zone) MLNShape
allocWithZone:
getSupportsSecureCoding() bool
supportsSecureCoding
isInstance(ObjCObjectBase obj) bool
Returns whether obj is an instance of MLNShape.
new$() MLNShape
new
shapeWithData(NSData data, {required int encoding, required Pointer<Pointer<ObjCObject>> error}) MLNShape?
Returns an MLNShape object initialized with the given data interpreted as a string containing a GeoJSON object.