19#include <cuproj/detail/pipeline.cuh>
24#include <rmm/cuda_stream_view.hpp>
25#include <rmm/exec_policy.hpp>
27#include <thrust/device_vector.h>
28#include <thrust/transform.h>
46template <
typename Coordinate>
58template <
typename Coordinate,
typename T =
typename Coordinate::value_type>
68 projection(std::vector<operation_type>
const& operations,
71 : params_(params), constructed_direction_(dir)
88 dir = (constructed_direction_ == direction::FORWARD) ? dir :
reverse(dir);
90 params_, operations_.data().get(), operations_.size(), dir};
104 template <
class InputCoordIter,
class OutputCoordIter>
107 OutputCoordIter result,
109 rmm::cuda_stream_view stream = rmm::cuda_stream_default)
const
115 void setup(std::vector<operation_type>
const& operations)
117 std::for_each(operations.begin(), operations.end(), [&](
auto const& op) {
119 case operation_type::TRANSVERSE_MERCATOR: {
120 auto op = transverse_mercator<Coordinate>{params_};
121 params_ = op.setup(params_);
129 operations_.resize(operations.size());
130 thrust::copy(operations.begin(), operations.end(), operations_.begin());
133 thrust::device_vector<operation_type> operations_;
134 projection_parameters<T> params_;
135 direction constructed_direction_{direction::FORWARD};
A projection transforms coordinates between coordinate reference systems.
projection(std::vector< operation_type > const &operations, projection_parameters< T > const ¶ms, direction dir=direction::FORWARD)
Construct a new projection object.
void transform(InputCoordIter first, InputCoordIter last, OutputCoordIter result, direction dir, rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Transform a range of coordinates.
device_projection< Coordinate > get_device_projection(direction dir) const
Get a device_projection object that can be passed to device code.
typename detail::pipeline< Coordinate > device_projection
A projection object that can be invoked from __device__ code to transform coordinates.
direction
Enumerates the direction of a transform operation.
direction reverse(direction dir)
Returns the opposite of a direction.