Permalink
Browse files

merge the PCD writer in to drivers.text.writer, as it's just another …

…output type, to eliminate a bunch of code duplication
  • Loading branch information...
hobu committed Nov 19, 2012
1 parent 0f4ca56 commit 61c44bf1d43d5927051c38183bb1908244243a91
View
@@ -485,7 +485,6 @@ if(WITH_PYTHON)
endif()
endif()
-set (USE_PDAL_PLUGIN_PCD FALSE CACHE BOOL "Build the PCD driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_TEXT FALSE CACHE BOOL "Build the text driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_SOCI FALSE CACHE BOOL "Build the soci driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_OCI FALSE CACHE BOOL "Build the oci driver as a plugin rather than embedding")
@@ -1,115 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2012, Howard Butler, hobu.inc@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.
-****************************************************************************/
-
-#ifndef INCLUDED_DRIVERS_PCD_WRITER_HPP
-#define INCLUDED_DRIVERS_PCD_WRITER_HPP
-
-#include <pdal/Writer.hpp>
-#include <pdal/FileUtils.hpp>
-#include <pdal/StageFactory.hpp>
-
-#include <boost/scoped_ptr.hpp>
-#include <boost/tuple/tuple.hpp>
-
-
-
-#ifdef USE_PDAL_PLUGIN_PCD
-
-pdal::Writer* createPCDWriter(pdal::Stage& prevStage, const pdal::Options& options);
-
-PDAL_C_START
-
-PDAL_DLL void PDALRegister_writer_pcd(void* factory);
-
-PDAL_C_END
-#endif
-
-namespace pdal
-{
-namespace drivers
-{
-namespace pcd
-{
-
-
-class pcd_driver_error : public pdal_error
-{
-public:
- pcd_driver_error(std::string const& msg)
- : pdal_error(msg)
- {}
-};
-
-
-typedef boost::shared_ptr<std::ostream> FileStreamPtr;
-
-class PDAL_DLL Writer : public pdal::Writer
-{
-public:
- SET_STAGE_NAME("drivers.pcd.writer", "PCL PCD 0.7 Writer")
-
- Writer(Stage& prevStage, const Options&);
- ~Writer();
-
- virtual void initialize();
- static Options getDefaultOptions();
-
- // for dumping
- virtual boost::property_tree::ptree toPTree() const;
-
-
-protected:
- virtual void writeBegin(boost::uint64_t targetNumPointsToWrite);
- virtual boost::uint32_t writeBuffer(const PointBuffer&);
- virtual void writeEnd(boost::uint64_t actualNumPointsWritten);
-
-private:
-
- Writer& operator=(const Writer&); // not implemented
- Writer(const Writer&); // not implemented
-
- std::string getStringRepresentation(PointBuffer const& data,
- Dimension const& d,
- std::size_t pointIndex) const;
-
- void WriteHeader(pdal::Schema const& schema);
- FileStreamPtr m_stream;
- bool m_wrote_header;
-};
-
-}
-}
-} // namespaces
-
-#endif
@@ -102,6 +102,15 @@ class PDAL_DLL Writer : public pdal::Writer
std::size_t pointIndex) const;
void WriteHeader(pdal::Schema const& schema);
+
+ void WriteGeoJSONHeader(pdal::Schema const& schema);
+ void WriteCSVHeader(pdal::Schema const& schema);
+ void WritePCDHeader(pdal::Schema const& schema);
+
+ void WriteCSVBuffer(const PointBuffer& data);
+ void WriteGeoJSONBuffer(const PointBuffer& data);
+ void WritePCDBuffer(const PointBuffer& data);
+
std::vector<boost::tuple<std::string, std::string> > getDimensionOrder(pdal::Schema const& schema) const;
FileStreamPtr m_stream;
bool bWroteHeader;
View
@@ -374,28 +374,6 @@ if (GDAL_FOUND)
list (APPEND PDAL_HPP ${PDAL_DRIVERS_NITF_HPP} )
endif()
-
-
-#
-# drivers/pcd
-#
-set(PDAL_PCD_PATH drivers/pcd)
-set(PDAL_PCD_HEADERS ${PDAL_HEADERS_DIR}/${PDAL_PCD_PATH})
-set(PDAL_PCD_SRC ${PROJECT_SOURCE_DIR}/src/${PDAL_PCD_PATH})
-
-set(PDAL_DRIVERS_PCD_HPP
- ${PDAL_PCD_HEADERS}/Writer.hpp
-)
-
-set (PDAL_DRIVERS_PCD_CPP
- ${PDAL_PCD_SRC}/Writer.cpp
-)
-
-if (NOT USE_PDAL_PLUGIN_PCD)
- list (APPEND PDAL_CPP ${PDAL_DRIVERS_PCD_CPP} )
- list (APPEND PDAL_HPP ${PDAL_DRIVERS_PCD_HPP} )
-endif()
-
#
# drivers/soci
#
@@ -669,21 +647,6 @@ if (USE_PDAL_PLUGIN_TEXT)
endif()
endif()
-if (USE_PDAL_PLUGIN_PCD)
- set(PDAL_PCD_WRITER_LIB_NAME pdal_plugin_writer_pcd)
- add_library(${PDAL_PCD_WRITER_LIB_NAME} SHARED ${PDAL_DRIVERS_PCD_CPP})
- target_link_libraries(${PDAL_PCD_WRITER_LIB_NAME}
- ${PDAL_LIB_NAME})
- set_target_properties(${PDAL_PCD_WRITER_LIB_NAME}
- PROPERTIES SOVERSION "${PDAL_LIB_SOVERSION}" )
- if (APPLE)
- set_target_properties(
- ${PDAL_PCD_WRITER_LIB_NAME}
- PROPERTIES
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
- endif()
-endif()
-
if (WITH_SOCI)
if (USE_PDAL_PLUGIN_SOCI)
set(PDAL_SOCI_WRITER_LIB_NAME pdal_plugin_writer_soci)
Oops, something went wrong.

0 comments on commit 61c44bf

Please sign in to comment.