GEOS: EdgeIntersectionList.h Source File

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

# EdgeIntersectionList.h

    00001 /**********************************************************************
    00002  * $Id: EdgeIntersectionList.h 1820 2006-09-06 16:54:23Z 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
    00018 #ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
    00019 #define GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
    00020
    00021 #include <vector>
    00022 #include <set>
    00023 #include <string>
    00024
    00025 #include <geos/geomgraph/EdgeIntersection.h> // for EdgeIntersectionLessThen
    00026 #include <geos/geom/Coordinate.h> // for CoordinateLessThen
    00027
    00028 #include <geos/inline.h>
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class Coordinate;
    00034         }
    00035         namespace geomgraph {
    00036                 class Edge;
    00037         }
    00038 }
    00039
    00040 namespace geos {
    00041 namespace geomgraph { // geos.geomgraph
    00042
    00043
    00049 class EdgeIntersectionList{
    00050 public:
    00051         typedef std::set<EdgeIntersection *, EdgeIntersectionLessThen> container;
    00052         typedef container::iterator iterator;
    00053         typedef container::const_iterator const_iterator;
    00054
    00055 private:
    00056         container nodeMap;
    00057
    00058 public:
    00059
    00060         Edge *edge;
    00061         EdgeIntersectionList(Edge *edge);
    00062         ~EdgeIntersectionList();
    00063
    00064         /*
    00065          * Adds an intersection into the list, if it isn't already there.
    00066          * The input segmentIndex and dist are expected to be normalized.
    00067          * @return the EdgeIntersection found or added
    00068          */
    00069         EdgeIntersection* add(const geom::Coordinate& coord,
    00070                 int segmentIndex, double dist);
    00071
    00072         iterator begin() { return nodeMap.begin(); }
    00073         iterator end() { return nodeMap.end(); }
    00074         const_iterator begin() const { return nodeMap.begin(); }
    00075         const_iterator end() const { return nodeMap.end(); }
    00076
    00077         bool isEmpty() const;
    00078         bool isIntersection(const geom::Coordinate& pt) const;
    00079
    00080         /*
    00081          * Adds entries for the first and last points of the edge to the list
    00082          */
    00083         void addEndpoints();
    00084
    00093         void addSplitEdges(std::vector<Edge*> *edgeList);
    00094
    00095         Edge *createSplitEdge(EdgeIntersection *ei0, EdgeIntersection *ei1);
    00096         std::string print() const;
    00097
    00098 };
    00099
    00100 } // namespace geos.geomgraph
    00101 } // namespace geos
    00102
    00103 //#ifdef GEOS_INLINE
    00104 //# include "geos/geomgraph/EdgeIntersectionList.inl"
    00105 //#endif
    00106
    00107 #endif // ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
    00108
    00109 /**********************************************************************
    00110  * $Log$
    00111  * Revision 1.2  2006/03/24 09:52:41  strk
    00112  * USE_INLINE => GEOS_INLINE
    00113  *
    00114  * Revision 1.1  2006/03/09 16:46:49  strk
    00115  * geos::geom namespace definition, first pass at headers split
    00116  *
    00117  **********************************************************************/
    00118