Package globus.glmap

Class GLMapMarkerLayer


  • public class GLMapMarkerLayer
    extends GLMapDrawObject
    GLMapMarkerLayer displays a markers with given style. It could display thousands of markers and optionally cluster them.
    • Constructor Detail

      • GLMapMarkerLayer

        public GLMapMarkerLayer​(@Nullable
                                java.lang.Object[] markers,
                                @NonNull
                                GLMapMarkerStyleCollection styleCollection,
                                double clusteringRadius,
                                int drawOrder)
        Initializes GLMapMarkerLayer with given markers and `styleCollection`
        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.
        drawOrder - Draw order used to sort objects on map
        clusteringRadius - Radius of clustering in points. If 0 marker clustering will be disabled
      • GLMapMarkerLayer

        public GLMapMarkerLayer​(@NonNull
                                GLMapVectorObjectList objects,
                                @NonNull
                                GLMapVectorCascadeStyle cascadeStyle,
                                @NonNull
                                GLMapMarkerStyleCollection styleCollection,
                                double clusteringRadius,
                                int drawOrder)
        Initializes GLMapMarkerLayer with given vector objects and `style`
        Parameters:
        objects - Array of marker objects. Usually you set objects with data, that you need to display on map.
        cascadeStyle - A cascadeStyle that defines what style use for markers and unions
        styleCollection - A style collection object used to display markers.
        drawOrder - Draw order used to sort objects on map
        clusteringRadius - Radius of clustering in points. If 0 marker clustering will be disabled
    • Method Detail

      • objectsNearPoint

        @Nullable
        public java.lang.Object[] objectsNearPoint​(@NonNull
                                                   GLMapViewRenderer mapView,
                                                   @NonNull
                                                   MapPoint point,
                                                   double distanceInPoints)
        Searches nearest object or cluster of objects at given mapView Note that GLMapView must be dispalyed on screen to calculate distances.
        Parameters:
        mapView - map view where layer is displayed
        point - point where object(s) will be searched
        distanceInPoints - maximum hit distance in points
        Returns:
        First object or cluster distance of which is not greater that given distance
      • haveObject

        public boolean haveObject​(java.lang.Object marker)
        Checks if given marker is added to layer
        Parameters:
        marker - marker to check
        Returns:
        true if object is in marker layer
      • modify

        public void modify​(@Nullable
                           java.lang.Object[] newMarkers,
                           @Nullable
                           java.util.Set<java.lang.Object> markersToRemove,
                           @Nullable
                           java.util.Set<java.lang.Object> markersToReload,
                           boolean animated,
                           @Nullable
                           java.lang.Runnable onComplete)
        Adds or removes markers on layer
        Parameters:
        newMarkers - markers that should be added
        markersToRemove - markers that should be removed
        markersToReload - markers that should be reloaded
        animated - deleting or adding single markers will be animated
        onComplete - called when operation is finished
      • changeStyle

        public void changeStyle​(@NonNull
                                GLMapMarkerStyleCollection styleCollection)
        Change style of layer
        Parameters:
        styleCollection - new style for layer