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

java.lang.Object
  extended by org.gvsig.fmap.geom.primitive.impl.AbstractPrimitive
      extended by org.gvsig.fmap.geom.primitive.impl.Point2D
All Implemented Interfaces:
Shape, Serializable, Comparable, DirectPosition, Geometry, FShape, Point, Primitive
Direct Known Subclasses:
Point2DZ

public class Point2D
extends AbstractPrimitive
implements Point, DirectPosition

2D point implementation.

Author:
Vicente Caballero Navarro, gvSIG team
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 static String COORDINATES_FIELD
           
 
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
Point2D(double x, double y)
           
Point2D(GeometryType geometryType)
          The constructor with the GeometryType like and argument is used by the GeometryType#create() to create the geometry
Point2D(int type, int subtype)
           
Point2D(Point2D point)
           
 
Method Summary
 FShape cloneFShape()
          Creates and returns a shape equal and independent of this one.
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double w, double h)
           
 boolean contains(Point2D p)
           
 boolean contains(Rectangle2D r)
           
 boolean equals(Object other)
           
 Rectangle getBounds()
           
 Rectangle2D getBounds2D()
          Returns this geometry's boundary rectangle.
 double getCoordinateAt(int dimension)
          Gets the coordinate in a concrete dimension
 double[] getCoordinates()
          Returns an array of coordinates.
 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.
 DirectPosition getDirectPosition()
          Gets the of a point, that is composed by a set of ordinates
 Envelope getEnvelope()
           Returns the minimum bounding box for this Geometry.
protected  String getFullTypeName()
           
 GeneralPathX getGeneralPath()
          Get GeneralPathIterator, to do registered operations to it.
 double getOrdinate(int dim)
          Returns the ordinate of the given dimension.
 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.
 Shape getShape(AffineTransform affineTransform)
           
 int getShapeType()
          Gets the geometry type of this shape.
 Handler[] getStretchingHandlers()
          Returns the handlers they utilized to stretch the geometries.
 double getX()
          Returns the X coordinate
 double getY()
          Returns the Y coordinate
 boolean intersects(double x, double y, double w, double h)
           
 boolean intersects(Rectangle2D r)
          Returns true if this geometry intersects the rectangle passed as parameter.
 void reProject(org.cresques.cts.ICoordTrans ct)
          Reprojects this geometry by the coordinate transformer passed as parameter.
 void setCoordinateAt(int dimension, double value)
          Sets a ordinate in a concrete dimension
 void setCoordinates(double[] values)
          Sets the point coordinates
 void setX(double x)
          Sets the X coordinate
 void setY(double y)
          Sets the Y coordinate
 String toString()
           
 void transform(AffineTransform at)
          Aplica la transformaciónn de la matriz de transformación que se pasa como parámetro.
 
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, fastIntersects, getGeometryType, getHandlers, getId, getInternalShape, getShape, getSRS, getType, intersection, intersects, intersectsRectangle, invokeOperation, invokeOperation, isSimple, moveGeom, overlaps, perimeter, rotateGeom, scaleGeom, 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, getType, intersection, intersects, invokeOperation, invokeOperation, isSimple, overlaps, perimeter, touches, union, within
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

COORDINATES_FIELD

protected static final String COORDINATES_FIELD
See Also:
Constant Field Values
Constructor Detail

Point2D

public Point2D(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

Point2D

public Point2D(double x,
               double y)

Point2D

public Point2D(int type,
               int subtype)

Point2D

public Point2D(Point2D point)
Method Detail

transform

public void transform(AffineTransform at)
Aplica la transformaciónn de la matriz de transformación que se pasa como parámetro.

Specified by:
transform in interface Geometry
Specified by:
transform in interface FShape
Parameters:
at - Matriz de transformación.
See Also:
AffineTransform

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

getX

public double getX()
Description copied from interface: Point
Returns the X coordinate

Specified by:
getX in interface Point
Returns:
The X coordinate

getY

public double getY()
Description copied from interface: Point
Returns the Y coordinate

Specified by:
getY in interface Point
Returns:
The Y coordinate

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)
Description copied from interface: Geometry
Returns true if this geometry intersects the rectangle passed as parameter.

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

getShape

public Shape getShape(AffineTransform affineTransform)
Specified by:
getShape in interface Geometry
Overrides:
getShape in class AbstractPrimitive
Returns:
the awt shape used to display the geometry. It applies a tranformation before to return the coordinates of the shape

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.

getShapeType

public int getShapeType()
Description copied from interface: FShape
Gets the geometry type of this shape.

Specified by:
getShapeType in interface FShape
Overrides:
getShapeType in class AbstractPrimitive
Returns:
int the geometry type of this shape.

cloneFShape

public FShape cloneFShape()
Description copied from interface: FShape
Creates and returns a shape equal and independent of this one.

Specified by:
cloneFShape in interface FShape
Returns:
the new shape.

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

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 DirectPosition
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.

getDirectPosition

public DirectPosition getDirectPosition()
Description copied from interface: Point
Gets the of a point, that is composed by a set of ordinates

Specified by:
getDirectPosition in interface Point
Returns:
The direct position

getOrdinate

public double getOrdinate(int dim)
Description copied from interface: DirectPosition
Returns the ordinate of the given dimension.

Specified by:
getOrdinate in interface DirectPosition
Parameters:
dim - The dimension to retrieve
Returns:
The value of the ordinate

equals

public boolean equals(Object other)
Overrides:
equals in class AbstractPrimitive

getCoordinates

public double[] getCoordinates()
Description copied from interface: Point
Returns an array of coordinates. Don't use the provided array to modify the point coordinates, but use the #setCoordinateAt(int, double)) , #setX(double)) or #setY(double)) methods instead.

Specified by:
getCoordinates in interface Point
Returns:
The point coordinates

getCoordinateAt

public double getCoordinateAt(int dimension)
Description copied from interface: Point
Gets the coordinate in a concrete dimension

Specified by:
getCoordinateAt in interface Point
Parameters:
dimension - The ordinate dimension
Returns:
The value of the ordinate

setCoordinateAt

public void setCoordinateAt(int dimension,
                            double value)
Description copied from interface: Point
Sets a ordinate in a concrete dimension

Specified by:
setCoordinateAt in interface Point
Parameters:
dimension - The dimension to set
value - The value to set

setCoordinates

public void setCoordinates(double[] values)
Description copied from interface: Point
Sets the point coordinates

Specified by:
setCoordinates in interface Point

setX

public void setX(double x)
Description copied from interface: Point
Sets the X coordinate

Specified by:
setX in interface Point
Parameters:
x - The value to set

setY

public void setY(double y)
Description copied from interface: Point
Sets the Y coordinate

Specified by:
setY in interface Point
Parameters:
y - The value to set

toString

public String toString()
Overrides:
toString in class AbstractPrimitive

getFullTypeName

protected String getFullTypeName()


Copyright © 2004-2012 gvSIG. All Rights Reserved.