org.deegree_impl.model.geometry
Class GM_Object_Impl

java.lang.Object
  extended byorg.deegree_impl.model.geometry.GM_Object_Impl
All Implemented Interfaces:
GM_Object, java.io.Serializable
Direct Known Subclasses:
GM_Aggregate_Impl, GM_Boundary_Impl, GM_Primitive_Impl

public abstract class GM_Object_Impl
extends java.lang.Object
implements GM_Object, java.io.Serializable

Default implementation of the GM_Object interface from package deegree.model. The implementation is abstract because only the management of the spatial reference system is unique for all geometries.

Version:
$Revision: 1.12 $ $Date: 2004/03/05 07:42:15 $
Author:
Andreas Poth, Markus Schneider
See Also:
Serialized Form

Field Summary
protected  GM_Boundary boundary
           
protected  GM_Point centroid
           
protected  GM_Object convexHull
           
protected  CS_CoordinateSystem crs
           
protected  boolean empty
           
protected  GM_Envelope envelope
           
protected static double mute
           
private static long serialVersionUID
          Use serialVersionUID for interoperability.
protected  boolean valid
           
 
Constructor Summary
protected GM_Object_Impl(CS_CoordinateSystem crs)
          constructor that sets the spatial reference system
 
Method Summary
protected abstract  void calculateParam()
          recalculates internal parameters
 java.lang.Object clone()
          returns a shallow copy of the geometry. this isn't realized at this level so a CloneNotSupportedException will be thrown.
 boolean contains(GM_Object that)
          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.
 GM_Object difference(GM_Object that)
          The "difference" operation shall return the set theoretic difference of this GM_Object and the passed GM_Object.
 double distance(GM_Object gmo)
          The operation "distance" shall return the distance between this GM_Object and another GM_Object.
 boolean equals(java.lang.Object that)
          Compares the GM_Object to be equal to another GM_Object.
 GM_Boundary getBoundary()
          returns the boundary of the surface as general boundary
 GM_Object getBuffer(double distance)
          The operation "buffer" shall return a GM_Object containing all points whose distance from this GM_Object is less than or equal to the "distance" passed as a parameter.
 GM_Point getCentroid()
          The operation "centroid" shall return the mathematical centroid for this GM_Object.
 GM_Object getConvexHull()
          The operation "convexHull" shall return a GM_Object that represents the convex hull of this GM_Object.
 CS_CoordinateSystem getCoordinateSystem()
          returns the spatial reference system of a geometry
 GM_Envelope getEnvelope()
          returns the bounding box / envelope of a geometry
 GM_Object intersection(GM_Object that)
          The "intersection" operation shall return the set theoretic intersection of this GM_Object and the passed GM_Object.
 boolean intersects(GM_Object that)
          The Boolean valued operation "intersects" shall return TRUE if this GM_Object intersects another GM_Object.
 boolean isEmpty()
          returns true if no geometry values resp. points stored within the geometry.
protected  boolean isValid()
          returns true if the calculated parameters of the GM_Object are valid and false if they must be recalculated
 boolean isWithinDistance(GM_Object that, double distance)
           
 void setCoordinateSystem(CS_CoordinateSystem crs)
          sets the spatial reference system
 void setEmpty(boolean empty)
          indicates the geometry as empty
protected  void setValid(boolean valid)
          invalidates the calculated parameters of the GM_Object
 java.lang.String toString()
           
 void translate(double[] d)
          dummy implementation of this method
 GM_Object union(GM_Object that)
          The "union" operation shall return the set theoretic union of this GM_Object and the passed GM_Object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.model.geometry.GM_Object
getCoordinateDimension, getDimension
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

mute

protected static double mute

crs

protected CS_CoordinateSystem crs

boundary

protected GM_Boundary boundary

envelope

protected GM_Envelope envelope

convexHull

protected GM_Object convexHull

centroid

protected GM_Point centroid

empty

protected boolean empty

valid

protected boolean valid
Constructor Detail

GM_Object_Impl

protected GM_Object_Impl(CS_CoordinateSystem crs)
constructor that sets the spatial reference system

Parameters:
crs - new spatial reference system
Method Detail

getCoordinateSystem

public CS_CoordinateSystem getCoordinateSystem()
returns the spatial reference system of a geometry

Specified by:
getCoordinateSystem in interface GM_Object

setCoordinateSystem

public void setCoordinateSystem(CS_CoordinateSystem crs)
sets the spatial reference system

Parameters:
crs - new spatial reference system

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
returns a shallow copy of the geometry. this isn't realized at this level so a CloneNotSupportedException will be thrown.

Throws:
java.lang.CloneNotSupportedException

isEmpty

public boolean isEmpty()
returns true if no geometry values resp. points stored within the geometry.

Specified by:
isEmpty in interface GM_Object

setEmpty

public void setEmpty(boolean empty)
indicates the geometry as empty


getBoundary

public GM_Boundary getBoundary()
returns the boundary of the surface as general boundary

Specified by:
getBoundary in interface GM_Object

translate

public void translate(double[] d)
dummy implementation of this method

Specified by:
translate in interface GM_Object

distance

public double distance(GM_Object gmo)
The operation "distance" shall return the distance between this GM_Object and another GM_Object. This distance is defined to be the greatest lower bound of the set of distances between all pairs of points that include one each from each of the two GM_Objects. A "distance" value shall be a positive number associated to distance units such as meters or standard foot. If necessary, the second geometric object shall be transformed into the same coordinate reference system as the first before the distance is calculated.

If the geometric objects overlap, or touch, then their distance apart shall be zero. Some current implementations use a "negative" distance for such cases, but the approach is neither consistent between implementations, nor theoretically viable.

dummy implementation

Specified by:
distance in interface GM_Object

getCentroid

public GM_Point getCentroid()
The operation "centroid" shall return the mathematical centroid for this GM_Object. The result is not guaranteed to be on the object. For heterogeneous collections of primitives, the centroid only takes into account those of the largest dimension. For example, when calculating the centroid of surfaces, an average is taken weighted by area. Since curves have no area they do not contribute to the average.

Specified by:
getCentroid in interface GM_Object

getEnvelope

public GM_Envelope getEnvelope()
returns the bounding box / envelope of a geometry

Specified by:
getEnvelope in interface GM_Object

getConvexHull

public GM_Object getConvexHull()
The operation "convexHull" shall return a GM_Object that represents the convex hull of this GM_Object.

dummy implementation

Specified by:
getConvexHull in interface GM_Object

getBuffer

public GM_Object getBuffer(double distance)
The operation "buffer" shall return a GM_Object containing all points whose distance from this GM_Object is less than or equal to the "distance" passed as a parameter. The GM_Object returned is in the same reference system as this original GM_Object. The dimension of the returned GM_Object is normally the same as the coordinate dimension - a collection of GM_Surfaces in 2D space and a collection of GM_Solids in 3D space, but this may be application defined.

dummy implementation

Specified by:
getBuffer in interface GM_Object

contains

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

Specified by:
contains in interface GM_Object
Parameters:
that - 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.

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

intersects

public boolean intersects(GM_Object that)
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
Parameters:
that - the GM_Object to intersect with
Returns:
true if the objects intersects, else false

union

public GM_Object union(GM_Object that)
The "union" operation shall return the set theoretic union of this GM_Object and the passed GM_Object.

Specified by:
union in interface GM_Object
Parameters:
that - the GM_Object to unify
Returns:
intersection or null, if computation failed

intersection

public GM_Object intersection(GM_Object that)
The "intersection" operation shall return the set theoretic intersection of this GM_Object and the passed GM_Object.

Specified by:
intersection in interface GM_Object
Parameters:
that - the GM_Object to intersect with
Returns:
intersection or null, if it is empty (or computation failed)

difference

public GM_Object difference(GM_Object that)
The "difference" operation shall return the set theoretic difference of this GM_Object and the passed GM_Object.

Specified by:
difference in interface GM_Object
Parameters:
that - the GM_Object to calculate the difference with
Returns:
difference or null, if it is empty (or computation failed)

equals

public boolean equals(java.lang.Object that)
Compares the GM_Object to be equal to another GM_Object.

Parameters:
that - the GM_Object to test for equality
Returns:
true if the objects are equal, else false

isWithinDistance

public boolean isWithinDistance(GM_Object that,
                                double distance)
Specified by:
isWithinDistance in interface GM_Object

setValid

protected void setValid(boolean valid)
invalidates the calculated parameters of the GM_Object


isValid

protected boolean isValid()
returns true if the calculated parameters of the GM_Object are valid and false if they must be recalculated


calculateParam

protected abstract void calculateParam()
recalculates internal parameters


toString

public java.lang.String toString()
Returns: