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 Details

    • GLMapMarkerLayer

      public GLMapMarkerLayer(@Nullable 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 Details

    • objectsNearPoint

      @Nullable public 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(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 Object[] newMarkers, @Nullable Set<Object> markersToRemove, boolean animated, @Nullable Runnable onComplete)
      Adds or removes markers on layer
      Parameters:
      newMarkers - markers that should be added
      markersToRemove - markers that should be removed
      animated - deleting or adding single markers will be animated
      onComplete - called when operation is finished
    • replace

      public void replace(@Nullable Object[] markers, @NonNull GLMapMarkerStyleCollection styleCollection, double clusteringRadius)
      Replace content with new data
      Parameters:
      markers - markers Array of marker objects.
      styleCollection - A style collection object used to display markers.
      clusteringRadius - Radius of clustering in points. If 0 marker clustering will be disabled
    • replaceWithVectorObjects

      public void replaceWithVectorObjects(@NonNull GLMapVectorObjectList objects, @NonNull GLMapVectorCascadeStyle cascadeStyle, @NonNull GLMapMarkerStyleCollection styleCollection, double clusteringRadius)
      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.
      clusteringRadius - Radius of clustering in points. If 0 marker clustering will be disabled
    • changeStyle

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

      public boolean markerIsGrouped(@NonNull Object marker)
      Checks if marker is part of group
      Parameters:
      marker - marker object
      Returns:
      YES if marker is grouped