Skip to content

Commit

Permalink
register drivers.nitf.writer, add pipeline example
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed May 10, 2013
1 parent ddaf129 commit d9f8acd
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -533,6 +533,7 @@ set (USE_PDAL_PLUGIN_SOCI FALSE CACHE BOOL "Build the soci driver as a plugin ra
set (USE_PDAL_PLUGIN_OCI FALSE CACHE BOOL "Build the oci driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_MRSID FALSE CACHE BOOL "Build the MrSID driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_CARIS FALSE CACHE BOOL "Build the Caris driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_NITRO FALSE CACHE BOOL "Build the NITF writer as a plugin rather than embedding")


#------------------------------------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions cmake/modules/FindNitro.cmake
Expand Up @@ -45,11 +45,8 @@ FIND_LIBRARY(NITRO_CPP_LIBRARY
/usr/lib
/usr/local/lib)

message(STATUS "cpplib: ${NITRO_CPP_LIBRARY}")
message(STATUS "clib: ${NITRO_C_LIBRARY}")

SET(NITRO_FOUND 1)
SET(NITRO_LIBRARIES ${NITRO_CPP_LIBRARY} ${NITRO_C_LIBRARY})
SET(NITRO_LIBRARIES ${NITRO_CPP_LIBRARY} ${NITRO_C_LIBRARY})


IF(NITRO_INCLUDE_DIR)
Expand Down
9 changes: 7 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -578,6 +578,12 @@ target_link_libraries(${APPS_CPP_DEPENDENCIES} ${ORACLE_LIBRARY})
endif()
endif()

if (WITH_NITRO)
if (NOT USE_PDAL_PLUGIN_NITRO)
target_link_libraries(${APPS_CPP_DEPENDENCIES} ${NITRO_LIBRARIES})
endif()
endif()

if (WIN32)
target_link_libraries(${APPS_CPP_DEPENDENCIES} LINK_PUBLIC general
${PDAL_LIB_NAME}
Expand Down Expand Up @@ -607,8 +613,7 @@ else()
${P2G_LIBRARY}
${GEOS_LIBRARY}
${FLANN_LIBRARIES}
${HEXER_LIBRARY}
${NITRO_LIBRARIES})
${HEXER_LIBRARY})
endif()

message(STATUS "Using boost lib: ${Boost_LIBRARIES}")
Expand Down
20 changes: 19 additions & 1 deletion src/StageFactory.cpp
Expand Up @@ -66,6 +66,12 @@
#endif
#endif

#ifdef PDAL_HAVE_NITRO
#ifndef USE_PDAL_PLUGIN_NITF
#include <pdal/drivers/nitf/Writer.hpp>
#endif
#endif

#ifdef PDAL_HAVE_P2G
#include <pdal/drivers/p2g/Writer.hpp>
#endif
Expand Down Expand Up @@ -195,6 +201,11 @@ MAKE_WRITER_CREATOR(SociWriter, pdal::drivers::soci::Writer)
#endif
#endif

#ifdef PDAL_HAVE_NITRO
#ifndef USE_PDAL_PLUGIN_NITF
MAKE_WRITER_CREATOR(NitfWriter, pdal::drivers::nitf::Writer)
#endif
#endif

StageFactory::StageFactory()
{
Expand Down Expand Up @@ -255,7 +266,8 @@ std::string StageFactory::inferWriterDriver(const std::string& filename, pdal::O
drivers["laz"] = "drivers.las.writer";
drivers["xyz"] = "drivers.text.writer";
drivers["txt"] = "drivers.text.writer";

drivers["ntf"] = "drivers.nitf.writer";

if (boost::algorithm::iequals(filename, "STDOUT"))
{
return drivers["txt"];
Expand Down Expand Up @@ -473,6 +485,12 @@ void StageFactory::registerKnownWriters()
#endif
#endif

#ifdef PDAL_HAVE_NITRO
#ifndef USE_PDAL_PLUGIN_NITF
REGISTER_WRITER(NitfWriter, pdal::drivers::nitf::Writer);
#endif
#endif

}

void StageFactory::loadPlugins()
Expand Down
21 changes: 21 additions & 0 deletions test/data/pipeline/pipeline_nitf.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Pipeline version="1.0">
<Writer type="drivers.nitf.writer">
<Option name="filename">
pdal-compressed.ntf
</Option>
<Option name="compression">
false
</Option>
<Filter type="filters.crop">
<Option name="bounds">
([0,1000000],[0,1000000],[0,1000000])
</Option>
<Reader type="drivers.las.reader">
<Option name="filename">
../1.2-with-color.las
</Option>
</Reader>
</Filter>
</Writer>
</Pipeline>

0 comments on commit d9f8acd

Please sign in to comment.