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) 2009 Sandro Santilli |
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/BasicSegmentString.java rev. 1.1 (JTS-1.9) |
16
|
|
|
|
|
|
|
* |
17
|
|
|
|
|
|
|
**********************************************************************/ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#ifndef GEOS_NODING_BASICSEGMENTSTRING_H |
20
|
|
|
|
|
|
|
#define GEOS_NODING_BASICSEGMENTSTRING_H |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#include |
23
|
|
|
|
|
|
|
#include // for inheritance |
24
|
|
|
|
|
|
|
#include // for inlines (size()) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#include |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#include |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
// Forward declarations |
31
|
|
|
|
|
|
|
namespace geos { |
32
|
|
|
|
|
|
|
namespace algorithm { |
33
|
|
|
|
|
|
|
//class LineIntersector; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
namespace geos { |
38
|
|
|
|
|
|
|
namespace noding { // geos.noding |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
/** |
41
|
|
|
|
|
|
|
* Represents a list of contiguous line segments, |
42
|
|
|
|
|
|
|
* and supports noding the segments. |
43
|
|
|
|
|
|
|
* The line segments are represented by an array of {@link Coordinate}s. |
44
|
|
|
|
|
|
|
* Intended to optimize the noding of contiguous segments by |
45
|
|
|
|
|
|
|
* reducing the number of allocated objects. |
46
|
|
|
|
|
|
|
* SegmentStrings can carry a context object, which is useful |
47
|
|
|
|
|
|
|
* for preserving topological or parentage information. |
48
|
|
|
|
|
|
|
* All noded substrings are initialized with the same context object. |
49
|
|
|
|
|
|
|
*/ |
50
|
|
|
|
|
|
|
class GEOS_DLL BasicSegmentString : public SegmentString { |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
public: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
/// Construct a BasicSegmentString. |
55
|
|
|
|
|
|
|
// |
56
|
|
|
|
|
|
|
/// @param newPts CoordinateSequence representing the string, |
57
|
|
|
|
|
|
|
/// externally owned |
58
|
|
|
|
|
|
|
/// @param newContext the context associated to this SegmentString |
59
|
|
|
|
|
|
|
/// |
60
|
5
|
|
|
|
|
|
BasicSegmentString(geom::CoordinateSequence *newPts, |
61
|
|
|
|
|
|
|
const void* newContext) |
62
|
|
|
|
|
|
|
: |
63
|
|
|
|
|
|
|
SegmentString(newContext), |
64
|
5
|
|
|
|
|
|
pts(newPts) |
65
|
5
|
|
|
|
|
|
{} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
~BasicSegmentString() override |
68
|
|
|
|
|
|
|
{} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
/// see dox in SegmentString.h |
71
|
|
|
|
|
|
|
unsigned int size() const override |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
return static_cast(pts->size()); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
/// see dox in SegmentString.h |
77
|
|
|
|
|
|
|
const geom::Coordinate& getCoordinate(unsigned int i) const override; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
/// see dox in SegmentString.h |
80
|
|
|
|
|
|
|
geom::CoordinateSequence* getCoordinates() const override; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
/// see dox in SegmentString.h |
83
|
|
|
|
|
|
|
bool isClosed() const override; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
/// see dox in SegmentString.h |
86
|
|
|
|
|
|
|
std::ostream& print(std::ostream& os) const override; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
/** \brief |
89
|
|
|
|
|
|
|
* Gets the octant of the segment starting at vertex index. |
90
|
|
|
|
|
|
|
* |
91
|
|
|
|
|
|
|
* @param index the index of the vertex starting the segment. |
92
|
|
|
|
|
|
|
* Must not be the last index in the vertex list |
93
|
|
|
|
|
|
|
* @return the octant of the segment at the vertex |
94
|
|
|
|
|
|
|
*/ |
95
|
|
|
|
|
|
|
int getSegmentOctant(unsigned int index) const; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
private: |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
geom::CoordinateSequence *pts; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
}; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} // namespace geos.noding |
104
|
|
|
|
|
|
|
} // namespace geos |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#endif // ndef GEOS_NODING_BASICSEGMENTSTRING_H |
107
|
|
|
|
|
|
|
|