|
Fishnet 2.0.1
Framework for Graph-Based Analysis of GIS Vector Data
|
Adapter for an OGRGeometry of statically unknown type, as handed out by a data source. More...
#include <OGRGeometryAdapter.hpp>


Public Types | |
| using | numeric_type = double |
Public Types inherited from fishnet::geometry::OGRAdapterBase< OGRGeometry > | |
| using | numeric_type = double |
Public Member Functions | |
| OGRGeometryAdapter (OGRUniquePtr< OGRGeometry > &&geometryPtr) | |
| OGRGeometryAdapter (const OGRRingAdapter &ring) | |
| OGRGeometryAdapter (const OGRPolygonAdapter &polygon) | |
| OGRGeometryAdapter (const OGRMultiPolygonAdapter &multiPolygon) | |
| OGRGeometryAdapter (OGRRingAdapter &&ring) | |
| Adopt a ring, polygon or multi-polygon which is no longer needed, without cloning it. | |
| OGRGeometryAdapter (OGRPolygonAdapter &&polygon) | |
| OGRGeometryAdapter (OGRMultiPolygonAdapter &&multiPolygon) | |
| OGRGeometryAdapter (const IRing auto &ring) | |
| Build from any ring, polygon or multi-polygon which is not already one of the OGR adapters above, by first converting it through the corresponding adapter. | |
| OGRGeometryAdapter (const IPolygon auto &polygon) | |
| OGRGeometryAdapter (const IMultiPolygon auto &multiPolygon) | |
| GeometryType | geometryType () const noexcept |
| Geometry type of the wrapped geometry. | |
| bool | isEmpty () const noexcept |
| bool | isRing () const noexcept |
| Whether the wrapped geometry can be viewed as a ring. | |
| bool | isPolygon () const noexcept |
| bool | isMultiPolygon () const noexcept |
| bool | isPoint () const noexcept |
| Option< Vec2DReal > | toPoint () const |
| Read the wrapped point out into a Vec2DReal. | |
| Option< OGRRingAdapter > | toRing () const |
| Convert to an OGRRingAdapter. | |
| Option< OGRPolygonAdapter > | toPolygon () const & |
| Convert to an OGRPolygonAdapter. | |
| Option< OGRPolygonAdapter > | toPolygon () && |
| Hand the wrapped polygon over to an OGRPolygonAdapter, without copying it. | |
| Option< OGRMultiPolygonAdapter > | toMultiPolygon () const & |
| Convert to an OGRMultiPolygonAdapter. | |
| Option< OGRMultiPolygonAdapter > | toMultiPolygon () && |
| Hand the wrapped multi-polygon over to an OGRMultiPolygonAdapter, without copying it. | |
| template<typename G > requires OGRLayerGeometry<G> || Shape<G> | |
| Option< NarrowTarget< G > > | narrowTo () const & |
| Narrow to G, leaving this adapter intact. | |
| template<typename G > requires OGRLayerGeometry<G> || Shape<G> | |
| Option< NarrowTarget< G > > | narrowTo () && |
| Narrow to G, coercing between polygon and multi-polygon where the shape is the same. | |
Public Member Functions inherited from fishnet::geometry::OGRAdapterBase< OGRGeometry > | |
| OGRAdapterBase (OGRUniquePtr< OGRGeometry > &&geomPtr) | |
| OGRAdapterBase (OGRAdapterBase &&other) noexcept | |
| OGRAdapterBase (const OGRAdapterBase &other) | |
| OGRAdapterBase & | operator= (const OGRAdapterBase &other) |
| OGRAdapterBase & | operator= (OGRAdapterBase &&other) noexcept |
| bool | operator== (const OGRAdapterBase &other) const noexcept |
| OGRGeometry * | raw () const noexcept |
| size_t | hash () const noexcept |
| std::string | toString () const |
Additional Inherited Members | |
Protected Attributes inherited from fishnet::geometry::OGRAdapterBase< OGRGeometry > | |
| OGRUniquePtr< OGRGeometry > | geomPtr |
Adapter for an OGRGeometry of statically unknown type, as handed out by a data source.
Narrows the wrapped geometry to one of the concrete adapters. Every conversion verifies the WKB type first and yields an empty Option if the geometry is of another type (or empty), so that a geometry read from a data source can be dispatched without an unchecked downcast:
OGRGeometryAdapter geometry {std::move(geometryPtr)};
geometry.toPolygon().if_value([](const auto & polygon){ ... });
The conversions copy the wrapped geometry, leaving this adapter intact.
| using fishnet::geometry::OGRGeometryAdapter::numeric_type = double |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Adopt a ring, polygon or multi-polygon which is no longer needed, without cloning it.
|
inline |
|
inline |
|
inline |
Build from any ring, polygon or multi-polygon which is not already one of the OGR adapters above, by first converting it through the corresponding adapter.
The adapter does the actual conversion (walking the shape's points/rings); the temporary it produces is then adopted by the move constructor above rather than cloned.
|
inline |
|
inline |
|
inlinenoexcept |
Geometry type of the wrapped geometry.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Whether the wrapped geometry can be viewed as a ring.
|
inline |
Narrow to G, coercing between polygon and multi-polygon where the shape is the same.
G is not limited to the OGR adapters: any other IRing/IPolygon/IMultiPolygon (a plain fishnet::geometry::Ring/Polygon/MultiPolygon, for instance) narrows to whichever adapter models the same kind of shape,
A data source does not always hold the geometry type its layer declares: a polygon layer may carry a multi-polygon of a single part, and a multi-polygon layer a lone polygon. Both denote the same shape, so they are converted rather than dropped. Anything else yields an empty Option, and the geometry is left where it was.
|
inline |
Narrow to G, leaving this adapter intact.
|
inline |
Hand the wrapped multi-polygon over to an OGRMultiPolygonAdapter, without copying it.
|
inline |
Convert to an OGRMultiPolygonAdapter.
Read the wrapped point out into a Vec2DReal.
|
inline |
Hand the wrapped polygon over to an OGRPolygonAdapter, without copying it.
For a geometry this adapter owns and the caller does not need afterwards, e.g. one just taken from a data source. On success this adapter is left moved-from and must not be used again.
|
inline |
Convert to an OGRPolygonAdapter.
|
inline |
Convert to an OGRRingAdapter.