Loading...
Searching...
No Matches
linestring_ref.cuh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022-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
28template <typename VecIterator>
30 public:
31 CUSPATIAL_HOST_DEVICE linestring_ref(VecIterator begin, VecIterator end);
32
34 CUSPATIAL_HOST_DEVICE auto num_segments() const;
35
37 CUSPATIAL_HOST_DEVICE auto segment_begin() const;
39 CUSPATIAL_HOST_DEVICE auto segment_end() const;
40
42 CUSPATIAL_HOST_DEVICE auto point_begin() const;
44 CUSPATIAL_HOST_DEVICE auto point_end() const;
45
47 CUSPATIAL_HOST_DEVICE auto begin() const { return segment_begin(); }
49 CUSPATIAL_HOST_DEVICE auto end() const { return segment_end(); }
50
52 CUSPATIAL_HOST_DEVICE auto enumerate() { return detail::enumerate_range{begin(), end()}; }
53
55 template <typename IndexType>
56 CUSPATIAL_HOST_DEVICE auto segment(IndexType segment_idx) const;
57
58 protected:
59 VecIterator _point_begin;
60 VecIterator _point_end;
61};
62
63} // namespace cuspatial
64
65#include <cuspatial/detail/geometry/linestring_ref.cuh>
Represent a reference to a linestring 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 num_segments() const
Return the number of segments in the linestring.
CUSPATIAL_HOST_DEVICE auto end() const
Return iterator to one past the last segment.
CUSPATIAL_HOST_DEVICE auto segment(IndexType segment_idx) const
Return the segment_idxth segment in the linestring.
CUSPATIAL_HOST_DEVICE auto segment_begin() const
Return iterator to the first segment of the linestring.
CUSPATIAL_HOST_DEVICE auto point_begin() const
Return iterator to the first point of the linestring.
CUSPATIAL_HOST_DEVICE auto begin() const
Return iterator to the first segment of the linestring.
CUSPATIAL_HOST_DEVICE auto segment_end() const
Return iterator to one past the last segment.
CUSPATIAL_HOST_DEVICE auto enumerate()
Return an enumerated range to the segments.