mirror of https://github.com/CGAL/cgal
Add C++11 conditions/tests/warnings for LAS and PLY IO functions and related files
This commit is contained in:
parent
018cefa306
commit
40ae0436e1
|
|
@ -266,6 +266,7 @@ ALIASES = "sc{1}=<span style=\"font-variant: small-caps;\">\1</sp
|
|||
"cgalAdvancedEnd=\htmlonly </div> \endhtmlonly" \
|
||||
"cgalAdvancedFunction=This is an advanced function." \
|
||||
"cgalAdvancedClass=This is an advanced class." \
|
||||
"cgalRequiresCPP11=\warning This function requires a C++11 compiler." \
|
||||
"cgalPkgPicture{1}=<div class=\"PkgImage\"> \n \image html \1 \n</div>" \
|
||||
"cgalPkgSummaryBegin=<div class=\"PkgSummary\">" \
|
||||
"cgalPkgSummaryEnd=</div>" \
|
||||
|
|
|
|||
|
|
@ -251,6 +251,8 @@ ALIASES += "cgalAdvancedEnd=\htmlonly </div> \endhtmlonly"
|
|||
ALIASES += "cgalAdvancedFunction=This is an advanced function."
|
||||
ALIASES += "cgalAdvancedClass=This is an advanced class."
|
||||
|
||||
ALIASES += "cgalRequiresCPP11=\warning This function requires a C++11 compiler."
|
||||
|
||||
ALIASES += "cgalPkgPicture{1}=<div class=\"PkgImage\"> \n \image html \1 \n</div>"
|
||||
|
||||
ALIASES += "cgalPkgSummaryBegin=<div class=\"PkgSummary\">"
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ if ( CGAL_FOUND )
|
|||
create_single_source_cgal_program( "property_map.cpp" )
|
||||
create_single_source_cgal_program( "random_simplification_example.cpp" )
|
||||
create_single_source_cgal_program( "read_write_xyz_point_set_example.cpp" )
|
||||
create_single_source_cgal_program( "read_ply_points_with_colors_example.cpp" )
|
||||
create_single_source_cgal_program( "write_ply_points_example.cpp" )
|
||||
create_single_source_cgal_program( "remove_outliers_example.cpp" )
|
||||
create_single_source_cgal_program( "scale_estimation_example.cpp" )
|
||||
create_single_source_cgal_program( "scale_estimation_2d_example.cpp" )
|
||||
|
|
@ -61,6 +59,26 @@ if ( CGAL_FOUND )
|
|||
create_single_source_cgal_program( "edge_aware_upsample_point_set_example.cpp" )
|
||||
create_single_source_cgal_program( "structuring_example.cpp" )
|
||||
|
||||
# Executables that require C++11
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_generalized_initializers has_cpp11)
|
||||
if(has_cpp11 LESS 0)
|
||||
message(STATUS "NOTICE: LAS/PLY IO examples require a C++11 compiler and will not be compiled.")
|
||||
else()
|
||||
create_single_source_cgal_program( "read_ply_points_with_colors_example.cpp" )
|
||||
create_single_source_cgal_program( "write_ply_points_example.cpp" )
|
||||
|
||||
find_package(LASLIB)
|
||||
if (LASLIB_FOUND)
|
||||
include(${LASLIB_USE_FILE})
|
||||
include_directories(${LASLIB_INCLUDE_DIR})
|
||||
include_directories(${LASZIP_INCLUDE_DIR})
|
||||
create_single_source_cgal_program( "read_las_example.cpp" )
|
||||
target_link_libraries(read_las_example ${LASLIB_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use Eigen or BLAS and LAPACK (optional)
|
||||
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
|
|
@ -83,16 +101,6 @@ if ( CGAL_FOUND )
|
|||
|
||||
endif(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
find_package(LASLIB)
|
||||
if (LASLIB_FOUND)
|
||||
include(${LASLIB_USE_FILE})
|
||||
include_directories(${LASLIB_INCLUDE_DIR})
|
||||
include_directories(${LASZIP_INCLUDE_DIR})
|
||||
create_single_source_cgal_program( "read_las_example.cpp" )
|
||||
target_link_libraries(read_las_example ${LASLIB_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "NOTICE : the las reader test needs LAS libraries and will not be compiled.")
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
#include <CGAL/license/Point_set_processing_3.h>
|
||||
|
||||
#ifndef CGAL_CXX11
|
||||
#error CGAL LAS reader requires a C++11 compiler
|
||||
#endif
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/value_type_traits.h>
|
||||
#include <CGAL/point_set_processing_assertions.h>
|
||||
|
|
@ -351,6 +355,8 @@ namespace internal {
|
|||
/// - `LAS_property::B` with type `unsigned short`
|
||||
/// - `LAS_property::I` with type `unsigned short`
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
///
|
||||
/// @sa `make_las_point_reader()`
|
||||
///
|
||||
/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
|
||||
|
|
@ -417,6 +423,8 @@ bool read_las_points_with_properties (std::istream& stream,
|
|||
/// It can be omitted if the value type of `OutputIterator` is convertible to `CGAL::Point_3`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <CGAL/license/Point_set_processing_3.h>
|
||||
|
||||
#ifndef CGAL_CXX11
|
||||
#error CGAL PLY reader requires a C++11 compiler
|
||||
#endif
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/value_type_traits.h>
|
||||
|
|
@ -556,6 +559,8 @@ namespace internal {
|
|||
/// @sa `make_ply_point_reader()`
|
||||
/// @sa `make_ply_normal_reader()`
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
///
|
||||
/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
|
||||
/// It is default to `value_type_traits<OutputIterator>::%type` and can be omitted when the default is fine.
|
||||
/// @tparam OutputIterator iterator over output points.
|
||||
|
|
@ -632,6 +637,8 @@ bool read_ply_points_with_properties (std::istream& stream,
|
|||
/// @tparam NormalPMap is a model of `WritablePropertyMap` with value type `CGAL::Vector_3`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
|
@ -715,6 +722,8 @@ bool read_ply_points_and_normals(std::istream& stream, ///< input stream.
|
|||
/// It can be omitted if the value type of `OutputIterator` is convertible to `CGAL::Point_3`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
#include <CGAL/license/Point_set_processing_3.h>
|
||||
|
||||
#ifndef CGAL_CXX11
|
||||
#error CGAL LAS writer requires a C++11 compiler
|
||||
#endif
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/value_type_traits.h>
|
||||
#include <CGAL/point_set_processing_assertions.h>
|
||||
|
|
@ -159,6 +163,8 @@ namespace internal {
|
|||
///
|
||||
/// @sa `make_las_point_writer()`
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
///
|
||||
/// @tparam ForwardIterator iterator over input points.
|
||||
/// @tparam PointMap is a model of `ReadablePropertyMap` with a value_type = `CGAL::Point_3`.
|
||||
/// @tparam PropertyHandler handlers to recover properties.
|
||||
|
|
@ -234,6 +240,8 @@ bool write_las_points_with_properties (std::ostream& stream, ///< output stream
|
|||
/// It can be omitted if the value type of `ForwardIterator` is convertible to `Point_3<Kernel>`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
template < typename ForwardIterator,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <CGAL/license/Point_set_processing_3.h>
|
||||
|
||||
#ifndef CGAL_CXX11
|
||||
#error CGAL PLY writer requires a C++11 compiler
|
||||
#endif
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/point_set_processing_assertions.h>
|
||||
|
|
@ -270,6 +273,8 @@ namespace internal {
|
|||
/// @sa `make_ply_point_writer()`
|
||||
/// @sa `make_ply_normal_writer()`
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
///
|
||||
/// @tparam ForwardIterator iterator over input points.
|
||||
/// @tparam PropertyHandler handlers to recover properties.
|
||||
///
|
||||
|
|
@ -326,6 +331,8 @@ write_ply_points_with_properties(
|
|||
/// @tparam VectorMap is a model of `ReadablePropertyMap` with a value type `CGAL::Vector_3`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
template < typename ForwardIterator,
|
||||
|
|
@ -379,6 +386,8 @@ write_ply_points_and_normals(
|
|||
/// It can be omitted if the value type of `ForwardIterator` is convertible to `CGAL::Point_3`.
|
||||
///
|
||||
/// @return `true` on success.
|
||||
///
|
||||
/// @cgalRequiresCPP11
|
||||
|
||||
// This variant requires all parameters.
|
||||
template < typename ForwardIterator,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/IO/read_off_points.h>
|
||||
#include <CGAL/IO/read_ply_points.h>
|
||||
#include <CGAL/IO/read_xyz_points.h>
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#include <CGAL/IO/read_ply_points.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
|
@ -49,6 +52,7 @@ bool read_off(std::string s,
|
|||
CGAL::Second_of_pair_property_map<PointVectorPair>());
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
bool read_ply (std::string s,
|
||||
std::vector<PointVectorPair>& pv_pairs)
|
||||
{
|
||||
|
|
@ -59,7 +63,7 @@ bool read_ply (std::string s,
|
|||
CGAL::First_of_pair_property_map<PointVectorPair>(),
|
||||
CGAL::Second_of_pair_property_map<PointVectorPair>());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
@ -91,6 +95,7 @@ int main()
|
|||
assert(pv_pairs[2] == std::make_pair(Point_3(4,5,6), Vector_3(0,0,0)));
|
||||
assert(pv_pairs[3] == std::make_pair(Point_3(7,8,9), Vector_3(0,0,0)));
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
pv_pairs.clear ();
|
||||
assert(read_ply("data/read_test/simple.ply", pv_pairs));
|
||||
assert(pv_pairs[0] == std::make_pair(Point_3(1,1,1), Vector_3(2,2,2)));
|
||||
|
|
@ -108,6 +113,7 @@ int main()
|
|||
assert(pv_pairs[0] == std::make_pair(Point_3(1,1,1), Vector_3(2,2,2)));
|
||||
assert(pv_pairs[1] == std::make_pair(Point_3(3,3,3), Vector_3(4,4,4)));
|
||||
assert(pv_pairs[2] == std::make_pair(Point_3(5,5,5), Vector_3(6,6,6)));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ endif()
|
|||
polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin)
|
||||
target_link_libraries(xyz_plugin scene_points_with_normal_item)
|
||||
|
||||
if(has_cpp11 LESS 0)
|
||||
message(STATUS "NOTICE: LAS/PLY IO plugins require a C++11 compiler and will not be compiled.")
|
||||
else()
|
||||
polyhedron_demo_plugin(ply_to_xyz_plugin PLY_to_xyz_io_plugin)
|
||||
target_link_libraries(ply_to_xyz_plugin scene_points_with_normal_item)
|
||||
|
||||
|
|
@ -78,3 +81,4 @@ if (LASLIB_FOUND)
|
|||
else()
|
||||
message(STATUS "NOTICE : the LAS IO plugin needs LAS libraries and will not be compiled.")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -537,6 +537,7 @@ void Scene_points_with_normal_item::selectDuplicates()
|
|||
Q_EMIT itemChanged();
|
||||
}
|
||||
|
||||
#ifdef CGAL_CXX11
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
// Loads point set from .LAS file
|
||||
bool Scene_points_with_normal_item::read_las_point_set(std::istream& stream)
|
||||
|
|
@ -569,7 +570,7 @@ bool Scene_points_with_normal_item::write_las_point_set(std::ostream& stream) co
|
|||
CGAL::write_las_point_set (stream, *(d->m_points));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // LAS
|
||||
|
||||
// Loads point set from .PLY file
|
||||
bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
|
||||
|
|
@ -608,6 +609,8 @@ bool Scene_points_with_normal_item::write_ply_point_set(std::ostream& stream, bo
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // CXX11
|
||||
|
||||
// Loads point set from .OFF file
|
||||
bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,12 +45,14 @@ public:
|
|||
QMenu* contextMenu() Q_DECL_OVERRIDE;
|
||||
|
||||
// IO
|
||||
#ifdef CGAL_CXX11
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
bool read_las_point_set(std::istream& in);
|
||||
bool write_las_point_set(std::ostream& out) const;
|
||||
#endif
|
||||
#endif // LAS
|
||||
bool read_ply_point_set(std::istream& in);
|
||||
bool write_ply_point_set(std::ostream& out, bool binary) const;
|
||||
#endif // CXX11
|
||||
bool read_off_point_set(std::istream& in);
|
||||
bool write_off_point_set(std::ostream& out) const;
|
||||
bool read_xyz_point_set(std::istream& in);
|
||||
|
|
|
|||
Loading…
Reference in New Issue