public class MarkerManager<E extends Marker>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
bEnableDrawing |
protected UnfoldingMap |
map |
protected java.util.List<E> |
markers |
Constructor and Description |
---|
MarkerManager()
Creates a MarkerManager with an empty markers list.
|
MarkerManager(java.util.List<E> markers)
Creates a MarkerManager with given markers.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addMarker(E marker)
Adds a marker to the manager marker list.
|
void |
addMarkers(java.util.List<E> markers)
Adds a list of markers to the managed markers.
|
void |
clearMarkers()
Removes all markers.
|
void |
disableDrawing() |
void |
draw()
Internal method to draw all managed markers.
|
void |
enableDrawing() |
E |
findMarkerById(java.lang.String id)
Searches marker with ID.
|
E |
findMarkerByName(java.lang.String name) |
E |
findMarkerByProperty(java.lang.String key,
java.lang.Object value)
Searches marker with a specific property.
|
java.util.List<E> |
findMarkersByIds(java.util.List<java.lang.String> ids)
Searches list of markers with IDs.
|
E |
getFirstHitMarker(float checkX,
float checkY)
Returns the first marker which the given screen coordinates hit.
|
java.util.List<E> |
getHitMarkers(float checkX,
float checkY)
Returns all hit markers.
|
java.util.List<E> |
getMarkers()
Returns all markers managed by this MarkerManager.
|
E |
getNearestMarker(float checkX,
float checkY)
Returns the nearest marker to the given screen coordinates.
|
boolean |
isDrawingEnabled() |
Marker |
isInside(float checkX,
float checkY)
Deprecated.
Replaced by
getFirstHitMarker(float, float) |
boolean |
removeMarker(E marker)
Removes a marker from the managed markers.
|
void |
setMap(UnfoldingMap map)
Set the map to use for conversion of geo-locations to screen positions for the markers.
|
void |
setMarkers(java.util.List<E> markers)
Sets the markers to manage.
|
void |
toggleDrawing()
Toggles whether this marker manager draws all markers or none.
|
protected UnfoldingMap map
protected boolean bEnableDrawing
public MarkerManager()
public MarkerManager(java.util.List<E> markers)
markers
- The markers to add.public void setMap(UnfoldingMap map)
map
- The map.public void setMarkers(java.util.List<E> markers)
markers
- A list of markers. If null all existing markers will be removed.public boolean removeMarker(E marker)
marker
- The marker to remove.public void clearMarkers()
public boolean isDrawingEnabled()
public void enableDrawing()
public void disableDrawing()
public void toggleDrawing()
public boolean addMarker(E marker)
marker
- The marker to add.public void addMarkers(java.util.List<E> markers)
markers
- A list of markers.public E findMarkerById(java.lang.String id)
id
- The ID of the marker to find.public java.util.List<E> findMarkersByIds(java.util.List<java.lang.String> ids)
ids
- The list of IDs of the markers to find.public E findMarkerByProperty(java.lang.String key, java.lang.Object value)
key
- The property key to search for.value
- The property value to search for.public E findMarkerByName(java.lang.String name)
public java.util.List<E> getMarkers()
@Deprecated public Marker isInside(float checkX, float checkY)
getFirstHitMarker(float, float)
public E getNearestMarker(float checkX, float checkY)
checkX
- The x position to check.checkY
- The y position to check.public E getFirstHitMarker(float checkX, float checkY)
checkX
- The x position to check.checkY
- The y position to check.public java.util.List<E> getHitMarkers(float checkX, float checkY)
checkX
- The x position to check.checkY
- The y position to check.public void draw()