Spatial DataBlade
JAVA API v8.21

com.ibm.spatial.geom
Class IfxPoint

java.lang.Object
  extended by com.ibm.spatial.geom.IfxGeometry
      extended by com.ibm.spatial.geom.IfxPoint
All Implemented Interfaces:
Geometry, Point, java.lang.Cloneable

public class IfxPoint
extends IfxGeometry
implements Point

An implementation of the Point interface, plus additional convenience methods.


Field Summary
 
Fields inherited from class com.ibm.spatial.geom.IfxGeometry
COORD_M, COORD_XY, COORD_Z
 
Method Summary
 int dimension()
          Returns the dimension of this geometry object.
 boolean equals(java.lang.Object anObject)
          Compares this IfxPoint to the specified object.
 java.lang.String geometryType()
          Gets the most appropriate OGC geometry interface type for this object.
 void getLabelPoint(CoordPoint point)
          Calculates a reasonable point location that can be used for labeling.
 boolean is3D()
          Tests whether or not this geometry object has three-dimensional coordinates.
 boolean isEmpty()
          Tests whether this geometry object is empty.
 boolean isMeasured()
          Tests whether or not this geometry object has measures.
 boolean isSimple()
          Tests whether this geometry object is simple (has no anomalous geometric points, such as self intersection or self tangency).
 double M()
          Returns the measure associated with this point.
 int numParts()
          Returns the number of parts of this object, that is 1 for a non-empty point and 0 for an empty point.
 int numPoints()
          Returns the number of points in this geometry.
 int numPoints(int part, int subPart)
          Returns the number of points in the specified part and subpart.
 int numSubParts(int part)
          Returns the number of subparts in the specified part.
 double ordAt(int index)
          Gets the coordinate specified by index n, where n=0 corresponds to x, n=1 to y, n=2 to z, and n=3 to m.
 int toCoordArray(double[] buf, int destOffset, int coordType, int srcOffset, int part, int subPart)
          This method overrides IfxGeometry#toCoordArray.
 CoordPoint toCoordPoint()
          Returns a CoordPoint object containing the coordinates of this point.
 void toCoordPoint(CoordPoint p)
          Fills in the CoordPoint argument with the coordinates of this point.
 int toPointArray(CoordPoint[] pointArray, int destOffset, int srcOffset, int part, int subPart)
          This method overrides IfxGeometry#toPointArray.
 double X()
          Returns the x coordinate of this point.
 double Y()
          Returns the y coordinate of this point.
 double Z()
          Returns the Z coordinate of this point.
 
Methods inherited from class com.ibm.spatial.geom.IfxGeometry
area, asBinary, asText, boundary, buffer, clone, contains, convexHull, crosses, difference, disjoint, distance, envelope, envelopesIntersect, extent, exterior, getCoordinateDimension, getDimensionality, getLabelPoint, getOGCType, interior, intersection, intersects, isValid, length, locateAlong, locateBetween, overlaps, perimeter, srid, symmetricDiff, toString, touches, union, within
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.spatial.geom.Geometry
asBinary, asText, boundary, buffer, contains, convexHull, crosses, difference, disjoint, distance, envelope, envelopesIntersect, extent, exterior, interior, intersection, intersects, isValid, locateAlong, locateBetween, overlaps, srid, symmetricDiff, touches, union, within
 

Method Detail

X

public double X()
Returns the x coordinate of this point.

Specified by:
X in interface Point
Returns:
the x coordinate of this point

Y

public double Y()
Returns the y coordinate of this point.

Specified by:
Y in interface Point
Returns:
the y coordinate of this point

ordAt

public double ordAt(int index)
Gets the coordinate specified by index n, where n=0 corresponds to x, n=1 to y, n=2 to z, and n=3 to m.

Specified by:
ordAt in interface Point
Parameters:
n - the measure value
Returns:
the corresponding coordinate value or java.lang.Double.NaN if this point doesn't have such a coordinate

dimension

public int dimension()

Returns the dimension of this geometry object. A geometry's dimension can be:

Specified by:
dimension in interface Geometry
Specified by:
dimension in class IfxGeometry
Returns:
The dimension of this geometry.

geometryType

public java.lang.String geometryType()
Gets the most appropriate OGC geometry interface type for this object.

Overrides:
geometryType in class IfxGeometry
Returns:
a string that identifies the OGC interface related to this geometry

isEmpty

public boolean isEmpty()
Tests whether this geometry object is empty.

Specified by:
isEmpty in interface Geometry
Overrides:
isEmpty in class IfxGeometry
Returns:
true if this geometry object is empty; otherwise, returns false

is3D

public boolean is3D()
Tests whether or not this geometry object has three-dimensional coordinates.

Specified by:
is3D in interface Geometry
Overrides:
is3D in class IfxGeometry
Returns:
true if this object has three-dimensional coordinates; otherwise, returns false

isMeasured

public boolean isMeasured()
Tests whether or not this geometry object has measures.

Specified by:
isMeasured in interface Geometry
Overrides:
isMeasured in class IfxGeometry
Returns:
true if this object has measures; otherwise, returns false

isSimple

public boolean isSimple()

Tests whether this geometry object is simple (has no anomalous geometric points, such as self intersection or self tangency).

For example, a LineString is simple if it does not intersect its interior. A MultiPoint is simple if none of its elements occupy the same coordinate space. A MultiLineString is simple if none of its element's interiors intersect.

Specified by:
isSimple in interface Geometry
Overrides:
isSimple in class IfxGeometry
Returns:
true if this geometry object is simple; otherwise, returns false

equals

public boolean equals(java.lang.Object anObject)
Compares this IfxPoint to the specified object. The result is true if and only if the argument is not null and is a IfxPoint object that represents the same sequence of coordinates as this object.

The coordinates are compared within the precision specified by this object's SRS.

Specified by:
equals in interface Geometry
Overrides:
equals in class IfxGeometry
Parameters:
anObject - the object to compare this IfxPoint against.
Returns:
true if the IfxPoints are equal; false otherwise.

numPoints

public int numPoints()
Returns the number of points in this geometry.

Specified by:
numPoints in interface Geometry
Specified by:
numPoints in class IfxGeometry
Returns:
the number of points in this geometry

getLabelPoint

public void getLabelPoint(CoordPoint point)
Calculates a reasonable point location that can be used for labeling.

Overrides:
getLabelPoint in class IfxGeometry
Parameters:
point - a CoordPoint object to be filled with the coordinates of the label point

M

public double M()
Returns the measure associated with this point.

Returns:
the measure associated with this point or java.lang.Double.NaN if this point is not "M-aware"

Z

public double Z()
Returns the Z coordinate of this point.

Returns:
the Z coordinate of this point or java.lang.Double.NaN if this point has no Z coordinate

toCoordPoint

public CoordPoint toCoordPoint()
Returns a CoordPoint object containing the coordinates of this point.

Returns:
the coordinates of this point in a CoordPoint object

toCoordPoint

public void toCoordPoint(CoordPoint p)
Fills in the CoordPoint argument with the coordinates of this point.


numParts

public int numParts()
Returns the number of parts of this object, that is 1 for a non-empty point and 0 for an empty point.

Specified by:
numParts in class IfxGeometry
Returns:
the number of parts

numSubParts

public int numSubParts(int part)
Returns the number of subparts in the specified part.

Specified by:
numSubParts in class IfxGeometry
Parameters:
part - part index
Returns:
the number of subparts in the specified part
Throws:
java.lang.IndexOutOfBoundsException - - for non-empty geometries, if the given part index is out of range (part < 0 || part >= numParts()).
See Also:
numParts()

numPoints

public int numPoints(int part,
                     int subPart)
Returns the number of points in the specified part and subpart.

Specified by:
numPoints in class IfxGeometry
Parameters:
part - part index
subPart - subpart index
Returns:
the number of points in the specified part and subpart
Throws:
java.lang.IndexOutOfBoundsException - - for non-empty geometries, if the given part and subpart indexes are out of range (part < 0 || part >= numParts()) || (subPart < 0 || subPart >= numSubParts(part)).
See Also:
numParts(), numSubParts(int)

toCoordArray

public int toCoordArray(double[] buf,
                        int destOffset,
                        int coordType,
                        int srcOffset,
                        int part,
                        int subPart)

This method overrides IfxGeometry#toCoordArray. It copies the coordinates out of the specified part and subpart of this point, starting with the position specified by index. The value of index is relative to the beginning of the current subpart.

The number of points read count is equal to the smaller of buf.length and numPoints(part, subpart)-index. If count is positive, then coordinates of the points starting with position index through index+count-1 are copied into buf. The value count is returned.

Note: because of its generality, this method incurs a significant overhead. For faster access to this point's coordinates, use X(), Y(), Z(), M().

Specified by:
toCoordArray in class IfxGeometry
Parameters:
buf - the array of double where point coordinates are returned. If buffer is null, an error is reported
bufOffset - the starting position in the destination buffer where coordinates are written
coordType - specifies which coordinates are returned. It may be any combination of the flag values COORD_XY, COORD_Z, and COORD_M. If coordType equals COORD_XY, the return sequence is: X,Y,X,Y,... If coordType equals IfxGeometry.COORD_XY | IfxGeometry.COORD_Z, then the return sequence is: X,Y,Z,X,Y,Z,... If coordType equals IfxGeometry.COORD_XY | IfxGeometry.COORD_Z | IfxGeometry.COORD_M, then the return sequence is: X,Y,Z,M,X,Y,Z,M...
srcOffset - the position of the first point whose coordinates are copied, relative to the beginning of the specified part and subpart - for a point, this should be 0
part - the current geometry part (see numParts); for a point, this should be 0
subPart - the current subpart (see numParts); for a point, this should be 0
Returns:
the number of points actually read from this object (possible values: 0 or 1)
Throws:
java.lang.IndexOutOfBoundsException - - if case of non-empty geometries, if an attempt is made to write past the destination array boundaries or the given part and subpart indexes are out of range (part < 0 || part >= numParts()) || (subPart < 0 || subPart >= numSubParts(part)).
See Also:
IfxGeometry.COORD_XY, IfxGeometry.COORD_Z, IfxGeometry.COORD_M

toPointArray

public int toPointArray(CoordPoint[] pointArray,
                        int destOffset,
                        int srcOffset,
                        int part,
                        int subPart)

This method overrides IfxGeometry#toPointArray. It copies up to count points from the specified part and subpart of this object, starting with the point at the position specified by index (relative to the current subpart beginning position), into pointArray.

The number of points read count is equal to the smaller of pointArray.length and numPoints(part, subpart)-index. If count is positive, then points starting with position index through index+count-1 are copied into buf. The value count is returned.

Note: because of its generality, this method incurs a significant overhead. For faster access to this point's coordinates, use X(), Y(), Z(), M().

Specified by:
toPointArray in class IfxGeometry
Parameters:
pointArray - the array of CoordPoints where point coordinates are copied into
destOffset - start position in the destination array pointArray
srcOffset - the position of the first point whose coordinates are returned, relative to the beginning of the specified part / subpart
part - the current geometry part (see numParts)
subPart - the current subpart (see numParts)
Returns:
the number of points actually read from this object
Throws:
java.lang.IndexOutOfBoundsException - - if case of non-empty geometries, if an attempt is made to write past the destination array boundaries or the given part and subpart indexes are out of range (part < 0 || part >= numParts()) || (subPart < 0 || subPart >= numSubParts(part)).

Spatial DataBlade
JAVA API v8.21


Licensed Materials - Property of IBM
Copyright IBM Corp. 2002, 2012 All Rights Reserved.