IPolygon implementation backed by an OGRPolygon.
More...
#include <OGRPolygonAdapter.hpp>
|
| using | Base = OGRAdapterBase< OGRPolygon > |
| |
| void | canonicalize () noexcept |
| | Bring the wrapped polygon into the canonical form of GEOS.
|
| |
| bool | envelopeOverlaps (const IPoint auto &lhs, const IPoint auto &rhs) const noexcept |
| | Whether the bounding box spanned by two points overlaps the one of this polygon.
|
| |
| const OGRLinearRing * | exteriorRing () const noexcept |
| |
| | OGRPolygonalAdapter (OGRUniquePtr< OGRPolygon > &&polygonPtr, Canonical) |
| | Adopt a polygon which is already canonical, skipping the GEOS call.
|
| |
| | OGRPolygonalAdapter (OGRUniquePtr< OGRPolygon > &&polygonPtr) |
| | Adopt a polygon and bring it into canonical form.
|
| |
| static OGRUniquePtr< OGRPolygon > | emptyPolygon () |
| |
| static OGRLinearRing | toLinearRing (const IRing auto &ring) |
| |
| static OGRUniquePtr< OGRPolygon > | toOGRPolygon (const IRing auto &ring) |
| | Copy an arbitrary IRing into an OGRPolygon, ready to be used with GEOS.
|
| |
| static OGRUniquePtr< OGRPolygon > | toOGRPolygon (const IPolygon auto &polygon) |
| | Copy an arbitrary IPolygon into an OGRPolygon, ready to be used with GEOS.
|
| |
| static bool | covers (const OGRGeometry &covering, const OGRGeometry &covered) |
| | Boundary inclusive containment: is every point of covered also a point of covering?
|
| |
| OGRUniquePtr< OGRPolygon > | geomPtr |
| |
IPolygon implementation backed by an OGRPolygon.
The exterior ring forms the boundary, the interior rings are the holes. Where OGR/OGC and fishnet disagree, fishnet's convention wins, so that an OGR backed polygon is substitutable for a fishnet::geometry::Polygon:
- contains() includes the boundary, whereas OGR's Contains() is interior only
- centroid() is the area weighted centroid over the mean-of-points centroids of its rings
- distance() returns 0 for polygons which overlap in any way
◆ numeric_type
◆ OGRPolygonAdapter() [1/2]
| fishnet::geometry::OGRPolygonAdapter::OGRPolygonAdapter |
( |
OGRUniquePtr< OGRPolygon > && |
polygonPtr | ) |
|
|
inline |
◆ OGRPolygonAdapter() [2/2]
| fishnet::geometry::OGRPolygonAdapter::OGRPolygonAdapter |
( |
IPolygon auto const & |
polygon | ) |
|
|
inline |
◆ centroid()
| Vec2DReal fishnet::geometry::OGRPolygonAdapter::centroid |
( |
| ) |
const |
|
inline |
Area weighted centroid of the polygon, obtained by decomposition into its rings.
- Note
- fishnet defines the centroid of a ring as the mean of its points, which is what the decomposition below is built on; it is not the geometric centroid OGR/GEOS would compute. The rings are weighted by their share of the area, as Vec2D rounds coordinates below epsilon to zero, which would round away centroid * area for slivers (see Polygon::centroid).
◆ contains() [1/5]
| bool fishnet::geometry::OGRPolygonalAdapter::contains |
( |
const IPoint auto & |
point | ) |
const |
|
inline |
- Note
- contains is boundary inclusive, unlike OGR's own Contains predicate
◆ contains() [2/5]
| bool fishnet::geometry::OGRPolygonalAdapter::contains |
( |
const IPolygon auto & |
polygon | ) |
const |
|
inline |
◆ contains() [3/5]
| bool fishnet::geometry::OGRPolygonalAdapter::contains |
( |
const IRing auto & |
ring | ) |
const |
|
inline |
◆ contains() [4/5]
| bool fishnet::geometry::OGRPolygonalAdapter::contains |
( |
const ISegment auto & |
segment | ) |
const |
|
inline |
- Note
- unlike the two dimensional overloads below, this one cannot use Contains: a segment which grazes the boundary and lies otherwise outside satisfies Touches but is not covered, and Contains alone misses a segment running along an edge. covers() answers both correctly, and measures cheaper than any of the DE-9IM predicates on top of that. Only the bounding box is tested first, to answer the common "nowhere near" case without calling GEOS at all.
◆ contains() [5/5]
| bool fishnet::geometry::OGRPolygonalAdapter::contains |
( |
const OGRPolygonalAdapter & |
other | ) |
const |
|
inline |
◆ containsInHole() [1/2]
| bool fishnet::geometry::OGRPolygonAdapter::containsInHole |
( |
const IPoint auto & |
point | ) |
const |
|
inline |
◆ containsInHole() [2/2]
| bool fishnet::geometry::OGRPolygonAdapter::containsInHole |
( |
const IPolygon auto & |
other | ) |
const |
|
inline |
◆ crosses()
| bool fishnet::geometry::OGRPolygonAdapter::crosses |
( |
const IPolygon auto & |
other | ) |
const |
|
inline |
◆ distance() [1/2]
| double fishnet::geometry::OGRPolygonAdapter::distance |
( |
const IPolygon auto & |
other | ) |
const |
|
inline |
Distance between the two polygons.
- Returns
- 0 if the polygons overlap in any way, i.e. if one contains or touches the other, otherwise the distance between their boundaries, measured through a hole where applicable
◆ distance() [2/2]
| double fishnet::geometry::OGRPolygonAdapter::distance |
( |
const OGRPolygonAdapter & |
other | ) |
const |
|
inline |
Distance between two OGR backed polygons.
- Note
- geomPtr already has its holes subtracted, so GEOS' own Distance() returns 0 exactly when the two regions overlap or touch and the true gap to the nearest boundary (a hole's rim included) otherwise - the same result the generic overload above computes by hand, without having to inspect bounding boxes or holes here
◆ getBoundary()
| OGRRingAdapter fishnet::geometry::OGRPolygonAdapter::getBoundary |
( |
| ) |
const |
|
inline |
- Note
- the wrapped polygon is canonical, hence so is its exterior ring
◆ getHoles()
| std::vector< OGRRingAdapter > fishnet::geometry::OGRPolygonAdapter::getHoles |
( |
| ) |
const |
|
inline |
- Note
- the wrapped polygon is canonical, so its holes only have to be turned the right way round,
- See also
- OGRRingAdapter::fromCanonicalHole
◆ intersections()
| std::unordered_set< Vec2DReal > fishnet::geometry::OGRPolygonAdapter::intersections |
( |
const LinearGeometry auto & |
linearFeature | ) |
const |
|
inline |
◆ intersects()
| bool fishnet::geometry::OGRPolygonAdapter::intersects |
( |
const LinearGeometry auto & |
linearFeature | ) |
const |
|
inline |
◆ isSimple()
| bool fishnet::geometry::OGRPolygonAdapter::isSimple |
( |
| ) |
const |
|
inline |
◆ toNative()
| Polygon< double > fishnet::geometry::OGRPolygonAdapter::toNative |
( |
| ) |
const |
|
inline |
◆ touches()
| bool fishnet::geometry::OGRPolygonAdapter::touches |
( |
const IPolygon auto & |
other | ) |
const |
|
inline |
◆ OGRGeometryAdapter
◆ OGRMultiPolygonAdapter
◆ type
| constexpr GeometryType fishnet::geometry::OGRPolygonAdapter::type = GeometryType::POLYGON |
|
staticconstexpr |
The documentation for this class was generated from the following file: