use c++17 fold expression

+ indicate official LASlib is supported
This commit is contained in:
Sébastien Loriot 2024-08-30 16:24:27 +02:00
parent 41b096c91a
commit d24a35eb56
3 changed files with 30 additions and 37 deletions

View File

@ -248,9 +248,8 @@ imported target `CGAL::LASLIB_support` provided in
\laslib information can be obtained from \laslib information can be obtained from
<a href="https://lastools.github.io/">https://lastools.github.io/</a> and <a href="https://lastools.github.io/">https://lastools.github.io/</a> and
<a href="https://rapidlasso.de/product-overview/">https://rapidlasso.de/product-overview/</a>. <a href="https://rapidlasso.de/product-overview/">https://rapidlasso.de/product-overview/</a>.
\laslib is usually distributed along with LAStools: for simplicity, \cgal \laslib is usually distributed along with LAStools. Current versions of \laslib provide CMake support.
provides <a href="https://github.com/CGAL/LAStools">a fork with a BUILD_SHARED_LIBS needs to be set to true on windows to create a dynamic linked library.
CMake based install procedure</a>.
\subsection thirdpartyOpenCV OpenCV \subsection thirdpartyOpenCV OpenCV

View File

@ -21,7 +21,7 @@ int main(int argc, char*argv[])
// Reads a .las point set file with normal vectors and colors // Reads a .las point set file with normal vectors and colors
std::ifstream in(fname, std::ios_base::binary); std::ifstream in(fname, std::ios_base::binary);
std::vector<PointWithColor> points; // store points std::vector<PointWithColor> points; // store points
if(!CGAL::IO::read_LAS_with_properties(in, std::back_inserter (points), if (!CGAL::IO::read_LAS_with_properties(in, std::back_inserter(points),
CGAL::IO::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()), CGAL::IO::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(), std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
CGAL::Construct_array(), CGAL::Construct_array(),

View File

@ -134,57 +134,51 @@ namespace LAS {
output_value (point, get(current.first, *it), current.second); output_value (point, get(current.first, *it), current.second);
} }
template<typename Value, typename Tuple, std::size_t I> template<typename Value, typename Tuple, std::size_t... Is>
void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence<I>) { void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence<Is...>) {
output_value(point, std::get<I>(v), std::get<I>(t)); (output_value(point, std::get<Is>(v), std::get<Is>(t)), ...);
}
template<typename Value, typename Tuple, std::size_t I, std::size_t... Is>
void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence<I, Is...>) {
output_value(point, std::get<I>(v), std::get<I>(t));
output_tuple(point, v, t, std::index_sequence<Is...>());
} }
template <typename ForwardIterator, template <typename ForwardIterator,
typename PropertyMap, typename PropertyMap,
typename ... T> typename ... T>
void output_properties(LASpoint& point, void output_properties(LASpoint& point,
ForwardIterator it, ForwardIterator it,
std::tuple<PropertyMap, T ...>&& current) std::tuple<PropertyMap, T ...>&& current)
{ {
output_tuple(point, get(std::get<0>(current), *it), std::tuple<T ...>(), std::index_sequence_for<T ...>{}); output_tuple(point, get(std::get<0>(current), *it), std::tuple<T ...>(), std::index_sequence_for<T ...>{});
} }
template <typename ForwardIterator, template <typename ForwardIterator,
typename PropertyMap, typename PropertyMap,
typename T, typename T,
typename NextPropertyHandler, typename NextPropertyHandler,
typename ... PropertyHandler> typename ... PropertyHandler>
void output_properties(LASpoint& point, void output_properties(LASpoint& point,
ForwardIterator it, ForwardIterator it,
std::pair<PropertyMap, T>&& current, std::pair<PropertyMap, T>&& current,
NextPropertyHandler&& next, NextPropertyHandler&& next,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
output_value(point, get(current.first, *it), current.second); output_value (point, get(current.first, *it), current.second);
output_properties(point, it, std::forward<NextPropertyHandler>(next), output_properties (point, it, std::forward<NextPropertyHandler>(next),
std::forward<PropertyHandler>(properties)...); std::forward<PropertyHandler>(properties)...);
} }
template <typename ForwardIterator, template <typename ForwardIterator,
typename PropertyMap, typename PropertyMap,
typename ... T, typename ... T,
typename NextPropertyHandler, typename NextPropertyHandler,
typename ... PropertyHandler> typename ... PropertyHandler>
void output_properties(LASpoint& point, void output_properties(LASpoint& point,
ForwardIterator it, ForwardIterator it,
std::tuple<PropertyMap, T ...>&& current, std::tuple<PropertyMap, T ...>&& current,
NextPropertyHandler&& next, NextPropertyHandler&& next,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
output_tuple(point, get(std::get<0>(current), *it), std::tuple<T ...>(), std::index_sequence_for<T ...>{}); output_tuple(point, get(std::get<0>(current), *it), std::tuple<T ...>(), std::index_sequence_for<T ...>{});
output_properties(point, it, std::forward<NextPropertyHandler>(next), output_properties(point, it, std::forward<NextPropertyHandler>(next),
std::forward<PropertyHandler>(properties)...); std::forward<PropertyHandler>(properties)...);
} }
} // namespace LAS } // namespace LAS