Package org.locationtech.jts.geom
Class GeometryCollectionIterator
java.lang.Object
org.locationtech.jts.geom.GeometryCollectionIterator
- All Implemented Interfaces:
Iterator
Iterates over all
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.- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIndicates whether or not the first element (the rootGeometryCollection) has been returned.private intThe index of theGeometrythat will be returned whennextis called.private intThe number ofGeometrys in the theGeometryCollection.private GeometryTheGeometrybeing iterated over.private GeometryCollectionIteratorThe iterator over a nestedGeometry, ornullif thisGeometryCollectionIteratoris 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, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
parent
TheGeometrybeing iterated over. -
atStart
private boolean atStartIndicates whether or not the first element (the rootGeometryCollection) has been returned. -
max
private int maxThe number ofGeometrys in the theGeometryCollection. -
index
private int indexThe index of theGeometrythat will be returned whennextis called. -
subcollectionIterator
The iterator over a nestedGeometry, ornullif thisGeometryCollectionIteratoris 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:
removein interfaceIterator- Throws:
UnsupportedOperationException- This method is not implemented.
-