/** * Creates new edges for all the edges that the intersections in this * list split the parent edge into. * Adds the edges to the input list (this is so a single list * can be used to accumulate all split edges for a Geometry). */ void SegmentNodeList::addSplitEdges(vector<SegmentString*> *edgeList) { // testingOnly //vector<SegmentString*> *testingSplitEdges=new vector<SegmentString*>(); // ensure that the list has entries for the first and last point of the edge addEndpoints(); set<SegmentNode*,SegmentNodeLT>::iterator it=nodes->begin(); // there should always be at least two entries in the list SegmentNode *eiPrev=*it; it++; for(;it!=nodes->end();it++) { SegmentNode *ei=*it; SegmentString *newEdge=createSplitEdge(eiPrev, ei); edgeList->push_back(newEdge); //testingSplitEdges->push_back(newEdge); eiPrev = ei; } //checkSplitEdgesCorrectness(testingSplitEdges); }
void EdgeIntersectionList::addSplitEdges(vector<Edge*> *edgeList) { // ensure that the list has entries for the first and last point // of the edge addEndpoints(); EdgeIntersectionList::iterator it=nodeMap.begin(); // there should always be at least two entries in the list EdgeIntersection *eiPrev=*it; ++it; while (it!=nodeMap.end()) { EdgeIntersection *ei=*it; Edge *newEdge=createSplitEdge(eiPrev,ei); edgeList->push_back(newEdge); eiPrev=ei; it++; } }
/* public */ void SegmentNodeList::addSplitEdges(std::vector<SegmentString*>& edgeList) { // testingOnly #if GEOS_DEBUG std::cerr<<__FUNCTION__<<" entered"<<std::endl; std::vector<SegmentString*> testingSplitEdges; #endif // ensure that the list has entries for the first and last // point of the edge addEndpoints(); addCollapsedNodes(); // there should always be at least two entries in the list // since the endpoints are nodes iterator it=begin(); SegmentNode *eiPrev=*it; assert(eiPrev); it++; for(iterator itEnd=end(); it!=itEnd; ++it) { SegmentNode *ei=*it; assert(ei); if ( ! ei->compareTo(*eiPrev) ) continue; SegmentString *newEdge=createSplitEdge(eiPrev, ei); edgeList.push_back(newEdge); #if GEOS_DEBUG testingSplitEdges.push_back(newEdge); #endif eiPrev = ei; } #if GEOS_DEBUG std::cerr<<__FUNCTION__<<" finished, now checking correctness"<<std::endl; checkSplitEdgesCorrectness(testingSplitEdges); #endif }