GLMapMarkerLayer

Objective-C


@interface GLMapMarkerLayer : GLMapDrawObject

Swift

class GLMapMarkerLayer : GLMapDrawObject

GLMapMarkerLayer displays a large number of markers with a given style. It supports marker clustering.

  • Unavailable

    Please use inits with data.

    Default -init is disabled.

    Declaration

    Objective-C

    - (instancetype _Nonnull)init;
  • Initializes GLMapMarkerLayer with given markers and style.

    Declaration

    Objective-C

    - (nonnull instancetype)
         initWithMarkers:(nonnull NSArray<id> *)markers
               andStyles:(nonnull GLMapMarkerStyleCollection *)styleCollection
        clusteringRadius:(double)clusteringRadius
               drawOrder:(int)drawOrder;

    Swift

    init(markers: [Any], andStyles styleCollection: GLMapMarkerStyleCollection, clusteringRadius: Double, drawOrder: Int32)

    Parameters

    markers

    An array of marker objects. Usually, you set objects with data that you need to display on the map.

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    The radius of clustering in points (0 will disable clustering).

    drawOrder

    The draw order of the layer.

    Return Value

    A new marker layer.

  • Initializes GLMapMarkerLayer with a given array of vector objects and style. When using this constructor, the location of markers is filled from the vector object. It can be modified in style together with style and text.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithVectorObjects:(nonnull GLMapVectorObjectArray *)vectorObjects
                    andStyles:(nonnull GLMapMarkerStyleCollection *)styleCollection
             clusteringRadius:(double)clusteringRadius
                    drawOrder:(int)drawOrder;

    Swift

    init(vectorObjects: GLMapVectorObjectArray, andStyles styleCollection: GLMapMarkerStyleCollection, clusteringRadius: Double, drawOrder: Int32)

    Parameters

    vectorObjects

    An array of vector objects.

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    The radius of clustering in points (0 will disable clustering).

    drawOrder

    The draw order of the layer.

    Return Value

    A new marker layer.

  • Initializes GLMapMarkerLayer with given markers and style.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithVectorObjects:(nonnull GLMapVectorObjectArray *)objects
                 cascadeStyle:(nonnull GLMapVectorCascadeStyle *)cascadeStyle
              styleCollection:(nonnull GLMapMarkerStyleCollection *)styleCollection
             clusteringRadius:(double)clusteringRadius
                    drawOrder:(int)drawOrder;

    Swift

    init(vectorObjects objects: GLMapVectorObjectArray, cascadeStyle: GLMapVectorCascadeStyle, styleCollection: GLMapMarkerStyleCollection, clusteringRadius: Double, drawOrder: Int32)

    Parameters

    objects

    An array of vector objects.

    cascadeStyle

    A cascade style used to select an image for the marker.

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    The radius of clustering in points (0 will disable clustering).

    drawOrder

    The draw order of the layer.

    Return Value

    A new marker layer.

  • Copies markers from another layer.

    Declaration

    Objective-C

    - (void)copyMarkersFromLayer:(nonnull GLMapMarkerLayer *)layer;

    Swift

    func copyMarkers(from layer: GLMapMarkerLayer)

    Parameters

    layer

    Another layer with markers to copy.

  • Adds or removes markers on the layer.

    Declaration

    Objective-C

    - (void)add:(NSArray<id> *_Nullable)markersToAdd
            remove:(NSArray<id> *_Nullable)markersToRemove
          animated:(BOOL)animated
        completion:(dispatch_block_t _Nullable)completion;

    Swift

    func add(_ markersToAdd: [Any]?, remove markersToRemove: [Any]?, animated: Bool) async

    Parameters

    markersToAdd

    Markers that should be added.

    markersToRemove

    Markers that should be removed (compared by pointer).

    animated

    If YES, the modification will be animated.

    completion

    A block that will be called when the modification is finished.

  • Changes the style of the marker layer.

    Declaration

    Objective-C

    - (void)changeStyle:(nonnull GLMapMarkerStyleCollection *)style
             completion:(dispatch_block_t _Nullable)completion;

    Swift

    func changeStyle(_ style: GLMapMarkerStyleCollection) async

    Parameters

    style

    The new style.

    completion

    A block that will be called when the modification is finished.

  • Searches for the nearest object or cluster of objects at a given mapView.

    Declaration

    Objective-C

    - (NSArray<id> *_Nullable)objectsAtMapView:(nonnull GLMapView *)mapView
                                     nearPoint:(nonnull GLMapPoint *)point
                                      distance:(double)distanceInPoints;

    Swift

    func objects(at mapView: GLMapView, nearPoint point: UnsafeMutablePointer<GLMapPoint>, distance distanceInPoints: Double) -> [Any]?

    Parameters

    mapView

    The map view where the layer is displayed.

    point

    The point where object(s) will be searched. If the return is non-null, it will be modified to the location of the cluster.

    distanceInPoints

    The maximum hit distance in points.

    Return Value

    An array of objects that meet the search criteria.

  • Checks if a marker is part of a group.

    Declaration

    Objective-C

    - (BOOL)markerIsGrouped:(nonnull id)marker;

    Swift

    func markerIsGrouped(_ marker: Any) -> Bool

    Parameters

    marker

    A marker object.

    Return Value

    YES if the marker is grouped.

  • Animation duration.

    Declaration

    Objective-C

    @property double animationDuration;

    Swift

    var animationDuration: Double { get set }