GLMapMarkerLayer

Objective-C


@interface GLMapMarkerLayer : GLMapDrawObject

Swift

class GLMapMarkerLayer : GLMapDrawObject

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

  • Unavailable

    Please use inits with data.

    Plain -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

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

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    Radius of clustering in points (0 will disable clustering)

    drawOrder

    draw order of layer

    Return Value

    A new marker layer

  • Initializes GLMapMarkerLayer with given array of vector objects and style. When using this constructor location of markers is filled from 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

    Array of vector objects.

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    Radius of clustering in points (0 will disable clustering)

    drawOrder

    draw order of 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

    Array of vector objects.

    cascadeStyle

    A cascade style used to select image for marker.

    styleCollection

    A style collection object used to display markers.

    clusteringRadius

    Radius of clustering in points (0 will disable clustering)

    drawOrder

    draw order of layer

    Return Value

    A new marker layer

  • Copies markers from other layer

    Declaration

    Objective-C

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

    Swift

    func copyMarkers(from layer: GLMapMarkerLayer)

    Parameters

    layer

    other layer with markers to copy

  • Adds or removes markers on 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 modification will be animated

    completion

    block that will be called when modification is finished

  • Changes style of marker layer

    Declaration

    Objective-C

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

    Swift

    func changeStyle(_ style: GLMapMarkerStyleCollection) async

    Parameters

    style

    New style

    completion

    block that will be called when modification is finished

  • Searchs nearest object or cluster of objects at given mapView

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    mapView

    map view where layer is displayed

    point

    point where object(s) will be searched

    distanceInPoints

    maximum hit distance in points

    Return Value

    An array of objects that meets search criteria

  • Checks if marker is part of group

    Declaration

    Objective-C

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

    Swift

    func markerIsGrouped(_ marker: Any) -> Bool

    Parameters

    marker

    marker object

    Return Value

    YES if marker is grouped

  • Animation duraration

    Declaration

    Objective-C

    @property double animationDuration;

    Swift

    var animationDuration: Double { get set }