GEOS  3.13.0dev
CommonBitsOp.h
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 #pragma once
16 
17 #include <geos/export.h>
18 #include <geos/precision/CommonBitsRemover.h> // for unique_ptr composition
19 
20 #include <vector>
21 #include <memory>
22 
23 #ifdef _MSC_VER
24 #pragma warning(push)
25 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
26 #endif
27 
28 namespace geos {
29 namespace geom {
30 class Geometry;
31 }
32 namespace precision {
33 //class CommonBitsRemover;
34 }
35 }
36 
37 namespace geos {
38 namespace precision { // geos.precision
39 
49 class GEOS_DLL CommonBitsOp {
50 
51 private:
52 
53  bool returnToOriginalPrecision;
54 
55  std::unique_ptr<CommonBitsRemover> cbr;
56 
65  std::unique_ptr<geom::Geometry> removeCommonBits(const geom::Geometry* geom0);
66 
70  void removeCommonBits(
71  const geom::Geometry* geom0,
72  const geom::Geometry* geom1,
73  std::unique_ptr<geom::Geometry>& rgeom0,
74  std::unique_ptr<geom::Geometry>& rgeom1);
75 
76 
77 public:
78 
83 
90  CommonBitsOp(bool nReturnToOriginalPrecision);
91 
100  std::unique_ptr<geom::Geometry> intersection(
101  const geom::Geometry* geom0,
102  const geom::Geometry* geom1);
103 
112  std::unique_ptr<geom::Geometry> Union(
113  const geom::Geometry* geom0,
114  const geom::Geometry* geom1);
115 
124  std::unique_ptr<geom::Geometry> difference(
125  const geom::Geometry* geom0,
126  const geom::Geometry* geom1);
127 
136  std::unique_ptr<geom::Geometry> symDifference(
137  const geom::Geometry* geom0,
138  const geom::Geometry* geom1);
139 
147  std::unique_ptr<geom::Geometry> buffer(
148  const geom::Geometry* geom0,
149  double distance);
150 
162  std::unique_ptr<geom::Geometry> computeResultPrecision(
163  std::unique_ptr<geom::Geometry> result);
164 };
165 
166 } // namespace geos.precision
167 } // namespace geos
168 
169 #ifdef _MSC_VER
170 #pragma warning(pop)
171 #endif
172 
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Provides versions of Geometry spatial functions which use common bit removal to reduce the likelihood...
Definition: CommonBitsOp.h:49
std::unique_ptr< geom::Geometry > difference(const geom::Geometry *geom0, const geom::Geometry *geom1)
Computes the set-theoretic difference of two Geometry, using enhanced precision.
std::unique_ptr< geom::Geometry > symDifference(const geom::Geometry *geom0, const geom::Geometry *geom1)
Computes the set-theoretic symmetric difference of two geometries, using enhanced precision.
std::unique_ptr< geom::Geometry > intersection(const geom::Geometry *geom0, const geom::Geometry *geom1)
Computes the set-theoretic intersection of two Geometry, using enhanced precision.
std::unique_ptr< geom::Geometry > Union(const geom::Geometry *geom0, const geom::Geometry *geom1)
Computes the set-theoretic union of two Geometry, using enhanced precision.
std::unique_ptr< geom::Geometry > buffer(const geom::Geometry *geom0, double distance)
Computes the buffer a geometry, using enhanced precision.
CommonBitsOp()
Creates a new instance of class, which reshifts result Geometry.
std::unique_ptr< geom::Geometry > computeResultPrecision(std::unique_ptr< geom::Geometry > result)
If required, returning the result to the orginal precision if required.
CommonBitsOp(bool nReturnToOriginalPrecision)
Creates a new instance of class, specifying whether the result geom::Geometrys should be reshifted.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25