deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.geometry.standard.primitive
Class DefaultOrientableCurve

java.lang.Object
  extended by org.deegree.geometry.standard.AbstractDefaultGeometry
      extended by org.deegree.geometry.standard.primitive.DefaultOrientableCurve
All Implemented Interfaces:
Geometry, Curve, GeometricPrimitive, OrientableCurve, GMLObject

public class DefaultOrientableCurve
extends AbstractDefaultGeometry
implements OrientableCurve

Default implementation of OrientableCurve.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.deegree.geometry.primitive.Curve
Curve.CurveType
 
Nested classes/interfaces inherited from interface org.deegree.geometry.primitive.GeometricPrimitive
GeometricPrimitive.PrimitiveType
 
Nested classes/interfaces inherited from interface org.deegree.geometry.Geometry
Geometry.GeometryType
 
Field Summary
 
Fields inherited from class org.deegree.geometry.standard.AbstractDefaultGeometry
jtsFactory, jtsGeometry, pm
 
Constructor Summary
DefaultOrientableCurve(String id, CRS crs, Curve baseCurve, boolean isReversed)
          Creates a new DefaultOrientableCurve instance from the given parameters.
 
Method Summary
 boolean contains(Geometry geometry)
          Tests whether this geometry contains the specified geometry.
 boolean crosses(Geometry geometry)
          Tests whether this geometry crosses the specified geometry.
 boolean equals(Geometry geometry)
          Tests whether this geometry is equal to the specified geometry.
 LineString getAsLineString()
          Returns a linear interpolated representation of the curve.
 Curve getBaseCurve()
          Returns the Curve that this OrientableCurve is based on.
 Pair<Point,Point> getBoundary()
          The boundary of a curve is the set of points at either end of the curve.
 Geometry getBuffer(Measure distance)
          Return a new Geometry that contains all points with a distance from this Geometry that is less than or equal to the specified distance.
 Points getControlPoints()
          Convenience method for accessing the control points of linear interpolated curves.
 Geometry getConvexHull()
          Returns the convex hull of the geometry.
 int getCoordinateDimension()
          Returns the coordinate dimension, i.e. the dimension of the space that the geometry is embedded in.
 CRS getCoordinateSystem()
          Returns the associated spatial reference system.
 List<CurveSegment> getCurveSegments()
          Returns the segments that constitute this curve.
 Curve.CurveType getCurveType()
          Must always return Curve.CurveType.OrientableCurve.
 Geometry getDifference(Geometry geometry)
          Returns the set-theoretic difference of this and the passed Geometry.
 Measure getDistance(Geometry geometry, Unit requestedUnit)
          Returns the minimum distance between this and the specified geometry.
 Point getEndPoint()
          Returns the end point of the curve.
 Envelope getEnvelope()
          Returns the minimal bounding box of the geometry.
 Geometry.GeometryType getGeometryType()
          Must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY.
 String getId()
          Returns the id of the geometry.
 Geometry getIntersection(Geometry geometry)
          Returns the set-theoretic intersection of this and the passed Geometry.
 com.vividsolutions.jts.geom.Geometry getJTSGeometry()
          Returns an equivalent (or best-fit) JTS geometry object.
 Measure getLength(Unit requestedUnit)
           
 PrecisionModel getPrecision()
          Returns the PrecisionModel of the geometry.
 GeometricPrimitive.PrimitiveType getPrimitiveType()
          Must always return GeometricPrimitive.PrimitiveType.Curve.
 Point getStartPoint()
          Returns the start point of the curve.
 Geometry getUnion(Geometry geometry)
          Returns the set-theoretic union of this and the passed Geometry.
 boolean intersects(Geometry geometry)
          Tests whether this geometry intersects the specified geometry.
 boolean isBeyond(Geometry geometry, Measure distance)
          Tests whether this geometry is beyond a specified distance of a second geometry.
 boolean isClosed()
          Returns whether the curve forms a closed loop.
 boolean isDisjoint(Geometry geometry)
          Tests whether this geometry is disjoint from the specified geometry.
 boolean isReversed()
          Returns whether the orientation of this curve is reversed compared to the base curve.
 boolean isWithin(Geometry geometry)
          tests whether the value of a geometric is topological located within this geometry.
 boolean isWithinDistance(Geometry geometry, Measure distance)
          Tests whether this geometry is within a specified distance of a second geometry.
 boolean overlaps(Geometry geometry)
          Tests whether this geometry overlaps the specified geometry.
 boolean touches(Geometry geometry)
          Tests whether this geometry touches the specified geometry.
 
Methods inherited from class org.deegree.geometry.standard.AbstractDefaultGeometry
buildJTSGeometry, createFromJTS, getAsDefaultGeometry, getCentroid, getGMLProperties, setCoordinateSystem, setGMLProperties, setId, setPrecision, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.geometry.Geometry
getCentroid, setCoordinateSystem, setGMLProperties, setId, setPrecision
 
Methods inherited from interface org.deegree.gml.GMLObject
getGMLProperties
 

Constructor Detail

DefaultOrientableCurve

public DefaultOrientableCurve(String id,
                              CRS crs,
                              Curve baseCurve,
                              boolean isReversed)
Creates a new DefaultOrientableCurve instance from the given parameters.

Parameters:
id - identifier of the created geometry object
crs - coordinate reference system
baseCurve - base curve
isReversed - set to true, if the order of the base curve shall be reversed
Method Detail

getId

public String getId()
Description copied from interface: Geometry
Returns the id of the geometry.

In a GML representation of the geometry, this corresponds to the gml:id (GML 3 and later) or gid (GML 2) attribute of the geometry element.

Specified by:
getId in interface Geometry
Specified by:
getId in interface GMLObject
Overrides:
getId in class AbstractDefaultGeometry
Returns:
the id of the geometry, or null if it is an anonymous (unidentified) geometry

getCoordinateSystem

public CRS getCoordinateSystem()
Description copied from interface: Geometry
Returns the associated spatial reference system.

Specified by:
getCoordinateSystem in interface Geometry
Overrides:
getCoordinateSystem in class AbstractDefaultGeometry
Returns:
spatial reference system, may be null

getAsLineString

public LineString getAsLineString()
Description copied from interface: Curve
Returns a linear interpolated representation of the curve.

NOTE: This method is only safe to use when the curve is a LineString or LinearRing or it only consists of LineStringSegments. In any other case it will fail.

Specified by:
getAsLineString in interface Curve
Returns:
curve as a linestring

getCurveSegments

public List<CurveSegment> getCurveSegments()
Description copied from interface: Curve
Returns the segments that constitute this curve.

Specified by:
getCurveSegments in interface Curve
Returns:
the segments that constitute this curve

getCurveType

public Curve.CurveType getCurveType()
Description copied from interface: OrientableCurve
Must always return Curve.CurveType.OrientableCurve.

Specified by:
getCurveType in interface Curve
Specified by:
getCurveType in interface OrientableCurve
Returns:
Curve.CurveType.OrientableCurve

getBaseCurve

public Curve getBaseCurve()
Description copied from interface: OrientableCurve
Returns the Curve that this OrientableCurve is based on.

Specified by:
getBaseCurve in interface OrientableCurve
Returns:
the base Curve

isReversed

public boolean isReversed()
Description copied from interface: OrientableCurve
Returns whether the orientation of this curve is reversed compared to the base curve.

Specified by:
isReversed in interface OrientableCurve
Returns:
true, if the orientation is reversed, false otherwise

getEndPoint

public Point getEndPoint()
Description copied from interface: Curve
Returns the end point of the curve.

Specified by:
getEndPoint in interface Curve
Returns:
the end point of the curve

getStartPoint

public Point getStartPoint()
Description copied from interface: Curve
Returns the start point of the curve.

Specified by:
getStartPoint in interface Curve
Returns:
the start point of the curve

contains

public boolean contains(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry contains the specified geometry. TODO formal explanation (DE9IM)

Specified by:
contains in interface Geometry
Overrides:
contains in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry contains geometry

crosses

public boolean crosses(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry crosses the specified geometry. TODO formal explanation (DE9IM)

Specified by:
crosses in interface Geometry
Overrides:
crosses in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry crosses geometry

getDifference

public Geometry getDifference(Geometry geometry)
Description copied from interface: Geometry
Returns the set-theoretic difference of this and the passed Geometry.

Specified by:
getDifference in interface Geometry
Overrides:
getDifference in class AbstractDefaultGeometry
Parameters:
geometry - other geometry, must not be null
Returns:
difference Geometry or null (empty set)

getDistance

public Measure getDistance(Geometry geometry,
                           Unit requestedUnit)
Description copied from interface: Geometry
Returns the minimum distance between this and the specified geometry.

Specified by:
getDistance in interface Geometry
Overrides:
getDistance in class AbstractDefaultGeometry
Parameters:
geometry - second geometry
requestedUnit - unit of the
Returns:
shortest distance between the two geometries

equals

public boolean equals(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry is equal to the specified geometry. TODO formal explanation (DE9IM)

Specified by:
equals in interface Geometry
Overrides:
equals in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry is equal to geometry

getBoundary

public Pair<Point,Point> getBoundary()
Description copied from interface: Curve
The boundary of a curve is the set of points at either end of the curve. If the curve is a cycle, the two ends are identical, and the curve (if topologically closed) is considered to not have a boundary.

Specified by:
getBoundary in interface Curve
Returns:
boundary of a curve. If a curve does not have a boundary because it is closed an empty List shall be retruned

getBuffer

public Geometry getBuffer(Measure distance)
Description copied from interface: Geometry
Return a new Geometry that contains all points with a distance from this Geometry that is less than or equal to the specified distance.

Specified by:
getBuffer in interface Geometry
Overrides:
getBuffer in class AbstractDefaultGeometry
Returns:
buffer geometry

getConvexHull

public Geometry getConvexHull()
Description copied from interface: Geometry
Returns the convex hull of the geometry.

Specified by:
getConvexHull in interface Geometry
Overrides:
getConvexHull in class AbstractDefaultGeometry
Returns:
convex hull of a Geometry

getCoordinateDimension

public int getCoordinateDimension()
Description copied from interface: Geometry
Returns the coordinate dimension, i.e. the dimension of the space that the geometry is embedded in.

Specified by:
getCoordinateDimension in interface Geometry
Returns:
the coordinate dimension

getEnvelope

public Envelope getEnvelope()
Description copied from interface: Geometry
Returns the minimal bounding box of the geometry.

Specified by:
getEnvelope in interface Geometry
Overrides:
getEnvelope in class AbstractDefaultGeometry
Returns:
the minimal bounding box of the geometry

getLength

public Measure getLength(Unit requestedUnit)
Specified by:
getLength in interface Curve
Returns:
length of the curve

getPrecision

public PrecisionModel getPrecision()
Description copied from interface: Geometry
Returns the PrecisionModel of the geometry.

Specified by:
getPrecision in interface Geometry
Overrides:
getPrecision in class AbstractDefaultGeometry
Returns:
the precision model

getIntersection

public Geometry getIntersection(Geometry geometry)
Description copied from interface: Geometry
Returns the set-theoretic intersection of this and the passed Geometry.

Specified by:
getIntersection in interface Geometry
Overrides:
getIntersection in class AbstractDefaultGeometry
Parameters:
geometry - other geometry, must not be null
Returns:
intersection Geometry or null (empty set)

intersects

public boolean intersects(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry intersects the specified geometry. TODO formal explanation (DE9IM)

Specified by:
intersects in interface Geometry
Overrides:
intersects in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry intersects geometry

isDisjoint

public boolean isDisjoint(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry is disjoint from the specified geometry. TODO formal explanation (DE9IM)

Specified by:
isDisjoint in interface Geometry
Overrides:
isDisjoint in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry is disjoint from geometry

overlaps

public boolean overlaps(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry overlaps the specified geometry. TODO formal explanation (DE9IM)

Specified by:
overlaps in interface Geometry
Overrides:
overlaps in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry overlaps geometry

touches

public boolean touches(Geometry geometry)
Description copied from interface: Geometry
Tests whether this geometry touches the specified geometry. TODO formal explanation (DE9IM)

Specified by:
touches in interface Geometry
Overrides:
touches in class AbstractDefaultGeometry
Parameters:
geometry - the Geometry to test this Geometry against
Returns:
true if this Geometry touches geometry

isBeyond

public boolean isBeyond(Geometry geometry,
                        Measure distance)
Description copied from interface: Geometry
Tests whether this geometry is beyond a specified distance of a second geometry.

Specified by:
isBeyond in interface Geometry
Overrides:
isBeyond in class AbstractDefaultGeometry
Parameters:
geometry - second geometry
Returns:
true, iff the minimum distance between this and the second geometry is greater than distance

isClosed

public boolean isClosed()
Description copied from interface: Curve
Returns whether the curve forms a closed loop.

Specified by:
isClosed in interface Curve
Returns:
true, if the curve forms a closed loop, false otherwise

isWithin

public boolean isWithin(Geometry geometry)
Description copied from interface: Geometry
tests whether the value of a geometric is topological located within this geometry. This method is the opposite of Geometry.contains(Geometry) method

Specified by:
isWithin in interface Geometry
Overrides:
isWithin in class AbstractDefaultGeometry
Returns:
true if passed geometry is located completly within this geometry

isWithinDistance

public boolean isWithinDistance(Geometry geometry,
                                Measure distance)
Description copied from interface: Geometry
Tests whether this geometry is within a specified distance of a second geometry.

Specified by:
isWithinDistance in interface Geometry
Overrides:
isWithinDistance in class AbstractDefaultGeometry
Parameters:
geometry - second geometry
Returns:
true, iff the distance between this and the second geometry is less than or equal distance

getUnion

public Geometry getUnion(Geometry geometry)
Description copied from interface: Geometry
Returns the set-theoretic union of this and the passed Geometry.

Specified by:
getUnion in interface Geometry
Overrides:
getUnion in class AbstractDefaultGeometry
Parameters:
geometry - other geometry, must not be null
Returns:
united Geometry (never null)

getPrimitiveType

public GeometricPrimitive.PrimitiveType getPrimitiveType()
Description copied from interface: Curve
Must always return GeometricPrimitive.PrimitiveType.Curve.

Specified by:
getPrimitiveType in interface Curve
Specified by:
getPrimitiveType in interface GeometricPrimitive
Returns:
GeometricPrimitive.PrimitiveType.Curve

getGeometryType

public Geometry.GeometryType getGeometryType()
Description copied from interface: GeometricPrimitive
Must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY.

Specified by:
getGeometryType in interface Geometry
Specified by:
getGeometryType in interface GeometricPrimitive
Returns:
must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY

getControlPoints

public Points getControlPoints()
Description copied from interface: Curve
Convenience method for accessing the control points of linear interpolated curves.

NOTE: This method is only safe to use when the curve is a LineString or LinearRing or it only consists of LineStringSegments. In any other case it will fail.

Specified by:
getControlPoints in interface Curve
Returns:
the control points

getJTSGeometry

public com.vividsolutions.jts.geom.Geometry getJTSGeometry()
Description copied from class: AbstractDefaultGeometry
Returns an equivalent (or best-fit) JTS geometry object.

Overrides:
getJTSGeometry in class AbstractDefaultGeometry
Returns:
an equivalent (or best-fit) JTS geometry

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>