1 /********************************************************************** 2 * 3 * GEOS - Geometry Engine Open Source 4 * http://geos.osgeo.org 5 * 6 * Copyright (C) 2001-2002 Vivid Solutions Inc. 7 * Copyright (C) 2006 Refractions Research Inc. 8 * 9 * This is free software; you can redistribute and/or modify it under 10 * the terms of the GNU Lesser General Licence as published 11 * by the Free Software Foundation. 12 * See the COPYING file for more information. 13 * 14 ********************************************************************** 15 * 16 * Last port: noding/SimpleNoder.java rev. 1.7 (JTS-1.9) 17 * 18 **********************************************************************/ 19 20 #include <geos/noding/SimpleNoder.h> 21 #include <geos/noding/SegmentString.h> 22 #include <geos/noding/SegmentIntersector.h> 23 #include <geos/geom/CoordinateSequence.h> 24 25 using namespace geos::geom; 26 27 namespace geos { 28 namespace noding { // geos.noding 29 30 /*private*/ 31 void computeIntersects(SegmentString * e0,SegmentString * e1)32SimpleNoder::computeIntersects(SegmentString* e0, SegmentString* e1) 33 { 34 assert(segInt); // must provide a segment intersector! 35 36 const CoordinateSequence* pts0 = e0->getCoordinates(); 37 const CoordinateSequence* pts1 = e1->getCoordinates(); 38 for(size_t i0 = 0, n0 = pts0->getSize() - 1; i0 < n0; i0++) { 39 for(size_t i1 = 0, n1 = pts1->getSize() - 1; i1 < n1; i1++) { 40 segInt->processIntersections(e0, i0, e1, i1); 41 } 42 } 43 44 } 45 46 /*public*/ 47 void computeNodes(SegmentString::NonConstVect * inputSegmentStrings)48SimpleNoder::computeNodes(SegmentString::NonConstVect* inputSegmentStrings) 49 { 50 nodedSegStrings = inputSegmentStrings; 51 52 for (SegmentString* edge0: *inputSegmentStrings) { 53 for (SegmentString* edge1: *inputSegmentStrings) { 54 computeIntersects(edge0, edge1); 55 } 56 } 57 58 } 59 60 61 } // namespace geos.noding 62 } // namespace geos 63