Class VectorElement

java.lang.Object
com.massifmaps.vectorelements.VectorElement
Direct Known Subclasses:
Billboard, GeometryCollection, Line, Point, Polygon, Polygon3D

public class VectorElement extends Object
A base class for all vector elements (points, lines, texts, models, etc).
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getBounds

      public MapBounds getBounds()
      Returns the bounds of this vector element.
      Returns:
      The bounds of this vector element.
    • getGeometry

      public Geometry getGeometry()
      Returns the geometry object that defines the location of this vector element.
      Returns:
      The geometry object of this vector element.
    • getId

      public long getId()
      Returns the internal id of this vector element.
      Returns:
      The internal id of this vector element.
    • setId

      public void setId(long id)
      Sets the internal id for this vector element. The id is used for internal caching, and
      should not be changed by the user. User id can added to meta data as a key-value pair.
      Parameters:
      id - The new internal id for this vector element.
    • getMetaData

      public StringVariantMap getMetaData()
      Returns a copy of the vector element meta data map. The changes you make to this map are NOT reflected in the actual meta data of the element.
      Returns:
      A copy of the vector element meta data map.
    • setMetaData

      public void setMetaData(StringVariantMap metaData)
      Sets a new meta data map for the vector element. Old meta data values will be lost.
      Parameters:
      metaData - The new meta data map for this vector element.
    • containsMetaDataKey

      public boolean containsMetaDataKey(String key)
      Returns true if the specified key exists in the vector element meta data map.
      Parameters:
      key - The key to check.
      Returns:
      True if the vector element meta data element exists.
    • getMetaDataElement

      public Variant getMetaDataElement(String key)
      Returns a meta data element corresponding to the key. If no value is found null variant is returned.
      Parameters:
      key - The key to use.
      Returns:
      The value corresponding to the key from the meta data map. If the key does not exists, empty variant is returned.
    • setMetaDataElement

      public void setMetaDataElement(String key, Variant element)
      Adds a new key-value pair to the meta data map. If the key already exists in the map,
      it's value will be replaced by the new value.
      Parameters:
      key - The new key.
      element - The new value.
    • isVisible

      public boolean isVisible()
      Returns the state of the visibility flag of this vector element.
      Returns:
      True if this vector element is visible.
    • setVisible

      public void setVisible(boolean visible)
      Sets the state of the visibility flag for this vector element. If set to false the element will not be
      drawn.
      Parameters:
      visible - The new state of the visibility flag for the vector element.
    • notifyElementChanged

      public void notifyElementChanged()
      Notifies this vector element's datasource about the change in this element.
      The data source may then notify the layer to update the view.