- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# LinearIterator.h

    00001 /**********************************************************************
    00002  * $Id: LinearIterator.h 2809 2009-12-06 01:05:24Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: linearref/LinearIterator.java rev. 1.10
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_LINEARREF_LINEARITERATOR_H
    00022 #define GEOS_LINEARREF_LINEARITERATOR_H
    00023
    00024 #include <string>
    00025
    00026 #include <geos/geom/Coordinate.h>
    00027 #include <geos/geom/Geometry.h>
    00028 #include <geos/geom/LineSegment.h>
    00029 #include <geos/linearref/LinearLocation.h>
    00030
    00031 namespace geos { namespace linearref
    00032 {
    00033
    00051 class LinearIterator
    00052 {
    00053 public:
    00059         LinearIterator(const geom::Geometry *linear);
    00060
    00068         LinearIterator(const geom::Geometry *linear, const LinearLocation& start);
    00069
    00078         LinearIterator(const geom::Geometry *linear, unsigned int componentIndex, unsigned int vertexIndex);
    00079
    00084         bool hasNext() const;
    00085
    00086
    00090         void next();
    00091
    00098         bool isEndOfLine() const;
    00099
    00104         unsigned int getComponentIndex() const;
    00105
    00110         unsigned int getVertexIndex() const;
    00111
    00116         const geom::LineString* getLine() const;
    00117
    00123         geom::Coordinate getSegmentStart() const;
    00124
    00132         geom::Coordinate getSegmentEnd() const;
    00133
    00134 private:
    00135
    00136         static unsigned int segmentEndVertexIndex(const LinearLocation& loc);
    00137
    00138         const geom::LineString *currentLine;
    00139         unsigned int vertexIndex;
    00140         unsigned int componentIndex;
    00141         const geom::Geometry *linear;
    00142         const unsigned int numLines;
    00143
    00147         void loadCurrentLine();
    00148
    00149     // Declare type as noncopyable
    00150     LinearIterator(const LinearIterator& other);
    00151     LinearIterator& operator=(const LinearIterator& rhs);
    00152 };
    00153
    00154 }} // namespace geos::linearref
    00155
    00156 #endif // GEOS_LINEARREF_LINEARITERATOR_H