Changeset 2730
- Timestamp:
- Nov 19, 2009, 12:29:01 PM (15 years ago)
- Location:
- trunk/source
- Files:
-
- 3 edited
-
headers/geos/operation/polygonize/PolygonizeGraph.h (modified) (1 diff)
-
operation/polygonize/PolygonizeGraph.cpp (modified) (3 diffs)
-
operation/polygonize/Polygonizer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/headers/geos/operation/polygonize/PolygonizeGraph.h
r2729 r2730 123 123 * an explicit recursion stack is used 124 124 * 125 * @return a List containing the LineStrings that formed dangles 126 */ 127 std::vector<const geom::LineString*>* deleteDangles(); 125 * @param dangleLines : the LineStrings that formed dangles will 126 * be push_back'ed here 127 */ 128 void deleteDangles(std::vector<const geom::LineString*> &dangleLines); 128 129 129 130 private: -
trunk/source/operation/polygonize/PolygonizeGraph.cpp
r2729 r2730 441 441 } 442 442 443 /** 444 * Marks all edges from the graph which are "dangles". 445 * Dangles are which are incident on a node with degree 1. 446 * This process is recursive, since removing a dangling edge 447 * may result in another edge becoming a dangle. 448 * In order to handle large recursion depths efficiently, 449 * an explicit recursion stack is used 450 * 451 * @return a List containing the LineStrings that formed dangles 452 */ 453 std::vector<const LineString*>* 454 PolygonizeGraph::deleteDangles() 443 /* public */ 444 void 445 PolygonizeGraph::deleteDangles(std::vector<const LineString*>& dangleLines) 455 446 { 456 447 std::vector<Node*> *nodesToRemove=findNodesOfDegree(1); 457 std::vector<const LineString*> *dangleLines=new std::vector<const LineString*>();458 448 std::vector<Node*> nodeStack; 459 449 for(int i=0;i<(int)nodesToRemove->size();i++) { … … 476 466 // save the line as a dangle 477 467 PolygonizeEdge *e=(PolygonizeEdge*) de->getEdge(); 478 dangleLines ->push_back(e->getLine());468 dangleLines.push_back(e->getLine()); 479 469 Node *toNode=de->getToNode(); 480 470 // add the toNode to the list to be processed, if it is now a dangle … … 483 473 } 484 474 } 485 return dangleLines;486 475 } 487 476 -
trunk/source/operation/polygonize/Polygonizer.cpp
r2728 r2730 235 235 if (graph==NULL) return; 236 236 237 dangles=graph->deleteDangles(); 237 // TODO: drop this heap allocation 238 dangles = new std::vector<const LineString*>(); 239 graph->deleteDangles(*dangles); 238 240 239 241 // TODO: drop this heap allocation
Note:
See TracChangeset
for help on using the changeset viewer.
