Skip to content
Snippets Groups Projects
Commit a891b532 authored by Dan Lipsa's avatar Dan Lipsa
Browse files

Use PDAL instead of Pdal for vtkPDALReader

parent 0ce0d74e
No related branches found
No related tags found
1 merge request!3540Use PDAL instead of Pdal for vtkPDALReader
find_package(PDAL CONFIG REQUIRED)
mark_as_advanced(PDAL_INCLUDE_DIR PDAL_LIBRARY)
set(PdalReader_SRCS vtkPdalReader.cxx)
set(PDALReader_SRCS vtkPDALReader.cxx)
include_directories(${PDAL_INCLUDE_DIRS})
......@@ -13,5 +13,5 @@ foreach(pdal_lib IN LISTS PDAL_LIBRARIES)
break()
endif()
endforeach()
vtk_module_library(vtkIOPDAL ${PdalReader_SRCS})
vtk_module_library(vtkIOPDAL ${PDALReader_SRCS})
vtk_module_link_libraries(vtkIOPDAL LINK_PRIVATE ${PDAL_LIBRARIES})
set(VTK_Pdal_READER_TESTS)
set(VTK_PDAL_READER_TESTS)
function(add_vtk_pdal_reader_test test_input elevation)
get_filename_component(VTK_Pdal_READER_POSTFIX ${test_input} NAME_WE)
string(REPLACE "-" "_" VTK_Pdal_READER_POSTFIX ${VTK_Pdal_READER_POSTFIX})
set(VTK_Pdal_READER_TEST_INPUT "${test_input}")
set(VTK_Pdal_READER_ELEVATION "${elevation}")
set(test_source "TestPdalReader_${VTK_Pdal_READER_POSTFIX}.cxx")
configure_file(TestPdalReader.cxx.in ${test_source})
set(VTK_Pdal_READER_TESTS ${VTK_Pdal_READER_TESTS} ${test_source} PARENT_SCOPE)
get_filename_component(VTK_PDAL_READER_POSTFIX ${test_input} NAME_WE)
string(REPLACE "-" "_" VTK_PDAL_READER_POSTFIX ${VTK_PDAL_READER_POSTFIX})
set(VTK_PDAL_READER_TEST_INPUT "${test_input}")
set(VTK_PDAL_READER_ELEVATION "${elevation}")
set(test_source "TestPDALReader_${VTK_PDAL_READER_POSTFIX}.cxx")
configure_file(TestPDALReader.cxx.in ${test_source})
set(VTK_PDAL_READER_TESTS ${VTK_PDAL_READER_TESTS} ${test_source} PARENT_SCOPE)
endfunction()
add_vtk_pdal_reader_test(test_1.las 0)
add_vtk_pdal_reader_test(test_2.las -90)
vtk_add_test_cxx(${vtk-module}CxxTests tests
${VTK_Pdal_READER_TESTS}
${VTK_PDAL_READER_TESTS}
)
vtk_test_cxx_executable(${vtk-module}CxxTests tests)
......@@ -20,7 +20,7 @@
#include "vtkDataArray.h"
#include "vtkLookupTable.h"
#include "vtkNew.h"
#include "vtkPdalReader.h"
#include "vtkPDALReader.h"
#include "vtkPointData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRegressionTestImage.h"
......@@ -34,11 +34,11 @@
int TestPdalReader_@VTK_Pdal_READER_POSTFIX@(int argc, char **argv)
int TestPDALReader_@VTK_PDAL_READER_POSTFIX@(int argc, char **argv)
{
const char* fileName = "Data/@VTK_Pdal_READER_TEST_INPUT@";
const char* fileName = "Data/@VTK_PDAL_READER_TEST_INPUT@";
const char* path = vtkTestUtilities::ExpandDataFileName(argc, argv, fileName);
vtkNew<vtkPdalReader> reader;
vtkNew<vtkPDALReader> reader;
//Select source file
reader->SetFileName(path);
......@@ -115,7 +115,7 @@ int TestPdalReader_@VTK_Pdal_READER_POSTFIX@(int argc, char **argv)
renderer->ResetCamera();
vtkCamera *camera=renderer->GetActiveCamera();
camera->Elevation(@VTK_Pdal_READER_ELEVATION@);
camera->Elevation(@VTK_PDAL_READER_ELEVATION@);
int retVal = vtkRegressionTestImage (renderWindow);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
......
......@@ -13,7 +13,7 @@
=========================================================================*/
#include "vtkPdalReader.h"
#include "vtkPDALReader.h"
#include <vtkDoubleArray.h>
#include <vtkInformation.h>
......@@ -52,11 +52,11 @@
#include <pdal/StageFactory.hpp>
#include <pdal/Options.hpp>
vtkStandardNewMacro(vtkPdalReader)
vtkStandardNewMacro(vtkPDALReader)
//----------------------------------------------------------------------------
vtkPdalReader::vtkPdalReader()
vtkPDALReader::vtkPDALReader()
{
this->FileName = NULL;
......@@ -65,14 +65,14 @@ vtkPdalReader::vtkPdalReader()
}
//----------------------------------------------------------------------------
vtkPdalReader::~vtkPdalReader()
vtkPDALReader::~vtkPDALReader()
{
if ( ! this->FileName )
delete[] this->FileName;
}
//----------------------------------------------------------------------------
int vtkPdalReader::RequestData(vtkInformation* vtkNotUsed(request),
int vtkPDALReader::RequestData(vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(request),
vtkInformationVector* outputVector)
{
......@@ -93,9 +93,9 @@ int vtkPdalReader::RequestData(vtkInformation* vtkNotUsed(request),
return 0;
}
pdal::Option las_opt_filename("filename", this->FileName);
pdal::Options las_opts;
las_opts.add(las_opt_filename);
pdal::Option opt_filename("filename", this->FileName);
pdal::Options opts;
opts.add(opt_filename);
pdal::Stage* stage = factory.createStage(driverName);
pdal::Reader* reader = static_cast<pdal::Reader*>(stage);
if (! reader)
......@@ -103,7 +103,7 @@ int vtkPdalReader::RequestData(vtkInformation* vtkNotUsed(request),
vtkErrorMacro("Cannot open file " << this->FileName);
return 0;
}
reader->setOptions(las_opts);
reader->setOptions(opts);
vtkNew<vtkPolyData> pointsPolyData;
this->ReadPointRecordData(*reader, pointsPolyData);
......@@ -125,7 +125,7 @@ int vtkPdalReader::RequestData(vtkInformation* vtkNotUsed(request),
}
//----------------------------------------------------------------------------
void vtkPdalReader::ReadPointRecordData(pdal::Reader &reader,
void vtkPDALReader::ReadPointRecordData(pdal::Reader &reader,
vtkPolyData* pointsPolyData)
{
vtkNew<vtkPoints> points;
......@@ -402,9 +402,9 @@ void vtkPdalReader::ReadPointRecordData(pdal::Reader &reader,
}
//----------------------------------------------------------------------------
void vtkPdalReader::PrintSelf(ostream &os, vtkIndent indent)
void vtkPDALReader::PrintSelf(ostream &os, vtkIndent indent)
{
Superclass::PrintSelf(os, indent);
os << "vtkPdalReader" << std::endl;
os << "vtkPDALReader" << std::endl;
os << "Filename: " << this->FileName << std::endl;
}
......@@ -13,10 +13,10 @@
=========================================================================*/
/**
* @class vtkPdalReader
* @class vtkPDALReader
* @brief Reads LIDAR data using the PDAL library.
*
* vtkPdalReader reads LIDAR data using the PDAL library. See the
* vtkPDALReader reads LIDAR data using the PDAL library. See the
* readers section on www.pdal.io for the supported formats. It produces a
* vtkPolyData with point data arrays for attributes such as Intensity,
* Classification, Color, ...
......@@ -26,8 +26,8 @@
* vtkPolyData
*/
#ifndef vtkPdalReader_h
#define vtkPdalReader_h
#ifndef vtkPDALReader_h
#define vtkPDALReader_h
#include <vtkIOPDALModule.h> // For export macro
......@@ -38,13 +38,13 @@ namespace pdal
class Reader;
};
class VTKIOPDAL_EXPORT vtkPdalReader: public vtkPolyDataAlgorithm
class VTKIOPDAL_EXPORT vtkPDALReader: public vtkPolyDataAlgorithm
{
public:
vtkPdalReader(const vtkPdalReader&) = delete;
void operator=(const vtkPdalReader&) = delete;
static vtkPdalReader* New();
vtkTypeMacro(vtkPdalReader,vtkPolyDataAlgorithm);
vtkPDALReader(const vtkPDALReader&) = delete;
void operator=(const vtkPDALReader&) = delete;
static vtkPDALReader* New();
vtkTypeMacro(vtkPDALReader,vtkPolyDataAlgorithm);
virtual void PrintSelf(ostream &os, vtkIndent indent) override;
/**
......@@ -54,8 +54,8 @@ public:
vtkGetStringMacro(FileName);
protected:
vtkPdalReader();
virtual ~vtkPdalReader();
vtkPDALReader();
virtual ~vtkPDALReader();
/**
* Core implementation of the data set reader
......@@ -71,4 +71,4 @@ protected:
char* FileName;
};
#endif // vtkPdalReader_h
#endif // vtkPDALReader_h
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment