1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2006 Refractions Research Inc.
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.
14 **********************************************************************
16 * Last port: noding/SimpleNoder.java rev. 1.7 (JTS-1.9)
18 **********************************************************************/
20 #include <geos/noding/SimpleNoder.h>
21 #include <geos/noding/SegmentString.h>
22 #include <geos/noding/SegmentIntersector.h>
23 #include <geos/geom/CoordinateSequence.h>
25 using namespace geos::geom
;
28 namespace noding
{ // geos.noding
32 SimpleNoder::computeIntersects(SegmentString
* e0
, SegmentString
* e1
)
34 assert(segInt
); // must provide a segment intersector!
36 const CoordinateSequence
* pts0
= e0
->getCoordinates();
37 const CoordinateSequence
* pts1
= e1
->getCoordinates();
38 for (unsigned int i0
=0, n0
=pts0
->getSize()-1; i0
<n0
; i0
++) {
39 for (unsigned int i1
=0, n1
=pts1
->getSize()-1; i1
<n1
; i1
++) {
40 segInt
->processIntersections(e0
, i0
, e1
, i1
);
48 SimpleNoder::computeNodes(SegmentString::NonConstVect
* inputSegmentStrings
)
50 nodedSegStrings
=inputSegmentStrings
;
52 for (SegmentString::NonConstVect::const_iterator
53 i0
=inputSegmentStrings
->begin(), i0End
=inputSegmentStrings
->end();
56 SegmentString
* edge0
= *i0
;
57 for (SegmentString::NonConstVect::iterator
58 i1
=inputSegmentStrings
->begin(), i1End
=inputSegmentStrings
->end();
61 SegmentString
* edge1
= *i1
;
62 computeIntersects(edge0
, edge1
);
68 } // namespace geos.noding
71 /**********************************************************************
73 * Revision 1.10 2006/03/15 09:51:12 strk
74 * streamlined headers usage
76 * Revision 1.9 2006/02/23 20:05:21 strk
77 * Fixed bug in MCIndexNoder constructor making memory checker go crazy, more
78 * doxygen-friendly comments, miscellaneous cleanups
80 * Revision 1.8 2006/02/19 19:46:49 strk
81 * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
83 * Revision 1.7 2006/02/18 21:08:09 strk
84 * - new CoordinateSequence::applyCoordinateFilter method (slow but useful)
85 * - SegmentString::getCoordinates() doesn't return a clone anymore.
86 * - SegmentString::getCoordinatesRO() obsoleted.
87 * - SegmentString constructor does not promises constness of passed
88 * CoordinateSequence anymore.
89 * - NEW ScaledNoder class
90 * - Stubs for MCIndexPointSnapper and MCIndexSnapRounder
91 * - Simplified internal interaces of OffsetCurveBuilder and OffsetCurveSetBuilder
93 * Revision 1.6 2006/02/14 13:28:26 strk
94 * New SnapRounding code ported from JTS-1.7 (not complete yet).
95 * Buffer op optimized by using new snaprounding code.
96 * Leaks fixed in XMLTester.
98 * Revision 1.5 2006/01/31 19:07:34 strk
99 * - Renamed DefaultCoordinateSequence to CoordinateArraySequence.
100 * - Moved GetNumGeometries() and GetGeometryN() interfaces
101 * from GeometryCollection to Geometry class.
102 * - Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence class.
103 * - Reworked automake scripts to produce a static lib for each subdir and
104 * then link all subsystem's libs togheter
105 * - Moved C-API in it's own top-level dir capi/
106 * - Moved source/bigtest and source/test to tests/bigtest and test/xmltester
107 * - Fixed PointLocator handling of LinearRings
108 * - Changed CoordinateArrayFilter to reduce memory copies
109 * - Changed UniqueCoordinateArrayFilter to reduce memory copies
110 * - Added CGAlgorithms::isPointInRing() version working with
111 * Coordinate::ConstVect type (faster!)
112 * - Ported JTS-1.7 version of ConvexHull with big attention to
113 * memory usage optimizations.
114 * - Improved XMLTester output and user interface
115 * - geos::geom::util namespace used for geom/util stuff
116 * - Improved memory use in geos::geom::util::PolygonExtractor
117 * - New ShortCircuitedGeometryVisitor class
118 * - New operation/predicate package
120 * Revision 1.4 2005/11/25 11:31:21 strk
121 * Removed all CoordinateSequence::getSize() calls embedded in for loops.
123 * Revision 1.3 2004/07/08 19:34:49 strk
124 * Mirrored JTS interface of CoordinateSequence, factory and
125 * default implementations.
126 * Added CoordinateArraySequenceFactory::instance() function.
128 * Revision 1.2 2004/07/02 13:28:27 strk
129 * Fixed all #include lines to reflect headers layout change.
130 * Added client application build tips in README.
132 * Revision 1.1 2004/03/26 07:48:30 ybychkov
133 * "noding" package ported (JTS 1.4)
136 **********************************************************************/