Class FeatureMate
- java.lang.Object
-
- org.hortonmachine.gears.utils.features.FeatureMate
-
public class FeatureMate extends Object
A wrapper for features that helps out with lots of stuff.- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Constructor Summary
Constructors Constructor Description FeatureMate(org.opengis.feature.simple.SimpleFeature feature)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconvertToLine()Tries to convert the internal geometry to aLineString.voidconvertToPoint()Tries to convert the internal geometry to aPoint.booleancovers(org.locationtech.jts.geom.Geometry geometry, boolean usePrepared)Check for cover.<T> TgetAttribute(String attrName, Class<T> adaptee)Gets an attribute from the feature table, adapting to the supplied class.List<String>getAttributesNames()Getter for the list of attribute names.org.locationtech.jts.geom.EnvelopegetEnvelope()Getter for theEnvelope.org.opengis.feature.simple.SimpleFeaturegetFeature()org.locationtech.jts.geom.GeometrygetGeometry()Getter for the geometry.org.locationtech.jts.geom.Geometryintersection(org.locationtech.jts.geom.Geometry geometry)Proxy for the intersection method.booleanintersects(org.locationtech.jts.geom.Geometry geometry, boolean usePrepared)Check for intersection.voidresetGeometry()Resets the geometry, so that at the next call ofgetGeometry()the original geometry is reread.StringtoString()voiduseBuffer(double buffer)Apply a buffer to the geometry and use that as newGeometry.
-
-
-
Method Detail
-
getFeature
public org.opengis.feature.simple.SimpleFeature getFeature()
-
useBuffer
public void useBuffer(double buffer)
Apply a buffer to the geometry and use that as newGeometry.- Parameters:
buffer- the buffer to apply.
-
getGeometry
public org.locationtech.jts.geom.Geometry getGeometry()
Getter for the geometry.- Returns:
- the geometry of the feature.
-
getEnvelope
public org.locationtech.jts.geom.Envelope getEnvelope()
Getter for theEnvelope.- Returns:
- the envelope.
-
getAttributesNames
public List<String> getAttributesNames()
Getter for the list of attribute names.- Returns:
- the list of attribute names.
-
getAttribute
public <T> T getAttribute(String attrName, Class<T> adaptee)
Gets an attribute from the feature table, adapting to the supplied class.- Parameters:
attrName- the attribute name to pick.adaptee- the class to adapt to.- Returns:
- the adapted value if possible.
-
intersects
public boolean intersects(org.locationtech.jts.geom.Geometry geometry, boolean usePrepared)Check for intersection.- Parameters:
geometry- the geometry to check against.usePrepared- use prepared geometry.- Returns:
- true if the geometries intersect.
-
covers
public boolean covers(org.locationtech.jts.geom.Geometry geometry, boolean usePrepared)Check for cover.- Parameters:
geometry- the geometry to check against.usePrepared- use prepared geometry.- Returns:
- true if the current geometries covers the supplied one.
-
intersection
public org.locationtech.jts.geom.Geometry intersection(org.locationtech.jts.geom.Geometry geometry)
Proxy for the intersection method.- Parameters:
geometry- the geometry to intersect.- Returns:
- the intersection geometry.
-
convertToLine
public void convertToLine() throws IllegalArgumentExceptionTries to convert the internal geometry to aLineString.This works only for Polygon and Lines features.
From this moment on the internal geometry (as got by the
getGeometry()) will be the line type.To get the original geometry one can simply call
resetGeometry().- Throws:
IllegalArgumentException- in the case the geometry is a point.
-
convertToPoint
public void convertToPoint()
Tries to convert the internal geometry to aPoint.From this moment on the internal geometry (as got by the
getGeometry()) will be the point type.To get the original geometry one can simply call
resetGeometry().
-
resetGeometry
public void resetGeometry()
Resets the geometry, so that at the next call ofgetGeometry()the original geometry is reread.
-
-