OTB  9.0.0
Orfeo Toolbox
otbOGRGeometryWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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
38 {
39 namespace ogr
40 {
41 namespace internal
42 {
53 struct OTBGdalAdapters_EXPORT GeometryDeleter
54 {
55  void operator()(OGRGeometry* p);
56 };
57 } // internal namespace
58 
59 
60 // we don't encapsulate OGRGeometry, but please, don't create new geometries with a new.
61 
109 typedef boost::interprocess::unique_ptr<OGRGeometry, internal::GeometryDeleter> UniqueGeometryPtr;
111 OTBGdalAdapters_EXPORT bool Intersects(OGRGeometry const& lhs, OGRGeometry const& rhs);
113 OTBGdalAdapters_EXPORT bool Equals(OGRGeometry const& lhs, OGRGeometry const& rhs);
115 OTBGdalAdapters_EXPORT bool Disjoint(OGRGeometry const& lhs, OGRGeometry const& rhs);
117 OTBGdalAdapters_EXPORT bool Touches(OGRGeometry const& lhs, OGRGeometry const& rhs);
119 OTBGdalAdapters_EXPORT bool Crosses(OGRGeometry const& lhs, OGRGeometry const& rhs);
121 OTBGdalAdapters_EXPORT bool Within(OGRGeometry const& lhs, OGRGeometry const& rhs);
123 OTBGdalAdapters_EXPORT bool Contains(OGRGeometry const& lhs, OGRGeometry const& rhs);
125 OTBGdalAdapters_EXPORT bool Overlaps(OGRGeometry const& lhs, OGRGeometry const& rhs);
127 OTBGdalAdapters_EXPORT double Distance(OGRGeometry const& lhs, OGRGeometry const& rhs);
129 
131 OTBGdalAdapters_EXPORT UniqueGeometryPtr Intersection(OGRGeometry const& lhs, OGRGeometry const& rhs);
133 OTBGdalAdapters_EXPORT UniqueGeometryPtr Union(OGRGeometry const& lhs, OGRGeometry const& rhs);
135 OTBGdalAdapters_EXPORT UniqueGeometryPtr UnionCascaded(OGRGeometry const& this_);
137 OTBGdalAdapters_EXPORT UniqueGeometryPtr Difference(OGRGeometry const& lhs, OGRGeometry const& rhs);
139 OTBGdalAdapters_EXPORT UniqueGeometryPtr SymDifference(OGRGeometry const& lhs, OGRGeometry const& rhs); // -1.8
140 
150 OTBGdalAdapters_EXPORT UniqueGeometryPtr Simplify(OGRGeometry const& g, double tolerance);
152 
157 OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyDontPreserveTopology(OGRGeometry const& g, double tolerance);
158 
163 OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyPreserveTopology(OGRGeometry const& g, double tolerance);
164 
166 }
167 } // end namespace otb::ogr
168 
169 #ifndef OTB_MANUAL_INSTANTIATION
170 // #include "otbOGRGeometryWrapper.hxx"
171 #endif
172 
173 #endif // otbOGRGeometryWrapper_h
otb::ogr::SimplifyDontPreserveTopology
OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyDontPreserveTopology(OGRGeometry const &g, double tolerance)
otb::ogr::Within
OTBGdalAdapters_EXPORT bool Within(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for containment.
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ogr::SimplifyPreserveTopology
OTBGdalAdapters_EXPORT UniqueGeometryPtr SimplifyPreserveTopology(OGRGeometry const &g, double tolerance)
otb::ogr::UniqueGeometryPtr
boost::interprocess::unique_ptr< OGRGeometry, internal::GeometryDeleter > UniqueGeometryPtr
Definition: otbOGRGeometryWrapper.h:109
otb::ogr::Difference
OTBGdalAdapters_EXPORT UniqueGeometryPtr Difference(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes difference.
otb::ogr::Touches
OTBGdalAdapters_EXPORT bool Touches(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for touching.
otb::ogr::Contains
OTBGdalAdapters_EXPORT bool Contains(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for containment.
otb::ogr::Distance
OTBGdalAdapters_EXPORT double Distance(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes distance between two geometries.
otb::ogr::SymDifference
OTBGdalAdapters_EXPORT UniqueGeometryPtr SymDifference(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes symmetric difference.
otb::ogr::Simplify
OTBGdalAdapters_EXPORT UniqueGeometryPtr Simplify(OGRGeometry const &g, double tolerance)
otb::ogr::Intersects
OTBGdalAdapters_EXPORT bool Intersects(OGRGeometry const &lhs, OGRGeometry const &rhs)
Do these features intersect?
otb::ogr::Crosses
OTBGdalAdapters_EXPORT bool Crosses(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for crossing.
otb::ogr::UnionCascaded
OTBGdalAdapters_EXPORT UniqueGeometryPtr UnionCascaded(OGRGeometry const &this_)
Computes union using cascading.
otb::ogr::Union
OTBGdalAdapters_EXPORT UniqueGeometryPtr Union(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes union.
otb::ogr::Disjoint
OTBGdalAdapters_EXPORT bool Disjoint(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for disjointness.
otb::ogr::Equals
OTBGdalAdapters_EXPORT bool Equals(OGRGeometry const &lhs, OGRGeometry const &rhs)
Returns wheither if two geometries are equivalent.
otb::ogr::Overlaps
OTBGdalAdapters_EXPORT bool Overlaps(OGRGeometry const &lhs, OGRGeometry const &rhs)
Tests for overlap.
otb::ogr::Intersection
OTBGdalAdapters_EXPORT UniqueGeometryPtr Intersection(OGRGeometry const &lhs, OGRGeometry const &rhs)
Computes intersection.
otb::ogr::internal::GeometryDeleter
Definition: otbOGRGeometryWrapper.h:53