org.geotools.renderer.geom
Class Point

java.lang.Object
  extended byorg.geotools.renderer.geom.Geometry
      extended byorg.geotools.renderer.geom.Point
All Implemented Interfaces:
java.lang.Cloneable, org.opengis.util.Cloneable, java.io.Serializable, java.awt.Shape

public class Point
extends Geometry

A wrapper around a single JTS Coordinate object to adapt it to the the Geometry hierarchy.

Version:
$Id: Point.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Andrea Aime
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.geotools.renderer.geom.Geometry
DEFAULT_COORDINATE_SYSTEM
 
Constructor Summary
Point(com.vividsolutions.jts.geom.Coordinate coord, CoordinateSystem cs)
          Creates a new instance of Point.
Point(com.vividsolutions.jts.geom.Coordinate coord, CoordinateTransformation ct)
          Creates a new instance of Point
 
Method Summary
 float compress(CompressionLevel level)
          Point compression is not supported as it makes no sense for points.
 boolean contains(java.awt.geom.Point2D p)
          This method returns true if p has the same coordinates as this object, false otherwise.
 boolean contains(java.awt.Shape shape)
          This method returns true if the shape is another Point object with the same coordinates, false otherwise.
 java.awt.geom.Rectangle2D getBounds2D()
          Returns the bounds of this points, that is, an immutable and empty rectangle centered on the current coordinates.
 CoordinateSystem getCoordinateSystem()
          Returns the polyline's coordinate system, or null if unknown.
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
          Returns a path iterator for this point.
 int getPointCount()
          Returns the number of coordinates contained in this geometry, as such, the result will always be 1
 Statistics getResolution()
          Implemented for compatibility, but it makes no sense to compute resolution for a single point
 float getX()
          Returns the x coordinate of the point, projected to the new coordinate system if the user has specified an non identity CoordinateTransform
 float getY()
          Returns the y coordinate of the point, projected to the new coordinate system if the user has specified an non identity CoordinateTransform
 boolean intersects(java.awt.Shape shape)
          Returns true if the shape contains the point
 boolean isFrozen()
          Always returns false, the point will never be frozen
 void setCoordinateSystem(CoordinateSystem coordinateSystem)
          Sets the polyline's coordinate system.
 void setResolution(double resolution)
          Emtpy method, provided for compatibility with base class.
 
Methods inherited from class org.geotools.renderer.geom.Geometry
clip, clone, contains, contains, contains, equals, getBounds, getID, getName, getPathIterator, getRenderingResolution, getStyle, getUserObject, hashCode, intersects, intersects, isEmpty, setID, setRenderingResolution, setStyle, setUserObject, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point

public Point(com.vividsolutions.jts.geom.Coordinate coord,
             CoordinateTransformation ct)
Creates a new instance of Point

Parameters:
coord - The point coordinates
ct - The coordinate transformation to be applied to the coordinates (which are supposed to be unprojected)

Point

public Point(com.vividsolutions.jts.geom.Coordinate coord,
             CoordinateSystem cs)
Creates a new instance of Point. An identity coordinate transformation will be created trasparently.

Parameters:
coord - The point coordinates
cs - The source coordinate system.
Method Detail

compress

public float compress(CompressionLevel level)
Point compression is not supported as it makes no sense for points.

Specified by:
compress in class Geometry
Parameters:
level - The compression level (or algorithm) to use. See the CompressionLevel javadoc for an explanation of available algorithms.
Returns:
A estimation of the compression rate. Will always be 1.0 since no compression is operated

contains

public boolean contains(java.awt.Shape shape)
This method returns true if the shape is another Point object with the same coordinates, false otherwise. The point's coordinates must be expressed according to the current coordinate system, that is getCoordinateSystem().

Specified by:
contains in class Geometry

contains

public boolean contains(java.awt.geom.Point2D p)
This method returns true if p has the same coordinates as this object, false otherwise. The point p coordinates must be expressed according to the current coordinate system, that is getCoordinateSystem().

Specified by:
contains in interface java.awt.Shape
Specified by:
contains in class Geometry
Parameters:
p - the specified point in this geometry coordinate system.
Returns:
true if the specified point is inside the geometry boundary; false otherwise.

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns the bounds of this points, that is, an immutable and empty rectangle centered on the current coordinates. Point reprojection will change rectangle coordinates too.

Specified by:
getBounds2D in interface java.awt.Shape
Specified by:
getBounds2D in class Geometry
Returns:
The bounding box of this geometry.

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Returns a path iterator for this point.

Specified by:
getPathIterator in interface java.awt.Shape
Specified by:
getPathIterator in class Geometry

getPointCount

public int getPointCount()
Returns the number of coordinates contained in this geometry, as such, the result will always be 1

Specified by:
getPointCount in class Geometry

getResolution

public Statistics getResolution()
Implemented for compatibility, but it makes no sense to compute resolution for a single point

Specified by:
getResolution in class Geometry
Returns:
Statistics about the resolution, or null if this geometry doesn't contains any point. If non-null, the statistics object contains minimum, maximum, mean, root mean square and standard deviation always in linear units.

intersects

public boolean intersects(java.awt.Shape shape)
Returns true if the shape contains the point

Specified by:
intersects in class Geometry

setResolution

public void setResolution(double resolution)
                   throws org.opengis.referencing.operation.TransformException,
                          UnmodifiableGeometryException
Emtpy method, provided for compatibility with base class.

Specified by:
setResolution in class Geometry
Parameters:
resolution - Desired resolution, in the same linear units than Geometry.getResolution().
Throws:
UnmodifiableGeometryException - if modifying this geometry would corrupt a container. To avoid this exception, clone this geometry before to modify it.
org.opengis.referencing.operation.TransformException - If some coordinate transformations were needed and failed. There is no guaranteed on geometry's state in case of failure.

getX

public float getX()
Returns the x coordinate of the point, projected to the new coordinate system if the user has specified an non identity CoordinateTransform


getY

public float getY()
Returns the y coordinate of the point, projected to the new coordinate system if the user has specified an non identity CoordinateTransform


isFrozen

public boolean isFrozen()
Always returns false, the point will never be frozen

See Also:
Geometry#isFrozen()

getCoordinateSystem

public CoordinateSystem getCoordinateSystem()
Returns the polyline's coordinate system, or null if unknown.

Specified by:
getCoordinateSystem in class Geometry

setCoordinateSystem

public void setCoordinateSystem(CoordinateSystem coordinateSystem)
                         throws org.opengis.referencing.operation.TransformException,
                                UnmodifiableGeometryException
Sets the polyline's coordinate system. Calling this method is equivalent to reprojecting all polyline's points from the old coordinate system to the new one.

Specified by:
setCoordinateSystem in class Geometry
Parameters:
coordinateSystem - The new coordinate system. A null value resets the coordinate system given at construction time.
Throws:
org.opengis.referencing.operation.TransformException - If a transformation failed. In case of failure, the state of this object will stay unchanged (as if this method has never been invoked).
UnmodifiableGeometryException - if modifying this geometry would corrupt a container. To avoid this exception, this geometry before to modify it.


Copyright © GeoTools. All Rights Reserved.