Fishnet 2.0.1
Framework for Graph-Based Analysis of GIS Vector Data
Loading...
Searching...
No Matches
IMultiPolygon.hpp
Go to the documentation of this file.
1#pragma once
2#include "IPolygon.hpp"
3
4namespace fishnet::geometry::__impl{
5template<typename T>
6class MultiPolygonStub{
7public:
8 using numeric_type = T;
9 using polygon_type = PolygonStub<T>;
10 constexpr static GeometryType type = GeometryType::MULTIPOLYGON;
11 MultiPolygonStub(std::vector<PolygonStub<T>> polygons){}
12 MultiPolygonStub(PolygonStub<T> polygon){}
13 bool operator==(const MultiPolygonStub<T> & other) const noexcept{
14 return true;
15 }
16 std::vector<PolygonStub<T>> getPolygons() const{
17 return {};
18 }
19 bool addPolygon(PolygonStub<T> polygon){
20 return true;
21 }
22 bool removePolygon(PolygonStub<T> polygon){
23 return true;
24 }
25 double area() const{
26 return 0.0;
27 }
28 PointStub<double> centroid() const{
29 return PointStub<double>(0,0);
30 }
31 EnvelopeStub<T> aaBB() const{
32 return EnvelopeStub<T>(0, 0, 0, 0);
33 }
34 bool isInside(PointStub<T> point) const{
35 return true;
36 }
37 bool isOnBoundary(PointStub<T> point) const{
38 return true;
39 }
40 bool isOutside(PointStub<T> point) const{
41 return true;
42 }
43 bool containsInHole(PolygonStub<T> polygon) const{
44 return true;
45 }
46 bool contains(PointStub<T> point) const{
47 return true;
48 }
49 bool contains(SegmentStub<T> segment) const{
50 return true;
51 }
52 bool contains(PolygonStub<T> polygon) const{
53 return true;
54 }
55 bool intersects(SegmentStub<T> segment) const{
56 return true;
57 }
58 bool intersects(LineStub<T> line) const{
59 return true;
60 }
61 std::vector<PointStub<T>> intersections(SegmentStub<T> segment) const{
62 return {};
63 }
64 std::vector<PointStub<T>> intersections(LineStub<T> line) const{
65 return {};
66 }
67 bool crosses(PolygonStub<T> polygon) const{
68 return true;
69 }
70 bool touches(PolygonStub<T> polygon) const{
71 return true;
72 }
73 double distance(PolygonStub<T> polygon) const{
74 return 0.0;
75 }
76 size_t hash() const noexcept {
77 return 0;
78 }
79 std::string toString() const {
80 return {};
81 }
82};
83} // namespace fishnet::geometry::__impl
84
85namespace fishnet::geometry{
86
92template<typename M>
93concept IMultiPolygon = GeometryBase<M> && requires(
94 const std::remove_cvref_t<M> & multiPolygon,
95 std::remove_cvref_t<M> & mutableMultiPolygon,
96 const typename std::remove_cvref_t<M>::polygon_type & ownPolygon,
97 const __impl::PolygonStub<typename std::remove_cvref_t<M>::numeric_type> & polygon,
98 const __impl::PointStub<typename std::remove_cvref_t<M>::numeric_type> & point,
99 const __impl::SegmentStub<typename std::remove_cvref_t<M>::numeric_type> & segment,
100 const __impl::LineStub<typename std::remove_cvref_t<M>::numeric_type> & line
101){
102 typename std::remove_cvref_t<M>::polygon_type;
103 {multiPolygon.getPolygons()} -> PolygonRange;
104 {mutableMultiPolygon.addPolygon(ownPolygon)} -> std::same_as<bool>;
105 {mutableMultiPolygon.removePolygon(ownPolygon)} -> std::same_as<bool>;
106 {multiPolygon.area()} -> std::convertible_to<double>;
107 {multiPolygon.centroid()} -> IPoint;
108 {multiPolygon.aaBB()} -> IEnvelope;
109 {multiPolygon.isInside(point)} -> std::same_as<bool>;
110 {multiPolygon.isOnBoundary(point)} -> std::same_as<bool>;
111 {multiPolygon.isOutside(point)} -> std::same_as<bool>;
112 {multiPolygon.containsInHole(polygon)} -> std::same_as<bool>;
113 {multiPolygon.contains(point)} -> std::same_as<bool>;
114 {multiPolygon.contains(segment)} -> std::same_as<bool>;
115 {multiPolygon.contains(polygon)} -> std::same_as<bool>;
116 {multiPolygon.intersects(segment)} -> std::same_as<bool>;
117 {multiPolygon.intersects(line)} -> std::same_as<bool>;
118 {multiPolygon.intersections(segment)} -> PointRange;
119 {multiPolygon.intersections(line)} -> PointRange;
120 {multiPolygon.crosses(polygon)} -> std::same_as<bool>;
121 {multiPolygon.touches(polygon)} -> std::same_as<bool>;
122 {multiPolygon.distance(polygon)} -> std::convertible_to<double>;
123};
124
127}
IPolygon implementation backed by an OGRPolygon.
Definition OGRPolygonAdapter.hpp:22
Definition GeometryBase.hpp:11
Definition IRing.hpp:128
Interface for a multi-polygon A multi-polygon is a collection of polygons.
Definition IMultiPolygon.hpp:93
Interface for a point.
Definition IPoint.hpp:92
Definition IPoint.hpp:138
Definition IPolygon.hpp:134
Definition BoundingBoxWrapper.hpp:5