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/OrientedCoordinateArray.java rev. 1.1 (JTS-1.9) |
16
|
|
|
|
|
|
|
* |
17
|
|
|
|
|
|
|
**********************************************************************/ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#ifndef GEOS_NODING_ORIENTEDCOORDINATEARRAY_H |
20
|
|
|
|
|
|
|
#define GEOS_NODING_ORIENTEDCOORDINATEARRAY_H |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#include |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
//#include |
25
|
|
|
|
|
|
|
//#include |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
//#include |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
// Forward declarations |
30
|
|
|
|
|
|
|
namespace geos { |
31
|
|
|
|
|
|
|
namespace geom { |
32
|
|
|
|
|
|
|
class CoordinateSequence; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
namespace noding { |
35
|
|
|
|
|
|
|
//class SegmentString; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
namespace geos { |
40
|
|
|
|
|
|
|
namespace noding { // geos.noding |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
/** \brief |
43
|
|
|
|
|
|
|
* Allows comparing {@link geom::CoordinateSequence}s |
44
|
|
|
|
|
|
|
* in an orientation-independent way. |
45
|
|
|
|
|
|
|
*/ |
46
|
|
|
|
|
|
|
class GEOS_DLL OrientedCoordinateArray |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
public: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
/** |
51
|
|
|
|
|
|
|
* Creates a new {@link OrientedCoordinateArray} |
52
|
|
|
|
|
|
|
* for the given {@link geom::CoordinateSequence}. |
53
|
|
|
|
|
|
|
* |
54
|
|
|
|
|
|
|
* @param pts the coordinates to orient |
55
|
|
|
|
|
|
|
*/ |
56
|
2
|
|
|
|
|
|
OrientedCoordinateArray(const geom::CoordinateSequence& pts) |
57
|
|
|
|
|
|
|
: |
58
|
|
|
|
|
|
|
pts(&pts), |
59
|
2
|
|
|
|
|
|
orientationVar(orientation(pts)) |
60
|
|
|
|
|
|
|
{ |
61
|
2
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
/** \brief |
64
|
|
|
|
|
|
|
* Compares two {@link OrientedCoordinateArray}s for their |
65
|
|
|
|
|
|
|
* relative order |
66
|
|
|
|
|
|
|
* |
67
|
|
|
|
|
|
|
* @return -1 this one is smaller |
68
|
|
|
|
|
|
|
* @return 0 the two objects are equal |
69
|
|
|
|
|
|
|
* @return 1 this one is greater |
70
|
|
|
|
|
|
|
* |
71
|
|
|
|
|
|
|
* In JTS, this is used automatically by ordered lists. |
72
|
|
|
|
|
|
|
* In C++, operator< would be used instead.... |
73
|
|
|
|
|
|
|
*/ |
74
|
|
|
|
|
|
|
int compareTo(const OrientedCoordinateArray& o1) const; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
private: |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
static int compareOriented(const geom::CoordinateSequence& pts1, |
80
|
|
|
|
|
|
|
bool orientation1, |
81
|
|
|
|
|
|
|
const geom::CoordinateSequence& pts2, |
82
|
|
|
|
|
|
|
bool orientation2); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
/** |
86
|
|
|
|
|
|
|
* Computes the canonical orientation for a coordinate array. |
87
|
|
|
|
|
|
|
* |
88
|
|
|
|
|
|
|
* @param pts the array to test |
89
|
|
|
|
|
|
|
* @return true if the points are oriented forwards |
90
|
|
|
|
|
|
|
* @return false
|
91
|
|
|
|
|
|
|
*/ |
92
|
|
|
|
|
|
|
static bool orientation(const geom::CoordinateSequence& pts); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
/// Externally owned |
95
|
|
|
|
|
|
|
const geom::CoordinateSequence* pts; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
bool orientationVar; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
}; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
/// Strict weak ordering operator for OrientedCoordinateArray |
102
|
|
|
|
|
|
|
// |
103
|
|
|
|
|
|
|
/// This is the C++ equivalent of JTS's compareTo |
104
|
|
|
|
|
|
|
inline bool operator< ( const OrientedCoordinateArray& oca1, |
105
|
|
|
|
|
|
|
const OrientedCoordinateArray& oca2 ) |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
return oca1.compareTo(oca2)<0; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
} // namespace geos.noding |
111
|
|
|
|
|
|
|
} // namespace geos |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#endif // GEOS_NODING_ORIENTEDCOORDINATEARRAY_H |
115
|
|
|
|
|
|
|
|