EdgeIntersectionList.h

00001 /**********************************************************************
00002  * $Id: EdgeIntersectionList.h 3340 2011-05-10 09:51:31Z strk $
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: geomgraph/EdgeIntersectionList.java rev. 1.5 (JTS-1.10)
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
00023 #define GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
00024 
00025 #include <geos/export.h>
00026 #include <vector>
00027 #include <set>
00028 #include <string>
00029 
00030 #include <geos/geomgraph/EdgeIntersection.h> // for EdgeIntersectionLessThen
00031 #include <geos/geom/Coordinate.h> // for CoordinateLessThen
00032 
00033 #include <geos/inline.h>
00034 
00035 #ifdef _MSC_VER
00036 #pragma warning(push)
00037 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00038 #endif
00039 
00040 // Forward declarations
00041 namespace geos {
00042         namespace geom {
00043                 class Coordinate;
00044         }
00045         namespace geomgraph {
00046                 class Edge;
00047         }
00048 }
00049 
00050 namespace geos {
00051 namespace geomgraph { // geos.geomgraph
00052 
00053 
00059 class GEOS_DLL EdgeIntersectionList{
00060 public:
00061         typedef std::set<EdgeIntersection *, EdgeIntersectionLessThen> container;
00062         typedef container::iterator iterator;
00063         typedef container::const_iterator const_iterator;
00064 
00065 private:
00066         container nodeMap;
00067 
00068 public:
00069 
00070         Edge *edge;
00071         EdgeIntersectionList(Edge *edge);
00072         ~EdgeIntersectionList();
00073 
00074         /*
00075          * Adds an intersection into the list, if it isn't already there.
00076          * The input segmentIndex and dist are expected to be normalized.
00077          * @return the EdgeIntersection found or added
00078          */
00079         EdgeIntersection* add(const geom::Coordinate& coord,
00080                 int segmentIndex, double dist);
00081 
00082         iterator begin() { return nodeMap.begin(); }
00083         iterator end() { return nodeMap.end(); }
00084         const_iterator begin() const { return nodeMap.begin(); }
00085         const_iterator end() const { return nodeMap.end(); }
00086 
00087         bool isEmpty() const;
00088         bool isIntersection(const geom::Coordinate& pt) const;
00089 
00090         /*
00091          * Adds entries for the first and last points of the edge to the list
00092          */
00093         void addEndpoints();
00094 
00103         void addSplitEdges(std::vector<Edge*> *edgeList);
00104 
00105         Edge *createSplitEdge(EdgeIntersection *ei0, EdgeIntersection *ei1);
00106         std::string print() const;
00107 
00108 };
00109 
00110 std::ostream& operator<< (std::ostream&, const EdgeIntersectionList&);
00111 
00112 } // namespace geos.geomgraph
00113 } // namespace geos
00114 
00115 #ifdef _MSC_VER
00116 #pragma warning(pop)
00117 #endif
00118 
00119 //#ifdef GEOS_INLINE
00120 //# include "geos/geomgraph/EdgeIntersectionList.inl"
00121 //#endif
00122 
00123 #endif // ifndef GEOS_GEOMGRAPH_EDGEINTERSECTIONLIST_H
00124 
00125 /**********************************************************************
00126  * $Log$
00127  * Revision 1.2  2006/03/24 09:52:41  strk
00128  * USE_INLINE => GEOS_INLINE
00129  *
00130  * Revision 1.1  2006/03/09 16:46:49  strk
00131  * geos::geom namespace definition, first pass at headers split
00132  *
00133  **********************************************************************/
00134 

Generated on Sat Aug 20 01:31:06 2011 for GEOS by  doxygen 1.4.7