Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

vertextiterator

martin schouwenburg edited this page Apr 12, 2014 · 3 revisions

The vertex iterator iterates through the vertices of a single geometry (also multi variant).

Design Rationale

Operations on the vertices of a geometry are common-place in GIS software. As the vertices can be translated into a linear form ( taking holes and gaps into account) it makes perfect sense to have an iterator for the vertices. This enables integration with the STL algorithms and in general gives a higher level of abstraction. The iterator is designed as a random access iterator that gives access (R/W) to the coordinates of a vertex.

Description

The VertexIterator iterates over all the vertices of a single geometry. This geometry may be of the multi-form. It will not iterate over multiple geometries. If you need this you probably need to combine the FeatureIterator and the VertextIterator The iterator can be initialized with either an external geometry or a WKT string. In the latter case, the iterator becomes owner of the resulting geometry(of the wkt) and will clean it up; while in the former case it will not become owner.

Apart from simply iterating over the vertices the it also has state in the sense that it contains two boolean states indicating that it jumped to a new sub-geometry ( in this case of multi-geometries) or to a hole in the case of polygons. Not that these flags are immediately reset after you move to the next vertex.

Usage

Clone this wiki locally