|
Spatial DataBlade JAVA API v8.21 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.spatial.geom.IfxGeometry
public abstract class IfxGeometry
IfxGeometry partially implements the Geometry interface. Several convenience methods for retrieving coordinate data are also implemented in this class.
IfxGeometry is the root class of a geometry objects hierarchy. It is an abstract class.
Field Summary | |
---|---|
static int |
COORD_M
M values are copied into the destination buffer. |
static int |
COORD_XY
X and Y coordinates are copied into the destination buffer. |
static int |
COORD_Z
Z coordinates are copied into the destination buffer. |
Method Summary | |
---|---|
double |
area()
Returns the area of this object, as measured in the spatial reference system of this object. |
java.io.ByteArrayOutputStream |
asBinary()
Exports this geometry to a specific well-known binary representation. |
java.lang.String |
asText()
Exports this geometry to a specific well-known text representation. |
Geometry |
boundary()
This implementation throws UnsupportedOperationException. |
Geometry |
buffer(double distance)
This implementation throws UnsupportedOperationException. |
java.lang.Object |
clone()
Return a copy of this object. |
boolean |
contains(Geometry geometry)
Returns whether or not this object completely contains the geometry argument. |
Geometry |
convexHull()
This implementation throws UnsupportedOperationException. |
boolean |
crosses(Geometry geometry)
This implementation throws UnsupportedOperationException. |
Geometry |
difference(Geometry geometry)
This implementation throws UnsupportedOperationException. |
abstract int |
dimension()
Returns the dimension of this geometry object. |
boolean |
disjoint(Geometry geometry)
This implementation throws UnsupportedOperationException. |
double |
distance(Geometry geometry)
This implementation throws UnsupportedOperationException. |
Geometry |
envelope()
Returns a Geometry that represents this object's envelope. |
boolean |
envelopesIntersect(Geometry geometry)
Returns true if the envelope of this geometry object intersects the envelope of the argument. |
boolean |
equals(java.lang.Object anObject)
Compares this IfxGeometry to the specified object. |
Envelope |
extent()
Returns an Envelope object that represents this geometry's envelope. |
Geometry |
exterior()
This implementation throws UnsupportedOperationException. |
java.lang.String |
geometryType()
Gets the most appropriate OGC geometry interface type for this object. |
int |
getCoordinateDimension()
Gets the dimension of the coordinates that define this geometry, which must be the same as the coordinate dimension of the spatial reference system for this geometry. |
int |
getDimensionality()
Gets the dimensionality of this geometry, which might be different from the coordinate dimension of the spatial reference system for this geometry. |
CoordPoint |
getLabelPoint()
Returns a label point for this geometry. |
void |
getLabelPoint(CoordPoint point)
Returns a label point for this geometry. |
java.lang.Class |
getOGCType()
Gets the most appropriate OGC geometry interface type for this object. |
Geometry |
interior()
This implementation throws UnsupportedOperationException. |
Geometry |
intersection(Geometry geometry)
This implementation throws UnsupportedOperationException. |
boolean |
intersects(Geometry geometry)
This implementation throws UnsupportedOperationException. |
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). |
boolean |
isValid()
This implementation throws UnsupportedOperationException. |
double |
length()
Returns the length of this object. |
Geometry |
locateAlong(double measure)
This implementation throws UnsupportedOperationException. |
Geometry |
locateBetween(double fromMeasure,
double toMeasure)
This implementation throws UnsupportedOperationException. |
abstract int |
numParts()
Returns the number of parts of this object. |
abstract int |
numPoints()
Returns the number of points in this geometry. |
abstract int |
numPoints(int part,
int subPart)
Returns the number of points in the specified part and subpart. |
abstract int |
numSubParts(int part)
Returns the number of subparts in the specified part. |
boolean |
overlaps(Geometry geometry)
This implementation throws UnsupportedOperationException. |
double |
perimeter()
Returns the perimeter of this object, as measured in the spatial reference system of this object. |
int |
srid()
Returns this object's spatial reference system identifier. |
Geometry |
symmetricDiff(Geometry geometry)
This implementation throws UnsupportedOperationException. |
abstract int |
toCoordArray(double[] buf,
int destOffset,
int coordType,
int srcOffset,
int part,
int subPart)
Gets the coordinates of up to count points from the specified part and subpart of this object, starting with the position specified by index. |
abstract int |
toPointArray(CoordPoint[] pointArray,
int destOffset,
int srcOffset,
int part,
int subPart)
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. |
java.lang.String |
toString()
Returns a String object representing this object's modified WKT representation. |
boolean |
touches(Geometry geometry)
This implementation throws UnsupportedOperationException. |
Geometry |
union(Geometry geometry)
This implementation throws UnsupportedOperationException. |
boolean |
within(Geometry geometry)
This implementation throws UnsupportedOperationException. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int COORD_XY
toCoordArray(double[], int, int, int, int, int)
,
Constant Field Valuespublic static final int COORD_Z
toCoordArray(double[], int, int, int, int, int)
,
Constant Field Valuespublic static final int COORD_M
toCoordArray(double[], int, int, int, int, int)
,
Constant Field ValuesMethod Detail |
---|
public abstract int dimension()
Returns the dimension of this geometry object. A geometry's dimension can be:
dimension
in interface Geometry
public java.io.ByteArrayOutputStream asBinary()
This implementation throws UnsupportedOperationException.
asBinary
in interface Geometry
public java.lang.String asText()
asText
in interface Geometry
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.
This implementation throws UnsupportedOperationException.
isSimple
in interface Geometry
public Geometry envelope()
Returns a Geometry that represents this object's envelope.
The envelope of a geometry is the bounding geometry formed by the minimum and maximum (x,y) coordinates. The envelopes of most geometries form a boundary rectangle; however, the envelope of a point is the point itself, since its minimum and maximum coordinates are the same, and the envelope of a horizontal or vertical linestring is a linestring represented by the endpoints of the source linestring.
envelope
in interface Geometry
public Envelope extent()
Returns an Envelope object that represents this geometry's envelope.
The envelope of a geometry is the bounding geometry formed by the minimum and maximum (x,y) coordinates. The envelopes of most geometries form a boundary rectangle; however, the envelope of a point is the point itself, since its minimum and maximum coordinates are the same, and the envelope of a horizontal or vertical linestring is a linestring represented by the endpoints of the source linestring.
extent
in interface Geometry
public boolean envelopesIntersect(Geometry geometry)
envelopesIntersect
in interface Geometry
geometry
- The geometry tested for envelope intersection
public int srid()
srid
in interface Geometry
public boolean isEmpty()
isEmpty
in interface Geometry
public abstract int numPoints()
numPoints
in interface Geometry
public boolean contains(Geometry geometry)
Returns whether or not this object completely contains the geometry argument. The boundary and interior of the argument geometry are not allowed to intersect the exterior of this object.
This function returns the opposite result of within.
This implementation throws UnsupportedOperationException.
contains
in interface Geometry
geometry
- The geometry tested for inclusion.
within(Geometry)
public boolean crosses(Geometry geometry)
crosses
in interface Geometry
Geometry.crosses(com.ibm.spatial.geom.Geometry)
public boolean disjoint(Geometry geometry)
disjoint
in interface Geometry
geometry
- The geometry tested for non-intersection.
Geometry.disjoint(com.ibm.spatial.geom.Geometry)
public boolean intersects(Geometry geometry)
intersects
in interface Geometry
geometry
- The geometry tested for intersection
Geometry.intersects(com.ibm.spatial.geom.Geometry)
public boolean overlaps(Geometry geometry)
overlaps
in interface Geometry
geometry
- The geometry to test for overlapping
Geometry.overlaps(com.ibm.spatial.geom.Geometry)
public boolean touches(Geometry geometry)
touches
in interface Geometry
geometry
- The geometry to test for touching
Geometry.touches(com.ibm.spatial.geom.Geometry)
public boolean within(Geometry geometry)
within
in interface Geometry
geometry
- The geometry to test for within
Geometry.within(com.ibm.spatial.geom.Geometry)
public Geometry boundary()
boundary
in interface Geometry
Geometry.boundary()
public Geometry buffer(double distance)
buffer
in interface Geometry
distance
- The distance at which the encircling geometry is
generated.
Geometry.buffer(double)
public Geometry convexHull()
convexHull
in interface Geometry
Geometry.convexHull()
public Geometry difference(Geometry geometry)
difference
in interface Geometry
geometry
- The geometry tested for inclusion.
Geometry.difference(com.ibm.spatial.geom.Geometry)
public double distance(Geometry geometry)
distance
in interface Geometry
geometry
- The geometry to which the distance is calculated.
Geometry.distance(com.ibm.spatial.geom.Geometry)
public Geometry intersection(Geometry geometry)
intersection
in interface Geometry
geometry
- The geometry to intersect with
Geometry.intersection(com.ibm.spatial.geom.Geometry)
public Geometry symmetricDiff(Geometry geometry)
symmetricDiff
in interface Geometry
geometry
- The second operand of the symmetric difference
Geometry.symmetricDiff(com.ibm.spatial.geom.Geometry)
public Geometry union(Geometry geometry)
union
in interface Geometry
geometry
- The second operand of the union
Geometry.union(com.ibm.spatial.geom.Geometry)
public boolean is3D()
is3D
in interface Geometry
public boolean isMeasured()
isMeasured
in interface Geometry
public boolean isValid()
isValid
in interface Geometry
Geometry.isValid()
public Geometry exterior()
exterior
in interface Geometry
Geometry.exterior()
public Geometry interior()
interior
in interface Geometry
Geometry.interior()
public Geometry locateAlong(double measure)
locateAlong
in interface Geometry
Geometry.locateAlong(double)
public Geometry locateBetween(double fromMeasure, double toMeasure)
locateBetween
in interface Geometry
Geometry.locateBetween(double, double)
public boolean equals(java.lang.Object anObject)
Note that only the srid's of the coordinate references of the two objects are compared for equality.
equals
in interface Geometry
equals
in class java.lang.Object
anObject
- the object to compare this IfxGeometry
against.
public int getCoordinateDimension()
public int getDimensionality()
public java.lang.String geometryType()
public java.lang.Class getOGCType()
public CoordPoint getLabelPoint() throws SpatialException
SpatialException
- if an error occurs during the calculation
of the label point coordinatespublic void getLabelPoint(CoordPoint point) throws SpatialException
point
- a CoordPoint object to be filled with the coordinates
of the label point
SpatialException
- if an error occurs during the calculation
of the label point coordinatespublic double area()
Note: this implementation does not compute the area of a given geometry; instead it merely returns an area value which was previously associated with this object. For example, if we call area() on an object read from the database, we get the correct answer only if the database server calculated this value and sent it to the client together with the coordinate data. If called on a geometry created locally (using a geometry factory, for example) this method will return 0.
public double perimeter()
public double length()
public abstract int numParts()
A IfxGeometry object is structured in parts. Each part can contain one or more subparts. Here is the part/subpart structure of instantiatiable subtypes:
Geometry Type | Parts | Subparts |
Point | 1 | 1 |
LineString | 1 | 1 |
Polygon | 1 | N (subpart <==> ring) |
MultiPoint | 1 | 1 |
MultiLineString | N | 1 |
MultiPolygon | N | N |
public abstract int numSubParts(int part)
part
- part index
java.lang.IndexOutOfBoundsException
- for non-empty geometries,
if the given part index is out of range
(part < 0 || part >= numParts()).numParts()
public abstract int numPoints(int part, int subPart)
part
- part indexsubPart
- subpart index
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)).numParts()
,
numSubParts(int)
public abstract int toCoordArray(double[] buf, int destOffset, int coordType, int srcOffset, int part, int subPart)
Gets the coordinates of up to count points from the specified part and subpart of this object, starting with the position specified by index. The value of index is relative to the beginning of the current subpart. The order in which the coordinates are returned is described by coordType:
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.
If the array buf is reused for several calls, this method may be used to save allocation costs.
Below is an usage example. Looping through geometries with the same (known) type may help to further optimize the code:
IfxGeometry geo; double buf[] = new double[1000]; ... for(int part = 0; part < geo.numParts(); part++) { for(int subpart = 0; subpart < geo.numSubParts(part); subpart++) { int position = 0, read = 0; for (int points = geo.numPoints(part, subpart); points > 0; points -= read) { read = geo.toCoordArray(buf, 0, IfxGeometry.COORD_XY, position, part, subpart); if (read == 0) break; // display coordinates ... // update position of the next point to read position += read; } } }In case of geometries with more than one point, if coordType only equals one of the flag values, then the coordinate values are copied into the buffer in the manner performed by System.arraycopy.
If a coordinate type is specified that this object does not hold (for example, if COORD_Z is specified for a Polygon M), this method returns 0 without copying any coordinate.
buf
- the array of double where point coordinates are
returned. If buffer is null, an error is reporteddestOffset
- the starting position in the destination buffer
where coordinates are writtencoordType
- specifies which coordinates are returned.
It may be any combination of the flag values
COORD_XY, COORD_Z, and COORD_M.srcOffset
- the position of the first point whose coordinates
are copied into the destination bufferpart
- the current part (see numParts
)subPart
- the current subpart (see numParts
)
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)).COORD_XY
,
COORD_Z
,
COORD_M
public abstract int toPointArray(CoordPoint[] pointArray, int destOffset, int srcOffset, int part, int subPart)
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.
If pointArray is reused for several calls, this method may be used to save allocation costs.
Below is an usage example. Looping through geometries with the same (known) type may help to further optimize the code:
IfxGeometry geo; CoordPoint buf[] = new CoordPoint.Double[1000]; for(int part = 0; part < geo.numParts(); part++) { for(int subpart = 0; subpart < geo.numSubParts(part); subpart++) { int read = 0; int position = 0; for (int points = geo.numPoints(part, subpart); points > 0; points -= read) { read = geo.toPointArray(buf, 0, position, part, subpart); if (read == 0) break; // display vertices ... // update position of the next point to read position += read; } } }
pointArray
- the array of CoordPoints where point
coordinates are returned.destOffset
- start position in the destination array pointArraysrcOffset
- the position of the first point whose coordinates
are copied, relative to the beginning of the specified
part / subpartpart
- the current geometry part (see numParts
)subPart
- the current subpart (see numParts
)
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)).public java.lang.String toString()
Returns a String object representing this object's modified WKT representation.
This representation is compatible with the representation defined by the IBM Informix Spatial DataBlade, used for loading text strings directly into geometry columns without filtering the string through one of the Spatial DataBlade text functions.
Examples:
1 Point zm(10.98 29.91 10.2 9.1)By placing the SRID in front of the text description, this representation may be used to insert data directly into a spatial column. Also, the load statement in the IBM Informix DB-Access utility reads text files generated with this format and inserts the modified well-known text representation into the geometry columns.
toString
in class java.lang.Object
asText()
public java.lang.Object clone()
clone
in class java.lang.Object
|
Spatial DataBlade JAVA API v8.21 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |