MLNFeature class interface
The MLNFeature protocol is used to provide details about geographic features
contained in an MLNShapeSource or MLNVectorTileSource object. Each concrete
subclass of MLNShape in turn has a subclass that conforms to this protocol. A
feature object associates a shape with an optional identifier and attributes.
You can add custom data to display on the map by creating feature objects and
adding them to an MLNShapeSource using the
MLNShapeSource/initWithIdentifier:shape:options: method or
MLNShapeSource/shape property.
In addition to adding data to the map, you can also extract data from the map:
MLNMapView/visibleFeaturesAtPoint: and related methods return feature
objects that correspond to features in the source. This enables you to inspect
the properties of features in vector tiles loaded by MLNVectorTileSource
objects. You also reuse these feature objects as overlay annotations.
While it is possible to add MLNFeature-conforming objects to the map as
annotations using MLNMapView/addAnnotations: and related methods, doing so
has trade-offs:
-
Features added as annotations will not have
identifierorattributesproperties when used with feature querying. -
Features added as annotations become interactive. Taps and selection can be handled in
MLNMapViewDelegate/mapView:didSelectAnnotation:.
Constructors
- MLNFeature.castFrom(ObjCObjectBase other)
-
Constructs a MLNFeature that points to the same underlying object as
other. -
MLNFeature.castFromPointer(Pointer<
ObjCObject> other, {bool retain = false, bool release = false}) - Constructs a MLNFeature that wraps the given raw object pointer.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- ref → ObjCObjectRef
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- $protocol → Protocol
-
Returns the
objc.Protocolobject for this protocol.no setter -
attributeForKey_
→ ObjCProtocolMethod<
ObjCObjectBase? Function(NSString)> -
Returns the feature attribute for the given attribute name.
final
-
attributes
→ ObjCProtocolMethod<
NSDictionary Function()> -
A dictionary of attributes for this feature.
final
-
coordinate
→ ObjCProtocolMethod<
CLLocationCoordinate2D Function()> -
The center point (specified as a map coordinate) of the annotation. (required)
(read-only)
final
-
geoJSONDictionary
→ ObjCProtocolMethod<
NSDictionary Function()> -
Returns a dictionary that can be serialized as a GeoJSON Feature representation
of an instance of an
MLNFeaturesubclass.final -
identifier
→ ObjCProtocolMethod<
ObjCObjectBase? Function()> -
An object that uniquely identifies the feature in its containing content
source.
final
-
setAttributes_
→ ObjCProtocolListenableMethod<
void Function(NSDictionary)> -
A dictionary of attributes for this feature.
final
-
setIdentifier_
→ ObjCProtocolListenableMethod<
void Function(ObjCObjectBase?)> -
An object that uniquely identifies the feature in its containing content
source.
final
-
subtitle
→ ObjCProtocolMethod<
NSString? Function()> -
The string containing the annotation’s subtitle.
final
-
title
→ ObjCProtocolMethod<
NSString? Function()> -
The string containing the annotation’s title.
final
Static Methods
-
addToBuilder(
ObjCProtocolBuilder builder, {required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → void -
Adds the implementation of the MLNFeature protocol to an existing
objc.ObjCProtocolBuilder.override -
addToBuilderAsBlocking(
ObjCProtocolBuilder builder, {required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → void -
Adds the implementation of the MLNFeature protocol to an existing
objc.ObjCProtocolBuilder. All methods that can be implemented as blocking listeners will be. -
addToBuilderAsListener(
ObjCProtocolBuilder builder, {required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → void -
Adds the implementation of the MLNFeature protocol to an existing
objc.ObjCProtocolBuilder. All methods that can be implemented as listeners will be. -
conformsTo(
ObjCObjectBase obj) → bool -
Returns whether
objis an instance of MLNFeature.override -
implement(
{required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → MLNFeature -
Builds an object that implements the MLNFeature protocol. To implement
multiple protocols, use addToBuilder or
objc.ObjCProtocolBuilderdirectly.override -
implementAsBlocking(
{required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → MLNFeature -
Builds an object that implements the MLNFeature protocol. To implement
multiple protocols, use addToBuilder or
objc.ObjCProtocolBuilderdirectly. All methods that can be implemented as blocking listeners will be. -
implementAsListener(
{required ObjCObjectBase? identifier(), required void setIdentifier_(ObjCObjectBase?), required NSDictionary attributes(), required void setAttributes_(NSDictionary), required ObjCObjectBase? attributeForKey_(NSString), required NSDictionary geoJSONDictionary(), required CLLocationCoordinate2D coordinate(), NSString? title()?, NSString? subtitle()?, bool $keepIsolateAlive = true}) → MLNFeature -
Builds an object that implements the MLNFeature protocol. To implement
multiple protocols, use addToBuilder or
objc.ObjCProtocolBuilderdirectly. All methods that can be implemented as listeners will be.