Package com.massifmaps.vectorelements
Class VectorElement
java.lang.Object
com.massifmaps.vectorelements.VectorElement
A base class for all vector elements (points, lines, texts, models, etc).
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the specified key exists in the vector element meta data map.booleanChecks if this object is equal to the specified object.Returns the bounds of this vector element.Returns the geometry object that defines the location of this vector element.longgetId()Returns the internal id of this vector element.Returns a copy of the vector element meta data map.getMetaDataElement(String key) Returns a meta data element corresponding to the key.inthashCode()Returns the hash value of this object.booleanReturns the state of the visibility flag of this vector element.voidNotifies this vector element's datasource about the change in this element.
The data source may then notify the layer to update the view.voidsetId(long id) Sets the internal id for this vector element.voidsetMetaData(StringVariantMap metaData) Sets a new meta data map for the vector element.voidsetMetaDataElement(String key, Variant element) Adds a new key-value pair to the meta data map.voidsetVisible(boolean visible) Sets the state of the visibility flag for this vector element.
-
Method Details
-
equals
Checks if this object is equal to the specified object. -
hashCode
public int hashCode()Returns the hash value of this object. -
getBounds
Returns the bounds of this vector element.- Returns:
- The bounds of this vector element.
-
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
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
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
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
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
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.
-