org.deegree_impl.model.geometry
Class GM_Surface_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_OrientableSurface_Impl
                  extended byorg.deegree_impl.model.geometry.GM_Surface_Impl
All Implemented Interfaces:
GM_GenericSurface, GM_Object, GM_OrientablePrimitive, GM_OrientableSurface, GM_Primitive, GM_Surface, java.io.Serializable

class GM_Surface_Impl
extends GM_OrientableSurface_Impl
implements GM_Surface, GM_GenericSurface, java.io.Serializable

default implementation of the GM_Surface interface from package jago.model.

for simplicity of the implementation it is assumed that a surface is build from just one surface patch. this isn't completly confrom to the ISO 19107 and the OGC GAIA specification but sufficient for most applications.

It will be extended to fullfill the complete specs as soon as possible.

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

Version:
05.04.2002
Author:
Andreas Poth

Field Summary
private  double area
           
protected  char orientation
           
protected  GM_SurfacePatch patch
           
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_Surface_Impl(char orientation, GM_SurfaceBoundary boundary)
          initializes the surface submitting the orientation and the surfaces boundary.
GM_Surface_Impl(char orientation, GM_SurfacePatch surfacePatch)
          initializes the surface submitting the orientation and one surface patch.
GM_Surface_Impl(GM_SurfaceBoundary boundary)
          initializes the surface with default orientation submitting the surfaces boundary
GM_Surface_Impl(GM_SurfacePatch surfacePatch)
          initializes the surface with default orientation submitting one surface patch.
 
Method Summary
 void addSurfacePatch(GM_SurfacePatch patch)
          adds a surface patch at the end of the curve
private  void calculateBoundary()
          calculates the boundary and area of the surface
private  void calculateCentroidArea()
          calculates the centroid and area of the surface
private  void calculateEnvelope()
          calculates the envelope of the surface
protected  void calculateParam()
          calculates area, centroid and the envelope of the surface
 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.
 void deleteSurfacePatchAt(int index)
          deletes the surface patch at the submitted index
 boolean equals(java.lang.Object other)
          checks if this surface is completly equal to the submitted geometry
 double getArea()
          The operation "area" shall return the area of this GM_GenericSurface.
 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.
 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.
 int getNumberOfSurfacePatches()
          returns the number of patches building the surface
 char getOrientation()
          returns the orientation of a curve
 double getPerimeter()
          returns the length of all boundaries of the surface in a reference system appropriate for measuring distances.
 GM_SurfaceBoundary getSurfaceBoundary()
          returns the boundary of the surface as surface boundary
 GM_SurfacePatch getSurfacePatchAt(int index)
          returns the surface patch at the submitted index
 void insertSurfacePatchAt(GM_SurfacePatch patch, int index)
          inserts a surface patch 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_Surface_Impl intersects with the given GM_Object.
 void setOrientation(char orientation)
          sets the curves orientation
 void setSurfacePatchAt(GM_SurfacePatch patch, int index)
          writes a surface patch to the surface at submitted position. the old patch will be deleted
 java.lang.String toString()
           
 void translate(double[] d)
          translate each point of the surface with the values of the submitted double array.
 
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, 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, union
 
Methods inherited from interface org.deegree.model.geometry.GM_GenericSurface
getEnvelope
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

patch

protected GM_SurfacePatch patch

area

private double area

orientation

protected char orientation
Constructor Detail

GM_Surface_Impl

public GM_Surface_Impl(GM_SurfacePatch surfacePatch)
                throws GM_Exception
initializes the surface with default orientation submitting one surface patch.

Parameters:
surfacePatch - patches of the surface.

GM_Surface_Impl

public GM_Surface_Impl(char orientation,
                       GM_SurfacePatch surfacePatch)
                throws GM_Exception
initializes the surface submitting the orientation and one surface patch.

Parameters:
surfacePatch - patches of the surface.

GM_Surface_Impl

public GM_Surface_Impl(GM_SurfaceBoundary boundary)
                throws GM_Exception
initializes the surface with default orientation submitting the surfaces boundary

Parameters:
boundary - boundary of the surface

GM_Surface_Impl

public GM_Surface_Impl(char orientation,
                       GM_SurfaceBoundary boundary)
                throws GM_Exception
initializes the surface submitting the orientation and the surfaces boundary.

Parameters:
boundary - boundary of the surface
Method Detail

calculateCentroidArea

private void calculateCentroidArea()
calculates the centroid and area of the surface


calculateBoundary

private void calculateBoundary()
calculates the boundary and area of the surface


calculateParam

protected void calculateParam()
calculates area, centroid and the envelope of the surface

Specified by:
calculateParam in class GM_Object_Impl

calculateEnvelope

private void calculateEnvelope()
calculates the envelope of the surface


getPerimeter

public double getPerimeter()
returns the length of all boundaries of the surface in a reference system appropriate for measuring distances.

Specified by:
getPerimeter in interface GM_GenericSurface

getArea

public double getArea()
The operation "area" shall return the area of this GM_GenericSurface. The area of a 2 dimensional geometric object shall be a numeric measure of its surface area Since area is an accumulation (integral) of the product of two distances, its return value shall be in a unit of measure appropriate for measuring distances squared.

Specified by:
getArea in interface GM_GenericSurface

getSurfaceBoundary

public GM_SurfaceBoundary getSurfaceBoundary()
returns the boundary of the surface as surface boundary

Specified by:
getSurfaceBoundary in interface GM_OrientableSurface

getNumberOfSurfacePatches

public int getNumberOfSurfacePatches()
returns the number of patches building the surface

Specified by:
getNumberOfSurfacePatches in interface GM_Surface

getSurfacePatchAt

public GM_SurfacePatch getSurfacePatchAt(int index)
                                  throws GM_Exception
returns the surface patch at the submitted index

Specified by:
getSurfacePatchAt in interface GM_Surface
Throws:
GM_Exception

setSurfacePatchAt

public void setSurfacePatchAt(GM_SurfacePatch patch,
                              int index)
                       throws GM_Exception
writes a surface patch to the surface at submitted position. the old patch will be deleted

Specified by:
setSurfacePatchAt in interface GM_Surface
Throws:
GM_Exception

insertSurfacePatchAt

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

Specified by:
insertSurfacePatchAt in interface GM_Surface
Throws:
GM_Exception

addSurfacePatch

public void addSurfacePatch(GM_SurfacePatch patch)
adds a surface patch at the end of the curve

Specified by:
addSurfacePatch in interface GM_Surface

deleteSurfacePatchAt

public void deleteSurfacePatchAt(int index)
                          throws GM_Exception
deletes the surface patch at the submitted index

Specified by:
deleteSurfacePatchAt in interface GM_Surface
Throws:
GM_Exception

equals

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

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

clone

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

Overrides:
clone in class GM_Object_Impl

translate

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

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

intersects

public boolean intersects(GM_Object gmo)
The boolean valued operation "intersects" shall return TRUE if this GM_Surface_Impl intersects with the given 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 test for intersection
Returns:
true if the GM_Object intersects with this

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.

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

contains

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

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

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