Skip to content

Commit

Permalink
Merge branch 'issues/554-port-all-plugins-nitf' into issues/554-port-…
Browse files Browse the repository at this point in the history
…all-plugins
  • Loading branch information
chambbj committed Oct 29, 2014
2 parents 2b74a9a + 4a7a6ad commit 5ca9123
Show file tree
Hide file tree
Showing 40 changed files with 277 additions and 399 deletions.
30 changes: 2 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ option(WITH_APPS "Choose if PDAL utilities should be built" TRUE)
option(WITH_GREYHOUND "Choose if Greyhound support should be built" FALSE)
option(WITH_ICEBRIDGE "Choose if Icebridge support should be built" FALSE)
option(WITH_MRSID "Choose if MrSID/LiDAR support should be built" FALSE)
option(WITH_NITF "Choose if NITF support should be built (only install supported is from http://github.com/hobu/nitro)" TRUE)
option(WITH_ORACLE "Choose if Oracle support should be built" TRUE)
option(WITH_P2G "Choose if Points2Grid support should be built" FALSE)
option(WITH_PCL "Choose if PCL support should be built" FALSE)
Expand Down Expand Up @@ -339,32 +340,6 @@ if(WITH_GEOTIFF)
endif()


#
# Nitro (optional)
#
option(WITH_NITRO "Choose if Nitro support (only install supported is from http://github.com/hobu/nitro)" TRUE)
if(WITH_NITRO)
find_package(Nitro 2.6)
IF (NITRO_FOUND)
set(PDAL_HAVE_NITRO 1)
include_directories(${NITRO_INCLUDE_DIR})
include_directories("${NITRO_INCLUDE_DIR}/nitro/c++")
include_directories("${NITRO_INCLUDE_DIR}/nitro/c")
add_definitions("-D_REENTRANT")
if (WIN32)
add_definitions("-DSIZEOF_SIZE_T=4")
add_definitions("-DIMPORT_NITRO_API")
else()
add_definitions("-D__POSIX")
endif()
message(STATUS "...building with Nitro")
else()
set(WITH_NITRO FALSE)
set(NITRO_LIBRARIES "")
endif()
endif()


#
# ICONV (optional)
#
Expand Down Expand Up @@ -496,10 +471,9 @@ option(USE_PDAL_PLUGIN_TEXT "Build the text driver as a plugin rather than embed
option(USE_PDAL_PLUGIN_SOCI "Build the soci driver as a plugin rather than embedding" FALSE)
option(USE_PDAL_PLUGIN_MRSID "Build the MrSID driver as a plugin rather than embedding" FALSE)
option(USE_PDAL_PLUGIN_CARIS "Build the Caris driver as a plugin rather than embedding" FALSE)
option(USE_PDAL_PLUGIN_NITRO "Build the NITF writer as a plugin rather than embedding" FALSE)

if (USE_PDAL_PLUGIN_TEXT OR USE_PDAL_PLUGIN_SOCI OR
USE_PDAL_PLUGIN_MRSID OR USE_PDAL_PLUGIN_CARIS OR USE_PDAL_PLUGIN_NITRO)
USE_PDAL_PLUGIN_MRSID OR USE_PDAL_PLUGIN_CARIS)
if (PDAL_BUILD_STATIC)
message(SEND_ERROR "Cannot build separate plugins with statically compiled PDAL")
endif()
Expand Down
16 changes: 0 additions & 16 deletions include/pdal/Drivers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@
#endif
#endif

#ifdef PDAL_HAVE_MRSID
#ifndef USE_PDAL_PLUGIN_MRSID
#include <pdal/drivers/mrsid/Reader.hpp>
#endif
#endif

#include <pdal/drivers/qfit/Reader.hpp>
#include <pdal/drivers/terrasolid/Reader.hpp>
#include <pdal/drivers/text/Writer.hpp>

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

#ifdef PDAL_HAVE_NITRO
#include <pdal/drivers/nitf/Reader.hpp>
#endif
65 changes: 47 additions & 18 deletions include/pdal/pdal_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
//
#define MAKE_READER_CREATOR(T, FullT) \
pdal::Reader* create_##T() \
{ \
return new FullT(); \
}

{ pdal::Reader *r = new FullT(); return r; }
#define MAKE_FILTER_CREATOR(T, FullT) \
pdal::Filter* create_##T() \
{ pdal::Filter *f = new FullT(); return f; }
Expand All @@ -52,7 +49,7 @@
{ pdal::Writer *w = new FullT(); return w; }
#define MAKE_KERNEL_CREATOR(T, FullT) \
pdal::Kernel* create_##T() \
{ pdal::Kernel *a = new FullT(); return a; }
{ pdal::Kernel *k = new FullT(); return k; }

//
// macros to register the stage creators
Expand All @@ -70,6 +67,9 @@
registerKernelDriverInfo<FullT>(); \
registerKernel(FullT::s_getName(), create_##T)

//
// macros to create the various plugins types
//
#define CREATE_READER_PLUGIN(T, FullT) \
MAKE_READER_CREATOR(T, FullT) \
PDAL_C_START PDAL_DLL void PDALRegister_reader_##T(void* factory) \
Expand All @@ -79,8 +79,7 @@
f.registerReader(FullT::s_getName(), create_##T); \
} \
PDAL_C_END \
SET_PLUGIN_VERSION(T)

SET_READER_PLUGIN_VERSION(T)
#define CREATE_FILTER_PLUGIN(T, FullT) \
MAKE_FILTER_CREATOR(T, FullT) \
PDAL_C_START PDAL_DLL void PDALRegister_filter_##T(void* factory) \
Expand All @@ -90,8 +89,7 @@
f.registerFilter(FullT::s_getName(), create_##T); \
} \
PDAL_C_END \
SET_PLUGIN_VERSION(T)

SET_FILTER_PLUGIN_VERSION(T)
#define CREATE_WRITER_PLUGIN(T, FullT) \
MAKE_WRITER_CREATOR(T, FullT) \
PDAL_C_START PDAL_DLL void PDALRegister_writer_##T(void* factory) \
Expand All @@ -101,8 +99,7 @@
f.registerWriter(FullT::s_getName(), create_##T); \
} \
PDAL_C_END \
SET_PLUGIN_VERSION(T)

SET_WRITER_PLUGIN_VERSION(T)
#define CREATE_KERNEL_PLUGIN(T, FullT) \
MAKE_KERNEL_CREATOR(T, FullT) \
PDAL_C_START PDAL_DLL void PDALRegister_kernel_##T(void* factory) \
Expand All @@ -112,15 +109,47 @@
f.registerKernel(FullT::s_getName(), create_##T); \
} \
PDAL_C_END \
SET_PLUGIN_VERSION(T)
SET_KERNEL_PLUGIN_VERSION(T)

#define SET_PLUGIN_VERSION(DriverName) \
PDAL_C_START PDAL_DLL int PDALRegister_version_##DriverName() \
{ \
return PDAL_PLUGIN_VERSION; \
} \
PDAL_C_END
//
// macros to register the plugin creators
//
//#define REGISTER_READER_PLUGIN(T) \
// PDAL_C_START \
// PDAL_DLL void PDALRegister_reader_##T(void* factory); \
// PDAL_C_END
//#define REGISTER_FILTER_PLUGIN(T) \
// PDAL_C_START \
// PDAL_DLL void PDALRegister_filter_##T(void* factory); \
// PDAL_C_END
//#define REGISTER_WRITER_PLUGIN(T) \
// PDAL_C_START \
// PDAL_DLL void PDALRegister_writer_##T(void* factory); \
// PDAL_C_END
//#define REGISTER_KERNEL_PLUGIN(T) \
// PDAL_C_START \
// PDAL_DLL void PDALRegister_kernel_##T(void* factory); \
// PDAL_C_END

//
// macro to register the version of PDAL the plugin was linked against
//
#define SET_READER_PLUGIN_VERSION(T) \
PDAL_C_START PDAL_DLL int PDALRegister_version_reader_##T() \
{ return PDAL_PLUGIN_VERSION; } \
PDAL_C_END
#define SET_FILTER_PLUGIN_VERSION(T) \
PDAL_C_START PDAL_DLL int PDALRegister_version_filter_##T() \
{ return PDAL_PLUGIN_VERSION; } \
PDAL_C_END
#define SET_WRITER_PLUGIN_VERSION(T) \
PDAL_C_START PDAL_DLL int PDALRegister_version_writer_##T() \
{ return PDAL_PLUGIN_VERSION; } \
PDAL_C_END
#define SET_KERNEL_PLUGIN_VERSION(T) \
PDAL_C_START PDAL_DLL int PDALRegister_version_kernel_##T() \
{ return PDAL_PLUGIN_VERSION; } \
PDAL_C_END

#ifdef _WIN32
inline long lround(double d)
Expand Down
4 changes: 4 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ if(WITH_MRSID)
add_subdirectory(mrsid)
endif()

if(WITH_NITF)
add_subdirectory(nitf)
endif()

if(WITH_ORACLE)
add_subdirectory(oci)
endif()
Expand Down
6 changes: 0 additions & 6 deletions plugins/greyhound/drivers/GreyhoundReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@

#include "WebSocketClient.hpp"

PDAL_C_START

PDAL_DLL void PDALRegister_reader_greyhound(void* factory);

PDAL_C_END

namespace pdal
{
namespace drivers
Expand Down
6 changes: 0 additions & 6 deletions plugins/icebridge/drivers/IcebridgeReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@

#include <vector>

PDAL_C_START

PDAL_DLL void PDALRegister_icebridge_reader(void* factory);

PDAL_C_END

namespace pdal
{
namespace drivers
Expand Down
6 changes: 0 additions & 6 deletions plugins/mrsid/drivers/MrsidReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ namespace LizardTech
class PointSource;
}

PDAL_C_START

PDAL_DLL void PDALRegister_reader_mrsid(void* factory);

PDAL_C_END

namespace pdal
{
namespace drivers
Expand Down
107 changes: 107 additions & 0 deletions plugins/nitf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# NITF plugin CMake configuration
#

include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/plugins/nitf)

find_package(Nitro 2.6 REQUIRED)
if(NITRO_FOUND)
message(STATUS "Building with NITF support")

include_directories(${NITRO_INCLUDE_DIR})
include_directories("${NITRO_INCLUDE_DIR}/nitro/c++")
include_directories("${NITRO_INCLUDE_DIR}/nitro/c")
add_definitions("-D_REENTRANT")
if (WIN32)
add_definitions("-DSIZEOF_SIZE_T=4")
add_definitions("-DIMPORT_NITRO_API")
else()
add_definitions("-D__POSIX")
endif()

set(PDAL_LAS_PATH drivers/las)
set(PDAL_LAS_HEADERS "${PROJECT_SOURCE_DIR}/include/pdal/${PDAL_LAS_PATH}")
set(PDAL_LAS_SRC "${PROJECT_SOURCE_DIR}/src/${PDAL_LAS_PATH}")

if ((GEOTIFF_FOUND) AND (GDAL_FOUND))
set(PDAL_GTIFF_SRCS "${PDAL_LAS_SRC}/GeotiffSupport.cpp")
set(PDAL_GTIFF_INCS "${PDAL_LAS_SRC}/GeotiffSupport.hpp")
endif()

if (LASZIP_FOUND)
set(PDAL_LASZIP_SRCS "${PDAL_LAS_SRC}/ZipPoint.cpp")
set(PDAL_LASZIP_INCS "${PDAL_LAS_HEADERS}/ZipPoint.hpp")
endif()

set(PDAL_LAS_SRCS
${PDAL_GTIFF_SRCS}
${PDAL_LASZIP_SRCS}
"${PDAL_LAS_SRC}/Header.cpp"
"${PDAL_LAS_SRC}/Reader.cpp"
"${PDAL_LAS_SRC}/SummaryData.cpp"
"${PDAL_LAS_SRC}/VariableLengthRecord.cpp"
"${PDAL_LAS_SRC}/Writer.cpp"
)

set(PDAL_LAS_INCS
${PDAL_GTIFF_INCS}
${PDAL_LASZIP_INCS}
"${PDAL_LAS_HEADERS}/Header.hpp"
"${PDAL_LAS_HEADERS}/Reader.hpp"
"${PDAL_LAS_HEADERS}/SummaryData.hpp"
"${PDAL_LAS_HEADERS}/VariableLengthRecord.hpp"
"${PDAL_LAS_HEADERS}/Writer.hpp"
)

#
# NITF Reader
#
set(srcs
${PDAL_LAS_SRCS}
drivers/NitfFile.cpp
drivers/MetadataReader.cpp
drivers/tre_plugins.cpp
drivers/NitfReader.cpp
)

set(incs
${PDAL_LAS_INCS}
drivers/NitfFile.hp
drivers/MetadataReader.hpp
drivers/tre_plugins.hpp
drivers/NitfReader.hpp
)

set(NITF_READER_LIB_NAME pdal_plugin_reader_nitf)
PDAL_ADD_PLUGIN(${NITF_READER_LIB_NAME} reader nitf ${srcs} ${incs})
target_link_libraries(${NITF_READER_LIB_NAME} ${PDAL_LINKAGE} ${NITRO_LIBRARIES})

#
# NITF Writer
#
set(srcs
${PDAL_LAS_SRCS}
drivers/NitfWriter.cpp
drivers/tre_plugins.cpp
)

set(incs
${PDAL_LAS_INCS}
drivers/NitfWriter.hpp
drivers/tre_plugins.hpp
)

set(NITF_WRITER_LIB_NAME pdal_plugin_writer_nitf)
PDAL_ADD_PLUGIN(${NITF_WRITER_LIB_NAME} writer nitf ${srcs} ${incs})
target_link_libraries(${NITF_WRITER_LIB_NAME} ${PDAL_LINKAGE} ${NITRO_LIBRARIES})

set(srcs
test/NitfReaderTest.cpp
test/NitfWriterTest.cpp
)

PDAL_ADD_TEST(nitftest ${srcs})
else()
message(STATUS "Building without NITF support")
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

#include "MetadataReader.hpp"

#ifdef PDAL_HAVE_NITRO

#include <pdal/Metadata.hpp>

#include <boost/algorithm/string.hpp>
Expand Down Expand Up @@ -423,5 +421,3 @@ void MetadataReader::doComments(const std::string& key,
}
}
} // namespaces

#endif // PDAL_HAVE_NITRO
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

#include <pdal/pdal_internal.hpp>

#ifdef PDAL_HAVE_NITRO

#include <vector>

#ifdef PDAL_COMPILER_GCC
Expand Down Expand Up @@ -133,5 +131,3 @@ class PDAL_DLL MetadataReader


} } } // namespaces

#endif // HAVE_NITRO
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

#include "NitfFile.hpp"

#ifdef PDAL_HAVE_NITRO

#include <pdal/Metadata.hpp>

#include <boost/algorithm/string.hpp>
Expand Down Expand Up @@ -268,5 +266,3 @@ bool NitfFile::locateLidarDataSegment()
}
}
} // namespaces

#endif // PDAL_HAVE_NITRO
Loading

0 comments on commit 5ca9123

Please sign in to comment.