Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Feb 23, 2018
2 parents e09a1a8 + e4573b9 commit cd9aa92
Show file tree
Hide file tree
Showing 242 changed files with 1,782 additions and 1,252 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -78,6 +78,7 @@ test/data/local

/_build*
/build*
/examples/build*
/*local*.bat
/*local*.sh
Makefile
Expand Down
28 changes: 13 additions & 15 deletions apps/pdal.cpp
Expand Up @@ -111,7 +111,7 @@ void App::outputHelp(const ProgramArgs& args)
m_out << "The following commands are available:" << std::endl;

StageFactory f(false);
StringList loaded_kernels = PluginManager::names(PF_PluginType_Kernel);
StringList loaded_kernels = PluginManager<Kernel>::names();

for (auto name : loaded_kernels)
m_out << " - " << name << std::endl;
Expand All @@ -124,8 +124,7 @@ void App::outputDrivers()
// Force plugin loading.
StageFactory f(false);

StringList stages = PluginManager::names(PF_PluginType_Filter |
PF_PluginType_Reader | PF_PluginType_Writer);
StringList stages = PluginManager<Stage>::names();

if (!m_showJSON)
{
Expand All @@ -146,7 +145,7 @@ void App::outputDrivers()

for (auto name : stages)
{
std::string descrip = PluginManager::description(name);
std::string descrip = PluginManager<Stage>::description(name);
StringList lines = Utils::wordWrap(descrip, descripColLen - 1);
for (size_t i = 0; i < lines.size(); ++i)
{
Expand All @@ -164,8 +163,8 @@ void App::outputDrivers()
Json::Value array(Json::arrayValue);
for (auto name : stages)
{
std::string description = PluginManager::description(name);
std::string link = PluginManager::link(name);
std::string description = PluginManager<Stage>::description(name);
std::string link = PluginManager<Stage>::link(name);
Json::Value node(Json::objectValue);
node["name"] = name;
node["description"] = description;
Expand All @@ -183,7 +182,7 @@ void App::outputCommands()
{
StageFactory f(false);
std::vector<std::string> loaded_kernels;
loaded_kernels = PluginManager::names(PF_PluginType_Kernel);
loaded_kernels = PluginManager<Kernel>::names();
for (auto name : loaded_kernels)
m_out << name << std::endl;
}
Expand All @@ -207,7 +206,7 @@ void App::outputOptions(std::string const& stageName, std::ostream& strm)

if (!m_showJSON)
{
strm << stageName << " -- " << PluginManager::link(stageName) <<
strm << stageName << " -- " << PluginManager<Stage>::link(stageName) <<
std::endl;
strm << headline << std::endl;

Expand Down Expand Up @@ -237,8 +236,7 @@ void App::outputOptions()
// Force plugin loading.
StageFactory f(false);

StringList nv = PluginManager::names(PF_PluginType_Filter |
PF_PluginType_Reader | PF_PluginType_Writer);
StringList nv = PluginManager<Stage>::names();

if (!m_showJSON)
{
Expand Down Expand Up @@ -317,14 +315,14 @@ std::string App::findKernel()
StageFactory f(true);
// Discover available kernels without plugins, and test to see if
// the positional option 'command' is a valid kernel
loadedKernels = PluginManager::names(PF_PluginType_Kernel);
loadedKernels = PluginManager<Kernel>::names();
for (auto& name : loadedKernels)
if (m_command == kernelSurname(name))
return name;

// Force loading of plugins.
StageFactory f2(false);
loadedKernels = PluginManager::names(PF_PluginType_Kernel);
loadedKernels = PluginManager<Kernel>::names();
for (auto& name : loadedKernels)
if (m_command == kernelSurname(name))
return name;
Expand Down Expand Up @@ -353,7 +351,8 @@ int App::execute(StringList& cmdArgs, LogPtr& log)
log->setLevel(m_logLevel);
else if (m_debug)
log->setLevel(LogLevel::Debug);
PluginManager::setLog(log);
PluginManager<Stage>::setLog(log);
PluginManager<Kernel>::setLog(log);
#ifndef _WIN32
#if __has_include(<execinfo.h>)
if (m_debug)
Expand All @@ -380,8 +379,7 @@ int App::execute(StringList& cmdArgs, LogPtr& log)
{
if (m_help)
cmdArgs.push_back("--help");
void *obj = PluginManager::createObject(name);
Kernel *kernel(static_cast<Kernel *>(obj));
Kernel *kernel = PluginManager<Kernel>::createObject(name);
// This shouldn't throw. If it does, it's something awful, so
// not cleaning up seems inconsequential.
log->setLeader("pdal " + m_command);
Expand Down
4 changes: 2 additions & 2 deletions doc/apps/pipeline.rst
Expand Up @@ -15,8 +15,8 @@ The ``pipeline`` command is used to execute :ref:`pipeline` JSON. See

--input, -i Input filename
--pipeline-serialization Output file for pipeline serialization
--validate Validate the pipeline (including serialization),
but do not write points
--validate Validate but do not process the pipeline.
Also reports whether a pipeline can be streamed.
--progress Name of file or FIFO to which stages should write
progress information. The file/FIFO must exist. PDAL will not create the
progress file.
Expand Down
37 changes: 31 additions & 6 deletions examples/CMakeLists.txt
@@ -1,7 +1,32 @@
include (${PDAL_CMAKE_DIR}/examples.cmake)
#
# This file allows a test compilation of all the examples without
# a PDAL installation.
#

cmake_minimum_required(VERSION 2.8.12)
project(PdalExamples)
set(PDAL_EXAMPLES 1)
include(FeatureSummary)

set (ROOT_DIR "${PROJECT_SOURCE_DIR}/..")
include (${ROOT_DIR}/cmake/common.cmake NO_POLICY_SCOPE)
include (${ROOT_DIR}/cmake/examples.cmake)
include (${ROOT_DIR}/cmake/dimension.cmake)
include (${ROOT_DIR}/cmake/json.cmake)

add_subdirectory(../dimbuilder ./dimbuilder)

file(GLOB SRCS
writing/*.cpp
writing-filter/*.cpp
writing-kernel/*.cpp
writing-reader/*.cpp
writing-writer/*.cpp)

add_library(dummy_lib OBJECT ${SRCS})
add_dependencies(dummy_lib generate_dimension_hpp)
target_include_directories(dummy_lib PRIVATE
${PDAL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}/include)
PDAL_TARGET_COMPILE_SETTINGS(dummy_lib)

add_subdirectory(writing)
add_subdirectory(writing-filter)
add_subdirectory(writing-kernel)
add_subdirectory(writing-reader)
add_subdirectory(writing-writer)
2 changes: 0 additions & 2 deletions examples/writing-filter/MyFilter.cpp
Expand Up @@ -3,10 +3,8 @@
#include "MyFilter.hpp"

#include <pdal/Options.hpp>
#include <pdal/pdal_macros.hpp>
#include <pdal/PointTable.hpp>
#include <pdal/PointView.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/util/ProgramArgs.hpp>

namespace pdal
Expand Down
3 changes: 0 additions & 3 deletions examples/writing-kernel/MyKernel.cpp
Expand Up @@ -5,8 +5,6 @@
#include <pdal/Filter.hpp>
#include <pdal/Kernel.hpp>
#include <pdal/Options.hpp>
#include <pdal/pdal_macros.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/PointTable.hpp>

#include <memory>
Expand Down Expand Up @@ -36,7 +34,6 @@ namespace pdal {
int MyKernel::execute()
{
PointTable table;
StageFactory f;

Stage& reader = makeReader(m_input_file, "readers.las");

Expand Down
6 changes: 2 additions & 4 deletions examples/writing-kernel/MyKernel.hpp
Expand Up @@ -3,7 +3,6 @@
#pragma once

#include <pdal/Kernel.hpp>
#include <pdal/plugin.hpp>

#include <string>

Expand All @@ -13,13 +12,12 @@ namespace pdal
class PDAL_DLL MyKernel : public Kernel
{
public:
static void * create();
static int32_t destroy(void *);
MyKernel();

std::string getName() const;
int execute(); // override

private:
MyKernel();
void addSwitches(ProgramArgs& args);

std::string m_input_file;
Expand Down
1 change: 0 additions & 1 deletion examples/writing-reader/MyReader.cpp
@@ -1,7 +1,6 @@
// MyReader.cpp

#include "MyReader.hpp"
#include <pdal/pdal_macros.hpp>
#include <pdal/util/ProgramArgs.hpp>

namespace pdal
Expand Down
3 changes: 1 addition & 2 deletions examples/writing-writer/MyWriter.cpp
@@ -1,7 +1,6 @@
// MyWriter.cpp

#include "MyWriter.hpp"
#include <pdal/pdal_macros.hpp>
#include <pdal/util/FileUtils.hpp>
#include <pdal/util/ProgramArgs.hpp>

Expand Down Expand Up @@ -33,7 +32,7 @@ namespace pdal
void MyWriter::addArgs(ProgramArgs& args)
{
// setPositional() Makes the argument required.
args.add("filename", "Output filename", m_filename).setPositional();
args.add("filename", "Output filename", m_filename).setPositional();
args.add("newline", "Line terminator", m_newline, "\n");
args.add("datafield", "Data field", m_datafield, "UserData");
args.add("precision", "Precision", m_precision, 3);
Expand Down
1 change: 0 additions & 1 deletion filters/ApproximateCoplanarFilter.cpp
Expand Up @@ -36,7 +36,6 @@

#include <pdal/EigenUtils.hpp>
#include <pdal/KDIndex.hpp>
#include <pdal/pdal_macros.hpp>
#include <pdal/util/ProgramArgs.hpp>

#include <Eigen/Dense>
Expand Down
1 change: 0 additions & 1 deletion filters/ApproximateCoplanarFilter.hpp
Expand Up @@ -35,7 +35,6 @@
#pragma once

#include <pdal/Filter.hpp>
#include <pdal/plugin.hpp>

#include <cstdint>
#include <memory>
Expand Down
1 change: 0 additions & 1 deletion filters/AssignFilter.cpp
Expand Up @@ -34,7 +34,6 @@

#include "AssignFilter.hpp"

#include <pdal/pdal_macros.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/util/ProgramArgs.hpp>

Expand Down
4 changes: 2 additions & 2 deletions filters/AssignFilter.hpp
Expand Up @@ -34,8 +34,8 @@

#pragma once

#include <pdal/plugin.hpp>
#include <pdal/Filter.hpp>
#include <pdal/Streamable.hpp>

extern "C" int32_t AssignFilter_ExitFunc();
extern "C" PF_ExitFunc AssignFilter_InitPlugin();
Expand All @@ -45,7 +45,7 @@ namespace pdal

struct AssignRange;

class PDAL_DLL AssignFilter : public Filter
class PDAL_DLL AssignFilter : public Filter, public Streamable
{
public:
AssignFilter();
Expand Down
1 change: 0 additions & 1 deletion filters/ChipperFilter.cpp
Expand Up @@ -62,7 +62,6 @@ partitions we are done, and we simply store away the contents of the
blocks.
**/

#include <pdal/pdal_macros.hpp>
#include <pdal/util/ProgramArgs.hpp>

namespace pdal
Expand Down
1 change: 0 additions & 1 deletion filters/ChipperFilter.hpp
Expand Up @@ -41,7 +41,6 @@

#pragma once

#include <pdal/plugin.hpp>
#include <pdal/Filter.hpp>
#include <pdal/PointView.hpp>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion filters/ClusterFilter.cpp
Expand Up @@ -34,7 +34,6 @@

#include "ClusterFilter.hpp"

#include <pdal/pdal_macros.hpp>
#include <pdal/Segmentation.hpp>

#include <string>
Expand Down
1 change: 0 additions & 1 deletion filters/ClusterFilter.hpp
Expand Up @@ -35,7 +35,6 @@
#pragma once

#include <pdal/Filter.hpp>
#include <pdal/plugin.hpp>

#include <string>

Expand Down
11 changes: 7 additions & 4 deletions filters/ColorinterpFilter.cpp
Expand Up @@ -36,7 +36,6 @@

#include <pdal/PointView.hpp>
#include <pdal/GDALUtils.hpp>
#include <pdal/pdal_macros.hpp>
#include <pdal/util/ProgramArgs.hpp>

#include <gdal.h>
Expand Down Expand Up @@ -260,12 +259,16 @@ void ColorinterpFilter::filter(PointView& view)
}


bool ColorinterpFilter::processOne(PointRef& point)
bool ColorinterpFilter::pipelineStreamable() const
{
// This will throw if min or max aren't defined.
if (std::isnan(m_min) || std::isnan(m_max))
throwStreamingError();
return false;
return Streamable::pipelineStreamable();
}


bool ColorinterpFilter::processOne(PointRef& point)
{
double v = point.getFieldAs<double>(m_interpDim);

// Don't color points that aren't in the min/max range.
Expand Down
8 changes: 3 additions & 5 deletions filters/ColorinterpFilter.hpp
Expand Up @@ -34,8 +34,8 @@

#pragma once

#include <pdal/plugin.hpp>
#include <pdal/Filter.hpp>
#include <pdal/Streamable.hpp>
#include <filters/StatsFilter.hpp>

#include <gdal.h>
Expand All @@ -54,7 +54,7 @@ namespace pdal
// for a given dimension
// specified dimensions. It also supports scaling the data by a multiplier
// on a per-dimension basis.
class PDAL_DLL ColorinterpFilter : public Filter
class PDAL_DLL ColorinterpFilter : public Filter, public Streamable
{
public:

Expand All @@ -71,11 +71,9 @@ class PDAL_DLL ColorinterpFilter : public Filter
{}
ColorinterpFilter& operator=(const ColorinterpFilter&) = delete;
ColorinterpFilter(const ColorinterpFilter&) = delete;

static void * create();
static int32_t destroy(void *);
std::string getName() const;

virtual bool pipelineStreamable() const;
private:
virtual void addArgs(ProgramArgs& args);
virtual void filter(PointView& view);
Expand Down
1 change: 0 additions & 1 deletion filters/ColorizationFilter.cpp
Expand Up @@ -35,7 +35,6 @@
#include "ColorizationFilter.hpp"

#include <pdal/PointView.hpp>
#include <pdal/pdal_macros.hpp>
#include <pdal/util/ProgramArgs.hpp>

#include <gdal.h>
Expand Down

0 comments on commit cd9aa92

Please sign in to comment.