Spatial DataBlade
JAVA API v8.21

com.ibm.spatial.geom
Class IfxGeometryCollection

java.lang.Object
  extended by com.ibm.spatial.geom.IfxGeometry
      extended by com.ibm.spatial.geom.IfxMultiCoord
          extended by com.ibm.spatial.geom.IfxGeometryCollection
All Implemented Interfaces:
Geometry, GeometryCollection, java.lang.Cloneable
Direct Known Subclasses:
IfxMultiLineString, IfxMultiPoint, IfxMultiPolygon

public class IfxGeometryCollection
extends IfxMultiCoord
implements GeometryCollection

A IfxGeometryCollection is a geometry that implements the GeometryCollection interface.

This implementation allows geometry members of different types to be stored in the same IfxGeometryCollection object (heterogeneous collection). However, all the members must have the same srid and subtype (Z, M, ZM...).

Descendents of this class may enforce type homogeneity.

See Also:
GeometryCollection, Geometry, IfxGeometry

Field Summary
 
Fields inherited from class com.ibm.spatial.geom.IfxGeometry
COORD_M, COORD_XY, COORD_Z
 
Method Summary
 double area()
          Returns the area of this object, as measured in the spatial reference system of this object.
 int dimension()
          Returns the dimension of this geometry object.
 boolean equals(java.lang.Object anObject)
          Compares this object to the specified object.
 Geometry geometryN(int index)
          Returns the Geometry at the specified position in this collection.
 java.lang.String geometryType()
          Gets the most appropriate OGC geometry interface type for this object.
 int numGeometries()
          Returns the number of Geometries in this collection.
 int numParts()
          Returns the number of parts of this object.
 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.
 Geometry[] toArray()
          Returns an array containing all of the Geometries in this object.
 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 srcOffset.
 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 srcOffset (relative to the current subpart beginning position), into pointArray.
 
Methods inherited from class com.ibm.spatial.geom.IfxMultiCoord
getLabelPoint, is3D, isEmpty, isMeasured, length, perimeter
 
Methods inherited from class com.ibm.spatial.geom.IfxGeometry
asBinary, asText, boundary, buffer, clone, contains, convexHull, crosses, difference, disjoint, distance, envelope, envelopesIntersect, extent, exterior, getCoordinateDimension, getDimensionality, getLabelPoint, getOGCType, interior, intersection, intersects, isSimple, isValid, locateAlong, locateBetween, overlaps, 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, is3D, isEmpty, isMeasured, isSimple, isValid, locateAlong, locateBetween, overlaps, srid, symmetricDiff, touches, union, within
 

Method Detail

numGeometries

public int numGeometries()
Returns the number of Geometries in this collection.

Specified by:
numGeometries in interface GeometryCollection
Returns:
the number of Geometries in this collection.

geometryN

public Geometry geometryN(int index)
                   throws SpatialException
Returns the Geometry at the specified position in this collection.

Specified by:
geometryN in interface GeometryCollection
Parameters:
index - index of element to return.
Returns:
the Geometry at the specified position in this collection.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= numGeometries()).
SpatialException - wrapping another exception

dimension

public int dimension()

Returns the dimension of this geometry object.

Specified by:
dimension in interface Geometry
Specified by:
dimension in class IfxGeometry
Returns:
The dimension of this geometry.
See Also:
Geometry.dimension()

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

equals

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

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

numPoints

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

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

area

public double area()
Returns the area of this object, as measured in the spatial reference system of this object.

Overrides:
area in class IfxGeometry
Returns:
the area of this object in double precision

toArray

public Geometry[] toArray()
                   throws SpatialException
Returns an array containing all of the Geometries in this object.

Returns:
an array of Geometry objects holding the coordinates of all the vertices of this LineString. It returns a zero-length array if this object is empty.
Throws:
SpatialException - wrapping another exception

numParts

public int numParts()
Returns the number of parts of this object. Every collection member is a different part.

In case of a heterogeneous collection, it is assumed that each collection member has a single part and one or possibly several subparts. In other words, none of the collection members is a GeometryCollection or GeometryCollection descendent.

In case of homogeneous collections, this function calls its superclass implementation.

Overrides:
numParts in class IfxMultiCoord
Returns:
the number of parts
See Also:
IfxGeometry.numParts()

numSubParts

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

It is assumed that each collection member has a single part and one or possibly several subparts. In other words, none of the collection members is a GeometryCollection descendent.

In case of homogeneous collections, this function calls its superclass implementation.

Overrides:
numSubParts in class IfxMultiCoord
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.

Overrides:
numPoints in class IfxMultiCoord
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)

Gets the coordinates of up to count points from the specified part and subpart of this object, starting with the position specified by srcOffset. The value of srcOffset is relative to the beginning of the current subpart.

The number of points read is limited by numPoints, the available space in the destination buffer, and the number of remaining points in the current part/subpart.

It is assumed that each collection member has a single part and one or possibly several subparts. In other words, none of the collection members is a GeometryCollection descendent.

Overrides:
toCoordArray in class IfxMultiCoord
Parameters:
buf - the array of double where point coordinates are returned. If buffer is null, an error is reported
destOffset - 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...

Note: 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.

srcOffset - position of the first point whose coordinates are copied into the destination array, relative to the beginning of the specified part and 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)).
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)

Copies up to count points from the specified part and subpart of this object, starting with the point at the position specified by srcOffset (relative to the current subpart beginning position), into pointArray.

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

It is assumed that each collection member has a single part and one or possibly several subparts. In other words, none of the collection members is a GeometryCollection descendent.

If pointArray is reused for several calls, this method may be used to save allocation costs.

Overrides:
toPointArray in class IfxMultiCoord
Parameters:
pointArray - the array of CoordPoints where point coordinates are returned
destOffset - start position in the destination buffer pointArray
srcOffset - position of the first point whose coordinates are copied into the destination array, relative to the beginning of the specified part and 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.