public class GeometryCollectionIterator
extends java.lang.Object
implements java.util.Iterator
Geometrys in a Geometry,
(which may be either a collection or an atomic geometry).
The iteration sequence follows a pre-order, depth-first traversal of the
structure of the GeometryCollection
(which may be nested). The original Geometry object is
returned as well (as the first object), as are all sub-collections and atomic elements.
It is simple to ignore the intermediate GeometryCollection objects if they are not
needed.| Modifier and Type | Field and Description |
|---|---|
private boolean |
atStart
Indicates whether or not the first element
(the root
GeometryCollection) has been returned. |
private int |
index
The index of the
Geometry that will be returned when next
is called. |
private int |
max
The number of
Geometrys in the the GeometryCollection. |
private Geometry |
parent
The
Geometry being iterated over. |
private GeometryCollectionIterator |
subcollectionIterator
The iterator over a nested
Geometry, or null
if this GeometryCollectionIterator is not currently iterating
over a nested GeometryCollection. |
| Constructor and Description |
|---|
GeometryCollectionIterator(Geometry parent)
Constructs an iterator over the given
Geometry. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Tests whether any geometry elements remain to be returned.
|
private static boolean |
isAtomic(Geometry geom) |
java.lang.Object |
next()
Gets the next geometry in the iteration sequence.
|
void |
remove()
Removal is not supported.
|
private Geometry parent
Geometry being iterated over.private boolean atStart
GeometryCollection) has been returned.private int max
Geometrys in the the GeometryCollection.private int index
Geometry that will be returned when next
is called.private GeometryCollectionIterator subcollectionIterator
Geometry, or null
if this GeometryCollectionIterator is not currently iterating
over a nested GeometryCollection.public GeometryCollectionIterator(Geometry parent)
Geometry.parent - the geometry over which to iterate; also, the first
element returned by the iterator.public boolean hasNext()
hasNext in interface java.util.Iteratorpublic java.lang.Object next()
next in interface java.util.Iteratorprivate static boolean isAtomic(Geometry geom)
public void remove()
remove in interface java.util.Iteratorjava.lang.UnsupportedOperationException - This method is not implemented.