Download code/validation/C++/0025059_IteratedNoder.cpp from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 2.83 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C%2B%2B/0025059_IteratedNoder.cpp
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/validation/C++/0025059_IteratedNoder.cpp
-
curl -L -o 0025059_IteratedNoder.cpp https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C%2B%2B/0025059_IteratedNoder.cpp
2.83 kB
| /********************************************************************** | |
| * | |
| * GEOS - Geometry Engine Open Source | |
| * http://geos.osgeo.org | |
| * | |
| * Copyright (C) 2006 Refractions Research Inc. | |
| * Copyright (C) 2001-2002 Vivid Solutions Inc. | |
| * | |
| * This is free software; you can redistribute and/or modify it under | |
| * the terms of the GNU Lesser General Licence as published | |
| * by the Free Software Foundation. | |
| * See the COPYING file for more information. | |
| * | |
| ********************************************************************** | |
| * | |
| * Last port: noding/IteratedNoder.java r591 (JTS-1.12+) | |
| * | |
| **********************************************************************/ | |
| using namespace std; | |
| using namespace geos::geom; | |
| namespace geos { | |
| namespace noding { // geos.noding | |
| /* private */ | |
| void | |
| IteratedNoder::node(vector<SegmentString*> *segStrings, | |
| int *numInteriorIntersections) | |
| { | |
| IntersectionAdder si(li); | |
| MCIndexNoder noder; | |
| noder.setSegmentIntersector(&si); | |
| noder.computeNodes(segStrings); | |
| nodedSegStrings = noder.getNodedSubstrings(); | |
| *numInteriorIntersections = si.numInteriorIntersections; | |
| //System.out.println("# intersection tests: " + si.numTests); | |
| } | |
| /* public */ | |
| void | |
| IteratedNoder::computeNodes(SegmentString::NonConstVect* segStrings) | |
| // throw(GEOSException); | |
| { | |
| int numInteriorIntersections; | |
| nodedSegStrings = segStrings; | |
| int nodingIterationCount = 0; | |
| int lastNodesCreated = -1; | |
| vector<SegmentString*> *lastStrings = 0; | |
| do { | |
| // NOTE: will change this.nodedSegStrings | |
| node(nodedSegStrings, &numInteriorIntersections); | |
| // Delete noded strings from previous iteration | |
| if ( lastStrings ) { | |
| for ( unsigned int i = 0, n = lastStrings->size(); i < n; ++i ) | |
| delete (*lastStrings)[i]; | |
| delete lastStrings; | |
| } | |
| lastStrings = nodedSegStrings; | |
| nodingIterationCount++; | |
| int nodesCreated = numInteriorIntersections; | |
| /** | |
| * Fail if the number of nodes created is not declining. | |
| * However, allow a few iterations at least before doing this | |
| */ | |
| //cerr<<"# nodes created: "<<nodesCreated<<endl; | |
| if (lastNodesCreated > 0 | |
| && nodesCreated >= lastNodesCreated | |
| && nodingIterationCount > maxIter) | |
| { | |
| stringstream s; | |
| s<<"Iterated noding failed to converge after "<< | |
| nodingIterationCount << " iterations"; | |
| throw util::TopologyException(s.str()); | |
| } | |
| lastNodesCreated = nodesCreated; | |
| } while (lastNodesCreated > 0); | |
| //cerr<<"# nodings = "<<nodingIterationCount<<endl; | |
| } | |
| } // namespace geos.noding | |
| } // namespace geos | |