org.deegree_impl.model.geometry
Class GM_MultiSurface_Impl

java.lang.Object
  extended byorg.deegree_impl.model.geometry.GM_Object_Impl
      extended byorg.deegree_impl.model.geometry.GM_Aggregate_Impl
          extended byorg.deegree_impl.model.geometry.GM_MultiPrimitive_Impl
              extended byorg.deegree_impl.model.geometry.GM_MultiSurface_Impl
All Implemented Interfaces:
GM_Aggregate, GM_MultiPrimitive, GM_MultiSurface, GM_Object, java.io.Serializable

final class GM_MultiSurface_Impl
extends GM_MultiPrimitive_Impl
implements GM_MultiSurface, java.io.Serializable

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

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

Version:
12.6.2001
Author:
Andreas Poth


Field Summary
protected  java.util.ArrayList aggregate
           
private  double area
           
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_MultiSurface_Impl(CS_CoordinateSystem crs)
          Creates a new GM_MultiSurface_Impl object.
GM_MultiSurface_Impl(GM_Surface[] surface)
          Creates a new GM_MultiSurface_Impl object.
GM_MultiSurface_Impl(GM_Surface[] surface, CS_CoordinateSystem crs)
          Creates a new GM_MultiSurface_Impl object.
 
Method Summary
 void add(GM_Object gmo)
          adds an GM_Object to the aggregation
 void addSurface(GM_Surface gms)
          adds an GM_Surface to the aggregation
private  void calculateCentroidArea()
          calculates the centroid and area of the aggregation
private  void calculateEnvelope()
          calculates the bounding box / envelope of the aggregation
protected  void calculateParam()
          calculates the centroid, area and envelope of the aggregation
 java.lang.Object clone()
          returns a shallow copy of the geometry
 boolean equals(java.lang.Object other)
          Compares the GM_Object to be equal to another GM_Object.
 GM_Object[] getAll()
          returns all GM_Objects as array
 GM_Primitive[] getAllPrimitives()
          returns all GM_Primitives as array
 GM_Surface[] getAllSurfaces()
          returns all GM_Surfaces as array
 double getArea()
          returns the area of the multi surface. this is calculate as the sum of all containing surface areas.
 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.
 java.util.Iterator getIterator()
          returns the aggregation as an iterator
 GM_Object getObjectAt(int index)
          returns the GM_Object at the submitted index. if index is larger then getSize() - 1 or smaller then 0 an exception will be thrown.
 GM_Primitive getPrimitiveAt(int index)
          returns the GM_Primitive at the submitted index.
 int getSize()
          returns the number of GM_Object within the aggregation
 GM_Surface getSurfaceAt(int index)
          returns the GM_Surface at the submitted index.
 void insertObjectAt(GM_Object gmo, int index)
          inserts a GM_Object in the aggregation. all elements with an index equal or larger index will be moved. if index is larger then getSize() - 1 or smaller then 0 or gmo equals null an exception will be thrown.
 void insertSurfaceAt(GM_Surface gms, int index)
          inserts a GM_Surface in the aggregation. all elements with an index equal or larger index will be moved. if index is larger then getSize() - 1 or smaller then 0 or gms equals null an exception will be thrown.
 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 geometry stored within the collection.
 boolean isMember(GM_Object gmo)
          returns true if the submitted GM_Object is within the aggregation
 void merge(GM_Aggregate aggregate)
          merges this aggregation with another one
 void removeAll()
          removes all GM_Object from the aggregation.
 GM_Object removeObject(GM_Object gmo)
          removes the submitted GM_Object from the aggregation
 GM_Object removeObjectAt(int index)
          removes the GM_Object at the submitted index from the aggregation.
 GM_Surface removeSurface(GM_Surface gms)
          removes the submitted GM_Surface from the aggregation
 GM_Surface removeSurfaceAt(int index)
          removes the GM_Surface at the submitted index from the aggregation.
 void setCoordinateSystem(CS_CoordinateSystem crs)
          sets the spatial reference system
 void setObjectAt(GM_Object gmo, int index)
          sets the submitted GM_Object at the submitted index. the element at the position index will be removed. if index is larger then getSize() - 1 or smaller then 0 or gmo equals null an exception will be thrown.
 void setSurfaceAt(GM_Surface gms, int index)
          sets the submitted GM_Surface at the submitted index. the element at the position index will be removed. if index is larger then getSize() - 1 or smaller then 0 or gms equals null an exception will be thrown.
 java.lang.String toString()
           
 void translate(double[] d)
          translate the point by the submitted values. the dz- value will be ignored.
 
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, 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_MultiPrimitive
getAllPrimitives, getPrimitiveAt
 
Methods inherited from interface org.deegree.model.geometry.GM_Aggregate
add, getAll, getIterator, getObjectAt, getSize, insertObjectAt, isMember, merge, removeAll, removeObject, removeObjectAt, setObjectAt
 
Methods inherited from interface org.deegree.model.geometry.GM_Object
contains, contains, difference, distance, getBoundary, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getEnvelope, intersection, intersects, isEmpty, isWithinDistance, translate, union
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

area

private double area

aggregate

protected java.util.ArrayList aggregate
Constructor Detail

GM_MultiSurface_Impl

public GM_MultiSurface_Impl(CS_CoordinateSystem crs)
Creates a new GM_MultiSurface_Impl object.

Parameters:
crs -

GM_MultiSurface_Impl

public GM_MultiSurface_Impl(GM_Surface[] surface)
Creates a new GM_MultiSurface_Impl object.

Parameters:
surface -

GM_MultiSurface_Impl

public GM_MultiSurface_Impl(GM_Surface[] surface,
                            CS_CoordinateSystem crs)
Creates a new GM_MultiSurface_Impl object.

Parameters:
surface -
crs -
Method Detail

addSurface

public void addSurface(GM_Surface gms)
adds an GM_Surface to the aggregation

Specified by:
addSurface in interface GM_MultiSurface

insertSurfaceAt

public void insertSurfaceAt(GM_Surface gms,
                            int index)
                     throws GM_Exception
inserts a GM_Surface in the aggregation. all elements with an index equal or larger index will be moved. if index is larger then getSize() - 1 or smaller then 0 or gms equals null an exception will be thrown.

Specified by:
insertSurfaceAt in interface GM_MultiSurface
Parameters:
gms - GM_Surface to insert.
index - position where to insert the new GM_Surface
Throws:
GM_Exception

setSurfaceAt

public void setSurfaceAt(GM_Surface gms,
                         int index)
                  throws GM_Exception
sets the submitted GM_Surface at the submitted index. the element at the position index will be removed. if index is larger then getSize() - 1 or smaller then 0 or gms equals null an exception will be thrown.

Specified by:
setSurfaceAt in interface GM_MultiSurface
Parameters:
gms - GM_Surface to set.
index - position where to set the new GM_Surface
Throws:
GM_Exception

removeSurface

public GM_Surface removeSurface(GM_Surface gms)
removes the submitted GM_Surface from the aggregation

Specified by:
removeSurface in interface GM_MultiSurface
Returns:
the removed GM_Surface

removeSurfaceAt

public GM_Surface removeSurfaceAt(int index)
                           throws GM_Exception
removes the GM_Surface at the submitted index from the aggregation. if index is larger then getSize() - 1 or smaller then 0 an exception will be thrown.

Specified by:
removeSurfaceAt in interface GM_MultiSurface
Returns:
the removed GM_Surface
Throws:
GM_Exception

getSurfaceAt

public GM_Surface getSurfaceAt(int index)
returns the GM_Surface at the submitted index.

Specified by:
getSurfaceAt in interface GM_MultiSurface

getAllSurfaces

public GM_Surface[] getAllSurfaces()
returns all GM_Surfaces as array

Specified by:
getAllSurfaces in interface GM_MultiSurface

calculateEnvelope

private void calculateEnvelope()
calculates the bounding box / envelope of the aggregation


calculateCentroidArea

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


calculateParam

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

Overrides:
calculateParam in class GM_MultiPrimitive_Impl

getArea

public double getArea()
returns the area of the multi surface. this is calculate as the sum of all containing surface areas.


clone

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

Overrides:
clone in class GM_Object_Impl

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
Overrides:
getDimension in class GM_MultiPrimitive_Impl

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
Overrides:
getCoordinateDimension in class GM_MultiPrimitive_Impl

merge

public void merge(GM_Aggregate aggregate)
           throws GM_Exception
merges this aggregation with another one

Specified by:
merge in interface GM_Aggregate
Overrides:
merge in class GM_Aggregate_Impl
Throws:
GM_Exception - will be thrown if the submitted isn't the same type as the recieving one.

getPrimitiveAt

public GM_Primitive getPrimitiveAt(int index)
returns the GM_Primitive at the submitted index.

Specified by:
getPrimitiveAt in interface GM_MultiPrimitive

getAllPrimitives

public GM_Primitive[] getAllPrimitives()
returns all GM_Primitives as array

Specified by:
getAllPrimitives in interface GM_MultiPrimitive

getSize

public int getSize()
returns the number of GM_Object within the aggregation

Specified by:
getSize in interface GM_Aggregate

add

public void add(GM_Object gmo)
adds an GM_Object to the aggregation

Specified by:
add in interface GM_Aggregate

insertObjectAt

public void insertObjectAt(GM_Object gmo,
                           int index)
                    throws GM_Exception
inserts a GM_Object in the aggregation. all elements with an index equal or larger index will be moved. if index is larger then getSize() - 1 or smaller then 0 or gmo equals null an exception will be thrown.

Specified by:
insertObjectAt in interface GM_Aggregate
Parameters:
gmo - GM_Object to insert.
index - position where to insert the new GM_Object
Throws:
GM_Exception

setObjectAt

public void setObjectAt(GM_Object gmo,
                        int index)
                 throws GM_Exception
sets the submitted GM_Object at the submitted index. the element at the position index will be removed. if index is larger then getSize() - 1 or smaller then 0 or gmo equals null an exception will be thrown.

Specified by:
setObjectAt in interface GM_Aggregate
Parameters:
gmo - GM_Object to set.
index - position where to set the new GM_Object
Throws:
GM_Exception

removeObject

public GM_Object removeObject(GM_Object gmo)
removes the submitted GM_Object from the aggregation

Specified by:
removeObject in interface GM_Aggregate
Returns:
the removed GM_Object

removeObjectAt

public GM_Object removeObjectAt(int index)
                         throws GM_Exception
removes the GM_Object at the submitted index from the aggregation. if index is larger then getSize() - 1 or smaller then 0 an exception will be thrown.

Specified by:
removeObjectAt in interface GM_Aggregate
Returns:
the removed GM_Object
Throws:
GM_Exception

removeAll

public void removeAll()
removes all GM_Object from the aggregation.

Specified by:
removeAll in interface GM_Aggregate

getObjectAt

public GM_Object getObjectAt(int index)
returns the GM_Object at the submitted index. if index is larger then getSize() - 1 or smaller then 0 an exception will be thrown.

Specified by:
getObjectAt in interface GM_Aggregate

getAll

public GM_Object[] getAll()
returns all GM_Objects as array

Specified by:
getAll in interface GM_Aggregate

isMember

public boolean isMember(GM_Object gmo)
returns true if the submitted GM_Object is within the aggregation

Specified by:
isMember in interface GM_Aggregate

getIterator

public java.util.Iterator getIterator()
returns the aggregation as an iterator

Specified by:
getIterator in interface GM_Aggregate

isEmpty

public boolean isEmpty()
returns true if no geometry stored within the collection.

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

setCoordinateSystem

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

Overrides:
setCoordinateSystem in class GM_Object_Impl
Parameters:
crs - new spatial reference system

translate

public void translate(double[] d)
translate the point by the submitted values. the dz- value will be ignored.

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

equals

public boolean equals(java.lang.Object other)
Description copied from class: GM_Object_Impl
Compares the GM_Object to be equal to another GM_Object.

Overrides:
equals in class GM_Object_Impl
Parameters:
other -
Returns:

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

toString

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