Changeset 2727
- Timestamp:
- Nov 19, 2009, 11:31:43 AM (15 years ago)
- Location:
- trunk/source
- Files:
-
- 2 edited
-
headers/geos/operation/polygonize/PolygonizeGraph.h (modified) (2 diffs)
-
operation/polygonize/PolygonizeGraph.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/headers/geos/operation/polygonize/PolygonizeGraph.h
r2726 r2727 144 144 * the list of start edges for the edgeRings to convert. 145 145 * 146 * TODO: take ringEdges by ref147 146 */ 148 147 void convertMaximalToMinimalEdgeRings( 149 std::vector<PolygonizeDirectedEdge*> *ringEdges);148 std::vector<PolygonizeDirectedEdge*> &ringEdges); 150 149 151 150 /** … … 164 163 165 164 /** 166 * @param dirEdges a List of the DirectedEdges in the graph 167 * @return a List of DirectedEdges, one for each edge ring found 168 */ 169 static std::vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings( 170 std::vector<planargraph::DirectedEdge*> &dirEdges); 165 * Finds and labels all edgerings in the graph. 166 * 167 * The edge rings are labelling with unique integers. 168 * The labelling allows detecting cut edges. 169 * 170 * @param dirEdgesIn a list of the DirectedEdges in the graph 171 * @param dirEdgesOut each ring found will be pushed here 172 */ 173 static void findLabeledEdgeRings( 174 std::vector<planargraph::DirectedEdge*> &dirEdgesIn, 175 std::vector<PolygonizeDirectedEdge*> &dirEdgesOut); 171 176 172 177 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label); -
trunk/source/operation/polygonize/PolygonizeGraph.cpp
r2726 r2727 172 172 void 173 173 PolygonizeGraph::convertMaximalToMinimalEdgeRings( 174 std::vector<PolygonizeDirectedEdge*> *ringEdges)174 std::vector<PolygonizeDirectedEdge*> &ringEdges) 175 175 { 176 176 typedef std::vector<Node*> IntersectionNodes; … … 178 178 179 179 IntersectionNodes intNodes; 180 for(RingEdges::size_type i=0, in=ringEdges ->size();180 for(RingEdges::size_type i=0, in=ringEdges.size(); 181 181 i<in; ++i) 182 182 { 183 PolygonizeDirectedEdge *de =(*ringEdges)[i];183 PolygonizeDirectedEdge *de = ringEdges[i]; 184 184 long label=de->getLabel(); 185 185 findIntersectionNodes(de, label, intNodes); … … 225 225 // clear labels of all edges in graph 226 226 label(dirEdges, -1); 227 std::vector<PolygonizeDirectedEdge*> *maximalRings=findLabeledEdgeRings(dirEdges); 227 std::vector<PolygonizeDirectedEdge*> maximalRings; 228 findLabeledEdgeRings(dirEdges, maximalRings); 228 229 convertMaximalToMinimalEdgeRings(maximalRings); 229 delete maximalRings;230 maximalRings.clear(); // not needed anymore 230 231 231 232 // find all edgerings … … 240 241 } 241 242 242 /** 243 * 244 * @param dirEdges a List of the DirectedEdges in the graph 245 * @return a List of DirectedEdges, one for each edge ring found 246 */ 247 std::vector<PolygonizeDirectedEdge*>* 248 PolygonizeGraph::findLabeledEdgeRings(std::vector<DirectedEdge*> &dirEdges) 249 { 250 std::vector<PolygonizeDirectedEdge*> *edgeRingStarts=new std::vector<PolygonizeDirectedEdge*>(); 243 /* static private */ 244 void 245 PolygonizeGraph::findLabeledEdgeRings(std::vector<DirectedEdge*> &dirEdges, 246 std::vector<PolygonizeDirectedEdge*> &edgeRingStarts) 247 { 251 248 // label the edge rings formed 252 249 long currLabel=1; … … 256 253 if (de->isMarked()) continue; 257 254 if (de->getLabel() >= 0) continue; 258 edgeRingStarts ->push_back(de);255 edgeRingStarts.push_back(de); 259 256 std::vector<DirectedEdge*> *edges=findDirEdgesInRing(de); 260 257 label(*edges, currLabel); … … 262 259 ++currLabel; 263 260 } 264 return edgeRingStarts;265 261 } 266 262 … … 275 271 276 272 // label the current set of edgerings 277 delete findLabeledEdgeRings(dirEdges); 273 std::vector<PolygonizeDirectedEdge*> junk; 274 findLabeledEdgeRings(dirEdges, junk); 275 junk.clear(); // not needed anymore 278 276 279 277 /*
Note:
See TracChangeset
for help on using the changeset viewer.
