Package io.structures
Class Feature
java.lang.Object
io.structures.Feature
public class Feature
extends java.lang.Object
Class representing a feature with geometry and attributes
- 
Constructor Summary
Constructors Constructor Description Feature(org.locationtech.jts.geom.Geometry geom)Initializes this feature without attributes.Feature(org.locationtech.jts.geom.Geometry geom, java.util.HashMap<java.lang.String,java.lang.Object> attributes)Initializes this feature with geometry and attributes. - 
Method Summary
Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.String name)Returns the value of the attribute, or null if feature does not have this attribute.java.util.List<java.lang.String>getAttributeNames()Returns a list of all the attribute names this feature has.org.locationtech.jts.geom.GeometrygetGeometry()Returns the (JTS-) geometry of this featurejava.lang.StringgetGeometryType()Returns a String representation of this features geometry type.booleanhasAttribute(java.lang.String name)Returns if the feature currently has a value for the given attribute.booleansetAttribute(java.lang.String key, java.lang.Object value)Sets the attribute for this geometry. 
- 
Constructor Details
- 
Feature
public Feature(org.locationtech.jts.geom.Geometry geom)Initializes this feature without attributes.- Parameters:
 geom- the geometry of this feature
 - 
Feature
public Feature(org.locationtech.jts.geom.Geometry geom, java.util.HashMap<java.lang.String,java.lang.Object> attributes)Initializes this feature with geometry and attributes.- Parameters:
 geom- the geometry of this featureattributes- the map of attributes for this feature
 
 - 
 - 
Method Details
- 
getGeometry
public org.locationtech.jts.geom.Geometry getGeometry()Returns the (JTS-) geometry of this feature- Returns:
 - a JTS geometry
 
 - 
setAttribute
public boolean setAttribute(java.lang.String key, java.lang.Object value)Sets the attribute for this geometry. Returns true if former attribute value got replaced, false if attribute is a new attribute.- Parameters:
 key- name of the attributevalue- value of the attribute- Returns:
 - true if feature previously had a value for this attribute
 
 - 
hasAttribute
public boolean hasAttribute(java.lang.String name)Returns if the feature currently has a value for the given attribute.- Parameters:
 name- name of the attribute- Returns:
 - boolean value for the result
 
 - 
getAttribute
public java.lang.Object getAttribute(java.lang.String name)Returns the value of the attribute, or null if feature does not have this attribute.- Parameters:
 name- name of the attribute- Returns:
 - attribute value or null if absent
 
 - 
getGeometryType
public java.lang.String getGeometryType()Returns a String representation of this features geometry type.- Returns:
 - possible values: GeometryCollection, LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
 
 - 
getAttributeNames
public java.util.List<java.lang.String> getAttributeNames()Returns a list of all the attribute names this feature has.- Returns:
 - ArrayList of the names
 
 
 -