OTB  9.0.0
Orfeo Toolbox
Classes | Typedefs | Functions
OGRGeometry Wrappers
+ Collaboration diagram for OGRGeometry Wrappers:

Classes

struct  otb::ogr::internal::GeometryDeleter
 

Typedefs

typedef boost::interprocess::unique_ptr< OGRGeometry, internal::GeometryDeleterotb::ogr::UniqueGeometryPtr
 

Functions

OTBGdalAdapters_EXPORT bool otb::ogr::Contains (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Crosses (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Difference (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Disjoint (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT double otb::ogr::Distance (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Equals (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Intersection (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Intersects (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
void otb::ogr::internal::GeometryDeleter::operator() (OGRGeometry *p)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Overlaps (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SymDifference (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Touches (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Union (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::UnionCascaded (OGRGeometry const &this_)
 
OTBGdalAdapters_EXPORT bool otb::ogr::Within (OGRGeometry const &lhs, OGRGeometry const &rhs)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Simplify (OGRGeometry const &g, double tolerance)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SimplifyDontPreserveTopology (OGRGeometry const &g, double tolerance)
 
OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SimplifyPreserveTopology (OGRGeometry const &g, double tolerance)
 

Detailed Description

Helper definition to handle OGRGeometry objects.

Note
OTB doesn't provide anything on top of OGRGeometryFactory to create new factories. Please, never create new OGRGeometry by hand with new operator as there is no guarantee they'll get destroyed within the proper memory context when released from an owning OGRFeature.

Thus, always use OGRGeometryFactory functions to create new geometries. You can then manage their lifetime manually or rely on UniqueGeometryPtr that provides a non-copyable, but movable RAII wrapper around OGRGeometry.

Since
OTB v 3.14.0

Typedef Documentation

◆ UniqueGeometryPtr

typedef boost::interprocess::unique_ptr<OGRGeometry, internal::GeometryDeleter> otb::ogr::UniqueGeometryPtr

Smart-pointer over OGRGeometry, with move-semantics. In a few words:

  • When a function receives a unique_ptr<>, it implicitly assumes responsibility of the received pointer.
  • When a function returns a unique_ptr<>, the client code implicitly assumes responsibility of the returned pointer.
  • When exiting a scope, the pointer is destroyed. Which means, as long as we keep using unique_ptr<> around functions calls, there is no need to burden our mind with the lifetime of the encapsulated pointers.
  • Moreover, we can specify how pointers are deleted; property that we exploit to use the ad'hoc destruction function from OGR API, see GeometryDeleter.
See also
http://www2.research.att.com/~bs/C++0xFAQ.html#rval about move-semantics.
http://www2.research.att.com/~bs/C++0xFAQ.html#std-unique_ptr about std::unique_ptr<>
GOTW #103, #104 about unique_ptr<> as well: http://herbsutter.com/gotw/_103/
Note
You may experiment difficulties to copy UniqueGeometryPtr. This is likelly to be normal. You'll have to emulate std::move() with boost::move() (with Boost v1.48+, or with boost::interprocess::move() otherwise). Check for instance Feature::StealGeometry(), or Feature::SetGeometryDirectly() to see examples.

Definition at line 109 of file otbOGRGeometryWrapper.h.

Function Documentation

◆ Contains()

OTBGdalAdapters_EXPORT bool otb::ogr::Contains ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Tests for containment.

◆ Crosses()

OTBGdalAdapters_EXPORT bool otb::ogr::Crosses ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Tests for crossing.

◆ Difference()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Difference ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Computes difference.

◆ Disjoint()

OTBGdalAdapters_EXPORT bool otb::ogr::Disjoint ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Tests for disjointness.

◆ Distance()

OTBGdalAdapters_EXPORT double otb::ogr::Distance ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Computes distance between two geometries.

◆ Equals()

OTBGdalAdapters_EXPORT bool otb::ogr::Equals ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Returns wheither if two geometries are equivalent.

◆ Intersection()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Intersection ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

◆ Intersects()

OTBGdalAdapters_EXPORT bool otb::ogr::Intersects ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

◆ operator()()

void otb::ogr::internal::GeometryDeleter::operator() ( OGRGeometry *  p)

◆ Overlaps()

OTBGdalAdapters_EXPORT bool otb::ogr::Overlaps ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Tests for overlap.

◆ Simplify()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Simplify ( OGRGeometry const &  g,
double  tolerance 
)

Simplifies Geometry. This function tries to uses the best simplication algorithm available in the current version of GDAL. Best in the sense of topology preservation. i.e. With GDAL v1.8.0, OGRGeometry::Simplify() is used; with GDAL v1.9.0+, OGRGeometry::SimplifyPreserveTopology() is used.

Precondition
Requires GDAL 1.8.0
See also
OGRGeometry::Simplify()
OGRGeometry::SimplifyPreserveTopology()

Referenced by otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().

◆ SimplifyDontPreserveTopology()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SimplifyDontPreserveTopology ( OGRGeometry const &  g,
double  tolerance 
)

Simplifies Geometry with no guarantee of preserving the geometry.

Precondition
Requires GDAL 1.8.0
See also
OGRGeometry::Simplify()

◆ SimplifyPreserveTopology()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SimplifyPreserveTopology ( OGRGeometry const &  g,
double  tolerance 
)

Simplifies Geometry while preserving topology.

Precondition
Requires GDAL 1.9.0
See also
OGRGeometry::SimplifyPreserveTopology()

◆ SymDifference()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::SymDifference ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Computes symmetric difference.

◆ Touches()

OTBGdalAdapters_EXPORT bool otb::ogr::Touches ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

Tests for touching.

◆ Union()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::Union ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)

◆ UnionCascaded()

OTBGdalAdapters_EXPORT UniqueGeometryPtr otb::ogr::UnionCascaded ( OGRGeometry const &  this_)

Computes union using cascading.

◆ Within()

OTBGdalAdapters_EXPORT bool otb::ogr::Within ( OGRGeometry const &  lhs,
OGRGeometry const &  rhs 
)