org.deegree_impl.model.geometry
Class GM_Ring_Impl

java.lang.Object
  extended byorg.deegree_impl.model.geometry.GM_Object_Impl
      extended byorg.deegree_impl.model.geometry.GM_Primitive_Impl
          extended byorg.deegree_impl.model.geometry.GM_OrientablePrimitive_Impl
              extended byorg.deegree_impl.model.geometry.GM_OrientableCurve_Impl
                  extended byorg.deegree_impl.model.geometry.GM_Ring_Impl
All Implemented Interfaces:
GM_Object, GM_OrientableCurve, GM_OrientablePrimitive, GM_Primitive, GM_Ring, java.io.Serializable

public class GM_Ring_Impl
extends GM_OrientableCurve_Impl
implements GM_Ring, java.io.Serializable

default implementation of the GM_Ring interface of the

-----------------------------------------------------------------------

Version:
05.04.2002
Author:
Andreas Poth
See Also:
Serialized Form

Field Summary
protected  char orientation
           
private  GM_Position[] points
           
private static long serialVersionUID
          Use serialVersionUID for interoperability.
private  GM_SurfacePatch sp
           
 
Fields inherited from class org.deegree_impl.model.geometry.GM_Object_Impl
boundary, centroid, convexHull, crs, empty, envelope, mute, valid
 
Constructor Summary
GM_Ring_Impl(GM_Position[] points, CS_CoordinateSystem crs)
          Constructor, with Array and CS_CoordinateSystem
GM_Ring_Impl(GM_Position[] points, CS_CoordinateSystem crs, char orientation)
          Constructor, with Array, CS_CoordinateSystem and Orientation
 
Method Summary
protected  void calculateCentroid()
          calculates the centroid of the ring
private  void calculateEnvelope()
          calculates the envelope
protected  void calculateParam()
          calculates the centroid and the envelope of the ring
 java.lang.Object clone()
          returns a shallow copy of the geometry
 boolean contains(GM_Object gmo)
          The Boolean valued operation "contains" shall return TRUE if this GM_Object contains another GM_Object.
 boolean contains(GM_Position position)
          The Boolean valued operation "contains" shall return TRUE if this GM_Object contains a single point given by a coordinate.
 boolean equals(java.lang.Object other)
          checks if this curve segment is completly equal to the submitted geometry
 GM_CurveSegment getAsCurveSegment()
          returns the Ring as a CurveSegment
 int getCoordinateDimension()
          The operation "coordinateDimension" shall return the dimension of the coordinates that define this GM_Object, which must be the same as the coordinate dimension of the coordinate reference system for this GM_Object.
 GM_CurveBoundary getCurveBoundary()
          returns the CurveBoundary of the Ring.
 int getDimension()
          The operation "dimension" shall return the inherent dimension of this GM_Object, which shall be less than or equal to the coordinate dimension.
 char getOrientation()
          returns the orientation of a curve
 GM_Position[] getPositions()
          gets the Ring as a Array of positions.
 boolean intersects(GM_Object gmo)
          The Boolean valued operation "intersects" shall return TRUE if this GM_Object intersects another GM_Object.
private  boolean intersectsAggregate(GM_Aggregate mprim)
          the operations returns true if the submitted multi primitive intersects with the curve segment
 boolean isCycle()
          GM_Ring must be closed, so isCycle returns TRUE.
 boolean isSimple()
          GM_Ring is a PrimitiveBoundary, so isSimple returns TRUE.
 void setOrientation(char orientation)
          sets the curves orientation
protected  void setPositions(GM_Position[] positions)
          sets the Ring as a ArrayList of points
 java.lang.String toString()
           
 
Methods inherited from class org.deegree_impl.model.geometry.GM_Object_Impl
difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, intersection, isEmpty, isValid, isWithinDistance, setCoordinateSystem, setEmpty, 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.geometry.GM_OrientablePrimitive
getOrientation, setOrientation
 
Methods inherited from interface org.deegree.model.geometry.GM_Object
difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, intersection, isEmpty, isWithinDistance, translate, union
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

points

private GM_Position[] points

sp

private GM_SurfacePatch sp

orientation

protected char orientation
Constructor Detail

GM_Ring_Impl

public GM_Ring_Impl(GM_Position[] points,
                    CS_CoordinateSystem crs)
             throws GM_Exception
Constructor, with Array and CS_CoordinateSystem


GM_Ring_Impl

public GM_Ring_Impl(GM_Position[] points,
                    CS_CoordinateSystem crs,
                    char orientation)
             throws GM_Exception
Constructor, with Array, CS_CoordinateSystem and Orientation

Method Detail

calculateEnvelope

private void calculateEnvelope()
calculates the envelope


isCycle

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

Specified by:
isCycle in interface GM_Ring

isSimple

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

Specified by:
isSimple in interface GM_Ring

getDimension

public int getDimension()
The operation "dimension" shall return the inherent dimension of this GM_Object, 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 GM_Object

getCoordinateDimension

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

Specified by:
getCoordinateDimension in interface GM_Object

getPositions

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

Specified by:
getPositions in interface GM_Ring

setPositions

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

Throws:
GM_Exception

getAsCurveSegment

public GM_CurveSegment getAsCurveSegment()
                                  throws GM_Exception
returns the Ring as a CurveSegment

Specified by:
getAsCurveSegment in interface GM_Ring
Throws:
GM_Exception

getCurveBoundary

public GM_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 GM_OrientableCurve

equals

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

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

clone

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

Overrides:
clone in class GM_Object_Impl

intersects

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

Specified by:
intersects in interface GM_Object
Overrides:
intersects in class GM_Object_Impl
Parameters:
gmo - the GM_Object to intersect with
Returns:
true if the objects intersects, else false

intersectsAggregate

private boolean intersectsAggregate(GM_Aggregate mprim)
                             throws java.lang.Exception
the operations returns true if the submitted multi primitive intersects with the curve segment

Throws:
java.lang.Exception

contains

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

At the moment the operation just works with point geometries

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

contains

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

dummy implementation

Specified by:
contains in interface GM_Object
Overrides:
contains in class GM_Object_Impl
Parameters:
position - GM_Position to test (whether is is contained)
Returns:
true if the given object is contained, else false

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 GM_Object_Impl

toString

public java.lang.String toString()
Overrides:
toString in class GM_Object_Impl
Returns:

getOrientation

public char getOrientation()
returns the orientation of a curve

Specified by:
getOrientation in interface GM_OrientablePrimitive
Returns:
curve orientation ('+'|'-')

setOrientation

public void setOrientation(char orientation)
                    throws GM_Exception
sets the curves orientation

Specified by:
setOrientation in interface GM_OrientablePrimitive
Parameters:
orientation - orientation of the curve ('+'|'-')
Throws:
GM_Exception - will be thrown if orientation is invalid