Package globus.glmap
Class GLMapMarkerLayer
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapDrawObject
globus.glmap.GLMapMarkerLayer
Displays markers with a given style and optional clustering.
The layer can render thousands of markers efficiently and supports hit-testing in screen coordinates.
-
Constructor Summary
ConstructorsConstructorDescriptionGLMapMarkerLayer(GLMapVectorObjectList objects, GLMapVectorCascadeStyle cascadeStyle, GLMapMarkerStyleCollection styleCollection, double clusteringRadius, int drawOrder) Initializes aGLMapMarkerLayerwith vector objects and a cascade style.GLMapMarkerLayer(Object[] markers, GLMapMarkerStyleCollection styleCollection, double clusteringRadius, int drawOrder) Initializes aGLMapMarkerLayerwith marker objects and a style collection. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeStyle(GLMapMarkerStyleCollection styleCollection) Change style of layerbooleanhaveObject(Object marker) Checks if given marker is added to layerbooleanmarkerIsGrouped(Object marker) Checks if marker is part of groupvoidAdds or removes markers on layerObject[]objectsNearPoint(GLMapViewRenderer mapView, MapPoint point, double distanceInPoints) Searches the nearest marker (or marker cluster) near a point.voidreplace(Object[] markers, GLMapMarkerStyleCollection styleCollection, double clusteringRadius) Replace content with new datavoidreplaceWithVectorObjects(GLMapVectorObjectList objects, GLMapVectorCascadeStyle cascadeStyle, GLMapMarkerStyleCollection styleCollection, double clusteringRadius) Replaces content with a set of vector objects and a cascade style.Methods inherited from class globus.glmap.GLMapDrawObject
getDrawOrder, isHidden, setHiddenMethods inherited from class globus.glmap.GLNativeObject
dispose
-
Constructor Details
-
GLMapMarkerLayer
public GLMapMarkerLayer(@Nullable Object[] markers, @NonNull GLMapMarkerStyleCollection styleCollection, double clusteringRadius, int drawOrder) Initializes aGLMapMarkerLayerwith marker objects and a style collection.- 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 screen points (dp). If0, marker clustering is disabled.drawOrder- Draw order used to sort objects on map.
-
GLMapMarkerLayer
public GLMapMarkerLayer(@NonNull GLMapVectorObjectList objects, @NonNull GLMapVectorCascadeStyle cascadeStyle, @NonNull GLMapMarkerStyleCollection styleCollection, double clusteringRadius, int drawOrder) Initializes aGLMapMarkerLayerwith vector objects and a cascade style.- Parameters:
objects- Array of marker objects. Usually you set objects with data, that you need to display on map.cascadeStyle- A cascade style that defines how markers and clusters are styled.styleCollection- A style collection object used to display markers.clusteringRadius- Radius of clustering in screen points (dp). If0, marker clustering is disabled.drawOrder- Draw order used to sort objects on map.
-
-
Method Details
-
objectsNearPoint
@Nullable public Object[] objectsNearPoint(@NonNull GLMapViewRenderer mapView, @NonNull MapPoint point, double distanceInPoints) Searches the nearest marker (or marker cluster) near a point.Note: the
GLMapViewmust be attached to a surface (visible on screen) to calculate screen distances.- Parameters:
mapView- renderer where this layer is displayedpoint- reference point in internal map coordinates (for example, fromGLMapViewRenderer.convertDisplayToInternal(double, double))distanceInPoints- maximum hit distance in screen points (dp)- Returns:
- array of matched objects (a single marker or a cluster), or
nullif nothing is within range
-
haveObject
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 addedmarkersToRemove- markers that should be removedanimated- deleting or adding single markers will be animatedonComplete- 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 screen points (dp). If0, marker clustering is disabled.
-
replaceWithVectorObjects
public void replaceWithVectorObjects(@NonNull GLMapVectorObjectList objects, @NonNull GLMapVectorCascadeStyle cascadeStyle, @NonNull GLMapMarkerStyleCollection styleCollection, double clusteringRadius) Replaces content with a set of vector objects and a cascade style.- Parameters:
objects- Array of marker objects. Usually you set objects with data, that you need to display on map.cascadeStyle- A cascade style that defines how markers and clusters are styled.styleCollection- A style collection object used to display markers.clusteringRadius- Radius of clustering in screen points (dp). If0, marker clustering is disabled.
-
changeStyle
Change style of layer- Parameters:
styleCollection- new style for layer
-
markerIsGrouped
Checks if marker is part of group- Parameters:
marker- marker object- Returns:
trueif marker is grouped
-