MGLCluster
@protocol MGLCluster <MGLFeature>
A protocol that feature subclasses (i.e. those already conforming to the MGLFeature
protocol) conform to if they represent clusters.
Currently the only class that conforms to MGLCluster
is MGLPointFeatureCluster
(a subclass of MGLPointFeature
).
To check if a feature is a cluster, check conformity to MGLCluster
, for example:
let shape = try! MGLShape(data: clusterShapeData, encoding: String.Encoding.utf8.rawValue)
guard let pointFeature = shape as? MGLPointFeature else {
throw ExampleError.unexpectedFeatureType
}
// Check for cluster conformance
guard let cluster = pointFeature as? MGLCluster else {
throw ExampleError.featureIsNotACluster
}
// Currently the only supported class that conforms to `MGLCluster` is
// `MGLPointFeatureCluster`
guard cluster is MGLPointFeatureCluster else {
throw ExampleError.unexpectedFeatureType
}
clusterIdentifier
The identifier for the cluster.
Declaration
Objective-C
@property (nonatomic, readonly) NSUInteger clusterIdentifier;
Swift
var clusterIdentifier: UInt { get }
clusterPointCount
The number of points within this cluster
Declaration
Objective-C
@property (nonatomic, readonly) NSUInteger clusterPointCount;
Swift
var clusterPointCount: UInt { get }
iOS SDK
SDK JS Reference
- MGLUserLocationAnnotationViewStyle
- MGLAccountManager
- MGLAnnotationImage
- MGLCircleStyleLayer
- MGLMapSnapshot
- NSValue(MGLHillshadeStyleLayerAdditions)
- MGLLight
- MGLCoordinateSpan
- MGLOfflinePack
- MGLAnnotationVerticalAlignment
- MGLSource
- MGLDEMEncoding
- MGLCoordinateSpan
- MGLMapCamera
- MGLTextWritingMode
- MGLIconTranslationAnchor
- NSValue(MGLSymbolStyleLayerAdditions)
- MGLOfflinePackProgress
- MGLMapSnapshotOptions
- Primitive Shapes
- NSValue(MGLAdditions)
- MGLTextPitchAlignment
- MGLSphericalPosition
- MGLCompassDirectionFormatter
- MGLVectorTileSource
- MGLMapViewDelegate
- MGLHillshadeIlluminationAnchor
- MGLIconTextFit
- MGLLocationManagerDelegate
- MGLShape
- Formatters
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLMapSnapshotterDelegate
- MGLAnnotationViewDragState
- MGLComputedShapeSource
- NSValue(MGLCircleStyleLayerAdditions)
- MGLHillshadeStyleLayer
- MGLOverlay
- MGLPolygon
- MGLStyleLayer
- MGLTilePyramidOfflineRegion
- MGLMapView
- MGLTransition
- MGLOfflineStorage
- MGLComputedShapeSourceDataSource
- MGLMapDebugMaskOptions
- MGLClockDirectionFormatter
- MGLTextRotationAlignment
- MGLUserTrackingMode
- NSValue(MGLRasterStyleLayerAdditions)
- MGLAttributionInfo
- MGLRasterStyleLayer
- Style Content
- MGLUserLocation
- MGLRasterTileSource
- MGLFillTranslationAnchor
- Other Protocols
- MGLSphericalPosition
- MGLMapSnapshotter
- MGLRasterResamplingMode
- MGLAnnotationView
- MGLResourceKind
- MGLShapeCollection
- Other Enumerations
- NSExpression(MGLAdditions)
- MGLCirclePitchAlignment
- MGLFillExtrusionTranslationAnchor
- Style Layers
- Other Constants
- MGLCoordinateBounds
- Appendices
- MGLLoggingConfiguration
- Other Structures
- MGLMapSnapshotOverlay
- MGLCircleTranslationAnchor
- User Interaction
- NSValue(MGLLineStyleLayerAdditions)
- MGLErrorCode
- MGLAttributedExpression
- MGLSymbolStyleLayer
- MGLCircleScaleAlignment
- MGLTextTransform
- MGLOrnamentVisibility
- MGLMultiPoint
- MGLShapeSource
- MGLLightAnchor
- MGLCalloutViewDelegate
- MGLCluster
- MGLOfflinePackProgress
- MGLPolyline
- MGLFeature
- MGLAnnotation
- MGLFillStyleLayer
- MGLIconRotationAlignment
- NSValue(MGLFillStyleLayerAdditions)
- Other Classes
- MGLLineTranslationAnchor
- MGLTextAnchor
- Offline Maps
- MGLLocationManager
- MGLStyle
- Other Type Definitions
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- Style Primitives
- MGLTileSource
- MGLTransition
- MGLForegroundStyleLayer
- MGLStylable
- MGLIconPitchAlignment
- MGLOfflineRegion
- MGLHeatmapStyleLayer
- MGLCompassButton
- MGLFillExtrusionStyleLayer
- MGLSymbolPlacement
- MGLMultiPolyline
- MGLOfflinePackState
- MGLImageSource
- MGLCoordinateFormatter
- MGLDistanceFormatter
- MGLCoordinateQuad
- MGLPointCollection
- MGLPointAnnotation
- MGLTextJustification
- MGLOfflineStorageDelegate
- MGLCalloutView
- MGLOrnamentPosition
- MGLUserLocationAnnotationView
- MGLTileCoordinateSystem
- MGLSymbolZOrder
- MGLLineCap
- Other Functions
- MGLNetworkConfiguration
- MGLShapeOfflineRegion
- Styling the Map
- MGLLineJoin
- Maps
- MGLAttributionInfoStyle
- MGLIconAnchor
- MGLBackgroundStyleLayer
- MGLMultiPolygon
- Annotations
- MGLVectorStyleLayer
- Location Updates
- MGLTextTranslationAnchor
- MGLLineStyleLayer
- Other Categories
- Geometry
- MGLLoggingLevel
On this page