org.deegree_impl.model.geometry
Class GM_Curve_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_Curve_Impl
All Implemented Interfaces:
GM_Curve, GM_GenericCurve, GM_Object, GM_OrientableCurve, GM_OrientablePrimitive, GM_Primitive, java.io.Serializable

class GM_Curve_Impl
extends GM_OrientableCurve_Impl
implements GM_Curve, GM_GenericCurve, java.io.Serializable

default implementation of the GM_Curve interface from package jago.model. ------------------------------------------------------------

Version:
14.10.2001
Author:
Andreas Poth

Field Summary
protected  char orientation
           
protected  java.util.ArrayList segments
           
private static long serialVersionUID
          Use serialVersionUID for interoperability.
 
Fields inherited from class org.deegree_impl.model.geometry.GM_Object_Impl
boundary, centroid, convexHull, crs, empty, envelope, mute, valid
 
Constructor Summary
GM_Curve_Impl(char orientation, GM_CurveSegment[] segments)
          initialize the curve by submitting a spatial reference system, an array of curve segments and the orientation of the curve
GM_Curve_Impl(GM_CurveSegment[] segments)
          initialize the curve by submitting a spatial reference system and an array of curve segments. the orientation of the curve is '+'
 
Method Summary
 void addCurveSegment(GM_CurveSegment segment)
          adds a segment at the end of the curve
private  void calculateBoundary()
          calculates the boundary of the Curve
private  void calculateCentroid()
          calculates the centroid of the Curve
private  void calculateEnvelope()
          calculates the envelope of the Curve
protected  void calculateParam()
          recalculates internal parameters
 java.lang.Object clone()
          returns a shallow copy of the geometry
 void deleteCurveSegmentAt(int index)
          deletes the segment at the submitted index
 boolean equals(java.lang.Object other)
          checks if this curve is completly equal to the submitted geometry
 GM_LineString getAsLineString()
          returns the curve as GM_LineString. if there isn't a curve segment within the curve null will be returned
 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 boundary of the curve
 GM_CurveSegment getCurveSegmentAt(int index)
          returns the curve segment at the submitted index
 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.
 GM_Point getEndPoint()
          returns the last point of the curve.if the curve doesn't contain a segment or the last segment doesn't contain a point null will be returned
 double getLength()
          returns the length of the curve in units of the related spatial reference system
 int getNumberOfCurveSegments()
          returns the number of segments building the curve
 char getOrientation()
          returns the orientation of a curve
 GM_Point getStartPoint()
          returns the first point of the curve. if the curve doesn't contain a segment or the first segment doesn't contain a point null will be returned
 void insertCurveSegmentAt(GM_CurveSegment segment, int index)
          inserts a segment in the curve at the submitted position. all points with a position that equals index or is higher will be shifted
 boolean intersects(GM_Object gmo)
          The Boolean valued operation "intersects" shall return TRUE if this GM_Object intersects another GM_Object.
 boolean isEmpty()
          returns true if no segment is within the curve
 void setCurveSegmentAt(GM_CurveSegment segment, int index)
          writes a segment to the curve at submitted position. the old point will be deleted
 void setOrientation(char orientation)
          sets the curves orientation
 java.lang.String toString()
           
 void translate(double[] d)
          translate each point of the curve with the values of the submitted double array.
 
Methods inherited from class org.deegree_impl.model.geometry.GM_Object_Impl
contains, contains, difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, intersection, isValid, isWithinDistance, setCoordinateSystem, setEmpty, setValid, 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
contains, contains, difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, intersection, isWithinDistance, union
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

segments

protected java.util.ArrayList segments

orientation

protected char orientation
Constructor Detail

GM_Curve_Impl

public GM_Curve_Impl(GM_CurveSegment[] segments)
              throws GM_Exception
initialize the curve by submitting a spatial reference system and an array of curve segments. the orientation of the curve is '+'

Parameters:
segments - array of GM_CurveSegment

GM_Curve_Impl

public GM_Curve_Impl(char orientation,
                     GM_CurveSegment[] segments)
              throws GM_Exception
initialize the curve by submitting a spatial reference system, an array of curve segments and the orientation of the curve

Parameters:
segments - array of GM_CurveSegment
orientation - of the curve
Method Detail

calculateEnvelope

private void calculateEnvelope()
calculates the envelope of the Curve


calculateBoundary

private void calculateBoundary()
calculates the boundary of the Curve


calculateCentroid

private void calculateCentroid()
calculates the centroid of the Curve


calculateParam

protected void calculateParam()
Description copied from class: GM_Object_Impl
recalculates internal parameters

Specified by:
calculateParam in class GM_Object_Impl

getCurveBoundary

public GM_CurveBoundary getCurveBoundary()
returns the boundary of the curve

Specified by:
getCurveBoundary in interface GM_OrientableCurve

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

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.

dummy implementation

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

getLength

public double getLength()
returns the length of the curve in units of the related spatial reference system

Specified by:
getLength in interface GM_GenericCurve

getNumberOfCurveSegments

public int getNumberOfCurveSegments()
returns the number of segments building the curve

Specified by:
getNumberOfCurveSegments in interface GM_Curve

getStartPoint

public GM_Point getStartPoint()
returns the first point of the curve. if the curve doesn't contain a segment or the first segment doesn't contain a point null will be returned

Specified by:
getStartPoint in interface GM_GenericCurve

getEndPoint

public GM_Point getEndPoint()
returns the last point of the curve.if the curve doesn't contain a segment or the last segment doesn't contain a point null will be returned

Specified by:
getEndPoint in interface GM_GenericCurve

getAsLineString

public GM_LineString getAsLineString()
                              throws GM_Exception
returns the curve as GM_LineString. if there isn't a curve segment within the curve null will be returned

Specified by:
getAsLineString in interface GM_GenericCurve
Throws:
GM_Exception

getCurveSegmentAt

public GM_CurveSegment getCurveSegmentAt(int index)
                                  throws GM_Exception
returns the curve segment at the submitted index

Specified by:
getCurveSegmentAt in interface GM_Curve
Parameters:
index - index of the curve segment that should be returned
Throws:
GM_Exception - a exception will be thrown if index is smaller than '0' or larger than getNumberOfCurveSegments()-1

setCurveSegmentAt

public void setCurveSegmentAt(GM_CurveSegment segment,
                              int index)
                       throws GM_Exception
writes a segment to the curve at submitted position. the old point will be deleted

Specified by:
setCurveSegmentAt in interface GM_Curve
Parameters:
segment - curve segment that should be set
index - index where to set the curve segment
Throws:
GM_Exception - a exception will be thrown if index is smaller than '0' or larger than getNumberOfCurveSegments()-1 or or the starting point of the submitted curve segment isn't equal to the ending point of segment at index-1 and/or the ending point of the submitted segment isn't equals to the curve segment at index+1

insertCurveSegmentAt

public void insertCurveSegmentAt(GM_CurveSegment segment,
                                 int index)
                          throws GM_Exception
inserts a segment in the curve at the submitted position. all points with a position that equals index or is higher will be shifted

Specified by:
insertCurveSegmentAt in interface GM_Curve
Parameters:
segment - curve segment that should be inserted
index - index where to insert the curve segment
Throws:
GM_Exception - a exception will be thrown if index is smaller than '0' or larger than getNumberOfCurveSegments()-1 or or the starting point of the submitted curve segment isn't equal to the ending point of segment at index-1 and/or the ending point of the submitted segment isn't equals to the curve segment at index+1

addCurveSegment

public void addCurveSegment(GM_CurveSegment segment)
                     throws GM_Exception
adds a segment at the end of the curve

Specified by:
addCurveSegment in interface GM_Curve
Parameters:
segment - curve segment that should be set
Throws:
GM_Exception - a exception will be thrown if the starting point of the submitted curve segment isn't equal to the ending point of the last segment.

deleteCurveSegmentAt

public void deleteCurveSegmentAt(int index)
                          throws GM_Exception
deletes the segment at the submitted index

Specified by:
deleteCurveSegmentAt in interface GM_Curve
Parameters:
index - index of the curve segement that should be removed from the curve.
Throws:
GM_Exception - will be thrown if index is smaller '0' or larger getNumberOfCurveSegments()-1

isEmpty

public boolean isEmpty()
returns true if no segment is within the curve

Specified by:
isEmpty in interface GM_Object
Overrides:
isEmpty in class GM_Object_Impl

translate

public void translate(double[] d)
translate each point of the curve with the values of the submitted double array.

Specified by:
translate in interface GM_Object
Overrides:
translate in class GM_Object_Impl

equals

public boolean equals(java.lang.Object other)
checks if this curve 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

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