Skip to content

Commit

Permalink
Merge branch 'master' into cpack-packaging
Browse files Browse the repository at this point in the history
Conflicts:
	CMakeLists.txt
  • Loading branch information
hobu committed Jan 7, 2015
2 parents f15c7bd + e4a20c1 commit 435496b
Show file tree
Hide file tree
Showing 77 changed files with 228 additions and 181 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ include("${PDAL_SOURCE_DIR}/cmake/pdal_utils.cmake")

# the next line is the ONLY place in the entire pdal system where
# the version info is hard-coded
set(PDAL_VERSION_STRING "1.0.0.b1" CACHE STRING "PDAL version")
set(PDAL_VERSION_STRING "1.0.0.b1" CACHE STRING "PDAL version" FORCE)

DISSECT_VERSION()
GET_OS_INFO()
Expand Down Expand Up @@ -431,15 +431,15 @@ if(WITH_LASZIP)
endif()
endif()

option(WITH_COMPRESSION "Choose to use laz-perf compression for database drivers" FALSE)
if (WITH_COMPRESSION)
option(WITH_LAZPERF "Choose to use laz-perf compression for database drivers" FALSE)
if (WITH_LAZPERF)
find_package(Lazperf)
set_package_properties(Lazperf PROPERTIES TYPE OPTIONAL)
if (LAZPERF_FOUND)
include_directories(${LAZPERF_INCLUDE_DIR})
set(PDAL_HAVE_LAZPERF 1)
else()
set(WITH_COMPRESSION FALSE)
set(WITH_LAZPERF FALSE)
endif()
endif()

Expand Down
135 changes: 101 additions & 34 deletions apps/pdal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,84 @@ std::string headline("----------------------------------------------------------

void outputVersion()
{
KernelFactory f;
std::map<std::string, KernelInfo> const& kernels = f.getKernelInfos();
std::cout << headline << std::endl;
std::cout << "pdal " << "(" << GetFullVersionString() << ")" << std::endl;
std::cout << headline << std::endl;
std::cout << std::endl;
}

void outputHelp(po::options_description const& options)
{
std::cerr << "Usage: pdal <command> [--debug] [--drivers] [--help] [--options[=<driver name>]] [--version]" << std::endl;
std::cerr << options << std::endl;

std::cerr << "The most commonly used pdal commands are:" << std::endl;

KernelFactory f;
std::map<std::string, KernelInfo> const& kernels = f.getKernelInfos();
for (auto i = kernels.begin(); i != kernels.end(); ++i)
std::cout << " - " << i->second.getName() << std::endl;

std::cout << "See http://pdal.io/apps.html for more detail";
std::cout << std::endl;
}

void outputDrivers()
{
pdal::StageFactory factory;
std::map<std::string, pdal::StageInfo> const& drivers = factory.getStageInfos();
std::string headline("------------------------------------------------------------------------------------------");
StageFactory f;
std::map<std::string, StageInfo> const& drivers = f.getStageInfos();

std::cout << headline << std::endl;
std::cout << "PDAL Drivers" << " (" << pdal::GetFullVersionString() << ")" <<std::endl;
std::cout << headline << std::endl << std::endl;
std::ostringstream strm;

std::string tablehead("================================ ==========================================================");
std::string headings ("Name Description");

strm << std::endl;
strm << tablehead << std::endl;
strm << headings << std::endl;
strm << tablehead << std::endl;

uint32_t name_column(32);
uint32_t description_column(57);

strm << std::left;

for (auto i = drivers.begin(); i != drivers.end(); ++i)
{
std::cout << i->second.toRST() << std::endl;
std::vector<std::string> lines;
std::string description(i->second.getDescription());
description = boost::algorithm::erase_all_copy(description, "\n");

Utils::wordWrap(description, lines, description_column-1);
if (lines.size() == 1)
{
strm << std::setw(name_column) << i->second.getName() << " "
<< std::setw(description_column) << description << std::endl;
}
else
{
strm << std::setw(name_column) << i->second.getName() << " "
<< lines[0] << std::endl;
}

std::stringstream blank;
size_t blanks(33);
for (size_t i = 0; i < blanks; ++i)
blank << " ";
for (size_t i = 1; i < lines.size(); ++i)
strm << blank.str() << lines[i] << std::endl;
}
}

strm << tablehead << std::endl;
std::cout << strm.str() << std::endl;
}

void outputOptions(std::string const& opt)
{
StageFactory f;
std::cout << opt << std::endl;
std::cout << f.toRST(opt) << std::endl;
}

int main(int argc, char* argv[])
{
Expand All @@ -81,18 +132,21 @@ int main(int argc, char* argv[])
po::options_description options;
po::positional_options_description positional;
po::variables_map variables;
positional.add("action", 1);
positional.add("command", 1);

options.add_options()
("action", po::value<std::string>(), "action name")
("version", po::value<bool>()->zero_tokens()->implicit_value(true), "Show version info")
("command", po::value<std::string>(), "command name")
("debug", po::value<bool>()->zero_tokens()->implicit_value(true), "Show debug information")
("drivers", po::value<bool>()->zero_tokens()->implicit_value(true), "Show drivers")
("help,h", po::value<bool>()->zero_tokens()->implicit_value(true), "Print help message")
("options", po::value<std::string>()->implicit_value("all"), "Show driver options")
("version", po::value<bool>()->zero_tokens()->implicit_value(true), "Show version info")
;

if (argc < 2)
{
std::cerr << "Action not specified!" << std::endl << std::endl;
outputVersion(); return 1;
outputHelp(options);
return 1;
}

try
Expand All @@ -111,48 +165,61 @@ int main(int argc, char* argv[])
#endif
outputVersion();
return 1;

}

int count(argc - 1); // remove the 1st argument
const char** args = const_cast<const char**>(&argv[1]);


if (variables.count("version") || variables.count("help") || !variables.count("action"))
if (variables.count("version"))
{
outputVersion();
return 0;
}

std::string action = variables["action"].as<std::string>();
if (variables.count("drivers"))
{
outputDrivers();
return 0;
}

if (variables.count("options"))
{
std::string opt = variables["options"].as<std::string>();
outputOptions(opt);
return 0;
}

if (variables.count("debug"))
{
std::cerr << getPDALDebugInformation() << std::endl;
return 0;
}

if (variables.count("help") || !variables.count("command"))
{
outputHelp(options);
return 0;
}

std::string command = variables["command"].as<std::string>();

bool isValidKernel = false;
std::map<std::string, KernelInfo> const& kernels = f.getKernelInfos();
for (auto i = kernels.begin(); i != kernels.end(); ++i)
{
if (boost::iequals(action, i->second.getName()))
if (boost::iequals(command, i->second.getName()))
{
isValidKernel = true;
}
if (boost::iequals(action, "debug"))
{
std::cerr << getPDALDebugInformation() << std::endl;
return 0;
}
if (boost::iequals(action, "drivers"))
{
outputDrivers() ;
return 0;
}
}

if (isValidKernel)
{
std::unique_ptr<Kernel> app(f.createKernel(action));
return app->run(count, args, action);
std::unique_ptr<Kernel> app(f.createKernel(command));
return app->run(count, args, command);
}

std::cerr << "Action '" << action <<"' not recognized" << std::endl << std::endl;
outputVersion();
std::cerr << "Command '" << command <<"' not recognized" << std::endl << std::endl;
outputHelp(options);
return 1;
}
2 changes: 1 addition & 1 deletion cmake/examples/hobu-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CC=$CC CXX=$CXX cmake -G "$CONFIG" \
-DBUILD_PLUGIN_ICEBRIDGE=ON \
-DBUILD_PLUGIN_PCL=ON \
-DBUILD_PLUGIN_ATTRIBUTE=ON \
-DWITH_COMPRESSION=ON \
-DWITH_LAZPERF=ON \
-DMRSID_INCLUDE_DIR=/Users/hobu/dev/release/mrsid/Lidar_DSDK/include \
-DMRSID_LIBRARY=/Users/hobu/dev/release/mrsid/Lidar_DSDK/lib/liblti_lidar_dsdk.dylib \
-DHEXER_INCLUDE_DIR=${HEXER_HOME}/include \
Expand Down
16 changes: 0 additions & 16 deletions doc/tutorial/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,6 @@ be hooked into the PDAL infrastructure:
containing documentation about the stage. It allows the information to be
integrated into PDAL’s web site and user information.

SET_STAGE_ENABLED(<enabled>)

enabled: A boolean (the constant ‘true’ or ‘false’) that indicates whether
the stage is runnable as part of a PDAL build. Some stages are not runnable
if certain prerequisite libraries and systems were not available at the time
that PDAL was built. If this is the case, this macro will normally appear
twice:

::

#ifdef HAVE_LIBRARY
SET_STAGE_ENABLED(true)
#else
SET_STAGE_ENABLED(false)
#endif

When a pipeline is started, each of its stages is processed in two distinct
steps. First, all stages are prepared.

Expand Down
1 change: 0 additions & 1 deletion filters/chipper/ChipperFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class PDAL_DLL ChipperFilter : public pdal::Filter
public:
SET_STAGE_NAME("filters.chipper", CHIPPERDOCS)
SET_STAGE_LINK("http://pdal.io/stages/filters.chipper.html")
SET_STAGE_ENABLED(true)

ChipperFilter() : Filter(),
m_xvec(DIR_X), m_yvec(DIR_Y), m_spare(DIR_NONE)
Expand Down
1 change: 0 additions & 1 deletion filters/colorization/ColorizationFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ struct BandInfo
public:
SET_STAGE_NAME("filters.colorization", COLORIZATIONDOC)
SET_STAGE_LINK("http://pdal.io/stages/filters.colorization.html")
SET_STAGE_ENABLED(true)

ColorizationFilter() : Filter()
{}
Expand Down
1 change: 0 additions & 1 deletion filters/crop/CropFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class PDAL_DLL CropFilter : public Filter
public:
SET_STAGE_NAME("filters.crop", CROPFILTERDOCS)
SET_STAGE_LINK("http://pdal.io/stages/filters.crop.html")
SET_STAGE_ENABLED(true)

CropFilter();

Expand Down
1 change: 0 additions & 1 deletion filters/decimation/DecimationFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class PDAL_DLL DecimationFilter : public Filter
public:
SET_STAGE_NAME("filters.decimation", "Rank decimation filter. Keep every Nth point.")
SET_STAGE_LINK("http://pdal.io/stages/filters.decimation.html")
SET_STAGE_ENABLED(true)

DecimationFilter();

Expand Down
1 change: 0 additions & 1 deletion filters/ferry/FerryFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class PDAL_DLL FerryFilter : public Filter
public:
SET_STAGE_NAME("filters.ferry", "Copy data from one dimension to another.")
SET_STAGE_LINK("http://pdal.io/stages/filters.ferry.html")
SET_STAGE_ENABLED(true)

FerryFilter() : Filter() {};
static Options getDefaultOptions();
Expand Down
1 change: 0 additions & 1 deletion filters/merge/MergeFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class PDAL_DLL MergeFilter : public MultiFilter
public:
SET_STAGE_NAME("filters.merge", "Merge data from two different readers into a single stream.")
SET_STAGE_LINK("http://pdal.io/stages/filters.merge.html")
SET_STAGE_ENABLED(true)

MergeFilter() : MultiFilter()
{}
Expand Down
1 change: 0 additions & 1 deletion filters/mortonorder/MortonOrderFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class PDAL_DLL MortonOrderFilter : public pdal::Filter
public:
SET_STAGE_NAME("filters.mortonorder", MORTONDOCS)
SET_STAGE_LINK("http://pdal.io/stages/filters.morton.html")
SET_STAGE_ENABLED(true)

MortonOrderFilter() : Filter() {}

Expand Down
1 change: 0 additions & 1 deletion filters/reprojection/ReprojectionFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class PDAL_DLL ReprojectionFilter : public Filter
public:
SET_STAGE_NAME("filters.reprojection", "Reproject data using GDAL from one coordinate system to another.")
SET_STAGE_LINK("http://www.pdal.io/stages/filters.reprojection.html")
SET_STAGE_ENABLED(true)

ReprojectionFilter();
ReprojectionFilter(const SpatialReference& outSRS);
Expand Down
1 change: 0 additions & 1 deletion filters/sort/SortFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class PDAL_DLL SortFilter : public Filter
public:
SET_STAGE_NAME("filters.sort", "Sort data based on a given dimension.")
SET_STAGE_LINK("http://www.pdal.io/stages/filters.sort.html")
SET_STAGE_ENABLED(true)

SortFilter()
{}
Expand Down
1 change: 0 additions & 1 deletion filters/splitter/SplitterFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class PDAL_DLL SplitterFilter : public pdal::Filter
public:
SET_STAGE_NAME("filters.splitter", "Split data based on a X/Y box length.")
SET_STAGE_LINK("http://pdal.io/stages/filters.splitter.html")
SET_STAGE_ENABLED(true)

SplitterFilter() : Filter()
{}
Expand Down
1 change: 0 additions & 1 deletion filters/stats/StatsFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class PDAL_DLL StatsFilter : public Filter
public:
SET_STAGE_NAME("filters.stats", "Compute statistics about each dimension (mean, min, max, etc.)")
SET_STAGE_LINK("http://pdal.io/stages/filters.stats.html")
SET_STAGE_ENABLED(true)

StatsFilter() : Filter()
{}
Expand Down
8 changes: 7 additions & 1 deletion include/pdal/Metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@

namespace
{
//ABELL - We should either pitch this or add a comment explaining why
// we need to do this.
/**
std::string sanitize(const std::string& name)
{
auto ischar = [](char c)
Expand All @@ -68,6 +71,7 @@ namespace
}
return v;
}
**/
}

namespace pdal
Expand Down Expand Up @@ -97,7 +101,9 @@ class MetadataNodeImpl
private:
MetadataNodeImpl(const std::string& name) : m_kind(MetadataType::Instance)
{
m_name = sanitize(name);
//ABELL
// m_name = sanitize(name);
m_name = name;
}

MetadataNodeImpl() : m_kind(MetadataType::Instance)
Expand Down
2 changes: 2 additions & 0 deletions include/pdal/PipelineWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class PDAL_DLL PipelineWriter

static void writeMetadata(boost::property_tree::ptree& tree,
const MetadataNode& input);
static void writeMetadata(boost::property_tree::ptree& tree,
const MetadataNodeList& input);

static boost::property_tree::ptree getMetadataEntry(
const MetadataNode& input);
Expand Down
3 changes: 3 additions & 0 deletions include/pdal/PointBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ class PDAL_DLL PointBuffer
{ return m_context.pointSize(); }
std::size_t dimSize(Dimension::Id::Enum id) const
{ return m_context.dimSize(id); }
DimTypeList dimTypes() const
{ return m_context.dimTypes(); }


/// Fill a buffer with point data specified by the dimension list.
/// \param[in] dims List of dimensions/types to retrieve.
Expand Down
Loading

0 comments on commit 435496b

Please sign in to comment.