Class 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
    • 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 feature
        id - common identifier of the feature
        properties - hashmap of containing properties related to the feature
        boundingBox - 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 store
        propertyValue - 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:
        toString in class java.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:
        update in interface java.util.Observer
        Parameters:
        observable - GeoJsonStyle object
        data - null, no extra argument is passed through the notifyObservers method