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) 2005-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
|
|
|
|
|
|
|
#ifndef GEOS_PRECISION_COMMONBITSOP_H |
16
|
|
|
|
|
|
|
#define GEOS_PRECISION_COMMONBITSOP_H |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#include |
19
|
|
|
|
|
|
|
#include // for unique_ptr composition |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#include |
22
|
|
|
|
|
|
|
#include |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#ifdef _MSC_VER |
25
|
|
|
|
|
|
|
#pragma warning(push) |
26
|
|
|
|
|
|
|
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class |
27
|
|
|
|
|
|
|
#endif |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
namespace geos { |
30
|
|
|
|
|
|
|
namespace geom { |
31
|
|
|
|
|
|
|
class Geometry; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
namespace precision { |
34
|
|
|
|
|
|
|
//class CommonBitsRemover; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
namespace geos { |
39
|
|
|
|
|
|
|
namespace precision { // geos.precision |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
/** \brief |
42
|
|
|
|
|
|
|
* Provides versions of Geometry spatial functions which use |
43
|
|
|
|
|
|
|
* common bit removal to reduce the likelihood of robustness problems. |
44
|
|
|
|
|
|
|
* |
45
|
|
|
|
|
|
|
* In the current implementation no rounding is performed on the |
46
|
|
|
|
|
|
|
* reshifted result geometry, which means that it is possible |
47
|
|
|
|
|
|
|
* that the returned Geometry is invalid. |
48
|
|
|
|
|
|
|
* Client classes should check the validity of the returned result themselves. |
49
|
|
|
|
|
|
|
*/ |
50
|
20
|
|
|
|
|
|
class GEOS_DLL CommonBitsOp { |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
private: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
bool returnToOriginalPrecision; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
std::unique_ptr cbr; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
/** \brief |
59
|
|
|
|
|
|
|
* Computes a copy of the input Geometry with the calculated |
60
|
|
|
|
|
|
|
* common bits removed from each coordinate. |
61
|
|
|
|
|
|
|
* |
62
|
|
|
|
|
|
|
* @param geom0 the Geometry to remove common bits from |
63
|
|
|
|
|
|
|
* @return a copy of the input Geometry with common bits removed |
64
|
|
|
|
|
|
|
* (caller takes responsibility of its deletion) |
65
|
|
|
|
|
|
|
*/ |
66
|
|
|
|
|
|
|
geom::Geometry* removeCommonBits(const geom::Geometry *geom0); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
/** \brief |
69
|
|
|
|
|
|
|
* |
70
|
|
|
|
|
|
|
*/ |
71
|
|
|
|
|
|
|
void removeCommonBits( |
72
|
|
|
|
|
|
|
const geom::Geometry* geom0, |
73
|
|
|
|
|
|
|
const geom::Geometry* geom1, |
74
|
|
|
|
|
|
|
std::unique_ptr& rgeom0, |
75
|
|
|
|
|
|
|
std::unique_ptr& rgeom1); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
public: |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
/** |
81
|
|
|
|
|
|
|
* Creates a new instance of class, which reshifts result Geometry |
82
|
|
|
|
|
|
|
*/ |
83
|
|
|
|
|
|
|
CommonBitsOp(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
/** |
86
|
|
|
|
|
|
|
* Creates a new instance of class, specifying whether |
87
|
|
|
|
|
|
|
* the result {@link Geometry}s should be reshifted. |
88
|
|
|
|
|
|
|
* |
89
|
|
|
|
|
|
|
* @param returnToOriginalPrecision |
90
|
|
|
|
|
|
|
*/ |
91
|
|
|
|
|
|
|
CommonBitsOp(bool nReturnToOriginalPrecision); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
/** |
94
|
|
|
|
|
|
|
* Computes the set-theoretic intersection of two Geometry, |
95
|
|
|
|
|
|
|
* using enhanced precision. |
96
|
|
|
|
|
|
|
* @param geom0 the first Geometry |
97
|
|
|
|
|
|
|
* @param geom1 the second Geometry |
98
|
|
|
|
|
|
|
* @return the Geometry representing the set-theoretic |
99
|
|
|
|
|
|
|
* intersection of the input Geometries. |
100
|
|
|
|
|
|
|
*/ |
101
|
|
|
|
|
|
|
geom::Geometry* intersection( |
102
|
|
|
|
|
|
|
const geom::Geometry *geom0, |
103
|
|
|
|
|
|
|
const geom::Geometry *geom1); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
/** |
106
|
|
|
|
|
|
|
* Computes the set-theoretic union of two Geometry, |
107
|
|
|
|
|
|
|
* using enhanced precision. |
108
|
|
|
|
|
|
|
* @param geom0 the first Geometry |
109
|
|
|
|
|
|
|
* @param geom1 the second Geometry |
110
|
|
|
|
|
|
|
* @return the Geometry representing the set-theoretic union |
111
|
|
|
|
|
|
|
* of the input Geometries. |
112
|
|
|
|
|
|
|
*/ |
113
|
|
|
|
|
|
|
geom::Geometry* Union( |
114
|
|
|
|
|
|
|
const geom::Geometry *geom0, |
115
|
|
|
|
|
|
|
const geom::Geometry *geom1); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
/** |
118
|
|
|
|
|
|
|
* Computes the set-theoretic difference of two Geometry, |
119
|
|
|
|
|
|
|
* using enhanced precision. |
120
|
|
|
|
|
|
|
* @param geom0 the first Geometry |
121
|
|
|
|
|
|
|
* @param geom1 the second Geometry, to be subtracted from the first |
122
|
|
|
|
|
|
|
* @return the Geometry representing the set-theoretic difference |
123
|
|
|
|
|
|
|
* of the input Geometries. |
124
|
|
|
|
|
|
|
*/ |
125
|
|
|
|
|
|
|
geom::Geometry* difference( |
126
|
|
|
|
|
|
|
const geom::Geometry *geom0, |
127
|
|
|
|
|
|
|
const geom::Geometry *geom1); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
/** |
130
|
|
|
|
|
|
|
* Computes the set-theoretic symmetric difference of two geometries, |
131
|
|
|
|
|
|
|
* using enhanced precision. |
132
|
|
|
|
|
|
|
* @param geom0 the first Geometry |
133
|
|
|
|
|
|
|
* @param geom1 the second Geometry |
134
|
|
|
|
|
|
|
* @return the Geometry representing the set-theoretic symmetric |
135
|
|
|
|
|
|
|
* difference of the input Geometries. |
136
|
|
|
|
|
|
|
*/ |
137
|
|
|
|
|
|
|
geom::Geometry* symDifference( |
138
|
|
|
|
|
|
|
const geom::Geometry *geom0, |
139
|
|
|
|
|
|
|
const geom::Geometry *geom1); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
/** |
142
|
|
|
|
|
|
|
* Computes the buffer a geometry, |
143
|
|
|
|
|
|
|
* using enhanced precision. |
144
|
|
|
|
|
|
|
* @param geom0 the Geometry to buffer |
145
|
|
|
|
|
|
|
* @param distance the buffer distance |
146
|
|
|
|
|
|
|
* @return the Geometry representing the buffer of the input Geometry. |
147
|
|
|
|
|
|
|
*/ |
148
|
|
|
|
|
|
|
geom::Geometry* buffer( |
149
|
|
|
|
|
|
|
const geom::Geometry *geom0, |
150
|
|
|
|
|
|
|
double distance); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
/** |
153
|
|
|
|
|
|
|
* If required, returning the result to the orginal precision |
154
|
|
|
|
|
|
|
* if required. |
155
|
|
|
|
|
|
|
* |
156
|
|
|
|
|
|
|
* In this current implementation, no rounding is performed on the |
157
|
|
|
|
|
|
|
* reshifted result geometry, which means that it is possible |
158
|
|
|
|
|
|
|
* that the returned Geometry is invalid. |
159
|
|
|
|
|
|
|
* |
160
|
|
|
|
|
|
|
* @param result the result Geometry to modify |
161
|
|
|
|
|
|
|
* @return the result Geometry with the required precision |
162
|
|
|
|
|
|
|
*/ |
163
|
|
|
|
|
|
|
geom::Geometry* computeResultPrecision( |
164
|
|
|
|
|
|
|
geom::Geometry *result); |
165
|
|
|
|
|
|
|
}; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} // namespace geos.precision |
168
|
|
|
|
|
|
|
} // namespace geos |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
#ifdef _MSC_VER |
171
|
|
|
|
|
|
|
#pragma warning(pop) |
172
|
|
|
|
|
|
|
#endif |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
#endif // GEOS_PRECISION_COMMONBITSOP_H |