GEOS  3.6.2
LinearIterator.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation.
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: linearref/LinearIterator.java r463
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_LINEARREF_LINEARITERATOR_H
00021 #define GEOS_LINEARREF_LINEARITERATOR_H
00022 
00023 #include <string>
00024 
00025 #include <geos/geom/Coordinate.h>
00026 #include <geos/geom/Geometry.h>
00027 #include <geos/geom/LineSegment.h>
00028 #include <geos/linearref/LinearLocation.h>
00029 
00030 namespace geos { namespace linearref
00031 {
00032 
00050 class LinearIterator
00051 {
00052 public:
00058         LinearIterator(const geom::Geometry *linear);
00059 
00067         LinearIterator(const geom::Geometry *linear, const LinearLocation& start);
00068 
00077         LinearIterator(const geom::Geometry *linear, unsigned int componentIndex, unsigned int vertexIndex);
00078 
00083         bool hasNext() const;
00084 
00085 
00089         void next();
00090 
00097         bool isEndOfLine() const;
00098 
00103         unsigned int getComponentIndex() const;
00104 
00109         unsigned int getVertexIndex() const;
00110 
00115         const geom::LineString* getLine() const;
00116 
00122         geom::Coordinate getSegmentStart() const;
00123 
00131         geom::Coordinate getSegmentEnd() const;
00132 
00133 private:
00134 
00135         static unsigned int segmentEndVertexIndex(const LinearLocation& loc);
00136 
00137         const geom::LineString *currentLine;
00138         unsigned int vertexIndex;
00139         unsigned int componentIndex;
00140         const geom::Geometry *linear;
00141         const unsigned int numLines;
00142 
00149         void loadCurrentLine();
00150 
00151     // Declare type as noncopyable
00152     LinearIterator(const LinearIterator& other);
00153     LinearIterator& operator=(const LinearIterator& rhs);
00154 };
00155 
00156 }} // namespace geos::linearref
00157 
00158 #endif // GEOS_LINEARREF_LINEARITERATOR_H