Loading...
Searching...
No Matches
multilinestring_ref.cuh
1/*
2 * Copyright (c) 2022, 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
29template <typename PartIterator, typename VecIterator>
31 public:
32 CUSPATIAL_HOST_DEVICE multilinestring_ref(PartIterator part_begin,
33 PartIterator part_end,
34 VecIterator point_begin,
35 VecIterator point_end);
37 CUSPATIAL_HOST_DEVICE auto num_linestrings() const;
39 CUSPATIAL_HOST_DEVICE auto size() const { return num_linestrings(); }
40
42 CUSPATIAL_HOST_DEVICE bool is_empty() const { return num_linestrings() == 0; }
43
45 CUSPATIAL_HOST_DEVICE auto part_begin() const;
47 CUSPATIAL_HOST_DEVICE auto part_end() const;
48
50 CUSPATIAL_HOST_DEVICE auto point_begin() const;
52 CUSPATIAL_HOST_DEVICE auto point_end() const;
53
55 CUSPATIAL_HOST_DEVICE auto begin() const { return part_begin(); }
57 CUSPATIAL_HOST_DEVICE auto end() const { return part_end(); }
58
60 CUSPATIAL_HOST_DEVICE auto enumerate() const { return detail::enumerate_range{begin(), end()}; }
61
63 template <typename IndexType>
64 CUSPATIAL_HOST_DEVICE auto operator[](IndexType linestring_idx) const;
65
66 protected:
67 PartIterator _part_begin;
68 PartIterator _part_end;
69 VecIterator _point_begin;
70 VecIterator _point_end;
71};
72
73} // namespace cuspatial
74
75#include <cuspatial/detail/geometry_collection/multilinestring_ref.cuh>
Represent a reference to a multilinestring stored in a structure of arrays.
CUSPATIAL_HOST_DEVICE auto end() const
Return iterator to one past the last linestring of the multilinestring.
CUSPATIAL_HOST_DEVICE bool is_empty() const
Return true if this multilinestring contains 0 linestrings.
CUSPATIAL_HOST_DEVICE auto point_begin() const
Return iterator to the first point of the multilinestring.
CUSPATIAL_HOST_DEVICE auto part_end() const
Return iterator to one past the last linestring.
CUSPATIAL_HOST_DEVICE auto begin() const
Return iterator to the first linestring of the multilinestring.
CUSPATIAL_HOST_DEVICE auto enumerate() const
Return an enumerated range to the linestrings.
CUSPATIAL_HOST_DEVICE auto operator[](IndexType linestring_idx) const
Return linestring_idxth linestring in the multilinestring.
CUSPATIAL_HOST_DEVICE auto num_linestrings() const
Return the number of linestrings in the multilinestring.
CUSPATIAL_HOST_DEVICE auto size() const
Return the number of linestrings in the multilinestring.
CUSPATIAL_HOST_DEVICE auto point_end() const
Return iterator to one past the last point of the multilinestring.
CUSPATIAL_HOST_DEVICE auto part_begin() const
Return iterator to the first linestring.