public class Renderer
extends java.lang.Object
KmlRenderer
and
GeoJsonRenderer
Modifier and Type | Class and Description |
---|---|
static class |
Renderer.ImagesCache |
Constructor and Description |
---|
Renderer(GoogleMap map,
android.content.Context context,
MarkerManager markerManager,
PolygonManager polygonManager,
PolylineManager polylineManager,
GroundOverlayManager groundOverlayManager,
Renderer.ImagesCache imagesCache)
Creates a new Renderer object for KML features
|
Renderer(GoogleMap map,
java.util.HashMap<? extends Feature,java.lang.Object> features,
MarkerManager markerManager,
PolygonManager polygonManager,
PolylineManager polylineManager,
GroundOverlayManager groundOverlayManager)
Creates a new Renderer object for GeoJSON features
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFeature(Feature feature)
Adds a new Feature to the map if its geometry property is not null.
|
protected java.lang.Object |
addGeoJsonFeatureToMap(Feature feature,
Geometry geometry)
Adds a new object onto the map using the Geometry for the coordinates and the
Feature for the styles.
|
protected java.lang.Object |
addKmlPlacemarkToMap(KmlPlacemark placemark,
Geometry geometry,
KmlStyle style,
KmlStyle inlineStyle,
boolean isVisible)
Adds a single geometry object to the map with its specified style (used for KML)
|
void |
assignStyleMap(java.util.HashMap<java.lang.String,java.lang.String> styleMap,
java.util.HashMap<java.lang.String,KmlStyle> styles)
Iterates through a list of styles and assigns a style
|
protected GroundOverlay |
attachGroundOverlay(GroundOverlayOptions groundOverlayOptions)
Adds a ground overlay to the map
|
protected void |
cacheBitmap(java.lang.String url,
android.graphics.Bitmap bitmap)
Cache loaded bitmap images
|
protected void |
checkClearBitmapCache()
Clear bitmap cache if no active image downloads remain.
|
protected void |
clearStylesRenderer()
Removes all the mappings from the mStylesRenderer hashmap
|
protected void |
downloadFinished()
Decrement active download count and check if bitmap cache should be cleared
|
protected void |
downloadStarted()
Increment active download count
|
protected java.util.HashMap<? extends Feature,java.lang.Object> |
getAllFeatures()
Gets a hashmap of all the features and objects that are on this layer
|
protected BitmapDescriptor |
getCachedGroundOverlayImage(java.lang.String url)
Gets a cached image needed for GroundOverlays images
|
protected BitmapDescriptor |
getCachedMarkerImage(java.lang.String url,
double scale)
Gets a cached image at the specified scale which is needed for Marker icon images.
|
protected java.util.ArrayList<KmlContainer> |
getContainerList()
Gets the list of KmlContainers that are on the current layer
|
java.util.Set<Feature> |
getFeatures()
Gets a set containing Features
|
java.util.HashMap<KmlGroundOverlay,GroundOverlay> |
getGroundOverlayMap()
Gets the ground overlays on the current layer
|
GoogleMap |
getMap()
Gets the GoogleMap that Feature objects are being placed on
|
protected java.util.Set<java.lang.String> |
getMarkerIconUrls()
Gets the URLs stored for the Marker icons
|
protected KmlStyle |
getPlacemarkStyle(java.lang.String styleId)
Obtains the styleUrl from a placemark and finds the corresponding style in a list
|
protected static boolean |
getPlacemarkVisibility(Feature feature)
Gets the visibility of the placemark if it is specified.
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
getStyleMaps()
Gets the styles for KML placemarks
|
protected java.util.HashMap<java.lang.String,KmlStyle> |
getStylesRenderer()
Gets the styles for KML placemarks
|
java.util.Collection<java.lang.Object> |
getValues()
getValues is called to retrieve the values stored in the mFeatures
hashmap.
|
protected boolean |
hasFeatures()
Checks if the layer contains placemarks
|
boolean |
isLayerOnMap()
Checks if layer has been added to map
|
protected void |
putContainerFeature(java.lang.Object mapObject,
Feature placemark) |
protected void |
putFeatures(Feature feature,
java.lang.Object object)
Adds a new mapping to the mFeatures hashmap
|
protected void |
putStyles()
Adds mStyles to the mStylesRenderer
|
protected void |
putStyles(java.util.HashMap<java.lang.String,KmlStyle> styles)
Stores new mappings into the mStylesRenderer hashmap
|
protected void |
removeFeature(Feature feature)
Removes a Feature from the map if its geometry property is not null
|
protected void |
removeFeatures(java.util.HashMap<? extends Feature,java.lang.Object> features)
Removes all given Features from the map and clears all stored features.
|
protected void |
removeFromMap(java.lang.Object mapObject)
Given a Marker, Polyline, Polygon or an array of these and removes it from the map
|
protected void |
removeGroundOverlays(java.util.HashMap<KmlGroundOverlay,GroundOverlay> groundOverlays)
Removes all ground overlays in the given hashmap
|
protected void |
setLayerVisibility(boolean layerOnMap)
Sets the visibility of the layer
|
void |
setMap(GoogleMap map)
Sets the map that objects are being placed on
|
protected void |
storeData(java.util.HashMap<java.lang.String,KmlStyle> styles,
java.util.HashMap<java.lang.String,java.lang.String> styleMaps,
java.util.HashMap<KmlPlacemark,java.lang.Object> features,
java.util.ArrayList<KmlContainer> folders,
java.util.HashMap<KmlGroundOverlay,GroundOverlay> groundOverlays)
Stores all given data
|
public Renderer(GoogleMap map, android.content.Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager, Renderer.ImagesCache imagesCache)
map
- map to place objects oncontext
- the ContextmarkerManager
- marker manager to create marker collection frompolygonManager
- polygon manager to create polygon collection frompolylineManager
- polyline manager to create polyline collection fromgroundOverlayManager
- ground overlay manager to create ground overlay collection fromimagesCache
- an optional ImagesCache to be used for caching images fetchedpublic Renderer(GoogleMap map, java.util.HashMap<? extends Feature,java.lang.Object> features, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager)
map
- map to place objects onfeatures
- contains a hashmap of features and objects that will go on the mapmarkerManager
- marker manager to create marker collection frompolygonManager
- polygon manager to create polygon collection frompolylineManager
- polyline manager to create polyline collection fromgroundOverlayManager
- ground overlay manager to create ground overlay collection frompublic boolean isLayerOnMap()
protected void setLayerVisibility(boolean layerOnMap)
layerOnMap
- contains true if the layer should be set to visible and false otherwisepublic GoogleMap getMap()
public void setMap(GoogleMap map)
map
- map to place all objects onprotected void putContainerFeature(java.lang.Object mapObject, Feature placemark)
public java.util.Set<Feature> getFeatures()
public java.util.Collection<java.lang.Object> getValues()
protected java.util.HashMap<? extends Feature,java.lang.Object> getAllFeatures()
protected java.util.Set<java.lang.String> getMarkerIconUrls()
protected java.util.HashMap<java.lang.String,KmlStyle> getStylesRenderer()
protected java.util.HashMap<java.lang.String,java.lang.String> getStyleMaps()
protected BitmapDescriptor getCachedMarkerImage(java.lang.String url, double scale)
url
- URL to get cached image forscale
- scale to get image atprotected BitmapDescriptor getCachedGroundOverlayImage(java.lang.String url)
url
- URL to get cached image forpublic java.util.HashMap<KmlGroundOverlay,GroundOverlay> getGroundOverlayMap()
protected java.util.ArrayList<KmlContainer> getContainerList()
protected KmlStyle getPlacemarkStyle(java.lang.String styleId)
styleId
- StyleUrl from a placemarkprotected void putFeatures(Feature feature, java.lang.Object object)
feature
- Feature to be added onto the mapobject
- Corresponding map object to this featureprotected void putStyles()
protected void putStyles(java.util.HashMap<java.lang.String,KmlStyle> styles)
styles
- hashmap of strings and KmlStyles to be added to mStylesRendererprotected void cacheBitmap(java.lang.String url, android.graphics.Bitmap bitmap)
url
- image URLbitmap
- image bitmapprotected void downloadStarted()
protected void downloadFinished()
protected void checkClearBitmapCache()
protected boolean hasFeatures()
protected void removeFeatures(java.util.HashMap<? extends Feature,java.lang.Object> features)
features
- features to removeprotected void removeGroundOverlays(java.util.HashMap<KmlGroundOverlay,GroundOverlay> groundOverlays)
groundOverlays
- hashmap of ground overlays to removeprotected void removeFeature(Feature feature)
feature
- feature to remove from mapprotected void clearStylesRenderer()
protected void storeData(java.util.HashMap<java.lang.String,KmlStyle> styles, java.util.HashMap<java.lang.String,java.lang.String> styleMaps, java.util.HashMap<KmlPlacemark,java.lang.Object> features, java.util.ArrayList<KmlContainer> folders, java.util.HashMap<KmlGroundOverlay,GroundOverlay> groundOverlays)
styles
- hashmap of stylesstyleMaps
- hashmap of style mapsfeatures
- hashmap of featuresfolders
- array of containersgroundOverlays
- hashmap of ground overlaysprotected void addFeature(Feature feature)
feature
- feature to add to the mapprotected void removeFromMap(java.lang.Object mapObject)
mapObject
- map object or array of map objects to remove from the mapprotected java.lang.Object addGeoJsonFeatureToMap(Feature feature, Geometry geometry)
feature
- feature to get geometry stylegeometry
- geometry to add to the mapprotected java.lang.Object addKmlPlacemarkToMap(KmlPlacemark placemark, Geometry geometry, KmlStyle style, KmlStyle inlineStyle, boolean isVisible)
geometry
- defines the type of object to add to the mapstyle
- defines styling properties to add to the object when added to the mapprotected static boolean getPlacemarkVisibility(Feature feature)
feature
- Feature to obtain visibility from.public void assignStyleMap(java.util.HashMap<java.lang.String,java.lang.String> styleMap, java.util.HashMap<java.lang.String,KmlStyle> styles)
styleMap
- styles
- protected GroundOverlay attachGroundOverlay(GroundOverlayOptions groundOverlayOptions)
groundOverlayOptions
- GroundOverlay style options to be added to the map