org.geotools.geometry.iso.root
Class GeometryImpl

java.lang.Object
  extended by org.geotools.geometry.iso.root.GeometryImpl
All Implemented Interfaces:
java.io.Serializable, org.opengis.geometry.Geometry, org.opengis.geometry.TransfiniteSet
Direct Known Subclasses:
AggregateImpl, ComplexImpl, PrimitiveImpl

public abstract class GeometryImpl
extends java.lang.Object
implements org.opengis.geometry.Geometry, java.io.Serializable

GeometryImpl is the root class of the geometric object taxonomy and supports methods common to all geographically referenced geometric objects. GeometryImpl instances are sets of direct positions in a particular coordinate reference system. A GeometryImpl can be regarded as an infinite set of points that satisfies the set operation interfaces for a set of direct positions, TransfiniteSet<DirectPosition>. Since an infinite collection class cannot be implemented directly, a boolean test for inclusion is provided by this class. NOTE As a type, GeometryImpl does not have a well-defined default state or value representation as a data type. Instantiated subclasses of GeometryImpl will.

Version:
Abstract Specification V5
Author:
Jackson Roehrig & Sanjay Jena
See Also:
Serialized Form

Field Summary
protected  org.opengis.referencing.crs.CoordinateReferenceSystem crs
           
protected  org.opengis.geometry.Precision percision
           
 
Constructor Summary
GeometryImpl(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
           
GeometryImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.geometry.Precision pm)
           
 
Method Summary
protected static GeometryImpl castToGeometryImpl(org.opengis.geometry.Geometry g)
          Use this function to cast Geometry instances to a GeometryImpl instance.
protected static GeometryImpl castToGeometryImpl(org.opengis.geometry.TransfiniteSet tf)
          Use this function to cast TransfiniteSet instances to a GeometryImpl instance.
abstract  GeometryImpl clone()
           
 boolean contains(org.opengis.geometry.DirectPosition position)
           
 boolean contains(org.opengis.geometry.TransfiniteSet pointSet)
           
static boolean cRelate(org.opengis.geometry.Geometry g1, org.opengis.geometry.Geometry g2, java.lang.String intersectionPatternMatrix)
          Verifies a boolean relation between two geometry objects
 boolean crosses(org.opengis.geometry.TransfiniteSet pointSet)
           
 org.opengis.geometry.TransfiniteSet difference(org.opengis.geometry.TransfiniteSet pointSet)
           
 boolean disjoint(org.opengis.geometry.TransfiniteSet pointSet)
          This operator tests, whether an object is spatially disjoint with this Geometry object
 double distance(org.opengis.geometry.Geometry geometry)
          Computes the distance between this and another geometry.
 boolean equals(org.opengis.geometry.TransfiniteSet pointSet)
           
abstract  org.opengis.geometry.Boundary getBoundary()
           
 org.opengis.geometry.Geometry getBuffer(double distance)
           
 org.opengis.geometry.DirectPosition getCentroid()
           
 org.opengis.geometry.complex.Complex getClosure()
           
 org.opengis.geometry.Geometry getConvexHull()
           
 int getCoordinateDimension()
           
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
           
abstract  int getDimension(org.opengis.geometry.DirectPosition point)
           
 double getDistance(org.opengis.geometry.Geometry geometry)
          Deprecated. use distance()
abstract  org.opengis.geometry.Envelope getEnvelope()
           
 org.opengis.geometry.Geometry getMbRegion()
          Return a Primitive which represents the envelope of this Geometry instance (non-Javadoc)
protected  org.opengis.geometry.PositionFactory getPositionFactory()
           
 org.opengis.geometry.Precision getPrecision()
           
abstract  org.opengis.geometry.DirectPosition getRepresentativePoint()
           
 org.opengis.geometry.TransfiniteSet intersection(org.opengis.geometry.TransfiniteSet pointSet)
           
 boolean intersects(org.opengis.geometry.TransfiniteSet pointSet)
           
 boolean isCycle()
           
 boolean isMutable()
           
 boolean overlaps(org.opengis.geometry.TransfiniteSet pointSet)
          This operator tests, whether an object overlaps with this object.
 boolean relate(org.opengis.geometry.Geometry aOther, java.lang.String intersectionPatternMatrix)
          Verifies a boolean relation between two geometry objects
 org.opengis.geometry.TransfiniteSet symmetricDifference(org.opengis.geometry.TransfiniteSet pointSet)
           
 org.opengis.geometry.Geometry toImmutable()
           
 boolean touches(org.opengis.geometry.TransfiniteSet pointSet)
          This operator tests, whether an object touches this object in an edge or point
 org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS)
           
 org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS, org.opengis.referencing.operation.MathTransform transform)
           
 org.opengis.geometry.TransfiniteSet union(org.opengis.geometry.TransfiniteSet pointSet)
           
 boolean within(org.opengis.geometry.TransfiniteSet pointSet)
          This operator tests, whether an object is spatially within this Geometry object
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.Geometry
getMaximalComplex, isSimple
 

Field Detail

crs

protected final org.opengis.referencing.crs.CoordinateReferenceSystem crs

percision

protected final org.opengis.geometry.Precision percision
Constructor Detail

GeometryImpl

public GeometryImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                    org.opengis.geometry.Precision pm)

GeometryImpl

public GeometryImpl(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
Method Detail

clone

public abstract GeometryImpl clone()
                            throws java.lang.CloneNotSupportedException
Specified by:
clone in interface org.opengis.geometry.Geometry
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getBoundary

public abstract org.opengis.geometry.Boundary getBoundary()
Specified by:
getBoundary in interface org.opengis.geometry.Geometry

getDimension

public abstract int getDimension(org.opengis.geometry.DirectPosition point)
Specified by:
getDimension in interface org.opengis.geometry.Geometry

getEnvelope

public abstract org.opengis.geometry.Envelope getEnvelope()
Specified by:
getEnvelope in interface org.opengis.geometry.Geometry

getRepresentativePoint

public abstract org.opengis.geometry.DirectPosition getRepresentativePoint()
Specified by:
getRepresentativePoint in interface org.opengis.geometry.Geometry

isMutable

public boolean isMutable()
Specified by:
isMutable in interface org.opengis.geometry.Geometry

toImmutable

public org.opengis.geometry.Geometry toImmutable()
Specified by:
toImmutable in interface org.opengis.geometry.Geometry

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Specified by:
getCoordinateReferenceSystem in interface org.opengis.geometry.Geometry

getPrecision

public org.opengis.geometry.Precision getPrecision()
Specified by:
getPrecision in interface org.opengis.geometry.Geometry

getCoordinateDimension

public int getCoordinateDimension()
Specified by:
getCoordinateDimension in interface org.opengis.geometry.Geometry

transform

public org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS)
                                        throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.geometry.Geometry
Throws:
org.opengis.referencing.operation.TransformException

transform

public org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS,
                                               org.opengis.referencing.operation.MathTransform transform)
                                        throws org.opengis.geometry.MismatchedDimensionException,
                                               org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.geometry.Geometry
Throws:
org.opengis.geometry.MismatchedDimensionException
org.opengis.referencing.operation.TransformException

getDistance

public final double getDistance(org.opengis.geometry.Geometry geometry)
Deprecated. use distance()

(non-Javadoc)

See Also:
org.opengis.geometry.coordinate.root.Geometry#getDistance(org.opengis.geometry.coordinate.root.Geometry)

distance

public final double distance(org.opengis.geometry.Geometry geometry)
Computes the distance between this and another geometry. We have to implement the logic of dealing with multiprimtive geometries separately. gdavis - This method should really be broken out into 1 of 2 things: 1. an operator class that figures out the geometry type and does the operation based on that, or 2. a double dispatch command pattern system that returns a command to perform based on the geometry type and the command of "distance". Currently this implementation works for our needs, but we should consider re-designing it with one of the above approaches for better scalability.

Specified by:
distance in interface org.opengis.geometry.Geometry
See Also:
org.opengis.geometry.coordinate.root.Geometry#distance(org.opengis.geometry.coordinate.root.Geometry)

getBuffer

public org.opengis.geometry.Geometry getBuffer(double distance)
Specified by:
getBuffer in interface org.opengis.geometry.Geometry

getMbRegion

public org.opengis.geometry.Geometry getMbRegion()
Return a Primitive which represents the envelope of this Geometry instance (non-Javadoc)

Specified by:
getMbRegion in interface org.opengis.geometry.Geometry
Returns:
primitive representing the envelope of this Geometry
See Also:
org.opengis.geometry.coordinate.root.Geometry#getMbRegion()

getCentroid

public org.opengis.geometry.DirectPosition getCentroid()
Specified by:
getCentroid in interface org.opengis.geometry.Geometry

getConvexHull

public org.opengis.geometry.Geometry getConvexHull()
Specified by:
getConvexHull in interface org.opengis.geometry.Geometry

cRelate

public static boolean cRelate(org.opengis.geometry.Geometry g1,
                              org.opengis.geometry.Geometry g2,
                              java.lang.String intersectionPatternMatrix)
                       throws UnsupportedDimensionException
Verifies a boolean relation between two geometry objects

Parameters:
geom1 -
geom2 -
intersectionPatternMatrix -
Returns:
TRUE if the Intersection Pattern Matrix describes the topological relation between the two input geomtries correctly, FALSE if not.
Throws:
UnsupportedDimensionException

relate

public boolean relate(org.opengis.geometry.Geometry aOther,
                      java.lang.String intersectionPatternMatrix)
               throws UnsupportedDimensionException
Verifies a boolean relation between two geometry objects

Parameters:
aOther -
intersectionPatternMatrix -
Returns:
TRUE if the Intersection Pattern Matrix describes the topological relation between the two input geomtries correctly, FALSE if not.
Throws:
UnsupportedDimensionException

contains

public boolean contains(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
contains in interface org.opengis.geometry.TransfiniteSet

within

public boolean within(org.opengis.geometry.TransfiniteSet pointSet)
This operator tests, whether an object is spatially within this Geometry object

Parameters:
pointSet - Another Object
Returns:
TRUE, if the other object is spatially within this object

contains

public boolean contains(org.opengis.geometry.DirectPosition position)
Specified by:
contains in interface org.opengis.geometry.TransfiniteSet

intersects

public boolean intersects(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
intersects in interface org.opengis.geometry.TransfiniteSet

disjoint

public boolean disjoint(org.opengis.geometry.TransfiniteSet pointSet)
This operator tests, whether an object is spatially disjoint with this Geometry object

Parameters:
pointSet - The other object
Returns:
TRUE, if the other object is disjoint with this object

equals

public boolean equals(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
equals in interface org.opengis.geometry.TransfiniteSet

touches

public boolean touches(org.opengis.geometry.TransfiniteSet pointSet)
This operator tests, whether an object touches this object in an edge or point

Parameters:
pointSet - The other object
Returns:
TRUE, if the other object touches this object

overlaps

public boolean overlaps(org.opengis.geometry.TransfiniteSet pointSet)
This operator tests, whether an object overlaps with this object. That is that a part of the object lies within this object and another part lies without this object, e.g. the other object intersects with the interior, boundary and exterior of this object

Parameters:
pointSet - The other object
Returns:
TRUE, if the other object overlaps with this object

crosses

public boolean crosses(org.opengis.geometry.TransfiniteSet pointSet)

union

public org.opengis.geometry.TransfiniteSet union(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
union in interface org.opengis.geometry.TransfiniteSet

intersection

public org.opengis.geometry.TransfiniteSet intersection(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
intersection in interface org.opengis.geometry.TransfiniteSet

difference

public org.opengis.geometry.TransfiniteSet difference(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
difference in interface org.opengis.geometry.TransfiniteSet

symmetricDifference

public org.opengis.geometry.TransfiniteSet symmetricDifference(org.opengis.geometry.TransfiniteSet pointSet)
Specified by:
symmetricDifference in interface org.opengis.geometry.TransfiniteSet

getClosure

public org.opengis.geometry.complex.Complex getClosure()
Specified by:
getClosure in interface org.opengis.geometry.Geometry

isCycle

public boolean isCycle()
Specified by:
isCycle in interface org.opengis.geometry.Geometry

castToGeometryImpl

protected static GeometryImpl castToGeometryImpl(org.opengis.geometry.Geometry g)
Use this function to cast Geometry instances to a GeometryImpl instance. In that way we can control the illegal injection of other instances at a central point.

Parameters:
g - Geometry instance
Returns:
Instance of Geometry Impl

castToGeometryImpl

protected static GeometryImpl castToGeometryImpl(org.opengis.geometry.TransfiniteSet tf)
Use this function to cast TransfiniteSet instances to a GeometryImpl instance. In that way we can control the illegal injection of other instances at a central point.

Parameters:
tf -
Returns:

getPositionFactory

protected org.opengis.geometry.PositionFactory getPositionFactory()


Copyright © 1996-2010 Geotools. All Rights Reserved.