| 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/FastNodingValidator.java rev. ??? (JTS-1.8) |
|
16
|
|
|
|
|
|
|
* |
|
17
|
|
|
|
|
|
|
**********************************************************************/ |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#ifndef GEOS_NODING_FASTNODINGVALIDATOR_H |
|
20
|
|
|
|
|
|
|
#define GEOS_NODING_FASTNODINGVALIDATOR_H |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#include // for composition |
|
23
|
|
|
|
|
|
|
#include // for composition |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#include |
|
26
|
|
|
|
|
|
|
#include |
|
27
|
|
|
|
|
|
|
#include |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
// Forward declarations |
|
30
|
|
|
|
|
|
|
namespace geos { |
|
31
|
|
|
|
|
|
|
namespace noding { |
|
32
|
|
|
|
|
|
|
class SegmentString; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
namespace geos { |
|
37
|
|
|
|
|
|
|
namespace noding { // geos.noding |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
/** \brief |
|
40
|
|
|
|
|
|
|
* Validates that a collection of {@link SegmentString}s is correctly noded. |
|
41
|
|
|
|
|
|
|
* |
|
42
|
|
|
|
|
|
|
* Uses indexes to improve performance. |
|
43
|
|
|
|
|
|
|
* Does NOT check a-b-a collapse situations. |
|
44
|
|
|
|
|
|
|
* Also does not check for endpt-interior vertex intersections. |
|
45
|
|
|
|
|
|
|
* This should not be a problem, since the noders should be |
|
46
|
|
|
|
|
|
|
* able to compute intersections between vertices correctly. |
|
47
|
|
|
|
|
|
|
* User may either test the valid condition, or request that a |
|
48
|
|
|
|
|
|
|
* {@link TopologyException} |
|
49
|
|
|
|
|
|
|
* be thrown. |
|
50
|
|
|
|
|
|
|
* |
|
51
|
|
|
|
|
|
|
* @version 1.7 |
|
52
|
|
|
|
|
|
|
*/ |
|
53
|
6
|
|
|
|
|
|
class FastNodingValidator |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
public: |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
|
FastNodingValidator(std::vector& newSegStrings) |
|
59
|
|
|
|
|
|
|
: |
|
60
|
|
|
|
|
|
|
li(), // robust... |
|
61
|
|
|
|
|
|
|
segStrings(newSegStrings), |
|
62
|
|
|
|
|
|
|
segInt(), |
|
63
|
3
|
|
|
|
|
|
isValidVar(true) |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
3
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
/** |
|
68
|
|
|
|
|
|
|
* Checks for an intersection and |
|
69
|
|
|
|
|
|
|
* reports if one is found. |
|
70
|
|
|
|
|
|
|
* |
|
71
|
|
|
|
|
|
|
* @return true if the arrangement contains an interior intersection |
|
72
|
|
|
|
|
|
|
*/ |
|
73
|
2
|
|
|
|
|
|
bool isValid() |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
2
|
|
|
|
|
|
execute(); |
|
76
|
2
|
|
|
|
|
|
return isValidVar; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
/** |
|
80
|
|
|
|
|
|
|
* Returns an error message indicating the segments containing |
|
81
|
|
|
|
|
|
|
* the intersection. |
|
82
|
|
|
|
|
|
|
* |
|
83
|
|
|
|
|
|
|
* @return an error message documenting the intersection location |
|
84
|
|
|
|
|
|
|
*/ |
|
85
|
|
|
|
|
|
|
std::string getErrorMessage() const; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
/** |
|
88
|
|
|
|
|
|
|
* Checks for an intersection and throws |
|
89
|
|
|
|
|
|
|
* a TopologyException if one is found. |
|
90
|
|
|
|
|
|
|
* |
|
91
|
|
|
|
|
|
|
* @throws TopologyException if an intersection is found |
|
92
|
|
|
|
|
|
|
*/ |
|
93
|
|
|
|
|
|
|
void checkValid(); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
private: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
geos::algorithm::LineIntersector li; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
std::vector& segStrings; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
std::unique_ptr segInt; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
bool isValidVar; |
|
104
|
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
|
void execute() |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
2
|
50
|
|
|
|
|
if (segInt.get() != nullptr) return; |
|
108
|
2
|
|
|
|
|
|
checkInteriorIntersections(); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
void checkInteriorIntersections(); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
// Declare type as noncopyable |
|
114
|
|
|
|
|
|
|
FastNodingValidator(const FastNodingValidator& other) = delete; |
|
115
|
|
|
|
|
|
|
FastNodingValidator& operator=(const FastNodingValidator& rhs) = delete; |
|
116
|
|
|
|
|
|
|
}; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} // namespace geos.noding |
|
119
|
|
|
|
|
|
|
} // namespace geos |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
#endif // GEOS_NODING_FASTNODINGVALIDATOR_H |