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/SegmentNode.java rev. 1.6 (JTS-1.9) |
16
|
|
|
|
|
|
|
* |
17
|
|
|
|
|
|
|
**********************************************************************/ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#ifndef GEOS_NODING_SEGMENTNODE_H |
20
|
|
|
|
|
|
|
#define GEOS_NODING_SEGMENTNODE_H |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#include |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#include |
25
|
|
|
|
|
|
|
#include |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#include |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#include |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
// Forward declarations |
32
|
|
|
|
|
|
|
namespace geos { |
33
|
|
|
|
|
|
|
namespace noding { |
34
|
|
|
|
|
|
|
class NodedSegmentString; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
namespace geos { |
39
|
|
|
|
|
|
|
namespace noding { // geos.noding |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
/// Represents an intersection point between two NodedSegmentString. |
42
|
|
|
|
|
|
|
// |
43
|
|
|
|
|
|
|
/// Final class. |
44
|
|
|
|
|
|
|
/// |
45
|
|
|
|
|
|
|
class GEOS_DLL SegmentNode { |
46
|
|
|
|
|
|
|
private: |
47
|
|
|
|
|
|
|
const NodedSegmentString& segString; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
int segmentOctant; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
bool isInteriorVar; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
// Declare type as noncopyable |
54
|
|
|
|
|
|
|
SegmentNode(const SegmentNode& other) = delete; |
55
|
|
|
|
|
|
|
SegmentNode& operator=(const SegmentNode& rhs) = delete; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
public: |
58
|
|
|
|
|
|
|
friend std::ostream& operator<< (std::ostream& os, const SegmentNode& n); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
/// the point of intersection (own copy) |
61
|
|
|
|
|
|
|
geom::Coordinate coord; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
/// the index of the containing line segment in the parent edge |
64
|
|
|
|
|
|
|
unsigned int segmentIndex; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
/// Construct a node on the given NodedSegmentString |
67
|
|
|
|
|
|
|
// |
68
|
|
|
|
|
|
|
/// @param ss the parent NodedSegmentString |
69
|
|
|
|
|
|
|
/// |
70
|
|
|
|
|
|
|
/// @param coord the coordinate of the intersection, will be copied |
71
|
|
|
|
|
|
|
/// |
72
|
|
|
|
|
|
|
/// @param nSegmentIndex the index of the segment on parent |
73
|
|
|
|
|
|
|
/// NodedSegmentString |
74
|
|
|
|
|
|
|
/// where the Node is located. |
75
|
|
|
|
|
|
|
/// |
76
|
|
|
|
|
|
|
/// @param nSegmentOctant |
77
|
|
|
|
|
|
|
/// |
78
|
|
|
|
|
|
|
SegmentNode(const NodedSegmentString& ss, |
79
|
|
|
|
|
|
|
const geom::Coordinate& nCoord, |
80
|
|
|
|
|
|
|
unsigned int nSegmentIndex, int nSegmentOctant); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
~SegmentNode() {} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
/// \brief |
85
|
|
|
|
|
|
|
/// Return true if this Node is *internal* (not on the boundary) |
86
|
|
|
|
|
|
|
/// of the corresponding segment. Currently only the *first* |
87
|
|
|
|
|
|
|
/// segment endpoint is checked, actually. |
88
|
|
|
|
|
|
|
/// |
89
|
4
|
|
|
|
|
|
bool isInterior() const { return isInteriorVar; } |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
bool isEndPoint(unsigned int maxSegmentIndex) const; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
/** |
94
|
|
|
|
|
|
|
* @return -1 this EdgeIntersection is located before |
95
|
|
|
|
|
|
|
* the argument location |
96
|
|
|
|
|
|
|
* @return 0 this EdgeIntersection is at the argument location |
97
|
|
|
|
|
|
|
* @return 1 this EdgeIntersection is located after the |
98
|
|
|
|
|
|
|
* argument location |
99
|
|
|
|
|
|
|
*/ |
100
|
|
|
|
|
|
|
int compareTo(const SegmentNode& other); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
//string print() const; |
103
|
|
|
|
|
|
|
}; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
std::ostream& operator<< (std::ostream& os, const SegmentNode& n); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
struct GEOS_DLL SegmentNodeLT { |
108
|
|
|
|
|
|
|
bool operator()(SegmentNode *s1, SegmentNode *s2) const { |
109
|
|
|
|
|
|
|
return s1->compareTo(*s2)<0; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
}; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} // namespace geos.noding |
115
|
|
|
|
|
|
|
} // namespace geos |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#endif // GEOS_NODING_SEGMENTNODE_H |