org.gvsig.fmap.geom.primitive.impl
Class OrientablePrimitive2D

java.lang.Object
  extended by org.gvsig.fmap.geom.primitive.impl.AbstractPrimitive
      extended by org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D
All Implemented Interfaces:
Shape, Serializable, Comparable, Geometry, FShape, OrientablePrimitive, Primitive
Direct Known Subclasses:
OrientableCurve2D, OrientableSurface2D

public abstract class OrientablePrimitive2D
extends AbstractPrimitive
implements OrientablePrimitive

Author:
Jorge Piera Llodrá (jorge.piera@iver.es)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gvsig.fmap.geom.Geometry
Geometry.DIMENSIONS, Geometry.OPERATIONS, Geometry.SUBTYPES, Geometry.TYPES
 
Field Summary
protected  GeneralPathX gp
           
 
Fields inherited from class org.gvsig.fmap.geom.primitive.impl.AbstractPrimitive
geometryType, geomManager, id, projection
 
Fields inherited from interface org.gvsig.fmap.geom.Geometry
BEST, E, EXTENDED_GEOMSUBTYPE_OFFSET, EXTENDED_GEOMTYPE_OFFSET, N, NE, NW, S, SE, SELECTHANDLER, STRETCHINGHANDLER, SW, W
 
Constructor Summary
OrientablePrimitive2D(GeometryType geometryType)
          The constructor with the GeometryType like and argument is used by the GeometryType#create() to create the geometry
OrientablePrimitive2D(GeometryType geometryType, String id, org.cresques.cts.IProjection projection, GeneralPathX gp)
           
 
Method Summary
 void addMoveToVertex(Point point)
          Adds a vertex (or direct position) to the curve
 void addVertex(Point point)
          Adds a vertex (or direct position) to the curve
 void addVertexes(List vertexes)
          Adds a list of vertexes (or direct positions) to the curve
 void closePrimitive()
          Closes the geometry
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double w, double h)
           
 boolean contains(Point2D p)
           
 boolean contains(Rectangle2D r)
           
 Rectangle getBounds()
           
 Rectangle2D getBounds2D()
          Returns this geometry's boundary rectangle.
 double getCoordinateAt(int index, int dimension)
          Gets the one of the values of a coordinate (direct position) in a concrete dimension.
 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.
 GeneralPathX getGeneralPathX()
          TODO método creado para dar visibilidad a gp despues de la refactorización
 int getNumVertices()
          Gets the number of vertices (direct positions) of the curve
 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.
 Handler[] getSelectHandlers()
          Returns the handlers used to select the geometries.
 Handler[] getStretchingHandlers()
          Returns the handlers they utilized to stretch the geometries.
 Point getVertex(int index)
          Gets a vertex (direct position)
 void insertVertex(int index, Point p)
          Inserts a vertex (direct position) to the curve.
 boolean intersects(double x, double y, double w, double h)
           
 boolean intersects(Rectangle2D r)
          El m�todo intersects de java.awt.Shape que define la intersecci�n entre una polil�nea y un Rectangle2D considera la polil�nea como un Shape gen�rico y se producen errores en la selecci�n de polil�neas.
 void removeVertex(int index)
          Remove a vertex (direct position) to the curve
 void reProject(org.cresques.cts.ICoordTrans ct)
          Reprojects this geometry by the coordinate transformer passed as parameter.
 void setCoordinateAt(int index, int dimension, double value)
          Sets the value of a coordinate (direct position) in a concrete dimension
 void setGeneralPath(GeneralPathX generalPathX)
          Sets all the coordinates of the curve
 void setPoints(Point startPoint, Point endPoint)
           
 void setVertex(int index, Point p)
          Sets a vertex in a concrete position and replaces the previous one that was in this position.
 void transform(AffineTransform at)
          DOCUMENT ME!
 
Methods inherited from class org.gvsig.fmap.geom.primitive.impl.AbstractPrimitive
area, buffer, centroid, cloneGeometry, compareTo, contains, containsPoint, containsRectangle, convertToWKB, convertToWKT, convexHull, coveredBy, crosses, difference, disjoint, distance, equals, fastIntersects, getGeometryType, getHandlers, getId, getInternalShape, getShape, getShape, getShapeType, getSRS, getType, intersection, intersects, intersectsRectangle, invokeOperation, invokeOperation, isSimple, moveGeom, overlaps, perimeter, rotateGeom, scaleGeom, toString, touches, transform, union, within
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.gvsig.fmap.geom.Geometry
area, buffer, centroid, cloneGeometry, contains, convertToWKB, convertToWKT, convexHull, coveredBy, crosses, difference, disjoint, distance, fastIntersects, getGeometryType, getHandlers, getInternalShape, getShape, getShape, getType, intersection, intersects, invokeOperation, invokeOperation, isSimple, overlaps, perimeter, touches, union, within
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.gvsig.fmap.geom.primitive.FShape
cloneFShape
 

Field Detail

gp

protected GeneralPathX gp
Constructor Detail

OrientablePrimitive2D

public OrientablePrimitive2D(GeometryType geometryType)
The constructor with the GeometryType like and argument is used by the GeometryType#create() to create the geometry

Parameters:
type - The geometry type

OrientablePrimitive2D

public OrientablePrimitive2D(GeometryType geometryType,
                             String id,
                             org.cresques.cts.IProjection projection,
                             GeneralPathX gp)
Method Detail

getGeneralPathX

public GeneralPathX getGeneralPathX()
TODO método creado para dar visibilidad a gp despues de la refactorización

Returns:

contains

public boolean contains(double x,
                        double y)
Specified by:
contains in interface Shape

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Specified by:
contains in interface Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Specified by:
intersects in interface Shape

getBounds

public Rectangle getBounds()
Specified by:
getBounds in interface Shape

contains

public boolean contains(Point2D p)
Specified by:
contains in interface Shape

getBounds2D

public Rectangle2D getBounds2D()
Description copied from interface: Geometry
Returns this geometry's boundary rectangle.

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

contains

public boolean contains(Rectangle2D r)
Specified by:
contains in interface Shape

intersects

public boolean intersects(Rectangle2D r)
El m�todo intersects de java.awt.Shape que define la intersecci�n entre una polil�nea y un Rectangle2D considera la polil�nea como un Shape gen�rico y se producen errores en la selecci�n de polil�neas. Por este motivo se ha modificado este m�todo intersect() de FPolyline2D para que realize la intersecci�n estricta entre el Rectangle2D y la polil�nea en cuesti�n. El precio es un incremento de tiempo m�ximo del 50%.

Specified by:
intersects in interface Shape
Specified by:
intersects in interface Geometry
Parameters:
r - Rect�ngulo.
Returns:
True si intersecta con el rectangulo que se pasa como par�metro.

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Description copied from interface: Geometry
If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.

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

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Description copied from interface: Geometry
If applies an affine transformation and returns the GeneralPathXIterator with this geometry's information.

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

transform

public void transform(AffineTransform at)
DOCUMENT ME!

Specified by:
transform in interface Geometry
Specified by:
transform in interface FShape
Parameters:
at - DOCUMENT ME!
See Also:
AffineTransform

reProject

public void reProject(org.cresques.cts.ICoordTrans ct)
Description copied from interface: Geometry
Reprojects this geometry by the coordinate transformer passed as parameter.

Specified by:
reProject in interface Geometry
Specified by:
reProject in interface FShape
Parameters:
ct - Coordinate Transformer.

getStretchingHandlers

public Handler[] getStretchingHandlers()
Description copied from interface: FShape
Returns the handlers they utilized to stretch the geometries.

Specified by:
getStretchingHandlers in interface FShape
Returns:
Handlers the handlers used to stretch the geometries

getCoordinateAt

public double getCoordinateAt(int index,
                              int dimension)
Description copied from interface: OrientablePrimitive
Gets the one of the values of a coordinate (direct position) in a concrete dimension.

Specified by:
getCoordinateAt in interface OrientablePrimitive
Parameters:
index - The index of the direct position to set.
dimension - The dimension of the direct position.
Returns:
The value of the coordinate

getSelectHandlers

public Handler[] getSelectHandlers()
Description copied from interface: FShape
Returns the handlers used to select the geometries.

Specified by:
getSelectHandlers in interface FShape
Returns:
Handlers the handlers used to select the geometries

getDimension

public int getDimension()
Description copied from interface: Geometry
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.

Specified by:
getDimension in interface Geometry
Returns:
The dimension.

getEnvelope

public Envelope getEnvelope()
Description copied from interface: Geometry

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.

Specified by:
getEnvelope in interface Geometry
Returns:
The minimum bounding box for this Geometry.

getGeneralPath

public GeneralPathX getGeneralPath()
Description copied from interface: Geometry
Get GeneralPathIterator, to do registered operations to it.

Specified by:
getGeneralPath in interface Geometry
Returns:
The GeneralPathX.

getNumVertices

public int getNumVertices()
Description copied from interface: OrientablePrimitive
Gets the number of vertices (direct positions) of the curve

Specified by:
getNumVertices in interface OrientablePrimitive
Returns:
The number of vertices

addVertex

public void addVertex(Point point)
Description copied from interface: OrientablePrimitive
Adds a vertex (or direct position) to the curve

Specified by:
addVertex in interface OrientablePrimitive
Parameters:
point - The new point to add

addVertexes

public void addVertexes(List vertexes)
Description copied from interface: OrientablePrimitive
Adds a list of vertexes (or direct positions) to the curve

Specified by:
addVertexes in interface OrientablePrimitive
Parameters:
vertexes - The new points to add

addMoveToVertex

public void addMoveToVertex(Point point)
Description copied from interface: OrientablePrimitive
Adds a vertex (or direct position) to the curve

Specified by:
addMoveToVertex in interface OrientablePrimitive
Parameters:
point - The new point to add

closePrimitive

public void closePrimitive()
Description copied from interface: OrientablePrimitive
Closes the geometry

Specified by:
closePrimitive in interface OrientablePrimitive

setVertex

public void setVertex(int index,
                      Point p)
Description copied from interface: OrientablePrimitive
Sets a vertex in a concrete position and replaces the previous one that was in this position.

Specified by:
setVertex in interface OrientablePrimitive
Parameters:
index - The index of the vertex where the new point has to be replaced.
p - The vertex to set.

getVertex

public Point getVertex(int index)
Description copied from interface: OrientablePrimitive
Gets a vertex (direct position)

Specified by:
getVertex in interface OrientablePrimitive
Parameters:
index - The index of the vertex to get
Returns:
One point

insertVertex

public void insertVertex(int index,
                         Point p)
Description copied from interface: OrientablePrimitive
Inserts a vertex (direct position) to the curve.

Specified by:
insertVertex in interface OrientablePrimitive
Parameters:
index - The index of the vertex where the new point has to be added.
p - The vertex to add.

removeVertex

public void removeVertex(int index)
Description copied from interface: OrientablePrimitive
Remove a vertex (direct position) to the curve

Specified by:
removeVertex in interface OrientablePrimitive
Parameters:
index - The index of the vertex to remove

setCoordinateAt

public void setCoordinateAt(int index,
                            int dimension,
                            double value)
Description copied from interface: OrientablePrimitive
Sets the value of a coordinate (direct position) in a concrete dimension

Specified by:
setCoordinateAt in interface OrientablePrimitive
Parameters:
index - The index of the direct position to set
dimension - The dimension of the direct position
value - The value to set

setGeneralPath

public void setGeneralPath(GeneralPathX generalPathX)
Description copied from interface: OrientablePrimitive
Sets all the coordinates of the curve

Specified by:
setGeneralPath in interface OrientablePrimitive
Parameters:
generalPathX - The generalPath that contains all the coordinates

setPoints

public void setPoints(Point startPoint,
                      Point endPoint)


Copyright © 2004-2012 gvSIG. All Rights Reserved.