mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/5.6.x-branch'
This commit is contained in:
commit
9ff709885a
|
|
@ -1,8 +1,19 @@
|
||||||
if(LASLIB_FOUND AND NOT TARGET CGAL::LASLIB_support)
|
if(LASLIB_FOUND)
|
||||||
|
if (NOT TARGET CGAL::LASLIB_support)
|
||||||
|
if (NOT TARGET LASlib)
|
||||||
|
# message(STATUS "Found using MODULE mode")
|
||||||
add_library(CGAL::LASLIB_support INTERFACE IMPORTED)
|
add_library(CGAL::LASLIB_support INTERFACE IMPORTED)
|
||||||
set_target_properties(CGAL::LASLIB_support PROPERTIES
|
set_target_properties(CGAL::LASLIB_support PROPERTIES
|
||||||
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_LASLIB"
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_LASLIB"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR};${LASZIP_INCLUDE_DIR}"
|
INTERFACE_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}"
|
||||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR};${LASZIP_INCLUDE_DIR}"
|
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LASLIB_INCLUDE_DIR}"
|
||||||
INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}")
|
INTERFACE_LINK_LIBRARIES "${LASLIB_LIBRARIES}")
|
||||||
|
else()
|
||||||
|
# message(STATUS "Found using CONFIG mode")
|
||||||
|
add_library(CGAL::LASLIB_support INTERFACE IMPORTED)
|
||||||
|
set_target_properties(CGAL::LASLIB_support PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_LASLIB")
|
||||||
|
target_link_libraries(CGAL::LASLIB_support INTERFACE LASlib)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ find_path(LASZIP_INCLUDE_DIR
|
||||||
NAMES mydefs.hpp
|
NAMES mydefs.hpp
|
||||||
PATHS /usr/local/include/LASzip/
|
PATHS /usr/local/include/LASzip/
|
||||||
${LASLIB_INCLUDE_DIR}/../../LASzip/src
|
${LASLIB_INCLUDE_DIR}/../../LASzip/src
|
||||||
|
${LASLIB_INCLUDE_DIR}/../LASzip
|
||||||
|
${LASLIB_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(LASLIB_LIBRARIES
|
find_library(LASLIB_LIBRARIES
|
||||||
|
|
@ -27,9 +29,22 @@ find_library(LASLIB_LIBRARIES
|
||||||
${LASLIB_INCLUDE_DIR}/../../lib
|
${LASLIB_INCLUDE_DIR}/../../lib
|
||||||
ENV LASLIB_LIB_DIR
|
ENV LASLIB_LIB_DIR
|
||||||
)
|
)
|
||||||
|
if (NOT LASLIB_LIBRARIES)
|
||||||
|
#library was renamed in recent versions of LAStools
|
||||||
|
find_library(LASLIB_LIBRARIES
|
||||||
|
NAMES LASlib
|
||||||
|
PATHS ENV LD_LIBRARY_PATH
|
||||||
|
ENV LIBRARY_PATH
|
||||||
|
/usr/local/lib
|
||||||
|
${LASLIB_INCLUDE_DIR}/../../lib
|
||||||
|
ENV LASLIB_LIB_DIR
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(LASLIB_LIBRARIES AND LASLIB_INCLUDE_DIR)
|
if(LASLIB_LIBRARIES AND LASLIB_INCLUDE_DIR AND LASZIP_INCLUDE_DIR)
|
||||||
|
if (NOT ${LASLIB_INCLUDE_DIR} STREQUAL ${LASZIP_INCLUDE_DIR})
|
||||||
|
list(APPEND LASLIB_INCLUDE_DIR ${LASZIP_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
set(LASLIB_FOUND TRUE)
|
set(LASLIB_FOUND TRUE)
|
||||||
set(LASLIB_USE_FILE "UseLASLIB")
|
set(LASLIB_USE_FILE "UseLASLIB")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
add_definitions(-DCGAL_LINKED_WITH_LASLIB)
|
add_definitions(-DCGAL_LINKED_WITH_LASLIB)
|
||||||
|
|
||||||
message(DEPRECATION "This file UseLASLIB.cmake is deprecated, and the imported target `CGAL::TBB_support` from CGAL_LASLIB_support.cmake should be used instead.")
|
message(DEPRECATION "This file UseLASLIB.cmake is deprecated, and the imported target `CGAL::LASLIB_support` from CGAL_LASLIB_support.cmake should be used instead.")
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ create_single_source_cgal_program("issue7996.cpp")
|
||||||
|
|
||||||
#Use LAS
|
#Use LAS
|
||||||
#disable if MSVC 2017
|
#disable if MSVC 2017
|
||||||
if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910))
|
if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910)
|
||||||
find_package(LASLIB QUIET)
|
find_package(LASLIB QUIET)
|
||||||
include(CGAL_LASLIB_support)
|
include(CGAL_LASLIB_support)
|
||||||
if (TARGET CGAL::LASLIB_support)
|
if (TARGET CGAL::LASLIB_support)
|
||||||
|
|
@ -23,5 +23,5 @@ if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1
|
||||||
message(STATUS "NOTICE: the LAS reader test requires LASlib, and will not be compiled.")
|
message(STATUS "NOTICE: the LAS reader test requires LASlib, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: the LAS reader does not work with Visual Studio 2017.")
|
message(STATUS "NOTICE: the LAS reader does not work with your version of Visual Studio 2017.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ find_package(LASLIB QUIET)
|
||||||
include(CGAL_LASLIB_support)
|
include(CGAL_LASLIB_support)
|
||||||
if(TARGET CGAL::LASLIB_support)
|
if(TARGET CGAL::LASLIB_support)
|
||||||
create_single_source_cgal_program("read_las_example.cpp")
|
create_single_source_cgal_program("read_las_example.cpp")
|
||||||
|
create_single_source_cgal_program("write_las_example.cpp")
|
||||||
target_link_libraries(read_las_example PRIVATE ${CGAL_libs} CGAL::LASLIB_support)
|
target_link_libraries(read_las_example PRIVATE ${CGAL_libs} CGAL::LASLIB_support)
|
||||||
|
target_link_libraries(write_las_example PRIVATE ${CGAL_libs} CGAL::LASLIB_support)
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: the LAS reader example requires LASlib and will not be compiled.")
|
message(STATUS "NOTICE: the LAS reader example requires LASlib and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
#include <CGAL/IO/read_las_points.h>
|
||||||
|
#include <CGAL/IO/write_las_points.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
// types
|
||||||
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
|
typedef Kernel::FT FT;
|
||||||
|
typedef Kernel::Point_3 Point;
|
||||||
|
typedef std::array<unsigned short, 4> Color;
|
||||||
|
typedef std::pair<Point, Color> PointWithColor;
|
||||||
|
|
||||||
|
int main(int argc, char*argv[])
|
||||||
|
{
|
||||||
|
const char* fname = "colored_points.las";
|
||||||
|
|
||||||
|
std::ofstream os(fname, std::ios::binary);
|
||||||
|
|
||||||
|
std::vector<PointWithColor> points; // store points
|
||||||
|
points.push_back(std::make_pair(Point(0, 0, 0), Color{ 65535, 0, 0, 0 }));
|
||||||
|
points.push_back(std::make_pair(Point(1, 0, 0), Color{ 0, 65535, 0, 0 }));
|
||||||
|
points.push_back(std::make_pair(Point(0, 1, 0), Color{ 0, 0, 65535, 0 }));
|
||||||
|
points.push_back(std::make_pair(Point(1, 1, 0), Color{ 0, 65535, 65535, 0 }));
|
||||||
|
points.push_back(std::make_pair(Point(1, 1, 1), Color{ 65535, 65535, 0, 0 }));
|
||||||
|
|
||||||
|
// Writes a .las point set file with colors
|
||||||
|
if(!CGAL::IO::write_LAS_with_properties(os, points,
|
||||||
|
CGAL::IO::make_las_point_writer(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||||
|
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||||
|
CGAL::IO::LAS_property::R(),
|
||||||
|
CGAL::IO::LAS_property::G(),
|
||||||
|
CGAL::IO::LAS_property::B(),
|
||||||
|
CGAL::IO::LAS_property::I())))
|
||||||
|
{
|
||||||
|
std::cerr << "Error: cannot write file " << fname << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_AS_DLL
|
#define USE_AS_DLL 1
|
||||||
#include <lasreader_las.hpp>
|
#include <lasreader_las.hpp>
|
||||||
#undef USE_AS_DLL
|
#undef USE_AS_DLL
|
||||||
|
|
||||||
|
|
@ -384,7 +384,11 @@ bool read_LAS_with_properties(std::istream& is,
|
||||||
if(!is)
|
if(!is)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if LAS_TOOLS_VERSION < 240319
|
||||||
LASreaderLAS lasreader;
|
LASreaderLAS lasreader;
|
||||||
|
#else
|
||||||
|
LASreaderLAS lasreader(nullptr);
|
||||||
|
#endif
|
||||||
lasreader.open(is);
|
lasreader.open(is);
|
||||||
|
|
||||||
while(lasreader.read_point())
|
while(lasreader.read_point())
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_AS_DLL
|
#define USE_AS_DLL 1
|
||||||
#include <lasdefinitions.hpp>
|
#include <lasdefinitions.hpp>
|
||||||
#include <lasreader_las.hpp>
|
#include <lasreader_las.hpp>
|
||||||
#include <laswriter_las.hpp>
|
#include <laswriter_las.hpp>
|
||||||
|
|
@ -84,41 +84,41 @@ make_las_point_writer(PointMap point_map)
|
||||||
namespace internal {
|
namespace internal {
|
||||||
namespace LAS {
|
namespace LAS {
|
||||||
|
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::Intensity&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::Intensity&)
|
||||||
{ r.set_intensity(v); }
|
{ r.set_intensity(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Return_number&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Return_number&)
|
||||||
{ r.set_return_number(v); }
|
{ r.set_return_number(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Number_of_returns&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Number_of_returns&)
|
||||||
{ r.set_number_of_returns(v); }
|
{ r.set_number_of_returns(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Scan_direction_flag&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Scan_direction_flag&)
|
||||||
{ r.set_scan_direction_flag(v); }
|
{ r.set_scan_direction_flag(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Edge_of_flight_line&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Edge_of_flight_line&)
|
||||||
{ r.set_edge_of_flight_line(v); }
|
{ r.set_edge_of_flight_line(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Classification&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Classification&)
|
||||||
{ r.set_classification(v); }
|
{ r.set_classification(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Synthetic_flag&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Synthetic_flag&)
|
||||||
{ r.set_synthetic_flag(v); }
|
{ r.set_synthetic_flag(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Keypoint_flag&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Keypoint_flag&)
|
||||||
{ r.set_keypoint_flag(v); }
|
{ r.set_keypoint_flag(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::Withheld_flag&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::Withheld_flag&)
|
||||||
{ r.set_withheld_flag(v); }
|
{ r.set_withheld_flag(v); }
|
||||||
inline void output_value(LASpoint& r, const float& v, LAS_property::Scan_angle&)
|
inline void output_value(LASpoint& r, const float& v, const LAS_property::Scan_angle&)
|
||||||
{ r.set_scan_angle_rank(char(v)); }
|
{ r.set_scan_angle_rank(char(v)); }
|
||||||
inline void output_value(LASpoint& r, const unsigned char& v, LAS_property::User_data&)
|
inline void output_value(LASpoint& r, const unsigned char& v, const LAS_property::User_data&)
|
||||||
{ r.set_user_data(v); }
|
{ r.set_user_data(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::Point_source_ID&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::Point_source_ID&)
|
||||||
{ r.set_point_source_ID(v); }
|
{ r.set_point_source_ID(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned int& v, LAS_property::Deleted_flag&)
|
inline void output_value(LASpoint& r, const unsigned int& v, const LAS_property::Deleted_flag&)
|
||||||
{ r.set_deleted_flag(v); }
|
{ r.set_deleted_flag(v); }
|
||||||
inline void output_value(LASpoint& r, const double& v, LAS_property::GPS_time&)
|
inline void output_value(LASpoint& r, const double& v, const LAS_property::GPS_time&)
|
||||||
{ r.set_gps_time(v); }
|
{ r.set_gps_time(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::R&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::R&)
|
||||||
{ r.set_R(v); }
|
{ r.set_R(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::G&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::G&)
|
||||||
{ r.set_G(v); }
|
{ r.set_G(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::B&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::B&)
|
||||||
{ r.set_B(v); }
|
{ r.set_B(v); }
|
||||||
inline void output_value(LASpoint& r, const unsigned short& v, LAS_property::I&)
|
inline void output_value(LASpoint& r, const unsigned short& v, const LAS_property::I&)
|
||||||
{ r.set_I(v); }
|
{ r.set_I(v); }
|
||||||
|
|
||||||
template <typename ForwardIterator>
|
template <typename ForwardIterator>
|
||||||
|
|
@ -134,6 +134,27 @@ 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>
|
||||||
|
void output_tuple(LASpoint& point, const Value& v, const Tuple& t, std::index_sequence<I>) {
|
||||||
|
output_value(point, std::get<I>(v), std::get<I>(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,
|
||||||
|
typename PropertyMap,
|
||||||
|
typename ... T>
|
||||||
|
void output_properties(LASpoint& point,
|
||||||
|
ForwardIterator it,
|
||||||
|
std::tuple<PropertyMap, T ...>&& current)
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
@ -145,8 +166,24 @@ namespace LAS {
|
||||||
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)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ForwardIterator,
|
||||||
|
typename PropertyMap,
|
||||||
|
typename ... T,
|
||||||
|
typename NextPropertyHandler,
|
||||||
|
typename ... PropertyHandler>
|
||||||
|
void output_properties(LASpoint& point,
|
||||||
|
ForwardIterator it,
|
||||||
|
std::tuple<PropertyMap, T ...>&& current,
|
||||||
|
NextPropertyHandler&& next,
|
||||||
|
PropertyHandler&& ... properties)
|
||||||
|
{
|
||||||
|
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),
|
||||||
std::forward<PropertyHandler>(properties)...);
|
std::forward<PropertyHandler>(properties)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ create_single_source_cgal_program( "structuring_test.cpp" )
|
||||||
|
|
||||||
#Use LAS
|
#Use LAS
|
||||||
#disable if MSVC 2017
|
#disable if MSVC 2017
|
||||||
if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910))
|
if(NOT MSVC_VERSION OR MSVC_VERSION GREATER_EQUAL 1919 OR MSVC_VERSION LESS 1910)
|
||||||
find_package(LASLIB QUIET)
|
find_package(LASLIB QUIET)
|
||||||
include(CGAL_LASLIB_support)
|
include(CGAL_LASLIB_support)
|
||||||
if (TARGET CGAL::LASLIB_support)
|
if (TARGET CGAL::LASLIB_support)
|
||||||
|
|
@ -43,7 +43,7 @@ if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1
|
||||||
message(STATUS "NOTICE: the LAS reader test requires LASlib and will not be compiled.")
|
message(STATUS "NOTICE: the LAS reader test requires LASlib and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: the LAS reader does not work with Visual Studio 2017.")
|
message(STATUS "NOTICE: the LAS reader does not work with your version of Visual Studio 2017.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use Eigen
|
# Use Eigen
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ find_library(
|
||||||
NAMES 3MF
|
NAMES 3MF
|
||||||
DOC "Path to the lib3MF library")
|
DOC "Path to the lib3MF library")
|
||||||
|
|
||||||
|
find_package(LASLIB QUIET)
|
||||||
|
include(CGAL_LASLIB_support)
|
||||||
|
|
||||||
# create a target per cppfile
|
# create a target per cppfile
|
||||||
file(
|
file(
|
||||||
GLOB cppfiles
|
GLOB cppfiles
|
||||||
|
|
@ -29,7 +32,16 @@ foreach(cppfile ${cppfiles})
|
||||||
else()
|
else()
|
||||||
message(STATUS "NOTICE: Some tests require the lib3MF library, and will not be compiled.")
|
message(STATUS "NOTICE: Some tests require the lib3MF library, and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
if("${cppfile}" STREQUAL "test_LAS.cpp")
|
||||||
|
if(TARGET CGAL::LASLIB_support)
|
||||||
|
create_single_source_cgal_program("test_LAS.cpp")
|
||||||
|
target_link_libraries(test_LAS PRIVATE CGAL::LASLIB_support)
|
||||||
|
else()
|
||||||
|
message(STATUS "NOTICE: Some tests require the LASlib library, and will not be compiled.")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
create_single_source_cgal_program("${cppfile}")
|
create_single_source_cgal_program("${cppfile}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,63 @@
|
||||||
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
#include <CGAL/IO/read_las_points.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
// types
|
||||||
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
|
typedef Kernel::FT FT;
|
||||||
|
typedef Kernel::Point_3 Point;
|
||||||
|
typedef std::array<unsigned short, 4> Color;
|
||||||
|
typedef std::pair<Point, Color> PointWithColor;
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::ifstream is("data/colored_points.las");
|
||||||
|
|
||||||
|
// Reads a .las point set file with normal vectors and colors
|
||||||
|
std::vector<PointWithColor> points; // store points
|
||||||
|
if (!CGAL::IO::read_LAS_with_properties(is, std::back_inserter(points),
|
||||||
|
CGAL::IO::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||||
|
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||||
|
CGAL::Construct_array(),
|
||||||
|
CGAL::IO::LAS_property::R(),
|
||||||
|
CGAL::IO::LAS_property::G(),
|
||||||
|
CGAL::IO::LAS_property::B(),
|
||||||
|
CGAL::IO::LAS_property::I())))
|
||||||
|
{
|
||||||
|
std::cerr << "Error: cannot read file data/colored_points.las" << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGAL_assertion(points.size() == 5);
|
||||||
|
CGAL_assertion(points[0].second[0] == 65535);
|
||||||
|
CGAL_assertion(points[0].second[1] == 0);
|
||||||
|
CGAL_assertion(points[0].second[2] == 0);
|
||||||
|
CGAL_assertion(points[0].second[3] == 0);
|
||||||
|
|
||||||
|
CGAL_assertion(points[1].second[0] == 0);
|
||||||
|
CGAL_assertion(points[1].second[1] == 65535);
|
||||||
|
CGAL_assertion(points[1].second[2] == 0);
|
||||||
|
CGAL_assertion(points[1].second[3] == 0);
|
||||||
|
|
||||||
|
CGAL_assertion(points[2].second[0] == 0);
|
||||||
|
CGAL_assertion(points[2].second[1] == 0);
|
||||||
|
CGAL_assertion(points[2].second[2] == 65535);
|
||||||
|
CGAL_assertion(points[2].second[3] == 0);
|
||||||
|
|
||||||
|
CGAL_assertion(points[3].second[0] == 0);
|
||||||
|
CGAL_assertion(points[3].second[1] == 65535);
|
||||||
|
CGAL_assertion(points[3].second[2] == 65535);
|
||||||
|
CGAL_assertion(points[3].second[3] == 0);
|
||||||
|
|
||||||
|
CGAL_assertion(points[4].second[0] == 65535);
|
||||||
|
CGAL_assertion(points[4].second[1] == 65535);
|
||||||
|
CGAL_assertion(points[4].second[2] == 0);
|
||||||
|
CGAL_assertion(points[4].second[3] == 0);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue