deegree 2.2 (2008/12/22 11:33 build-3038-official)

org.deegree.model.spatialschema
Class RingImpl

java.lang.Object
  extended by org.deegree.model.spatialschema.GeometryImpl
      extended by org.deegree.model.spatialschema.PrimitiveImpl
          extended by org.deegree.model.spatialschema.OrientablePrimitiveImpl
              extended by org.deegree.model.spatialschema.OrientableCurveImpl
                  extended by org.deegree.model.spatialschema.RingImpl
All Implemented Interfaces:
Serializable, Geometry, OrientableCurve, OrientablePrimitive, Primitive, Ring

public class RingImpl
extends OrientableCurveImpl
implements Ring, Serializable

default implementation of the Ring interface of the

Since:
2.0
Version:
$Revision: 9343 $, 1.0. $Revision: 9343 $, $Date: 2007-12-27 14:30:32 +0100 (Do, 27 Dez 2007) $
Author:
Andreas Poth, last edited by: $Author: apoth $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.deegree.model.spatialschema.OrientablePrimitiveImpl
orientation
 
Fields inherited from class org.deegree.model.spatialschema.GeometryImpl
boundary, centroid, convexHull, crs, empty, envelope, mute, valid
 
Constructor Summary
RingImpl(CurveSegment[] segments, CoordinateSystem crs, char orientation)
          Constructor, with curve segments, CoordinateSystem and Orientation
RingImpl(Position[] points, CoordinateSystem crs)
          Constructor, with an array and CoordinateSystem
RingImpl(Position[] points, CoordinateSystem crs, char orientation)
          Constructor, with an array, CoordinateSystem and Orientation
 
Method Summary
protected  void calculateCentroid()
          calculates the centroid of the ring
protected  void calculateParam()
          calculates the centroid and the envelope of the ring
 Object clone()
          returns a shallow copy of the geometry
 boolean contains(Geometry gmo)
          The Boolean valued operation "contains" shall return TRUE if this Geometry contains another Geometry.
 boolean contains(Position position)
          The Boolean valued operation "contains" shall return TRUE if this Geometry contains a single point given by a coordinate.
 boolean equals(Object other)
          checks if this curve segment is completly equal to the submitted geometry
 CurveSegment getAsCurveSegment()
          returns the Ring as one CurveSegment
 int getCoordinateDimension()
          The operation "coordinateDimension" shall return the dimension of the coordinates that define this Geometry, which must be the same as the coordinate dimension of the coordinate reference system for this Geometry.
 CurveBoundary getCurveBoundary()
          returns the CurveBoundary of the Ring.
 CurveSegment[] getCurveSegments()
          returns the Ring as a CurveSegments
 int getDimension()
          The operation "dimension" shall return the inherent dimension of this Geometry, which shall be less than or equal to the coordinate dimension.
 Position[] getPositions()
          gets the Ring as a Array of positions.
 boolean intersects(Geometry gmo)
          The Boolean valued operation "intersects" shall return TRUE if this Geometry intersects another Geometry.
 boolean isCycle()
          Ring must be closed, so isCycle returns TRUE.
 boolean isSimple()
          Ring is a PrimitiveBoundary, so isSimple returns TRUE.
protected  void setPositions(Position[][] positions)
          sets the Ring as a ArrayList of points
 String toString()
           
 
Methods inherited from class org.deegree.model.spatialschema.OrientablePrimitiveImpl
getOrientation, setOrientation
 
Methods inherited from class org.deegree.model.spatialschema.GeometryImpl
difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, getTolerance, intersection, isEmpty, isValid, isWithinDistance, setCoordinateSystem, setEmpty, setTolerance, setValid, translate, union
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.model.spatialschema.OrientablePrimitive
getOrientation, setOrientation
 
Methods inherited from interface org.deegree.model.spatialschema.Geometry
difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, getTolerance, intersection, isEmpty, isWithinDistance, setTolerance, translate, union
 

Constructor Detail

RingImpl

public RingImpl(Position[] points,
                CoordinateSystem crs)
         throws GeometryException
Constructor, with an array and CoordinateSystem

Parameters:
points -
crs -
Throws:
GeometryException

RingImpl

public RingImpl(Position[] points,
                CoordinateSystem crs,
                char orientation)
         throws GeometryException
Constructor, with an array, CoordinateSystem and Orientation

Parameters:
points -
crs -
orientation -
Throws:
GeometryException

RingImpl

public RingImpl(CurveSegment[] segments,
                CoordinateSystem crs,
                char orientation)
         throws GeometryException
Constructor, with curve segments, CoordinateSystem and Orientation

Parameters:
segments -
crs -
orientation -
Throws:
GeometryException
Method Detail

isCycle

public boolean isCycle()
Ring must be closed, so isCycle returns TRUE.

Specified by:
isCycle in interface Ring
Returns:
true because a ring is always a cycle

isSimple

public boolean isSimple()
Ring is a PrimitiveBoundary, so isSimple returns TRUE.

Specified by:
isSimple in interface Ring
Returns:
true because a ring is always a simple

getDimension

public int getDimension()
The operation "dimension" shall return the inherent dimension of this Geometry, which shall be less than or equal to the coordinate dimension. The dimension of a collection of geometric objects shall be the largest dimension of any of its pieces. Points are 0-dimensional, curves are 1-dimensional, surfaces are 2-dimensional, and solids are 3-dimensional.

Specified by:
getDimension in interface Geometry

getCoordinateDimension

public int getCoordinateDimension()
The operation "coordinateDimension" shall return the dimension of the coordinates that define this Geometry, which must be the same as the coordinate dimension of the coordinate reference system for this Geometry.

Specified by:
getCoordinateDimension in interface Geometry

getPositions

public Position[] getPositions()
gets the Ring as a Array of positions.

Specified by:
getPositions in interface Ring
Returns:
all positions the builds the ring

setPositions

protected void setPositions(Position[][] positions)
                     throws GeometryException
sets the Ring as a ArrayList of points

Throws:
GeometryException

getAsCurveSegment

public CurveSegment getAsCurveSegment()
                               throws GeometryException
returns the Ring as one CurveSegment

Specified by:
getAsCurveSegment in interface Ring
Returns:
the ring as an instance of CurveSegment
Throws:
GeometryException

getCurveSegments

public CurveSegment[] getCurveSegments()
returns the Ring as a CurveSegments

Specified by:
getCurveSegments in interface Ring
Returns:
curve segments

getCurveBoundary

public CurveBoundary getCurveBoundary()
returns the CurveBoundary of the Ring. For a CurveBoundary is defines as the first and the last point of a Curve the CurveBoundary of a Ring contains two indentical point (because a Ring is closed)

Specified by:
getCurveBoundary in interface OrientableCurve

equals

public boolean equals(Object other)
checks if this curve segment is completly equal to the submitted geometry

Overrides:
equals in class GeometryImpl
Parameters:
other - object to compare to
Returns:
true if the objects are equal, else false

clone

public Object clone()
returns a shallow copy of the geometry

Overrides:
clone in class GeometryImpl
Returns:
a shallow copy of the geometry. this isn't realized at this level so a CloneNotSupportedException will be thrown.

intersects

public boolean intersects(Geometry gmo)
The Boolean valued operation "intersects" shall return TRUE if this Geometry intersects another Geometry. Within a Complex, the Primitives do not intersect one another. In general, topologically structured data uses shared geometric objects to capture intersection information.

Specified by:
intersects in interface Geometry
Overrides:
intersects in class GeometryImpl
Parameters:
gmo -
Returns:
true if intersects

contains

public boolean contains(Geometry gmo)
The Boolean valued operation "contains" shall return TRUE if this Geometry contains another Geometry.

At the moment the operation just works with point geometries

Specified by:
contains in interface Geometry
Overrides:
contains in class GeometryImpl
Parameters:
gmo - the Geometry to test (whether is is contained)
Returns:
true if the given object is contained, else false

contains

public boolean contains(Position position)
The Boolean valued operation "contains" shall return TRUE if this Geometry contains a single point given by a coordinate.

Specified by:
contains in interface Geometry
Overrides:
contains in class GeometryImpl
Parameters:
position -
Returns:
true if Ring contains passed position

calculateCentroid

protected void calculateCentroid()
calculates the centroid of the ring


calculateParam

protected void calculateParam()
calculates the centroid and the envelope of the ring

Specified by:
calculateParam in class GeometryImpl

toString

public String toString()
Overrides:
toString in class GeometryImpl
Returns:
string representation

deegree 2.2 (2008/12/22 11:33 build-3038-official)

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