org.gvsig.fmap.geom
Interface Geometry

All Superinterfaces:
Comparable, Serializable, Shape
All Known Subinterfaces:
Aggregate, Arc, Circle, Complex, Composite, CompositeCurve, CompositeSolid, CompositeSurface, CompositeSurface, Curve, Ellipse, EllipticArc, MultiCurve, MultiPoint, MultiPrimitive, MultiSolid, MultiSurface, NullGeometry, OrientableCurve, OrientablePrimitive, OrientableSurface, Point, Primitive, Solid, Spline, Surface
All Known Implementing Classes:
AbstractPrimitive, Arc2D, Arc2DZ, BaseMultiPrimitive, BaseMultiPrimitive2D, Circle2D, Circle2DZ, Curve2D, Curve2DZ, DefaultCurve, DefaultNullGeometry, Ellipse2D, Ellipse2DZ, EllipticArc2D, EllipticArc2DZ, Geometry2D, MultiCurve2D, MultiCurve2DZ, MultiPoint2D, MultiPoint2DZ, MultiSolid2DZ, MultiSurface2D, MultiSurface3D, OrientableCurve2D, OrientablePrimitive2D, OrientableSurface2D, Point2D, Point2DZ, Solid2DZ, Spline2D, Spline2DZ, Surface2D, Surface2DZ

public interface Geometry
extends Shape, Serializable, Comparable

This interface is equivalent to the GM_Object specified in ISO 19107. It is the root class of the geometric object taxonomy and supports interfaces common to all geographically referenced geometric objects.

Geometry instances are sets of direct positions in a particular coordinate reference system. A Geometry can be regarded as an infinite set of points that satisfies the set operation interfaces for a set of direct positions.

A geometric object shall be a combination of a coordinate geometry and a coordinate reference system. In all of the operations, all geometric calculations shall be done in the coordinate reference system of the first geometric object accessed, which is normally the object whose operation is being invoked. Returned objects shall be in the coordinate reference system in which the calculations are done unless explicitly stated otherwise.

This class extends of the Shape class by historical reasons but this inheritance will disappear in future versions.

See Also:
ISO 19107< /a>

Nested Class Summary
static interface Geometry.DIMENSIONS
           
static interface Geometry.OPERATIONS
           
static interface Geometry.SUBTYPES
          The subtype of a geometry is related with the dimension of the geometry, that is a combination between the spatial dimension (2D, 2ZD, 3D) and the M coordinate or "measure".
static interface Geometry.TYPES
          Predefined geometry types in the model.
 
Field Summary
static int BEST
           
static int E
          East.
static int EXTENDED_GEOMSUBTYPE_OFFSET
          Initial value for new geometry subtypes (it must not overlap with the basic ones defined in SUBTYPES).
static int EXTENDED_GEOMTYPE_OFFSET
          Initial value for new geometry types (it must not overlap with the basic ones defined in TYPES).
static int N
          North.
static int NE
          North - East.
static int NW
          North - West.
static int S
          South.
static int SE
          South - East.
static int SELECTHANDLER
           
static int STRETCHINGHANDLER
           
static int SW
          South - West.
static int W
          West.
 
Method Summary
 double area()
           
 Geometry buffer(double distance)
          Computes a buffer area around this geometry having the given width This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.BUFFER.
 Point centroid()
           
 Geometry cloneGeometry()
          Creates a clone of this geometry.
 boolean contains(Geometry geometry)
          Tests whether this geometry contains the specified geometry.
 byte[] convertToWKB()
          Return a byte array with the equivalent in WKB format of the Geometry.
 String convertToWKT()
          Return a string with the equivalent in WKT format of the Geometry.
 Geometry convexHull()
           
 boolean coveredBy(Geometry geometry)
           
 boolean crosses(Geometry geometry)
           
 Geometry difference(Geometry other)
           
 boolean disjoint(Geometry geometry)
           
 double distance(Geometry geometry)
          Returns the minimum distance between this Geometry and the specified geometry.
 boolean fastIntersects(double x, double y, double w, double h)
          Used by the drawing strategies to quickly test whether this geometry intersects with the visible rectangle.
 Rectangle2D getBounds2D()
          Deprecated. use getEnvelope.
 int getDimension()
          Returns the largest number n such that each direct position in a geometric set can be associated with a subset that has the direct position in its interior and is similar (isomorphic) to Rn, Euclidean n-space.
 Envelope getEnvelope()
           Returns the minimum bounding box for this Geometry.
 GeneralPathX getGeneralPath()
          Get GeneralPathIterator, to do registered operations to it.
 GeometryType getGeometryType()
          Instance of the GeometryType associated to this geometry.
 Handler[] getHandlers(int type)
          It returns the handlers of the geometry, these they can be of two types is straightening and of selection.
 Shape getInternalShape()
          Useful to have the real shape behind the scenes.
 PathIterator getPathIterator(AffineTransform at)
          If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.
 PathIterator getPathIterator(AffineTransform at, double flatness)
          If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.
 Shape getShape()
          Deprecated. this class inherits of Shape by historical reasons. This method has been added just to control the usage of the Shape class but it will removed in a future.
 Shape getShape(AffineTransform affineTransform)
          Deprecated. this class inherits of Shape by historical reasons. This method has been added just to control the usage of the Shape class but it will removed in a future.
 int getType()
          If this geometry is a predefined interface then this method returns one of Geometry.TYPES contants.
 Geometry intersection(Geometry other)
           
 boolean intersects(Geometry geometry)
           
 boolean intersects(Rectangle2D r)
          Returns true if this geometry intersects the rectangle passed as parameter.
 Object invokeOperation(int index, GeometryOperationContext ctx)
          Invokes a geometry operation given its index and context.
 Object invokeOperation(String opName, GeometryOperationContext ctx)
          Invokes a geometry operation given its name and context.
 boolean isSimple()
          Returns true if this Geometry has no interior point of self-intersection or self-tangency.
 boolean overlaps(Geometry geometry)
          Tests whether this geometry overlaps the specified geometry.
 double perimeter()
           
 void reProject(org.cresques.cts.ICoordTrans ct)
          Reprojects this geometry by the coordinate transformer passed as parameter.
 boolean touches(Geometry geometry)
           
 void transform(AffineTransform at)
          It applies an affine transformation to the geometry.
 Geometry union(Geometry other)
           
 boolean within(Geometry geometry)
           
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getBounds, intersects
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

EXTENDED_GEOMTYPE_OFFSET

static final int EXTENDED_GEOMTYPE_OFFSET
Initial value for new geometry types (it must not overlap with the basic ones defined in TYPES).

See Also:
Constant Field Values

EXTENDED_GEOMSUBTYPE_OFFSET

static final int EXTENDED_GEOMSUBTYPE_OFFSET
Initial value for new geometry subtypes (it must not overlap with the basic ones defined in SUBTYPES).

See Also:
Constant Field Values

BEST

static final int BEST
See Also:
Constant Field Values

N

static final int N
North.

See Also:
Constant Field Values

NE

static final int NE
North - East.

See Also:
Constant Field Values

E

static final int E
East.

See Also:
Constant Field Values

SE

static final int SE
South - East.

See Also:
Constant Field Values

S

static final int S
South.

See Also:
Constant Field Values

SW

static final int SW
South - West.

See Also:
Constant Field Values

W

static final int W
West.

See Also:
Constant Field Values

NW

static final int NW
North - West.

See Also:
Constant Field Values

SELECTHANDLER

static final int SELECTHANDLER
See Also:
Constant Field Values

STRETCHINGHANDLER

static final int STRETCHINGHANDLER
See Also:
Constant Field Values
Method Detail

getType

int getType()
If this geometry is a predefined interface then this method returns one of Geometry.TYPES contants.
If this geometry is an extended type then this method returns a runtime constant that identifies its type. By convention this value is stored in a constant called .CODE within the geometry class, for instance: Point2D.CODE.

Returns:
If this geometry is a predefined interface then one of Geometry.TYPES or a runtime constant if it is an extended type.

cloneGeometry

Geometry cloneGeometry()
Creates a clone of this geometry.

Returns:
A clone of this geometry.

intersects

boolean intersects(Rectangle2D r)
Returns true if this geometry intersects the rectangle passed as parameter.

Specified by:
intersects in interface Shape
Parameters:
r - Rectangle.
Returns:
True, if this intersects r.

fastIntersects

boolean fastIntersects(double x,
                       double y,
                       double w,
                       double h)
Used by the drawing strategies to quickly test whether this geometry intersects with the visible rectangle.

Parameters:
x - The minimum X coordinate.
y - The minimum Y coordinate.
w - The width of the envelope.
h - The height of the envelope.
Returns:
true if this intersects the rectangle defined by the parameters.

getBounds2D

Rectangle2D getBounds2D()
Deprecated. use getEnvelope.

Returns this geometry's boundary rectangle.

Specified by:
getBounds2D in interface Shape
Returns:
Boundary rectangle.

getEnvelope

Envelope getEnvelope()

Returns the minimum bounding box for this Geometry. This shall be the coordinate region spanning the minimum and maximum value for each ordinate taken on by DirectPositions in this Geometry. The simplest representation for an envelope consists of two DirectPositions, the first one containing all the minimums for each ordinate, and second one containing all the maximums.

Returns:
The minimum bounding box for this Geometry.

reProject

void reProject(org.cresques.cts.ICoordTrans ct)
Reprojects this geometry by the coordinate transformer passed as parameter.

Parameters:
ct - Coordinate Transformer.

getPathIterator

PathIterator getPathIterator(AffineTransform at)
If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.

Specified by:
getPathIterator in interface Shape
Parameters:
at - The transformation to apply.
Returns:
The GeneralPathXIterator with this geometry's information.

getHandlers

Handler[] getHandlers(int type)
It returns the handlers of the geometry, these they can be of two types is straightening and of selection.

Parameters:
type - Type of handlers.
Returns:
The handlers.

transform

void transform(AffineTransform at)
It applies an affine transformation to the geometry.

Parameters:
at - The transformation to apply.

getPathIterator

PathIterator getPathIterator(AffineTransform at,
                             double flatness)
If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.

Specified by:
getPathIterator in interface Shape
Parameters:
at - The affine transformation.
flatness -
Returns:
The GeneralPathXIterator with this geometry's information.

getInternalShape

Shape getInternalShape()
Useful to have the real shape behind the scenes. May be uses to edit it knowing it it is a Circle, Ellipse, etc.

Returns:
The awt shape

getDimension

int getDimension()
Returns the largest number n such that each direct position in a geometric set can be associated with a subset that has the direct position in its interior and is similar (isomorphic) to Rn, Euclidean n-space.

Returns:
The dimension.

isSimple

boolean isSimple()
Returns true if this Geometry has no interior point of self-intersection or self-tangency. In mathematical formalisms, this means that every point in the interior of the object must have a metric neighborhood whose intersection with the object is isomorphic to an n-sphere, where n is the dimension of this Geometry.

Returns:
If the geometry is simple.

invokeOperation

Object invokeOperation(int index,
                       GeometryOperationContext ctx)
                       throws GeometryOperationNotSupportedException,
                              GeometryOperationException
Invokes a geometry operation given its index and context.

Parameters:
index - Unique index of the operation. Operation code.
ctx - The context of the geometry operation.
Returns:
Object returned by the operation.
Throws:
GeometryOperationNotSupportedException - It is thrown when the operation has been not registered for this geometry.
GeometryOperationException - It is thrown when there is an error executing the operation.

invokeOperation

Object invokeOperation(String opName,
                       GeometryOperationContext ctx)
                       throws GeometryOperationNotSupportedException,
                              GeometryOperationException
Invokes a geometry operation given its name and context.

Parameters:
opName - Operation name.
ctx - The context of the geometry operation.
Returns:
Object returned by the operation.
Throws:
GeometryOperationNotSupportedException - It is thrown when the operation has been not registered for this geometry.
GeometryOperationException - It is thrown when there is an error executing the operation.

getGeometryType

GeometryType getGeometryType()
Instance of the GeometryType associated to this geometry.

Returns:
The geometry type.

getGeneralPath

GeneralPathX getGeneralPath()
Get GeneralPathIterator, to do registered operations to it.

Returns:
The GeneralPathX.

convertToWKB

byte[] convertToWKB()
                    throws GeometryOperationNotSupportedException,
                           GeometryOperationException
Return a byte array with the equivalent in WKB format of the Geometry. Utility method to wrap the invocation to the operation Geometry.OPERATIONS.CONVERTTOWKB.

Returns:
the WKB version of the geometry
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

convertToWKT

String convertToWKT()
                    throws GeometryOperationNotSupportedException,
                           GeometryOperationException
Return a string with the equivalent in WKT format of the Geometry. This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.CONVERTTOWKT.

Returns:
the WKT version of the geometry.
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

buffer

Geometry buffer(double distance)
                throws GeometryOperationNotSupportedException,
                       GeometryOperationException
Computes a buffer area around this geometry having the given width This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.BUFFER.

Parameters:
distance - the width of the buffer
Returns:
a new Geometry with the computed buffer.
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

contains

boolean contains(Geometry geometry)
                 throws GeometryOperationNotSupportedException,
                        GeometryOperationException
Tests whether this geometry contains the specified geometry. This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.CONTAINS.

Parameters:
geometry - the Geometry with which to compare this Geometry
Returns:
if this Geometry contains the specified geometry
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

distance

double distance(Geometry geometry)
                throws GeometryOperationNotSupportedException,
                       GeometryOperationException
Returns the minimum distance between this Geometry and the specified geometry. This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.DISTANCE.

Parameters:
geometry - the Geometry from which to compute the distance
Returns:
the distance between the geometries
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

overlaps

boolean overlaps(Geometry geometry)
                 throws GeometryOperationNotSupportedException,
                        GeometryOperationException
Tests whether this geometry overlaps the specified geometry. This is a utility method to wrap the invocation to the operation Geometry.OPERATIONS.OVERLAPS.

Parameters:
geometry - the Geometry with which to compare this Geometry
Returns:
true if the two geometries overlap.
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

convexHull

Geometry convexHull()
                    throws GeometryOperationNotSupportedException,
                           GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

coveredBy

boolean coveredBy(Geometry geometry)
                  throws GeometryOperationNotSupportedException,
                         GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

crosses

boolean crosses(Geometry geometry)
                throws GeometryOperationNotSupportedException,
                       GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

difference

Geometry difference(Geometry other)
                    throws GeometryOperationNotSupportedException,
                           GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

disjoint

boolean disjoint(Geometry geometry)
                 throws GeometryOperationNotSupportedException,
                        GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

intersection

Geometry intersection(Geometry other)
                      throws GeometryOperationNotSupportedException,
                             GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

intersects

boolean intersects(Geometry geometry)
                   throws GeometryOperationNotSupportedException,
                          GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

touches

boolean touches(Geometry geometry)
                throws GeometryOperationNotSupportedException,
                       GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

union

Geometry union(Geometry other)
               throws GeometryOperationNotSupportedException,
                      GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

within

boolean within(Geometry geometry)
               throws GeometryOperationNotSupportedException,
                      GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

centroid

Point centroid()
               throws GeometryOperationNotSupportedException,
                      GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

area

double area()
            throws GeometryOperationNotSupportedException,
                   GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

perimeter

double perimeter()
                 throws GeometryOperationNotSupportedException,
                        GeometryOperationException
Throws:
GeometryOperationNotSupportedException
GeometryOperationException

getShape

Shape getShape(AffineTransform affineTransform)
Deprecated. this class inherits of Shape by historical reasons. This method has been added just to control the usage of the Shape class but it will removed in a future.

Returns:
the awt shape used to display the geometry. It applies a tranformation before to return the coordinates of the shape

getShape

Shape getShape()
Deprecated. this class inherits of Shape by historical reasons. This method has been added just to control the usage of the Shape class but it will removed in a future.

Returns:
the awt shape used to display the geometry.


Copyright © 2004-2012 gvSIG. All Rights Reserved.