libcuspatial  23.12.00
Loading...
Searching...
No Matches
multipolygon_ref.cuh
1/*
2 * Copyright (c) 2023, NVIDIA CORPORATION.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <cuspatial/cuda_utils.hpp>
19#include <cuspatial/detail/range/enumerate_range.cuh>
20
21namespace cuspatial {
22
30template <typename PartIterator, typename RingIterator, typename VecIterator>
32 public:
33 CUSPATIAL_HOST_DEVICE multipolygon_ref(PartIterator part_begin,
34 PartIterator part_end,
35 RingIterator ring_begin,
36 RingIterator ring_end,
37 VecIterator point_begin,
38 VecIterator point_end);
40 CUSPATIAL_HOST_DEVICE auto num_polygons() const;
42 CUSPATIAL_HOST_DEVICE auto size() const { return num_polygons(); }
43
45 CUSPATIAL_HOST_DEVICE bool is_empty() const { return num_polygons() == 0; }
46
48 CUSPATIAL_HOST_DEVICE auto part_begin() const;
50 CUSPATIAL_HOST_DEVICE auto part_end() const;
51
53 CUSPATIAL_HOST_DEVICE auto ring_begin() const;
55 CUSPATIAL_HOST_DEVICE auto ring_end() const;
56
58 CUSPATIAL_HOST_DEVICE auto point_begin() const;
60 CUSPATIAL_HOST_DEVICE auto point_end() const;
61
63 CUSPATIAL_HOST_DEVICE auto begin() const { return part_begin(); }
65 CUSPATIAL_HOST_DEVICE auto end() const { return part_end(); }
66
68 CUSPATIAL_HOST_DEVICE auto enumerate() const { return detail::enumerate_range{begin(), end()}; }
69
71 template <typename IndexType>
72 CUSPATIAL_HOST_DEVICE auto operator[](IndexType polygon_idx) const;
73
74 protected:
75 PartIterator _part_begin;
76 PartIterator _part_end;
77 RingIterator _ring_begin;
78 RingIterator _ring_end;
79 VecIterator _point_begin;
80 VecIterator _point_end;
81};
82
83} // namespace cuspatial
84
85#include <cuspatial/detail/geometry_collection/multipolygon_ref.cuh>
Represent a reference to a multipolygon stored in a structure of arrays.
CUSPATIAL_HOST_DEVICE auto end() const
Return iterator to one past the last polygon of the multipolygon.
CUSPATIAL_HOST_DEVICE auto enumerate() const
Return an enumerated range to the polygons.
CUSPATIAL_HOST_DEVICE auto part_end() const
Return iterator to one past the last polygon.
CUSPATIAL_HOST_DEVICE auto begin() const
Return iterator to the first polygon of the multipolygon.
CUSPATIAL_HOST_DEVICE auto operator[](IndexType polygon_idx) const
Return polygon_idxth polygon in the multipolygon.
CUSPATIAL_HOST_DEVICE auto point_begin() const
Return iterator to the first point of the multipolygon.
CUSPATIAL_HOST_DEVICE bool is_empty() const
Returns true if the multipolygon contains 0 geometries.
CUSPATIAL_HOST_DEVICE auto ring_begin() const
Return iterator to the first ring.
CUSPATIAL_HOST_DEVICE auto num_polygons() const
Return the number of polygons in the multipolygon.
CUSPATIAL_HOST_DEVICE auto point_end() const
Return iterator to one past the last point of the multipolygon.
CUSPATIAL_HOST_DEVICE auto ring_end() const
Return iterator to one past the last ring.
CUSPATIAL_HOST_DEVICE auto part_begin() const
Return iterator to the first polygon.
CUSPATIAL_HOST_DEVICE auto size() const
Return the number of polygons in the multipolygon.