diff --git a/cmake/laszip.cmake b/cmake/laszip.cmake index e328538d40..f5896da1b5 100644 --- a/cmake/laszip.cmake +++ b/cmake/laszip.cmake @@ -5,7 +5,7 @@ option(WITH_LASZIP "Choose if LASzip support should be built" TRUE) option(WITH_STATIC_LASZIP "Choose if LASzip should be statically linked" FALSE) mark_as_advanced(WITH_STATIC_LASZIP) if (WITH_LASZIP) - find_package(LASzip QUIET 3.1.1) + find_package(LASzip QUIET 3.1) set_package_properties(LASzip PROPERTIES TYPE RECOMMENDED PURPOSE "Provides LASzip compression") if(LASZIP_FOUND) diff --git a/cmake/modules/FindLASzip.cmake b/cmake/modules/FindLASzip.cmake index 9596fca86f..11ba51c7ec 100644 --- a/cmake/modules/FindLASzip.cmake +++ b/cmake/modules/FindLASzip.cmake @@ -25,7 +25,7 @@ IF(LASZIP_INCLUDE_DIR) ENDIF() IF(WIN32) - SET(OSGEO4W_IMPORT_LIBRARY laszip) + SET(OSGEO4W_IMPORT_LIBRARY laszip3) IF(DEFINED ENV{OSGEO4W_ROOT}) SET(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT}) #MESSAGE(STATUS " FindLASzip: trying OSGeo4W using environment variable OSGEO4W_ROOT=$ENV{OSGEO4W_ROOT}") diff --git a/doc/stages/filters.computerange.rst b/doc/stages/filters.computerange.rst deleted file mode 100644 index 4b4dc94db3..0000000000 --- a/doc/stages/filters.computerange.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. _filters.computerange: - -=============================================================================== -filters.computerange -=============================================================================== - -The Compute Range filter computes the range from the sensor to each of the -detected returns. - -.. note:: - - The Compute Range filter is specific to raw data from a particular data - provider, where the sensor coordinates for each frame are encoded as regular - points, and are identified by the pixel number -5. - -.. embed:: - -Example -------------------------------------------------------------------------------- - -.. code-block:: json - - { - "pipeline":[ - "input.bpf", - { - "type":"filters.computerange" - }, - { - "type":"writers.bpf", - "filename":"output.bpf", - "output_dims":"X,Y,Z,Range" - } - ] - } - diff --git a/filters/ComputeRangeFilter.cpp b/filters/ComputeRangeFilter.cpp deleted file mode 100644 index a99c42b26a..0000000000 --- a/filters/ComputeRangeFilter.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2016, Bradley J Chambers (brad.chambers@gmail.com) -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following -* conditions are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -* OF SUCH DAMAGE. -****************************************************************************/ - -#include "ComputeRangeFilter.hpp" - -#include - -namespace pdal -{ - -static StaticPluginInfo const s_info -{ - "filters.computerange", - "Compute Range Filter", - "http://pdal.io/stages/filters.computerange.html" -}; - -CREATE_STATIC_STAGE(ComputeRangeFilter, s_info) - -std::string ComputeRangeFilter::getName() const -{ - return s_info.name; -} - - -void ComputeRangeFilter::addDimensions(PointLayoutPtr layout) -{ - m_range = layout->registerOrAssignDim("Range", Dimension::Type::Double); -} - - -void ComputeRangeFilter::prepared(PointTableRef table) -{ - using namespace Dimension; - - const PointLayoutPtr layout(table.layout()); - - m_frameNumber = layout->findDim("Frame Number"); - if (m_frameNumber == Id::Unknown) - throwError("missing Frame Number dimension in input PointView"); - - m_pixelNumber = layout->findDim("Pixel Number"); - if (m_pixelNumber == Id::Unknown) - throwError("missing Pixel Number dimension in input PointView"); -} - -void ComputeRangeFilter::filter(PointView& view) -{ - using namespace Dimension; - - // Sensor coordinates are provided for each frame. The pixel number -5 is - // used to flag the sensor position. - log()->get(LogLevel::Debug) << "Stash sensor positions...\n"; - struct sp - { - double sx, sy, sz; - }; - std::map smap; - for (PointId i = 0; i < view.size(); ++i) - { - int f = view.getFieldAs(m_frameNumber, i); - int p = view.getFieldAs(m_pixelNumber, i); - if (p == -5) - { - smap[f].sx = view.getFieldAs(Id::X, i); - smap[f].sy = view.getFieldAs(Id::Y, i); - smap[f].sz = view.getFieldAs(Id::Z, i); - } - } - - // For each XYZ coordinate, we look up the sensor position for the - // corresponding frame and compute the Euclidean distance. This is - // recorded in the Range dimension. - log()->get(LogLevel::Debug) << "Compute ranges...\n"; - for (PointId i = 0; i < view.size(); ++i) - { - int f = view.getFieldAs(m_frameNumber, i); - double dx = smap[f].sx - view.getFieldAs(Id::X, i); - double dy = smap[f].sy - view.getFieldAs(Id::Y, i); - double dz = smap[f].sz - view.getFieldAs(Id::Z, i); - double r = std::sqrt(dx * dx + dy * dy + dz * dz); - view.setField(m_range, i, r); - } -} - -} // namespace pdal diff --git a/filters/ComputeRangeFilter.hpp b/filters/ComputeRangeFilter.hpp deleted file mode 100644 index a862b9d004..0000000000 --- a/filters/ComputeRangeFilter.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2016, Bradley J Chambers (brad.chambers@gmail.com) -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following -* conditions are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -* OF SUCH DAMAGE. -****************************************************************************/ - -#pragma once - -#include - -#include - -namespace pdal -{ - -class PointLayout; -class PointView; - -class PDAL_DLL ComputeRangeFilter : public Filter -{ -public: - ComputeRangeFilter() : Filter() - {} - - std::string getName() const; - -private: - Dimension::Id m_pixelNumber, m_frameNumber, m_range; - - virtual void addDimensions(PointLayoutPtr layout); - virtual void filter(PointView& view); - virtual void prepared(PointTableRef table); - - ComputeRangeFilter& operator=(const ComputeRangeFilter&); // not implemented - ComputeRangeFilter(const ComputeRangeFilter&); // not implemented -}; - -} // namespace pdal diff --git a/io/TextReader.cpp b/io/TextReader.cpp index 9e1d1f2e70..6f0d7a0937 100644 --- a/io/TextReader.cpp +++ b/io/TextReader.cpp @@ -90,6 +90,7 @@ QuickInfo TextReader::inspect() void TextReader::checkHeader(const std::string& header) { + std::cerr << "Header = " << header << "!\n"; auto it = std::find_if(header.begin(), header.end(), [](char c){ return std::isalpha(c); }); if (it == header.end()) @@ -130,6 +131,7 @@ void TextReader::initialize(PointTableRef table) if (!m_istream) throwError("Unable to open text file '" + m_filename + "'."); + m_line = 0; // Skip lines requested. std::string dummy; for (size_t i = 0; i < m_skip; ++i) diff --git a/pdal/FlexWriter.hpp b/pdal/FlexWriter.hpp index a623ccc7d5..eebe801d26 100644 --- a/pdal/FlexWriter.hpp +++ b/pdal/FlexWriter.hpp @@ -105,7 +105,11 @@ class PDAL_DLL FlexWriter : public Writer virtual void write(const PointViewPtr view) final { if (m_hashPos != std::string::npos) + { + if (view->size() == 0) + return; readyFile(generateFilename(), view->spatialReference()); + } writeView(view); if (m_hashPos != std::string::npos) doneFile(); diff --git a/plugins/nitf/io/tre_plugins.hpp b/plugins/nitf/io/tre_plugins.hpp index 33cd4f536b..e273e63ba9 100644 --- a/plugins/nitf/io/tre_plugins.hpp +++ b/plugins/nitf/io/tre_plugins.hpp @@ -39,7 +39,15 @@ #ifndef IMPORT_NITRO_API #define IMPORT_NITRO_API #endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wunused-private-field" + #include + +#pragma GCC diagnostic pop + #include namespace pdal diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 0011818e55..f405587ef3 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -108,7 +108,6 @@ PDAL_ADD_TEST(pdal_filters_colorinterp_test FILES filters/ColorinterpFilterTest.cpp) PDAL_ADD_TEST(pdal_filters_colorization_test FILES filters/ColorizationFilterTest.cpp) -PDAL_ADD_TEST(pdal_filters_computerange_test FILES filters/ComputeRangeFilterTest.cpp) PDAL_ADD_TEST(pdal_filters_crop_test FILES filters/CropFilterTest.cpp) PDAL_ADD_TEST(pdal_filters_decimation_test FILES filters/DecimationFilterTest.cpp) diff --git a/test/unit/filters/ComputeRangeFilterTest.cpp b/test/unit/filters/ComputeRangeFilterTest.cpp deleted file mode 100644 index 5c52421b50..0000000000 --- a/test/unit/filters/ComputeRangeFilterTest.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/****************************************************************************** -* Copyright (c) 2016, Bradley J Chambers (brad.chambers@gmail.com) -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following -* conditions are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided -* with the distribution. -* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -* OF SUCH DAMAGE. -****************************************************************************/ - -#include - -#include -#include -#include -#include -#include - -#include "Support.hpp" - -using namespace pdal; - -TEST(ComputeRangeFilterTest, create) -{ - StageFactory f; - Stage* filter(f.createStage("filters.computerange")); - EXPECT_TRUE(filter); -} - -TEST(ComputeRangeFilterTest, compute) -{ - using namespace Dimension; - - PointTable table; - PointLayoutPtr layout(table.layout()); - - layout->registerDim(Id::X); - layout->registerDim(Id::Y); - layout->registerDim(Id::Z); - Id pn = layout->registerOrAssignDim("Pixel Number", Type::Double); - Id fn = layout->registerOrAssignDim("Frame Number", Type::Double); - - PointViewPtr view(new PointView(table)); - - BufferReader r; - r.addView(view); - - ComputeRangeFilter crop; - crop.setInput(r); - crop.prepare(table); - - view->setField(Id::X, 0, 0.0); - view->setField(Id::Y, 0, 0.0); - view->setField(Id::Z, 0, 0.0); - view->setField(pn, 0, 0.0); - view->setField(fn, 0, 0.0); - - view->setField(Id::X, 1, 0.0); - view->setField(Id::Y, 1, 3.0); - view->setField(Id::Z, 1, 4.0); - view->setField(pn, 1, -5.0); - view->setField(fn, 1, 0.0); - - PointViewSet s = crop.execute(table); - EXPECT_EQ(1u, s.size()); - - Id range = layout->findDim("Range"); - EXPECT_NE(Id::Unknown, range); - - PointViewPtr out = *s.begin(); - EXPECT_EQ(2u, out->size()); - - EXPECT_EQ(5.0, out->getFieldAs(range, 0)); - EXPECT_EQ(0.0, out->getFieldAs(range, 1)); -}