From dac7cfed72f9c8d9f8a653af3da427eb59d9b9c9 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Mon, 5 Mar 2018 15:58:05 -0500 Subject: [PATCH 1/4] Issue 1824 (#1830) * Force initial cell I/J to be in bounds where not otherwise checked. * Remove unnecessary assignments. * Make sure width/height are in range. * Remove misplaced '='. * Add grid OOB test. * Add test file. --- io/GDALGrid.cpp | 47 ++++++++++++++--------- io/GDALGrid.hpp | 2 +- io/GDALWriter.cpp | 11 +++++- test/data/gdal/grid_bounds.txt | 40 ++++++++++++++++++++ test/unit/io/GDALWriterTest.cpp | 67 +++++++++++++++++++++++++-------- 5 files changed, 131 insertions(+), 36 deletions(-) create mode 100644 test/data/gdal/grid_bounds.txt diff --git a/io/GDALGrid.cpp b/io/GDALGrid.cpp index 429fa45417..2b01dfa871 100644 --- a/io/GDALGrid.cpp +++ b/io/GDALGrid.cpp @@ -48,6 +48,15 @@ GDALGrid::GDALGrid(size_t width, size_t height, double edgeLength, m_width(width), m_height(height), m_windowSize(windowSize), m_edgeLength(edgeLength), m_radius(radius), m_outputTypes(outputTypes) { + if (width > std::numeric_limits::max() || + height > std::numeric_limits::max()) + { + std::ostringstream oss; + oss << "Grid width or height is too large. Width and height are " + "limited to " << std::numeric_limits::max() << " cells." + "Try setting bounds or increasing resolution."; + throw error(oss.str()); + } size_t size(width * height); m_count.reset(new DataVec(size)); @@ -199,9 +208,11 @@ void GDALGrid::addPoint(double x, double y, double z) // <- v + int i, j; + int iStart, jStart; // First quadrant; - int i = iOrigin + 1; - int j = jOrigin; + i = iStart = std::max(0, iOrigin + 1); + j = std::min(jOrigin, int(m_height - 1)); while (i < (int)m_width && j >= 0) { double d = distance(i, j, x, y); @@ -212,16 +223,16 @@ void GDALGrid::addPoint(double x, double y, double z) } else { - if (i == iOrigin + 1) + if (i == iStart) break; - i = iOrigin + 1; + i = iStart; j--; } } // Second quadrant; - i = iOrigin; - j = jOrigin - 1; + i = std::min(iOrigin, int(m_width - 1)); + j = jStart = std::min(jOrigin - 1, int(m_height - 1)); while (i >= 0 && j >= 0) { double d = distance(i, j, x, y); @@ -232,16 +243,16 @@ void GDALGrid::addPoint(double x, double y, double z) } else { - if (j == jOrigin - 1) + if (j == jStart) break; - j = jOrigin - 1; + j = jStart; i--; } } // Third quadrant; - i = iOrigin - 1; - j = jOrigin; + i = iStart = std::min(iOrigin - 1, int(m_width - 1)); + j = std::max(jOrigin, 0); while (i >= 0 && j < (int)m_height) { double d = distance(i, j, x, y); @@ -252,15 +263,15 @@ void GDALGrid::addPoint(double x, double y, double z) } else { - if (i == iOrigin - 1) + if (i == iStart) break; - i = iOrigin - 1; + i = iStart; j++; } } // Fourth quadrant; - i = iOrigin; - j = jOrigin + 1; + i = std::max(iOrigin, 0); + j = jStart = std::max(jOrigin + 1, 0); while (i < (int)m_width && j < (int)m_height) { double d = distance(i, j, x, y); @@ -271,9 +282,9 @@ void GDALGrid::addPoint(double x, double y, double z) } else { - if (j == jOrigin + 1) + if (j == jStart) break; - j = jOrigin + 1; + j = jStart; i++; } } @@ -283,11 +294,11 @@ void GDALGrid::addPoint(double x, double y, double z) double d = distance(iOrigin, jOrigin, x, y); if (d < m_radius && iOrigin >= 0 && jOrigin >= 0 && - iOrigin < (int)m_width && jOrigin <= (int)m_height) + iOrigin < (int)m_width && jOrigin < (int)m_height) update(iOrigin, jOrigin, z, d); } -void GDALGrid::update(int i, int j, double val, double dist) +void GDALGrid::update(size_t i, size_t j, double val, double dist) { // Once we determine that a point is close enough to a cell to count it, // this function does the actual math. We use the value of the diff --git a/io/GDALGrid.hpp b/io/GDALGrid.hpp index 99a4bc6bc6..583b49bcd2 100644 --- a/io/GDALGrid.hpp +++ b/io/GDALGrid.hpp @@ -139,7 +139,7 @@ class GDALGrid } // Update cell at i, j with value at a distance. - void update(int i, int j, double val, double dist); + void update(size_t i, size_t j, double val, double dist); // Fill cell at index \c i with the nondata value. void fillNodata(size_t i); diff --git a/io/GDALWriter.cpp b/io/GDALWriter.cpp index 65d9f86531..8709d2077f 100644 --- a/io/GDALWriter.cpp +++ b/io/GDALWriter.cpp @@ -143,8 +143,15 @@ void GDALWriter::createGrid(BOX2D bounds) m_curBounds = bounds; size_t width = ((m_curBounds.maxx - m_curBounds.minx) / m_edgeLength) + 1; size_t height = ((m_curBounds.maxy - m_curBounds.miny) / m_edgeLength) + 1; - m_grid.reset(new GDALGrid(width, height, m_edgeLength, m_radius, - m_outputTypes, m_windowSize)); + try + { + m_grid.reset(new GDALGrid(width, height, m_edgeLength, m_radius, + m_outputTypes, m_windowSize)); + } + catch (GDALGrid::error& err) + { + throwError(err.what()); + } } diff --git a/test/data/gdal/grid_bounds.txt b/test/data/gdal/grid_bounds.txt new file mode 100644 index 0000000000..69ceffe1ad --- /dev/null +++ b/test/data/gdal/grid_bounds.txt @@ -0,0 +1,40 @@ +X,Y,Z + +0, 0, 0 +.5, .5, 1 +1.5, .5, 2 +2.5, .5, 3 +3.5, .5, 4 +4.5, .5, 5 +3.5, 1, 4.4 +4.5, 1, 5.4 +.5, 1.5, 2 +1.5, 1.5, 3 +2.5, 1.5, 4 +3, 1.5, 4.4 +3.5, 1.5, 5 +4, 1.5, 5.4 +4.5, 1.5, 6 +3.5, 2, 5.4 +4.5, 2, 6.4 +.5, 2.5, 3 +1.5, 2.5, 4 +2.5, 2.5, 5 +3.5, 2.5, 6 +4.5, 2.5, 7 +.5, 3.5, 4 +2.5, 3.5, 6 +3.5, 3.5, 7 +4.5, 3.5, 8 +.5, 4.5, 5 +2.5, 4.5, 7 +3.5, 4.5, 8 +4.5, 4.6, 9.1 +4.7, 4.5, 8.9 +4.3, 4.5, 8.9 +-1000, 2, -45 +-1000, -10000, 4 +3.2, -1000, 7 +10000, 3, 4 +2, 10000, 45 +999, 9995, 45 diff --git a/test/unit/io/GDALWriterTest.cpp b/test/unit/io/GDALWriterTest.cpp index 579f85b963..47ba6ab78a 100644 --- a/test/unit/io/GDALWriterTest.cpp +++ b/test/unit/io/GDALWriterTest.cpp @@ -49,13 +49,13 @@ using namespace pdal; namespace { -void runGdalWriter(const Options& wo, const std::string& outfile, - const std::string& values) +void runGdalWriter(const Options& wo, const std::string& infile, + const std::string& outfile, const std::string& values) { FileUtils::deleteFile(outfile); Options ro; - ro.add("filename", Support::datapath("gdal/grid.txt")); + ro.add("filename", infile); TextReader r; r.setOptions(ro); @@ -162,6 +162,7 @@ void runGdalWriter2(const Options& wo, const std::string& outfile, TEST(GDALWriterTest, min) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -178,7 +179,7 @@ TEST(GDALWriterTest, min) "2.000 3.000 4.000 4.400 5.400 " "1.000 2.000 3.000 4.000 5.000 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, min2) @@ -213,6 +214,7 @@ TEST(GDALWriterTest, min2) TEST(GDALWriterTest, minWindow) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -230,11 +232,12 @@ TEST(GDALWriterTest, minWindow) "2.000 3.000 4.000 4.400 5.400 " "1.000 2.000 3.000 4.000 5.000 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, max) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -251,11 +254,12 @@ TEST(GDALWriterTest, max) "2.000 3.000 4.000 5.400 6.400 " "1.000 2.000 3.000 4.400 5.400 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, maxWindow) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -273,11 +277,12 @@ TEST(GDALWriterTest, maxWindow) "2.000 3.000 4.000 5.400 6.400 " "1.000 2.000 3.000 4.400 5.400 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, mean) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -294,11 +299,12 @@ TEST(GDALWriterTest, mean) "2.000 3.000 4.000 4.800 5.800 " "1.000 2.000 3.000 4.200 5.200 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, meanWindow) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -316,11 +322,12 @@ TEST(GDALWriterTest, meanWindow) "2.000 3.000 4.000 4.800 5.800 " "1.000 2.000 3.000 4.200 5.200 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, idw) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -337,11 +344,12 @@ TEST(GDALWriterTest, idw) "2.000 3.000 4.000 5.000 6.000 " "1.000 2.000 3.000 4.000 5.000 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, idwWindow) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -359,11 +367,12 @@ TEST(GDALWriterTest, idwWindow) "2.000 3.000 4.000 5.000 6.000 " "1.000 2.000 3.000 4.000 5.000 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, count) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -380,11 +389,12 @@ TEST(GDALWriterTest, count) "1.000 1.000 1.000 4.000 4.000 " "1.000 1.000 1.000 2.000 2.000 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, stdev) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -401,11 +411,12 @@ TEST(GDALWriterTest, stdev) "0.000 0.000 0.000 0.424 0.424 " "0.000 0.000 0.000 0.200 0.200 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, stdevWindow) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -423,7 +434,7 @@ TEST(GDALWriterTest, stdevWindow) "0.000 0.000 0.000 0.424 0.424 " "0.000 0.000 0.000 0.200 0.200 "; - runGdalWriter(wo, outfile, output); + runGdalWriter(wo, infile, outfile, output); } TEST(GDALWriterTest, additionalDim) @@ -468,6 +479,7 @@ TEST(GDALWriterTest, additionalDim) TEST(GDALWriterTest, btbad) { + std::string infile = Support::datapath("gdal/grid.txt"); std::string outfile = Support::temppath("tmp.tif"); Options wo; @@ -485,7 +497,7 @@ TEST(GDALWriterTest, btbad) "2.000 3.000 4.000 4.000 5.000 " "1.000 2.000 3.000 4.000 5.000 "; - EXPECT_THROW(runGdalWriter(wo, outfile, output), pdal_error); + EXPECT_THROW(runGdalWriter(wo, infile, outfile, output), pdal_error); } TEST(GDALWriterTest, btint) @@ -575,3 +587,28 @@ TEST(GDALWriterTest, no_points) EXPECT_THROW(w.execute(t), pdal_error); } +// Check that we don't crash with bad X/Y's in grid_bounds.txt and a preset +// grid bounds. +TEST(GDALWriterTest, bounds) +{ + std::string infile = Support::datapath("gdal/grid_bounds.txt"); + std::string outfile = Support::temppath("tmp.tif"); + + Options wo; + wo.add("gdaldriver", "GTiff"); + wo.add("output_type", "mean"); + wo.add("resolution", 1); + wo.add("radius", .7071); + wo.add("filename", outfile); + wo.add("bounds", "([0, 4.5],[0, 4.5])"); + + const std::string output = + "5.000 -9999.000 7.000 8.000 8.967 " + "4.000 -9999.000 6.000 7.000 8.000 " + "3.000 4.000 5.000 5.700 6.700 " + "2.000 3.000 4.000 4.800 5.800 " + "1.000 2.000 3.000 4.200 5.200 "; + + runGdalWriter(wo, infile, outfile, output); +} + From cfb72b4b810d5efd0d1a9441d2474d057dc39426 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Tue, 6 Mar 2018 15:17:36 -0500 Subject: [PATCH 2/4] Don't allow 'all' for readers.las.extra_dims. --- io/LasReader.cpp | 2 +- io/LasUtils.cpp | 7 ++++++- io/LasUtils.hpp | 2 +- io/LasWriter.cpp | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/io/LasReader.cpp b/io/LasReader.cpp index 406e78892b..02659d652a 100644 --- a/io/LasReader.cpp +++ b/io/LasReader.cpp @@ -159,7 +159,7 @@ void LasReader::initializeLocal(PointTableRef table, MetadataNode& m) { try { - m_extraDims = LasUtils::parse(m_extraDimSpec); + m_extraDims = LasUtils::parse(m_extraDimSpec, false); } catch (const LasUtils::error& err) { diff --git a/io/LasUtils.cpp b/io/LasUtils.cpp index a6515abbae..12d7b8995a 100644 --- a/io/LasUtils.cpp +++ b/io/LasUtils.cpp @@ -212,7 +212,7 @@ std::vector parseIgnoreVLRs(const StringList& ignored) return ignoredVLRs; } -std::vector parse(const StringList& dimString) +std::vector parse(const StringList& dimString, bool allOk) { std::vector extraDims; bool all = false; @@ -221,6 +221,11 @@ std::vector parse(const StringList& dimString) { if (dim == "all") { + // We only accept all for LasWriter. + if (!allOk) + throw error("Invalid extra dimension specified: '" + dim + + "'. Need =. See documentation " + " for details."); all = true; continue; } diff --git a/io/LasUtils.hpp b/io/LasUtils.hpp index b87b546127..0c13b33c1b 100644 --- a/io/LasUtils.hpp +++ b/io/LasUtils.hpp @@ -171,7 +171,7 @@ struct error : public std::runtime_error {} }; -std::vector parse(const StringList& dimString); +std::vector parse(const StringList& dimString, bool allOk); struct IgnoreVLR diff --git a/io/LasWriter.cpp b/io/LasWriter.cpp index 4254634a30..bc287d3165 100644 --- a/io/LasWriter.cpp +++ b/io/LasWriter.cpp @@ -152,7 +152,7 @@ void LasWriter::initialize() #endif try { - m_extraDims = LasUtils::parse(m_extraDimSpec); + m_extraDims = LasUtils::parse(m_extraDimSpec, true); } catch (const LasUtils::error& err) { From 0cd659140d5750a63f106630d7e803e7a04ddcde Mon Sep 17 00:00:00 2001 From: Howard Butler Date: Wed, 7 Mar 2018 15:57:14 -0600 Subject: [PATCH 3/4] output more detail for readers.bpf when the coordinate system configuration is not a combo we support (#1828) * output more detail for readers.bpf when the coordinate system configuration is not a combo we support * support ECEF for readers.bpf when the file SRS is defined correctly * fix comment --- io/BpfReader.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/io/BpfReader.cpp b/io/BpfReader.cpp index 64fedbef87..67bb4404f3 100644 --- a/io/BpfReader.cpp +++ b/io/BpfReader.cpp @@ -135,13 +135,31 @@ void BpfReader::initialize() Utils::toString(zone)); code += (zone < 10 ? "0" : "") + Utils::toString(zone); } + else if (m_header.m_coordType == static_cast(BpfCoordType::TCR)) + { + // TCR is ECEF meters, or EPSG:4978 + // According to the 1.0 spec, the m_coordId must be 1 to be + // valid. + if (m_header.m_coordId == 1) + code = std::string("EPSG:4978"); + else + { + std::ostringstream oss; + oss << "BPF has ECEF/TCR coordinate type defined, but the ID of '" + << m_header.m_coordId << "' is invalid"; + throwError(oss.str()); + } + } else { - // BPF supports something called Terrestrial Centered Rotational - // (BpfCoordType::TCR) and East North Up (BpfCoordType::ENU) + // BPF also supports something East North Up (BpfCoordType::ENU) // which we can figure out when we run into a file with these // coordinate systems. - throwError("BPF file contains unsupported coordinate system"); + std::ostringstream oss; + oss << "BPF file contains unsupported coordinate system with " + << "coordinate type: '" << m_header.m_coordType + << "' and coordinate id: '" << m_header.m_coordId << "'"; + throwError(oss.str()); } SpatialReference srs(code); setSpatialReference(srs); From 444681a7808061324fb523b239bd179f3dca4e18 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Thu, 8 Mar 2018 08:52:46 -0500 Subject: [PATCH 4/4] Don't set visibility of inline functions/statics to local for PCL. (#1832) Simplify some PCL build. --- plugins/pcl/CMakeLists.txt | 41 +++++++++++++++--------------- plugins/pcl/filters/IcpFilter.cpp | 4 +-- plugins/pcl/test/IcpFilterTest.cpp | 8 +++--- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/pcl/CMakeLists.txt b/plugins/pcl/CMakeLists.txt index 133d4b09ac..cf6308cdcc 100644 --- a/plugins/pcl/CMakeLists.txt +++ b/plugins/pcl/CMakeLists.txt @@ -34,16 +34,14 @@ set_package_properties(PCL PROPERTIES DESCRIPTION "Point Cloud Library" URL "http://pointclouds.org" TYPE RECOMMENDED PURPOSE "Enables PCD reader/writer, PCLVisualizer, PCLBlock filter, ICP filter, and ground, pcl, smooth, and view kernels") -set(INCLUDE_DIRS - ${ROOT_DIR} - ${PCL_INCLUDE_DIRS} - ${CMAKE_CURRENT_LIST_DIR} - ) - add_definitions(${PCL_DEFINITIONS}) -if (NOT WIN32) - add_definitions("-fvisibility-inlines-hidden") -endif() +# +# This can cause problems if you inline some code that instantiates a static. +# I'm not sure why it was here, but I'm keeping it for now in case someone +# goes looking for it. - ABELL 3/18 +#if (NOT WIN32) +# add_definitions("-fvisibility-inlines-hidden") +#endif() # PCL's configuration clobbers Boost find_package - do it again find_package(Boost QUIET 1.52 COMPONENTS program_options iostreams filesystem system thread) @@ -57,7 +55,7 @@ PDAL_ADD_PLUGIN(pcd_reader_libname reader pcd io/PcdReader.cpp LINK_WITH ${PCL_LIBRARIES}) target_include_directories(${pcd_reader_libname} PRIVATE - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) set_source_files_properties(io/PcdReader.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic) endif() @@ -71,7 +69,7 @@ PDAL_ADD_PLUGIN(pcd_writer_libname writer pcd io/PcdWriter.cpp LINK_WITH ${PCL_LIBRARIES}) target_include_directories(${pcd_writer_libname} PRIVATE - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) set_source_files_properties(io/PcdWriter.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic) endif() @@ -89,7 +87,7 @@ PDAL_ADD_PLUGIN(pclblock_libname filter pclblock ) target_include_directories(${pclblock_libname} PRIVATE - ${INCLUDE_DIRS} + ${PCL_INCLUDE_DIRS} ${PDAL_JSONCPP_INCLUDE_DIR} ) @@ -97,15 +95,17 @@ PDAL_ADD_PLUGIN(voxelgrid_filter_libname filter voxelgrid FILES filters/VoxelGridFilter.cpp LINK_WITH ${PCL_LIBRARIES}) -target_include_directories(${voxelgrid_filter_libname} PRIVATE - ${INCLUDE_DIRS}) +target_include_directories(${voxelgrid_filter_libname} + PRIVATE + ${PCL_INCLUDE_DIRS} +) PDAL_ADD_PLUGIN(movingleastsquares_filter_libname filter movingleastsquares FILES filters/MovingLeastSquaresFilter.cpp LINK_WITH ${PCL_LIBRARIES}) target_include_directories(${movingleastsquares_filter_libname} PRIVATE - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) set_source_files_properties(filters/MovingLeastSquaresFilter.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic) endif() @@ -116,14 +116,14 @@ PDAL_ADD_PLUGIN(gridprojection_filter_libname filter gridprojection filters/GridProjectionFilter.cpp LINK_WITH ${PCL_LIBRARIES}) target_include_directories(${gridprojection_filter_libname} PRIVATE - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) PDAL_ADD_PLUGIN(icp_filter_libname filter icp FILES filters/IcpFilter.cpp LINK_WITH ${PCL_LIBRARIES}) target_include_directories(${icp_filter_libname} PRIVATE - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) # # PCL Kernel @@ -134,7 +134,7 @@ PDAL_ADD_PLUGIN(pcl_libname kernel pcl LINK_WITH ${PCL_LIBRARIES} ${pclblock_libname}) target_include_directories(${pcl_libname} PRIVATE ${PDAL_IO_DIR} - ${INCLUDE_DIRS}) + ${PCL_INCLUDE_DIRS}) # # Smooth Kernel @@ -145,7 +145,7 @@ PDAL_ADD_PLUGIN(smooth_libname kernel smooth kernel/SmoothKernel.cpp LINK_WITH ${PCL_LIBRARIES} ${pclblock_libname}) target_include_directories(${smooth_libname} PRIVATE - ${INCLUDE_DIRS} + ${PCL_INCLUDE_DIRS} ${PDAL_IO_DIR}) if (WITH_TESTS) @@ -162,5 +162,6 @@ if (WITH_TESTS) LINK_WITH ${icp_filter_libname} ) - target_include_directories(pdal_filters_icp_test PRIVATE ${INCLUDE_DIRS}) + target_include_directories(pdal_filters_icp_test PRIVATE + ${PCL_INCLUDE_DIRS}) endif() diff --git a/plugins/pcl/filters/IcpFilter.cpp b/plugins/pcl/filters/IcpFilter.cpp index 8b31110649..b0bcbeb31e 100644 --- a/plugins/pcl/filters/IcpFilter.cpp +++ b/plugins/pcl/filters/IcpFilter.cpp @@ -32,8 +32,8 @@ * OF SUCH DAMAGE. ****************************************************************************/ -#include "PCLConversions.hpp" -#include +#include "../PCLConversions.hpp" +#include "IcpFilter.hpp" #include #include #include diff --git a/plugins/pcl/test/IcpFilterTest.cpp b/plugins/pcl/test/IcpFilterTest.cpp index 9ef6293317..3f7219f15f 100644 --- a/plugins/pcl/test/IcpFilterTest.cpp +++ b/plugins/pcl/test/IcpFilterTest.cpp @@ -34,12 +34,12 @@ #include "Support.hpp" #include -#include #include #include #include #include #include +#include namespace pdal { @@ -55,9 +55,11 @@ std::unique_ptr newReader() return reader; } -std::unique_ptr newFilter() +Stage* newFilter() { - return std::unique_ptr(new IcpFilter()); + static StageFactory f; + + return f.createStage("filters.icp"); } void checkPointsEqualReader(const PointViewSet& pointViewSet, double tolerance)