Reading Coordinate Data
Many applications need to read coordinate data from a geometry object. This example uses for loops to read the coordinates of an existing geometry object, to temporarily hold the coordinates in a buffer, and then to pass the coordinates to a drawing function.
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;
// do something with the coordinate buffer
...
// update position of the next point to read
position += read;
}
}
}