Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/PDAL/PDAL into las1.4
Browse files Browse the repository at this point in the history
Conflicts:
	include/pdal/drivers/las/Writer.hpp
	src/drivers/las/Reader.cpp
	src/drivers/las/Writer.cpp
  • Loading branch information
abellgithub committed Oct 10, 2014
2 parents f502850 + c2bc8ff commit 439e27d
Show file tree
Hide file tree
Showing 41 changed files with 1,220 additions and 147 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,14 @@ endif(Boost_FOUND)
#------------------------------------------------------------------------------

option(WITH_PCL "Choose if PCL support should be built" FALSE)
option(WITH_PCL_VISUALIZE "Choose if PCL was built with VTK support for visualization" FALSE)
if(WITH_PCL)
find_package(PCL 1.7)
if(PCL_FOUND)
set(PDAL_HAVE_PCL 1)
if(WITH_PCL_VISUALIZE)
set(PDAL_HAVE_PCL_VISUALIZE 1)
endif()
set(WITH_PCL_TEST 1)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
Expand Down
19 changes: 14 additions & 5 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,29 @@ endif()

link_directories(${Boost_LIBRARY_DIRS})

if(APPLE)
option(PDAL_BUNDLE "Create PDAL as Application Bundle on OSX" FALSE)
endif()

if(PDAL_UTILITY)
list(APPEND PDAL_UTILITIES ${PDAL_UTILITY})
add_executable(${PDAL_UTILITY} pdal.cpp)
if (APPLE AND PDAL_BUNDLE)
add_executable(${PDAL_UTILITY} MACOSX_BUNDLE pdal.cpp)
else (APPLE AND PDAL_BUNDLE)
add_executable(${PDAL_UTILITY} pdal.cpp)
endif(APPLE AND PDAL_BUNDLE)
target_link_libraries(${PDAL_UTILITY} ${PDAL_LINKAGE} ${PDAL_LIB_NAME})
endif()

#------------------------------------------------------------------------------
# Targets installation
#------------------------------------------------------------------------------

install(TARGETS ${PDAL_UTILITIES}
RUNTIME DESTINATION ${PDAL_BIN_DIR}
LIBRARY DESTINATION ${PDAL_LIB_DIR}
ARCHIVE DESTINATION ${PDAL_LIB_DIR})
if (APPLE AND PDAL_BUNDLE)
install(TARGETS ${PDAL_UTILITIES} BUNDLE DESTINATION ${PDAL_BIN_DIR})
else(APPLE AND PDAL_BUNDLE)
install(TARGETS ${PDAL_UTILITIES} RUNTIME DESTINATION ${PDAL_BIN_DIR})
endif(APPLE AND PDAL_BUNDLE)

if(UNIX)

Expand Down
11 changes: 11 additions & 0 deletions apps/pdal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void outputVersion()
std::cout << " - pipeline" << std::endl;
std::cout << " - random" << std::endl;
std::cout << " - translate" << std::endl;
#ifdef PDAL_HAVE_PCL_VISUALIZE
std::cout << " - view" << std::endl;
#endif
std::cout << std::endl;
std::cout << "See http://pdal.io/apps.html for more detail";

Expand Down Expand Up @@ -144,6 +147,14 @@ int main(int argc, char* argv[])
}
#endif

#ifdef PDAL_HAVE_PCL_VISUALIZE
if (boost::iequals(action, "view"))
{
pdal::kernel::View app(count, args);
return app.run();
}
#endif

if (boost::iequals(action, "pipeline"))
{
pdal::kernel::Pipeline app(count, args);
Expand Down
57 changes: 55 additions & 2 deletions doc/apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ application currently contains six commands:
* :ref:`pipeline <pipeline_command>`
* :ref:`random <random_command>`
* :ref:`translate <translate_command>`
* :ref:`view <view_command>`

Applications are run by invoking the *pdal* application along with the
command name:
Expand All @@ -31,8 +32,8 @@ command name:

.. note::

The :ref:`ground <ground_command>` and :ref:`pcl <pcl_command>` commands
are only available if PCL is linked.
The :ref:`ground <ground_command>`, :ref:`pcl <pcl_command>`, and
:ref:`view <view_command>` commands are only available if PCL is linked.

Help about each command can be retrieved via the ``--help`` switch.
The ``--drivers`` and ``--options`` switches can tell you more about
Expand Down Expand Up @@ -336,3 +337,55 @@ command line invocation. For example, the following invocation will translate
--filters.crop.polygon="POLYGON ((636889.412951239268295 851528.512293258565478 422.7001953125,636899.14233423944097 851475.000686757150106 422.4697265625,636899.14233423944097 851475.000686757150106 422.4697265625,636928.33048324030824 851494.459452757611871 422.5400390625,636928.33048324030824 851494.459452757611871 422.5400390625,636928.33048324030824 851494.459452757611871 422.5400390625,636976.977398241520859 851513.918218758190051 424.150390625,636976.977398241520859 851513.918218758190051 424.150390625,637069.406536744092591 851475.000686757150106 438.7099609375,637132.647526245797053 851445.812537756282836 425.9501953125,637132.647526245797053 851445.812537756282836 425.9501953125,637336.964569251285866 851411.759697255445644 425.8203125,637336.964569251285866 851411.759697255445644 425.8203125,637473.175931254867464 851158.795739248627797 435.6298828125,637589.928527257987298 850711.244121236610226 420.509765625,637244.535430748714134 850511.791769731207751 420.7998046875,636758.066280735656619 850667.461897735483944 434.609375,636539.155163229792379 851056.63721774588339 422.6396484375,636889.412951239268295 851528.512293258565478 422.7001953125))" \
./test/data/1.2-with-color.las \
output.laz

.. _view_command:

``view`` command
------------------------------------------------------------------------------

The *view* command can be used to visualize a point cloud using the
PCLVisualizer. The command takes a single argument, the input file name.

::

$ pdal view myfile.las

Once the data has been loaded into the viewer, press h or H to display the
help.

::

| Help:
-------
p, P : switch to a point-based representation
w, W : switch to a wireframe-based representation (where available)
s, S : switch to a surface-based representation (where available)

j, J : take a .PNG snapshot of the current window view
c, C : display current camera/window parameters
f, F : fly to point mode

e, E : exit the interactor
q, Q : stop and call VTK's TerminateApp

+/- : increment/decrement overall point size
+/- [+ ALT] : zoom in/out

g, G : display scale grid (on/off)
u, U : display lookup table (on/off)

o, O : switch between perspective/parallel projection (default = perspective)
r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]
CTRL + s, S : save camera parameters
CTRL + r, R : restore camera parameters

ALT + s, S : turn stereo mode on/off
ALT + f, F : switch between maximized window mode and original size

l, L : list all available geometric and color handlers for the current actor map
ALT + 0..9 [+ CTRL] : switch between different geometric handlers (where available)
0..9 [+ CTRL] : switch between different color handlers (where available)

SHIFT + left click : select a point (start with -use_point_picking)

x, X : toggle rubber band selection mode for left mouse button
20 changes: 20 additions & 0 deletions doc/stages/drivers.buffer.reader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. _drivers.buffer.reader.
drivers.buffer.reader
================================================================================

The `drivers.buffer.reader`_ stage is a special stage that allows
you to read data from your own PointBuffer rather than
fetching the data from a specific reader. In the `writing`_ example,
it is used to take a simple listing of points and turn them into an
LAS file.


Example
-------

See `writing`_ for an example usage scenario for `drivers.buffer.reader`.

Options
-------

21 changes: 21 additions & 0 deletions doc/stages/drivers.pclvisualizer.writer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _drivers.pclvisualizer.writer:

drivers.pclvisualizer.writer
============================

The **PCLVisualizer Writer** enables use of the `Point Cloud Library (PCL)`_
PCLVisualizer. This is primarily used by :ref:`pdal view <view_command>`.

Options
-------

filename
PCD file to write [Required]

.. note::

A filename is currently required by PDAL, but no data is written to disk.


.. _Point Cloud Library (PCL): http://pointclouds.org

2 changes: 2 additions & 0 deletions doc/stages/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Readers & Writers
.. toctree::
:maxdepth: 1

drivers.buffer.reader
drivers.las.reader
drivers.las.writer
drivers.pgpointcloud.reader
Expand Down Expand Up @@ -41,6 +42,7 @@ Filters
filters.chipper
filters.crop
filters.decimation
filters.ferry
filters.hexbin
filters.pclblock
filters.predicate
Expand Down
4 changes: 4 additions & 0 deletions include/pdal/Drivers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
#include <pdal/drivers/pcd/Writer.hpp>
#endif

#ifdef PDAL_HAVE_PCL_VISUALIZE
#include <pdal/drivers/pclvisualizer/PCLVisualizer.hpp>
#endif

#ifdef PDAL_HAVE_SQLITE
#ifndef USE_PDAL_PLUGIN_SQLITE
#include <pdal/drivers/sqlite/SQLiteReader.hpp>
Expand Down
6 changes: 6 additions & 0 deletions include/pdal/PDALUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,13 @@ inline ptree toPTree(const SpatialReference& ref)
namespace reST
{

std::ostream& toRST(const ptree&, std::ostream& os);

void write_rst(std::ostream& ost,
const boost::property_tree::ptree& pt,
int level=0);


inline std::ostream& toRST(const PointBuffer& buffer, std::ostream& os)
{
const Dimension::IdList& dims = buffer.dims();
Expand Down
71 changes: 71 additions & 0 deletions include/pdal/drivers/pclvisualizer/PCLVisualizer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/******************************************************************************
* Copyright (c) 2014, Brad 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 <pdal/Writer.hpp>

#include <string>

namespace pdal
{
namespace drivers
{
namespace pclvisualizer
{

class PDAL_DLL PclVisualizer : public pdal::Writer
{
public:
SET_STAGE_NAME("drivers.pclvisualizer.writer", "PCD Writer")
SET_STAGE_LINK("http://pdal.io/stages/drivers.pclvisualizer.writer.html")
SET_STAGE_ENABLED(true)

PclVisualizer(const Options& options) : pdal::Writer(options) {};

private:
virtual void processOptions(const Options&) {};
virtual void ready(PointContextRef ctx) {};
virtual void write(const PointBuffer& buf);

std::string m_filename;

PclVisualizer& operator=(const PclVisualizer&); // not implemented
PclVisualizer(const PclVisualizer&); // not implemented
};

}
}
} // namespaces

5 changes: 5 additions & 0 deletions include/pdal/kernel/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class PDAL_DLL Application

bool isDebug() const;
boost::uint32_t getVerboseLevel() const;
void visualize(PointBufferPtr buffer) const;
void visualize(PointBufferPtr input_buffer, PointBufferPtr output_buffer) const;
void printError(const std::string&) const;

protected:
Expand Down Expand Up @@ -128,6 +130,9 @@ class PDAL_DLL Application
bool m_reportDebug;
std::string m_scales;
std::string m_offsets;
#ifdef PDAL_HAVE_PCL_VISUALIZE
bool m_visualize;
#endif

std::vector<boost::program_options::options_description*> m_options;
boost::program_options::positional_options_description m_positionalOptions;
Expand Down
8 changes: 5 additions & 3 deletions include/pdal/kernel/Info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ class PDAL_DLL Info : public Application
private:
void addSwitches(); // overrride
void validateSwitches(); // overrride

void dump(PointContext ctx, PointBufferPtr buf);

void dumpPoints(PointBufferPtr buf) const;
void dumpStats();
void dumpSummary(PointContext ctx, PointBufferPtr buf);
void dumpQuery(PointBufferPtr buf) const;
void dumpMetadata(PointContext ctx, const Stage&) const;
void dumpSDO_PCMetadata(PointContext ctx, Stage const&) const;
Expand All @@ -89,17 +90,18 @@ class PDAL_DLL Info : public Application
boost::uint32_t m_sample_size;
bool m_useXML;
bool m_useJSON;
bool m_useRST;
std::string m_Dimensions;
std::string m_QueryPoint;
double m_QueryDistance;
boost::uint64_t m_numPointsToWrite;
std::string m_pipelineFile;
bool m_showSample;
bool m_showSummary;

std::unique_ptr<boost::property_tree::ptree> m_tree;
std::unique_ptr<PipelineManager> m_manager;
};

} // namespace kernel
} // namespace pdal

4 changes: 4 additions & 0 deletions include/pdal/kernel/Kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@
#include "Ground.hpp"
#include "PCL.hpp"
#endif

#ifdef PDAL_HAVE_PCL_VISUALIZE
#include "View.hpp"
#endif
3 changes: 2 additions & 1 deletion include/pdal/kernel/Translate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class PDAL_DLL Translate : public Application
void addSwitches();
void validateSwitches();

Stage* makeReader(Options readerOptions);
std::unique_ptr<Stage> makeReader(Options readerOptions);
Stage* makeTranslate(Options translateOptions, Stage* reader);
void forwardMetadata(Options & options, Metadata metadata);

std::string m_inputFile;
Expand Down

0 comments on commit 439e27d

Please sign in to comment.