Class GeoJsonFeature
- java.lang.Object
-
- java.util.Observable
-
- com.google.maps.android.data.Feature
-
- com.google.maps.android.data.geojson.GeoJsonFeature
-
- All Implemented Interfaces:
java.util.Observer
public class GeoJsonFeature extends Feature implements java.util.Observer
A GeoJsonFeature has a geometry, bounding box, id and set of properties. Styles are also stored in this class.
-
-
Constructor Summary
Constructors Constructor Description GeoJsonFeature(Geometry geometry, java.lang.String id, java.util.HashMap<java.lang.String,java.lang.String> properties, com.google.android.gms.maps.model.LatLngBounds boundingBox)Creates a new GeoJsonFeature object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.android.gms.maps.model.LatLngBoundsgetBoundingBox()Gets the array containing the coordinates of the bounding box for the feature.GeoJsonLineStringStylegetLineStringStyle()Returns the style used to render GeoJsonLineStringscom.google.android.gms.maps.model.MarkerOptionsgetMarkerOptions()Gets a MarkerOptions object from mPointStyle containing styles for the GeoJsonPointGeoJsonPointStylegetPointStyle()Returns the style used to render GeoJsonPointscom.google.android.gms.maps.model.PolygonOptionsgetPolygonOptions()Gets a PolygonOptions object from mPolygonStyle containing styles for the GeoJsonPolygonGeoJsonPolygonStylegetPolygonStyle()Returns the style used to render GeoJsonPolygonscom.google.android.gms.maps.model.PolylineOptionsgetPolylineOptions()Gets a Polyline object from mLineStringStyle containing styles for the GeoJsonLineStringjava.lang.StringremoveProperty(java.lang.String property)Removes a given propertyvoidsetGeometry(Geometry geometry)Sets the stored Geometry and redraws it on the layer if it has already been addedvoidsetLineStringStyle(GeoJsonLineStringStyle lineStringStyle)Sets the style used to render GeoJsonLineStringsvoidsetPointStyle(GeoJsonPointStyle pointStyle)Sets the style used to render GeoJsonPointsvoidsetPolygonStyle(GeoJsonPolygonStyle polygonStyle)Sets the style used to render GeoJsonPolygonsjava.lang.StringsetProperty(java.lang.String property, java.lang.String propertyValue)Store a new property key and valuejava.lang.StringtoString()voidupdate(java.util.Observable observable, java.lang.Object data)Update is called if the developer modifies a style that is stored in this feature-
Methods inherited from class com.google.maps.android.data.Feature
getGeometry, getId, getProperties, getProperty, getPropertyKeys, hasGeometry, hasProperties, hasProperty
-
-
-
-
Constructor Detail
-
GeoJsonFeature
public GeoJsonFeature(Geometry geometry, java.lang.String id, java.util.HashMap<java.lang.String,java.lang.String> properties, com.google.android.gms.maps.model.LatLngBounds boundingBox)
Creates a new GeoJsonFeature object- Parameters:
geometry- type of geometry to assign to the featureid- common identifier of the featureproperties- hashmap of containing properties related to the featureboundingBox- bounding box of the feature
-
-
Method Detail
-
setProperty
public java.lang.String setProperty(java.lang.String property, java.lang.String propertyValue)Store a new property key and value- Parameters:
property- key of the property to storepropertyValue- value of the property to store- Returns:
- previous value with the same key, otherwise null if the key didn't exist
-
removeProperty
public java.lang.String removeProperty(java.lang.String property)
Removes a given property- Parameters:
property- key of the property to remove- Returns:
- value of the removed property or null if there was no corresponding key
-
getPointStyle
public GeoJsonPointStyle getPointStyle()
Returns the style used to render GeoJsonPoints- Returns:
- style used to render GeoJsonPoints
-
setPointStyle
public void setPointStyle(GeoJsonPointStyle pointStyle)
Sets the style used to render GeoJsonPoints- Parameters:
pointStyle- style used to render GeoJsonPoints
-
getLineStringStyle
public GeoJsonLineStringStyle getLineStringStyle()
Returns the style used to render GeoJsonLineStrings- Returns:
- style used to render GeoJsonLineStrings
-
setLineStringStyle
public void setLineStringStyle(GeoJsonLineStringStyle lineStringStyle)
Sets the style used to render GeoJsonLineStrings- Parameters:
lineStringStyle- style used to render GeoJsonLineStrings
-
getPolygonStyle
public GeoJsonPolygonStyle getPolygonStyle()
Returns the style used to render GeoJsonPolygons- Returns:
- style used to render GeoJsonPolygons
-
setPolygonStyle
public void setPolygonStyle(GeoJsonPolygonStyle polygonStyle)
Sets the style used to render GeoJsonPolygons- Parameters:
polygonStyle- style used to render GeoJsonPolygons
-
getPolygonOptions
public com.google.android.gms.maps.model.PolygonOptions getPolygonOptions()
Gets a PolygonOptions object from mPolygonStyle containing styles for the GeoJsonPolygon- Returns:
- PolygonOptions object
-
getMarkerOptions
public com.google.android.gms.maps.model.MarkerOptions getMarkerOptions()
Gets a MarkerOptions object from mPointStyle containing styles for the GeoJsonPoint- Returns:
- MarkerOptions object
-
getPolylineOptions
public com.google.android.gms.maps.model.PolylineOptions getPolylineOptions()
Gets a Polyline object from mLineStringStyle containing styles for the GeoJsonLineString- Returns:
- Polyline object
-
setGeometry
public void setGeometry(Geometry geometry)
Sets the stored Geometry and redraws it on the layer if it has already been added- Parameters:
geometry- Geometry to set
-
getBoundingBox
public com.google.android.gms.maps.model.LatLngBounds getBoundingBox()
Gets the array containing the coordinates of the bounding box for the feature. If the feature did not have a bounding box then null will be returned.- Returns:
- LatLngBounds containing bounding box of the feature, null if no bounding box
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
update
public void update(java.util.Observable observable, java.lang.Object data)Update is called if the developer modifies a style that is stored in this feature- Specified by:
updatein interfacejava.util.Observer- Parameters:
observable- GeoJsonStyle objectdata- null, no extra argument is passed through the notifyObservers method
-
-