Package org.locationtech.jts.geom
Class GeometryCollectionIterator
java.lang.Object
org.locationtech.jts.geom.GeometryCollectionIterator
- All Implemented Interfaces:
Iterator
Iterates over all
Geometry
s 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.- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Indicates whether or not the first element (the rootGeometryCollection
) has been returned.private int
The index of theGeometry
that will be returned whennext
is called.private int
The number ofGeometry
s in the theGeometryCollection
.private Geometry
TheGeometry
being iterated over.private GeometryCollectionIterator
The iterator over a nestedGeometry
, ornull
if thisGeometryCollectionIterator
is not currently iterating over a nestedGeometryCollection
. -
Constructor Summary
ConstructorsConstructorDescriptionGeometryCollectionIterator
(Geometry parent) Constructs an iterator over the givenGeometry
. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
parent
TheGeometry
being iterated over. -
atStart
private boolean atStartIndicates whether or not the first element (the rootGeometryCollection
) has been returned. -
max
private int maxThe number ofGeometry
s in the theGeometryCollection
. -
index
private int indexThe index of theGeometry
that will be returned whennext
is called. -
subcollectionIterator
The iterator over a nestedGeometry
, ornull
if thisGeometryCollectionIterator
is not currently iterating over a nestedGeometryCollection
.
-
-
Constructor Details
-
GeometryCollectionIterator
Constructs an iterator over the givenGeometry
.- Parameters:
parent
- the geometry over which to iterate; also, the first element returned by the iterator.
-
-
Method Details
-
hasNext
public boolean hasNext()Tests whether any geometry elements remain to be returned. -
next
Gets the next geometry in the iteration sequence. -
isAtomic
-
remove
public void remove()Removal is not supported.- Specified by:
remove
in interfaceIterator
- Throws:
UnsupportedOperationException
- This method is not implemented.
-