libcuspatial  23.12.00
Loading...
Searching...
No Matches
polygon_ref.cuh
Go to the documentation of this file.
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
20namespace cuspatial {
21
27template <typename RingIterator, typename VecIterator>
29 public:
30 CUSPATIAL_HOST_DEVICE polygon_ref(RingIterator ring_begin,
31 RingIterator ring_end,
32 VecIterator point_begin,
33 VecIterator point_end);
34
36 CUSPATIAL_HOST_DEVICE auto num_rings() const;
37
39 CUSPATIAL_HOST_DEVICE auto size() const { return num_rings(); }
40
42 CUSPATIAL_HOST_DEVICE auto ring_begin() const;
44 CUSPATIAL_HOST_DEVICE auto ring_end() const;
45
47 CUSPATIAL_HOST_DEVICE auto point_begin() const;
49 CUSPATIAL_HOST_DEVICE auto point_end() const;
50
52 CUSPATIAL_HOST_DEVICE auto begin() const { return ring_begin(); }
54 CUSPATIAL_HOST_DEVICE auto end() const { return ring_end(); }
55
57 template <typename IndexType>
58 CUSPATIAL_HOST_DEVICE auto ring(IndexType ring_idx) const;
59
60 protected:
61 RingIterator _ring_begin;
62 RingIterator _ring_end;
63 VecIterator _point_begin;
64 VecIterator _point_end;
65};
66
67} // namespace cuspatial
68
69#include <cuspatial/detail/geometry/polygon_ref.cuh>
Represent a reference to a polygon stored in a structure of arrays.
CUSPATIAL_HOST_DEVICE auto point_end() const
Return iterator to one past the last point.
CUSPATIAL_HOST_DEVICE auto ring_begin() const
Return iterator to the first ring of the polygon.
CUSPATIAL_HOST_DEVICE auto end() const
Return iterator to one past the last ring.
CUSPATIAL_HOST_DEVICE auto ring_end() const
Return iterator to one past the last ring.
CUSPATIAL_HOST_DEVICE auto num_rings() const
Return the number of rings in the polygon.
CUSPATIAL_HOST_DEVICE auto begin() const
Return iterator to the first ring of the polygon.
CUSPATIAL_HOST_DEVICE auto point_begin() const
Return iterator to the first point of the polygon.
CUSPATIAL_HOST_DEVICE auto ring(IndexType ring_idx) const
Return the ring_idxth ring in the polygon.
CUSPATIAL_HOST_DEVICE auto size() const
Return the number of rings in the polygon.