Class AbstractBasicFeature
java.lang.Object
com.vividsolutions.jump.feature.AbstractBasicFeature
- All Implemented Interfaces:
Feature, Serializable, Cloneable, Comparable
- Direct Known Subclasses:
BasicFeature
Default implementation of the Feature interface. Subclasses need
implement only the four remaining Feature methods: #getAttribute,
#setAttribute, #getAttributes, #setAttributes
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractBasicFeature(FeatureSchema featureSchema) Creates a new Feature based on the given metadata. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones this Feature.clone(boolean deep) Clones this Feature.clone(boolean deep, boolean copyPK) Clones this Feature.static BasicFeatureUtil static method used to create a new BasicFeature from a feature.static intStatic method to compare two features.intgetAttribute(String name) Returns the specified attribute.doublegetDouble(int attributeIndex) Returns a double attribute.org.locationtech.jts.geom.GeometryConvenience method for returning the spatial attribute.intgetID()Returns a number that uniquely identifies this feature.intgetInteger(int attributeIndex) Returns a integer attribute.Returns the feature's metadatagetString(int attributeIndex) Returns a String representation of the attribute at the given index.Returns a String representation of the attribute at the given index.getUserData(Object key) Gets the userData value for this key.voidremoveAllUserData(Object key) Remove all the userData keys and nullify the userData map itself.voidremoveUserData(Object key) Removes the userData value for this key.voidsetAttribute(String attributeName, Object newAttribute) Sets the specified attribute.voidsetGeometry(org.locationtech.jts.geom.Geometry geometry) Convenience method for setting the spatial attribute.voidsetSchema(FeatureSchema schema) A low-level accessor that is not normally used.voidsetUserData(Object key, Object value) Sets a new value in userData replacing the old one for this key.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Feature
getAttribute, getAttributes, setAttribute, setAttributes
-
Constructor Details
-
AbstractBasicFeature
Creates a new Feature based on the given metadata.- Parameters:
featureSchema- the metadata containing information on each column
-
-
Method Details
-
setSchema
A low-level accessor that is not normally used. -
getID
-
setAttribute
Sets the specified attribute.- Specified by:
setAttributein interfaceFeature- Parameters:
attributeName- the name of the attribute to setnewAttribute- the new attribute
-
setGeometry
public void setGeometry(org.locationtech.jts.geom.Geometry geometry) Convenience method for setting the spatial attribute. JUMP Workbench PlugIns and CursorTools should not use this method directly, but should use an EditTransaction, so that the proper events are fired.- Specified by:
setGeometryin interfaceFeature- Parameters:
geometry- the new spatial attribute
-
getAttribute
Returns the specified attribute. Throws an ArrayOutOfBoundException if attributeName does not exists.- Specified by:
getAttributein interfaceFeature- Parameters:
name- the name of the attribute to get- Returns:
- the attribute
-
getString
Returns a String representation of the attribute at the given index. If the attribute at the given index is null, the method returns null. -
getInteger
public int getInteger(int attributeIndex) Returns a integer attribute.- Specified by:
getIntegerin interfaceFeature- Parameters:
attributeIndex- the index of the attribute to retrieve- Returns:
- the integer attribute with the given name
-
getDouble
-
getString
Returns a String representation of the attribute at the given index. If the attribute at the given index is null, the method returns null. -
getGeometry
public org.locationtech.jts.geom.Geometry getGeometry()Convenience method for returning the spatial attribute.- Specified by:
getGeometryin interfaceFeature- Returns:
- the feature's spatial attribute
-
getSchema
Returns the feature's metadata -
clone
Clones this Feature. Geometry and PrimaryKey will also be cloned. Warning : clone method does not follow general contract of clone (which recommends using super.clone) but makes a deep copy of the Object using BasicFeature constructor. -
clone
-
clone
-
clone
Util static method used to create a new BasicFeature from a feature.- Parameters:
feature- the feature to be cloneddeep- if deep, the geometry is cloned.copyPK- if copyPK is true and a PK is defined, the PK is copied otherwise, the PK is set to null.- Returns:
- a new BasicFeature
-
compareTo
- Specified by:
compareToin interfaceComparable
-
compare
Static method to compare two features. The method uses feature ID to compare them in a first time, and if equals, it uses the feature hashcode.- Parameters:
a- the first feature to be comparedb- the second feature to be compared- Returns:
- a positive integer if a > b, a negative integer if a invalid input: '<' b and 0 if a and b have same ID and same hashcode.
-
setUserData
-
getUserData
-
removeUserData
Removes the userData value for this key. -
removeAllUserData
Remove all the userData keys and nullify the userData map itself.
-