File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/libgeos.x/i/geos/noding/IteratedNoder.h
Criterion Covered Total %
statement 4 4 100.0
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 5 6 83.3


line stmt bran cond sub pod time code
1             /**********************************************************************
2             *
3             * GEOS - Geometry Engine Open Source
4             * http://geos.osgeo.org
5             *
6             * Copyright (C) 2006 Refractions Research Inc.
7             *
8             * This is free software; you can redistribute and/or modify it under
9             * the terms of the GNU Lesser General Public Licence as published
10             * by the Free Software Foundation.
11             * See the COPYING file for more information.
12             *
13             **********************************************************************
14             *
15             * Last port: noding/IteratedNoder.java r591 (JTS-1.12+)
16             *
17             **********************************************************************/
18              
19             #ifndef GEOS_NODING_ITERATEDNODER_H
20             #define GEOS_NODING_ITERATEDNODER_H
21              
22             #include
23              
24             #include
25             #include
26              
27             #include
28              
29             #include
30             #include // due to inlines
31             #include // for inheritance
32              
33             // Forward declarations
34             namespace geos {
35             namespace geom {
36             class PrecisionModel;
37             }
38             }
39              
40             namespace geos {
41             namespace noding { // geos::noding
42              
43             /** \brief
44             * Nodes a set of SegmentStrings completely.
45             *
46             * The set of segmentStrings is fully noded;
47             * i.e. noding is repeated until no further
48             * intersections are detected.
49             *
50             * Iterated noding using a FLOATING precision model is not guaranteed to converge,
51             * due to roundoff error. This problem is detected and an exception is thrown.
52             * Clients can choose to rerun the noding using a lower precision model.
53             *
54             */
55             class GEOS_DLL IteratedNoder : public Noder { // implements Noder
56              
57             private:
58             static const int MAX_ITER = 5;
59              
60              
61             const geom::PrecisionModel *pm;
62             algorithm::LineIntersector li;
63             std::vector* nodedSegStrings;
64             int maxIter;
65              
66             /**
67             * Node the input segment strings once
68             * and create the split edges between the nodes
69             */
70             void node(std::vector* segStrings,
71             int *numInteriorIntersections);
72              
73             public:
74              
75 2           IteratedNoder(const geom::PrecisionModel *newPm)
76             :
77             pm(newPm),
78             li(pm),
79 2 50         maxIter(MAX_ITER)
80             {
81 2           }
82              
83             ~IteratedNoder() override {}
84              
85             /**
86             * Sets the maximum number of noding iterations performed before
87             * the noding is aborted.
88             * Experience suggests that this should rarely need to be changed
89             * from the default.
90             * The default is MAX_ITER.
91             *
92             * @param n the maximum number of iterations to perform
93             */
94 1           void setMaximumIterations(int n) { maxIter = n; }
95              
96             std::vector* getNodedSubstrings() const override {
97             return nodedSegStrings;
98             }
99              
100              
101             /**
102             * Fully nodes a list of {@link SegmentStrings}, i.e. peforms noding iteratively
103             * until no intersections are found between segments.
104             * Maintains labelling of edges correctly through
105             * the noding.
106             *
107             * @param segStrings a collection of SegmentStrings to be noded
108             * @throws TopologyException if the iterated noding fails to converge.
109             */
110             void computeNodes(std::vector* inputSegmentStrings) override; // throw(GEOSException);
111             };
112              
113             } // namespace geos::noding
114             } // namespace geos
115              
116              
117             #endif // GEOS_NODING_ITERATEDNODER_H