Fishnet 2.0.1
Framework for Graph-Based Analysis of GIS Vector Data
Loading...
Searching...
No Matches
fishnet::geometry::OGRMultiPolygonAdapter Class Reference

IMultiPolygon implementation backed by an OGRMultiPolygon. More...

#include <OGRMultiPolygonAdapter.hpp>

Inheritance diagram for fishnet::geometry::OGRMultiPolygonAdapter:
Collaboration diagram for fishnet::geometry::OGRMultiPolygonAdapter:

Public Types

using numeric_type = double
 
using polygon_type = OGRPolygonAdapter
 
- Public Types inherited from fishnet::geometry::OGRAdapterBase< OGRMultiPolygon >
using numeric_type = double
 

Public Member Functions

 OGRMultiPolygonAdapter (OGRUniquePtr< OGRMultiPolygon > &&multiPolygonPtr)
 
 OGRMultiPolygonAdapter (IMultiPolygon auto const &multiPolygon)
 
 OGRMultiPolygonAdapter (const PolygonRange auto &polygons, bool checked=false)
 Construct a multi-polygon from a range of polygons.
 
size_t size () const noexcept
 
auto getPolygons () const &-> fishnet::util::forward_range_of< OGRPolygonAdapter > auto
 
std::vector< OGRPolygonAdapter > getPolygons () const &&
 
bool addPolygon (const OGRPolygonAdapter &polygon) noexcept
 Add a polygon to the multi-polygon.
 
bool removePolygon (const OGRPolygonAdapter &polygon) noexcept
 
MultiPolygon< Polygon< double > > toNative () const
 Copy the multi-polygon out into a fishnet MultiPolygon, which precomputes its segments.
 
double area () const
 
Vec2DReal centroid () const
 Centroid of the multi-polygon, i.e. the centroids of its polygons weighted by area.
 
Rectangle< double > aaBB () const
 
bool isInside (const IPoint auto &point) const
 
bool isOnBoundary (const IPoint auto &point) const
 
bool isOutside (const IPoint auto &point) const
 
bool contains (const IPoint auto &point) const
 
bool contains (const ISegment auto &segment) const
 
bool contains (const IPolygon auto &query) const
 
bool containsInHole (const IPolygon auto &query) const
 
bool intersects (const LinearGeometry auto &linearFeature) const
 
std::unordered_set< Vec2DReal > intersections (const LinearGeometry auto &linearFeature) const
 
bool crosses (const IPolygon auto &query) const
 
bool touches (const IPolygon auto &query) const
 
double distance (const IPolygon auto &query) const
 
double distance (const IMultiPolygon auto &other) const
 
double distance (const OGRMultiPolygonAdapter &other) const
 Distance between two OGR backed multi-polygons.
 
- Public Member Functions inherited from fishnet::geometry::OGRAdapterBase< OGRMultiPolygon >
 OGRAdapterBase (OGRUniquePtr< OGRMultiPolygon > &&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
 
OGRMultiPolygon * raw () const noexcept
 
size_t hash () const noexcept
 
std::string toString () const
 

Static Public Attributes

static constexpr GeometryType type = GeometryType::MULTIPOLYGON
 

Friends

class OGRGeometryAdapter
 

Additional Inherited Members

- Protected Attributes inherited from fishnet::geometry::OGRAdapterBase< OGRMultiPolygon >
OGRUniquePtr< OGRMultiPolygon > geomPtr
 

Detailed Description

IMultiPolygon implementation backed by an OGRMultiPolygon.

Mirrors the semantics of fishnet::geometry::MultiPolygon: the polygons of a multi-polygon must neither be duplicates, nor cross, nor contain one another, which is enforced by addPolygon().

Member Typedef Documentation

◆ numeric_type

◆ polygon_type

Constructor & Destructor Documentation

◆ OGRMultiPolygonAdapter() [1/3]

fishnet::geometry::OGRMultiPolygonAdapter::OGRMultiPolygonAdapter ( OGRUniquePtr< OGRMultiPolygon > &&  multiPolygonPtr)
inline

◆ OGRMultiPolygonAdapter() [2/3]

fishnet::geometry::OGRMultiPolygonAdapter::OGRMultiPolygonAdapter ( IMultiPolygon auto const &  multiPolygon)
inline

◆ OGRMultiPolygonAdapter() [3/3]

fishnet::geometry::OGRMultiPolygonAdapter::OGRMultiPolygonAdapter ( const PolygonRange auto &  polygons,
bool  checked = false 
)
inline

Construct a multi-polygon from a range of polygons.

Parameters
polygonsrange of IPolygon objects
checkedif true the polygons are added as they are, otherwise invalid entries (duplicates, crossing or contained polygons) are skipped

Member Function Documentation

◆ aaBB()

Rectangle< double > fishnet::geometry::OGRMultiPolygonAdapter::aaBB ( ) const
inline

◆ addPolygon()

bool fishnet::geometry::OGRMultiPolygonAdapter::addPolygon ( const OGRPolygonAdapter &  polygon)
inlinenoexcept

Add a polygon to the multi-polygon.

Returns
false if the polygon is a duplicate, crosses or is contained in (or contains) one of the polygons already present, true on success

◆ area()

double fishnet::geometry::OGRMultiPolygonAdapter::area ( ) const
inline

◆ centroid()

Vec2DReal fishnet::geometry::OGRMultiPolygonAdapter::centroid ( ) const
inline

Centroid of the multi-polygon, i.e. the centroids of its polygons weighted by area.

◆ contains() [1/3]

bool fishnet::geometry::OGRMultiPolygonAdapter::contains ( const IPoint auto &  point) const
inline

◆ contains() [2/3]

bool fishnet::geometry::OGRMultiPolygonAdapter::contains ( const IPolygon auto &  query) const
inline

◆ contains() [3/3]

bool fishnet::geometry::OGRMultiPolygonAdapter::contains ( const ISegment auto &  segment) const
inline

◆ containsInHole()

bool fishnet::geometry::OGRMultiPolygonAdapter::containsInHole ( const IPolygon auto &  query) const
inline

◆ crosses()

bool fishnet::geometry::OGRMultiPolygonAdapter::crosses ( const IPolygon auto &  query) const
inline

◆ distance() [1/3]

double fishnet::geometry::OGRMultiPolygonAdapter::distance ( const IMultiPolygon auto &  other) const
inline

◆ distance() [2/3]

double fishnet::geometry::OGRMultiPolygonAdapter::distance ( const IPolygon auto &  query) const
inline

◆ distance() [3/3]

double fishnet::geometry::OGRMultiPolygonAdapter::distance ( const OGRMultiPolygonAdapter &  other) const
inline

Distance between two OGR backed multi-polygons.

Note
mirrors the generic overloads above (0 if any pair of member polygons overlaps or touches, otherwise the smallest gap between any pair), but leaves finding that pair to GEOS instead of checking every polygon of this against every polygon of other by hand

◆ getPolygons() [1/2]

std::vector< OGRPolygonAdapter > fishnet::geometry::OGRMultiPolygonAdapter::getPolygons ( ) const &&
inline

Note
every member of the wrapped multi-polygon is canonical (
See also
canonicalize()), so the members are handed out without normalising them again
Note
ref-qualified, same as OGRRingAdapter::getSegments(): the lvalue (&) overload below lazily reads through this on every access, cheap as long as this multi-polygon outlives the view; the rvalue (&&) overload, selected when this is itself a temporary, instead copies the polygons out into an owning vector before that temporary is destroyed.

◆ getPolygons() [2/2]

auto fishnet::geometry::OGRMultiPolygonAdapter::getPolygons ( ) const & -> fishnet::util::forward_range_of<OGRPolygonAdapter> auto
inline
Note
every member of the wrapped multi-polygon is canonical (
See also
canonicalize()), so the members are handed out without normalising them again
Note
ref-qualified, same as OGRRingAdapter::getSegments(): the lvalue (&) overload below lazily reads through this on every access, cheap as long as this multi-polygon outlives the view; the rvalue (&&) overload, selected when this is itself a temporary, instead copies the polygons out into an owning vector before that temporary is destroyed.

◆ intersections()

std::unordered_set< Vec2DReal > fishnet::geometry::OGRMultiPolygonAdapter::intersections ( const LinearGeometry auto &  linearFeature) const
inline

◆ intersects()

bool fishnet::geometry::OGRMultiPolygonAdapter::intersects ( const LinearGeometry auto &  linearFeature) const
inline

◆ isInside()

bool fishnet::geometry::OGRMultiPolygonAdapter::isInside ( const IPoint auto &  point) const
inline

◆ isOnBoundary()

bool fishnet::geometry::OGRMultiPolygonAdapter::isOnBoundary ( const IPoint auto &  point) const
inline

◆ isOutside()

bool fishnet::geometry::OGRMultiPolygonAdapter::isOutside ( const IPoint auto &  point) const
inline

◆ removePolygon()

bool fishnet::geometry::OGRMultiPolygonAdapter::removePolygon ( const OGRPolygonAdapter &  polygon)
inlinenoexcept

◆ size()

size_t fishnet::geometry::OGRMultiPolygonAdapter::size ( ) const
inlinenoexcept

◆ toNative()

MultiPolygon< Polygon< double > > fishnet::geometry::OGRMultiPolygonAdapter::toNative ( ) const
inline

Copy the multi-polygon out into a fishnet MultiPolygon, which precomputes its segments.

See also
OGRRingAdapter::toNative()

◆ touches()

bool fishnet::geometry::OGRMultiPolygonAdapter::touches ( const IPolygon auto &  query) const
inline

Friends And Related Symbol Documentation

◆ OGRGeometryAdapter

friend class OGRGeometryAdapter
friend

Member Data Documentation

◆ type

constexpr GeometryType fishnet::geometry::OGRMultiPolygonAdapter::type = GeometryType::MULTIPOLYGON
staticconstexpr

The documentation for this class was generated from the following file: