org.postgis
Class Point

java.lang.Object
  extended by org.postgis.Geometry
      extended by org.postgis.Point
All Implemented Interfaces:
java.io.Serializable

public class Point
extends Geometry

See Also:
Serialized Form

Field Summary
static boolean CUTINTS
           
 double m
          The measure of the point.
 double x
          The X coordinate of the point.
 double y
          The Y coordinate of the point.
 double z
          The Z coordinate of the point.
 
Fields inherited from class org.postgis.Geometry
ALLTYPES, dimension, GEOMETRYCOLLECTION, haveMeasure, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, POINT, POLYGON, srid, type, UNKNOWN_SRID
 
Constructor Summary
  Point()
           
  Point(double x, double y)
          Constructs a new Point
  Point(double x, double y, double z)
          Constructs a new Point
  Point(java.lang.String value)
          Construct a Point from EWKT.
protected Point(java.lang.String value, boolean haveM)
          Construct a Point
 
Method Summary
 boolean checkConsistency()
          Do some internal consistency checks on the geometry.
 double distance(Point other)
           
static boolean double_equals(double a, double b)
           
 boolean equals(Point other)
           
protected  boolean equalsintern(Geometry otherg)
          Whether test coordinates for geometry - subclass specific code Implementors can assume that dimensin, type, srid and haveMeasure are equal, other != null and other is the same subclass.
 Point getFirstPoint()
          Optimized versions for this special case
 Point getLastPoint()
          Optimized versions for this special case
 double getM()
           
 Point getPoint(int index)
          Get the nth Point of the geometry
 double getX()
           
 double getY()
           
 double getZ()
           
 int hashCode()
          java.lang.Object hashCode implementation
static int hashCode(double value)
           
 void innerWKT(java.lang.StringBuffer sb)
          Render the "inner" part of the WKT (inside the brackets) into the StringBuffer.
 int numPoints()
          Return the number of Points of the geometry
 void setM(double m)
           
 void setX(double x)
           
 void setX(int x)
           
 void setY(double y)
           
 void setY(int y)
           
 void setZ(double z)
           
 void setZ(int z)
           
 
Methods inherited from class org.postgis.Geometry
equals, equals, getDimension, getSrid, getType, getTypeString, getTypeString, getValue, initSRID, isMeasured, mediumWKT, outerWKT, outerWKT, parseSRID, setSrid, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CUTINTS

public static final boolean CUTINTS
See Also:
Constant Field Values

x

public double x
The X coordinate of the point. In most long/lat systems, this is the longitude.


y

public double y
The Y coordinate of the point. In most long/lat systems, this is the latitude.


z

public double z
The Z coordinate of the point. In most long/lat systems, this is a radius from the center of the earth, or the height / elevation over the ground.


m

public double m
The measure of the point.

Constructor Detail

Point

public Point()

Point

public Point(double x,
             double y,
             double z)
Constructs a new Point

Parameters:
x - the longitude / x ordinate
y - the latitude / y ordinate
z - the radius / height / elevation / z ordinate

Point

public Point(double x,
             double y)
Constructs a new Point

Parameters:
x - the longitude / x ordinate
y - the latitude / y ordinate

Point

public Point(java.lang.String value)
      throws java.sql.SQLException
Construct a Point from EWKT. (3D and measures are legal, but SRID is not allowed).

Throws:
java.sql.SQLException

Point

protected Point(java.lang.String value,
                boolean haveM)
         throws java.sql.SQLException
Construct a Point

Parameters:
value - The text representation of this point
haveM - Hint whether we have a measure. This is used by other geometries parsing inner points where we only get "1 2 3 4" like strings without the "POINT(" and ")" stuff. If there acutally is a POINTM prefix, this overrides the given value. However, POINT does not set it to false, as they can be contained in measured collections, as in "GEOMETRYCOLLECTIONM(POINT(0 0 0))".
Throws:
java.sql.SQLException
Method Detail

hashCode

public int hashCode()
Description copied from class: Geometry
java.lang.Object hashCode implementation

Overrides:
hashCode in class Geometry

hashCode

public static int hashCode(double value)

equalsintern

protected boolean equalsintern(Geometry otherg)
Description copied from class: Geometry
Whether test coordinates for geometry - subclass specific code Implementors can assume that dimensin, type, srid and haveMeasure are equal, other != null and other is the same subclass.

Specified by:
equalsintern in class Geometry

double_equals

public static boolean double_equals(double a,
                                    double b)

equals

public final boolean equals(Point other)

getPoint

public Point getPoint(int index)
Description copied from class: Geometry
Get the nth Point of the geometry

Specified by:
getPoint in class Geometry
Parameters:
index - the index of the point, from 0 to numPoints()-1;

getFirstPoint

public Point getFirstPoint()
Optimized versions for this special case

Specified by:
getFirstPoint in class Geometry

getLastPoint

public Point getLastPoint()
Optimized versions for this special case

Specified by:
getLastPoint in class Geometry

numPoints

public int numPoints()
Description copied from class: Geometry
Return the number of Points of the geometry

Specified by:
numPoints in class Geometry

innerWKT

public void innerWKT(java.lang.StringBuffer sb)
Description copied from class: Geometry
Render the "inner" part of the WKT (inside the brackets) into the StringBuffer.

Specified by:
innerWKT in class Geometry

getX

public double getX()

getY

public double getY()

getZ

public double getZ()

getM

public double getM()

setX

public void setX(double x)

setY

public void setY(double y)

setZ

public void setZ(double z)

setM

public void setM(double m)

setX

public void setX(int x)

setY

public void setY(int y)

setZ

public void setZ(int z)

distance

public double distance(Point other)

checkConsistency

public boolean checkConsistency()
Description copied from class: Geometry
Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as non-measured Points must have m=0.0. Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. BinaryWriter may produce invalid results on inconsistent geometries.

Overrides:
checkConsistency in class Geometry
Returns:
true if all checks are passed.