public abstract class Layer
extends java.lang.Object
KmlLayer
and
GeoJsonLayer
Modifier and Type | Class and Description |
---|---|
static interface |
Layer.OnFeatureClickListener
Callback interface for when a map object is clicked.
|
Constructor and Description |
---|
Layer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFeature(Feature feature)
Adds a provided feature to the map
|
protected void |
addGeoJsonToMap()
Adds GeoJson data to the map
|
protected void |
addKMLToMap()
Adds the KML data to the map
|
abstract void |
addLayerToMap() |
Feature |
getContainerFeature(java.lang.Object mapObject) |
protected java.lang.Iterable<KmlContainer> |
getContainers()
Gets an iterable of KmlContainerInterface objects
|
GeoJsonLineStringStyle |
getDefaultLineStringStyle()
Gets the default style used to render GeoJsonLineStrings.
|
GeoJsonPointStyle |
getDefaultPointStyle()
Gets the default style used to render GeoJsonPoints.
|
GeoJsonPolygonStyle |
getDefaultPolygonStyle()
Gets the default style used to render GeoJsonPolygons.
|
Feature |
getFeature(java.lang.Object mapObject)
Retrieves a corresponding Feature instance for the given Object
Allows maps with multiple layers to determine which layer the Object
belongs to.
|
java.lang.Iterable<? extends Feature> |
getFeatures()
Gets an iterable of all Feature elements that have been added to the layer
|
protected java.lang.Iterable<KmlGroundOverlay> |
getGroundOverlays()
Gets an iterable of KmlGroundOverlay objects
|
GoogleMap |
getMap()
Gets the map on which the layer is rendered
|
protected boolean |
hasContainers()
Checks if the layer contains any KmlContainers
|
protected boolean |
hasFeatures()
Checks if there are any features currently on the layer
|
boolean |
isLayerOnMap()
Checks if the current layer has been added to the map
|
protected void |
removeFeature(Feature feature)
Remove a specified feature from the map
|
void |
removeLayerFromMap()
Removes all the data from the map and clears all the stored placemarks
|
void |
setMap(GoogleMap map)
Renders the layer on the given map.
|
void |
setOnFeatureClickListener(Layer.OnFeatureClickListener listener)
Sets a single click listener for the entire GoogleMap object, that will be called
with the corresponding Feature object when an object on the map (Polygon,
Marker, Polyline) is clicked.
|
protected void |
storeRenderer(Renderer renderer)
Stores a new Renderer object into mRenderer
|
protected void addKMLToMap()
protected void addGeoJsonToMap()
public abstract void addLayerToMap()
public void removeLayerFromMap()
public void setOnFeatureClickListener(Layer.OnFeatureClickListener listener)
If getFeature() returns null this means that either the object is inside a KMLContainer, or the object is a MultiPolygon, MultiLineString or MultiPoint and must be handled differently.
listener
- Listener providing the onFeatureClick method to call.protected void storeRenderer(Renderer renderer)
renderer
- the new Renderer object that belongs to this Layerpublic java.lang.Iterable<? extends Feature> getFeatures()
public Feature getFeature(java.lang.Object mapObject)
mapObject
- Objectpublic Feature getContainerFeature(java.lang.Object mapObject)
protected boolean hasFeatures()
protected boolean hasContainers()
protected java.lang.Iterable<KmlContainer> getContainers()
protected java.lang.Iterable<KmlGroundOverlay> getGroundOverlays()
public GoogleMap getMap()
public void setMap(GoogleMap map)
map
- to render the layer on, if null the layer is cleared from the current mappublic boolean isLayerOnMap()
protected void addFeature(Feature feature)
feature
- feature to add to mapprotected void removeFeature(Feature feature)
feature
- feature to be removedpublic GeoJsonPointStyle getDefaultPointStyle()
public GeoJsonLineStringStyle getDefaultLineStringStyle()
public GeoJsonPolygonStyle getDefaultPolygonStyle()