OTB  6.7.0
Orfeo Toolbox
otbOGRGeometryWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbOGRGeometryWrapper_h
22 #define otbOGRGeometryWrapper_h
23 
24 #if defined(__GNUC__) || defined(__clang__)
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wshadow"
27 #include <boost/interprocess/smart_ptr/unique_ptr.hpp>
28 #pragma GCC diagnostic pop
29 #else
30 #include <boost/interprocess/smart_ptr/unique_ptr.hpp>
31 #endif
32 
33 #include "OTBGdalAdaptersExport.h"
34 
35 class OGRGeometry;
36 
37 namespace otb { namespace ogr {
38 namespace internal {
49 struct OTBGdalAdapters_EXPORT GeometryDeleter
50  {
51  void operator()(OGRGeometry* p);
52  };
53 } // internal namespace
54 
55 
56 // we don't encapsulate OGRGeometry, but please, don't create new geometries with a new.
57 
105 typedef boost::interprocess::unique_ptr<OGRGeometry, internal::GeometryDeleter> UniqueGeometryPtr;
107 OTBGdalAdapters_EXPORT bool Intersects (OGRGeometry const& lhs, OGRGeometry const& rhs);
109 OTBGdalAdapters_EXPORT bool Equals (OGRGeometry const& lhs, OGRGeometry const& rhs);
111 OTBGdalAdapters_EXPORT bool Disjoint (OGRGeometry const& lhs, OGRGeometry const& rhs);
113 OTBGdalAdapters_EXPORT bool Touches (OGRGeometry const& lhs, OGRGeometry const& rhs);
115 OTBGdalAdapters_EXPORT bool Crosses (OGRGeometry const& lhs, OGRGeometry const& rhs);
117 OTBGdalAdapters_EXPORT bool Within (OGRGeometry const& lhs, OGRGeometry const& rhs);
119 OTBGdalAdapters_EXPORT bool Contains (OGRGeometry const& lhs, OGRGeometry const& rhs);
121 OTBGdalAdapters_EXPORT bool Overlaps (OGRGeometry const& lhs, OGRGeometry const& rhs);
123 OTBGdalAdapters_EXPORT double Distance (OGRGeometry const& lhs, OGRGeometry const& rhs);
125 
127 OTBGdalAdapters_EXPORT UniqueGeometryPtr Intersection (OGRGeometry const& lhs, OGRGeometry const& rhs);
129 OTBGdalAdapters_EXPORT UniqueGeometryPtr Union (OGRGeometry const& lhs, OGRGeometry const& rhs);
131 OTBGdalAdapters_EXPORT UniqueGeometryPtr UnionCascaded (OGRGeometry const& this_);
133 OTBGdalAdapters_EXPORT UniqueGeometryPtr Difference (OGRGeometry const& lhs, OGRGeometry const& rhs);
135 OTBGdalAdapters_EXPORT UniqueGeometryPtr SymDifference (OGRGeometry const& lhs, OGRGeometry const& rhs); // -1.8
136 
146 OTBGdalAdapters_EXPORT UniqueGeometryPtr Simplify(OGRGeometry const& g, double tolerance);
148 
153 OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyDontPreserveTopology(OGRGeometry const& g, double tolerance);
154 
159 OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyPreserveTopology(OGRGeometry const& g, double tolerance);
160 
163 } } // end namespace otb::ogr
164 
165 #ifndef OTB_MANUAL_INSTANTIATION
166 // #include "otbOGRGeometryWrapper.hxx"
167 #endif
168 
169 #endif // otbOGRGeometryWrapper_h
OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyDontPreserveTopology(OGRGeometry const &g, double tolerance)
OTBGdalAdapters_EXPORT UniqueGeometryPtr SymDifference(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes symmetric difference.
OTBGdalAdapters_EXPORT bool Overlaps(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for overlap.
OTBGdalAdapters_EXPORT bool Crosses(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for crossing.
OTBGdalAdapters_EXPORT bool Equals(OGRGeometry const &lhs, OGRGeometry const &rhs)
Returns wheither if two geometries are equivalent.
OTBGdalAdapters_EXPORT bool Disjoint(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for disjointness.
OTBGdalAdapters_EXPORT bool Touches(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for touching.
OTBGdalAdapters_EXPORT UniqueGeometryPtr Simplify(OGRGeometry const &g, double tolerance)
OTBGdalAdapters_EXPORT UniqueGeometryPtr UnionCascaded(OGRGeometry const &this_)
Computes union using cascading.
OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyPreserveTopology(OGRGeometry const &g, double tolerance)
OTBGdalAdapters_EXPORT UniqueGeometryPtr Difference(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes difference.
OTBGdalAdapters_EXPORT bool Contains(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for containment.
boost::interprocess::unique_ptr< OGRGeometry, internal::GeometryDeleter > UniqueGeometryPtr
OTBGdalAdapters_EXPORT bool Within(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for containment.
OTBGdalAdapters_EXPORT double Distance(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes distance between two geometries.
OTBGdalAdapters_EXPORT UniqueGeometryPtr Union(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes union.
OTBGdalAdapters_EXPORT UniqueGeometryPtr Intersection(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes intersection.
OTBGdalAdapters_EXPORT bool Intersects(OGRGeometry const &lhs, OGRGeometry const &rhs)
Do these features intersect?