GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: operation/buffer/BufferSubgraph.java r378 (JTS-1.12) 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H 00020 #define GEOS_OP_BUFFER_BUFFERSUBGRAPH_H 00021 00022 #include <geos/export.h> 00023 00024 #include <geos/operation/buffer/RightmostEdgeFinder.h> // for composition 00025 00026 #include <vector> 00027 #include <set> 00028 00029 #ifdef _MSC_VER 00030 #pragma warning(push) 00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00032 #endif 00033 00034 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Coordinate; 00038 class Envelope; 00039 } 00040 namespace algorithm { 00041 class CGAlgorithms; 00042 } 00043 namespace geomgraph { 00044 class DirectedEdge; 00045 class Node; 00046 } 00047 } 00048 00049 namespace geos { 00050 namespace operation { // geos.operation 00051 namespace buffer { // geos.operation.buffer 00052 00061 class GEOS_DLL BufferSubgraph { 00062 private: 00063 RightmostEdgeFinder finder; 00064 00065 std::vector<geomgraph::DirectedEdge*> dirEdgeList; 00066 00067 std::vector<geomgraph::Node*> nodes; 00068 00069 geom::Coordinate *rightMostCoord; 00070 00071 geom::Envelope *env; 00072 00080 void addReachable(geomgraph::Node *startNode); 00081 00083 // 00087 void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack); 00088 00089 void clearVisitedEdges(); 00090 00097 // <FIX> MD - use iteration & queue rather than recursion, for speed and robustness 00098 void computeDepths(geomgraph::DirectedEdge *startEdge); 00099 00100 void computeNodeDepth(geomgraph::Node *n); 00101 00102 void copySymDepths(geomgraph::DirectedEdge *de); 00103 00104 bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node *node); 00105 00106 public: 00107 00108 friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs); 00109 00110 BufferSubgraph(); 00111 00112 ~BufferSubgraph(); 00113 00114 std::vector<geomgraph::DirectedEdge*>* getDirectedEdges(); 00115 00116 std::vector<geomgraph::Node*>* getNodes(); 00117 00121 geom::Coordinate* getRightmostCoordinate(); 00122 00131 void create(geomgraph::Node *node); 00132 00133 void computeDepth(int outsideDepth); 00134 00146 void findResultEdges(); 00147 00162 int compareTo(BufferSubgraph *); 00163 00170 geom::Envelope *getEnvelope(); 00171 }; 00172 00173 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs); 00174 00175 // INLINES 00176 inline geom::Coordinate* 00177 BufferSubgraph::getRightmostCoordinate() {return rightMostCoord;} 00178 00179 inline std::vector<geomgraph::Node*>* 00180 BufferSubgraph::getNodes() { return &nodes; } 00181 00182 inline std::vector<geomgraph::DirectedEdge*>* 00183 BufferSubgraph::getDirectedEdges() { 00184 return &dirEdgeList; 00185 } 00186 00187 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second); 00188 00189 } // namespace geos::operation::buffer 00190 } // namespace geos::operation 00191 } // namespace geos 00192 00193 #ifdef _MSC_VER 00194 #pragma warning(pop) 00195 #endif 00196 00197 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H 00198