[Liblas-commits] hg: 4 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Dec 17 10:18:40 EST 2010
changeset 31d5978be725 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=31d5978be725
summary: reflect WKT VLR addition
changeset 85e234ea7623 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=85e234ea7623
summary: set the header, as written, back on to the liblas::WriterImpl so the user can fetch what was actually written
changeset 8eb28c112f40 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=8eb28c112f40
summary: test padding scenario for LAS 1.0 files
changeset dc3cb1f372a2 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=dc3cb1f372a2
summary: start on ReaderFactory
diffstat:
apps/las2oci.cpp | 7 +++-
include/liblas/detail/fwd.hpp | 2 +
include/liblas/factory.hpp | 85 +++++++++++++++++++++++++++++++++++++++++++
include/liblas/lasreader.hpp | 11 +----
include/liblas/liblas.hpp | 1 +
python/tests/SRS-GDAL.txt | 2 +-
src/CMakeLists.txt | 2 +
src/detail/writer/writer.cpp | 2 +
src/factory.cpp | 82 +++++++++++++++++++++++++++++++++++++++++
src/las_c_api.cpp | 4 +-
src/lasreader.cpp | 29 +++-----------
test/unit/laswriter_test.cpp | 34 ++++++++++++++++-
12 files changed, 227 insertions(+), 34 deletions(-)
diffs (truncated from 419 to 300 lines):
diff -r 018aae9571f4 -r dc3cb1f372a2 apps/las2oci.cpp
--- a/apps/las2oci.cpp Thu Dec 16 12:13:27 2010 -0600
+++ b/apps/las2oci.cpp Fri Dec 17 09:18:22 2010 -0600
@@ -1112,7 +1112,12 @@
liblas::Reader* reader2 = 0;
if (bCachedReader)
- reader2 = new liblas::Reader(*istrm2,0);
+ {
+ liblas::ReaderFactory rf;
+ liblas::Reader r = rf.CreateCached(*istrm2, 0);
+ reader2 = new liblas::Reader(r);
+ // reader2 = new liblas::Reader(*istrm2,0);
+ }
else
reader2 = new liblas::Reader(*istrm2);
diff -r 018aae9571f4 -r dc3cb1f372a2 include/liblas/detail/fwd.hpp
--- a/include/liblas/detail/fwd.hpp Thu Dec 16 12:13:27 2010 -0600
+++ b/include/liblas/detail/fwd.hpp Fri Dec 17 09:18:22 2010 -0600
@@ -67,6 +67,8 @@
typedef boost::shared_ptr<Point> PointPtr;
typedef boost::shared_ptr<TransformI> TransformPtr;
typedef boost::shared_ptr<FilterI> FilterPtr;
+typedef boost::shared_ptr<ReaderI> ReaderIPtr;
+typedef boost::shared_ptr<WriterI> WriterIPtr;
namespace detail {
diff -r 018aae9571f4 -r dc3cb1f372a2 include/liblas/factory.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/liblas/factory.hpp Fri Dec 17 09:18:22 2010 -0600
@@ -0,0 +1,85 @@
+/******************************************************************************
+* $Id$
+*
+* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
+* Purpose: LAS factories
+* Author: Howard Butler, hobu.inc at gmail.com
+*
+******************************************************************************
+* Copyright (c) 2008, Mateusz Loskot
+* Copyright (c) 2010, Howard Butler
+*
+* 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 the Martin Isenburg or Iowa Department
+* of Natural Resources 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 LIBLAS_FACTORY_HPP_INCLUDED
+#define LIBLAS_FACTORY_HPP_INCLUDED
+
+#include <liblas/lasreader.hpp>
+#include <liblas/laswriter.hpp>
+#include <liblas/export.hpp>
+// boost
+#include <boost/cstdint.hpp>
+// std
+
+
+namespace liblas {
+
+
+class LAS_DLL ReaderFactory
+{
+public:
+
+
+ ReaderFactory() {};
+
+ ReaderFactory(ReaderFactory const& other);
+ ReaderFactory& operator=(ReaderFactory const& rhs);
+
+ Reader CreateWithImpl(ReaderIPtr r);
+
+ Reader CreateCached(std::istream& stream, boost::uint32_t cache_size);
+ Reader Create(std::istream& stream);
+
+ /// Destructor.
+ /// @exception nothrow
+ ~ReaderFactory() {};
+
+
+private:
+
+
+
+};
+
+} // namespace liblas
+
+#endif // ndef LIBLAS_LASREADER_HPP_INCLUDED
diff -r 018aae9571f4 -r dc3cb1f372a2 include/liblas/lasreader.hpp
--- a/include/liblas/lasreader.hpp Thu Dec 16 12:13:27 2010 -0600
+++ b/include/liblas/lasreader.hpp Fri Dec 17 09:18:22 2010 -0600
@@ -71,17 +71,11 @@
/// @param ifs - stream used as source of LAS records.
/// @exception std::runtime_error - on failure state of the input stream.
Reader(std::istream& ifs);
- Reader(std::istream& ifs, boost::uint32_t cache_size);
- Reader(std::istream& ifs, boost::uint32_t cache_size, Header const& header);
- Reader(ReaderI* reader);
+ Reader(ReaderIPtr reader);
Reader(Reader const& other);
Reader& operator=(Reader const& rhs);
- /// User-defined consructor initializes reader with input stream and
- /// a header to override the values in the file
- /// @exception std::runtime_error - on failure state of the input stream.
- Reader(std::istream& ifs, Header const& header);
/// Destructor.
/// @exception nothrow
@@ -90,6 +84,8 @@
/// Provides read-only access to header of LAS file being read.
/// @exception nothrow
Header const& GetHeader() const;
+
+ void SetHeader(Header const& );
/// Provides read-only access to current point record.
/// @exception nothrow
@@ -146,7 +142,6 @@
void Init(); // throws on error
- typedef boost::shared_ptr<ReaderI> ReaderIPtr;
ReaderIPtr m_pimpl;
diff -r 018aae9571f4 -r dc3cb1f372a2 include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp Thu Dec 16 12:13:27 2010 -0600
+++ b/include/liblas/liblas.hpp Fri Dec 17 09:18:22 2010 -0600
@@ -68,6 +68,7 @@
#include <liblas/detail/private_utility.hpp>
#include <liblas/capi/las_version.h>
#include <liblas/export.hpp>
+#include <liblas/factory.hpp>
// booost
#include <boost/array.hpp>
diff -r 018aae9571f4 -r dc3cb1f372a2 python/tests/SRS-GDAL.txt
--- a/python/tests/SRS-GDAL.txt Thu Dec 16 12:13:27 2010 -0600
+++ b/python/tests/SRS-GDAL.txt Fri Dec 17 09:18:22 2010 -0600
@@ -31,7 +31,7 @@
True
>>> p = f.read(0)
>>> s2.vlr_count()
- 3
+ 4
>>> s2.GetVLR(0).recordlength
64
>>> int(round(p.x))
diff -r 018aae9571f4 -r dc3cb1f372a2 src/CMakeLists.txt
--- a/src/CMakeLists.txt Thu Dec 16 12:13:27 2010 -0600
+++ b/src/CMakeLists.txt Fri Dec 17 09:18:22 2010 -0600
@@ -23,6 +23,7 @@
${LIBLAS_HEADERS_DIR}/chipper.hpp
${LIBLAS_HEADERS_DIR}/exception.hpp
${LIBLAS_HEADERS_DIR}/export.hpp
+ ${LIBLAS_HEADERS_DIR}/factory.hpp
${LIBLAS_HEADERS_DIR}/guid.hpp
${LIBLAS_HEADERS_DIR}/iterator.hpp
${LIBLAS_HEADERS_DIR}/lasbounds.hpp
@@ -108,6 +109,7 @@
set(LIBLAS_CPP
chipper.cpp
+ factory.cpp
lasclassification.cpp
lascolor.cpp
lasdimension.cpp
diff -r 018aae9571f4 -r dc3cb1f372a2 src/detail/writer/writer.cpp
--- a/src/detail/writer/writer.cpp Thu Dec 16 12:13:27 2010 -0600
+++ b/src/detail/writer/writer.cpp Fri Dec 17 09:18:22 2010 -0600
@@ -69,6 +69,8 @@
m_header_writer = HeaderWriterPtr(new writer::Header(m_ofs,m_pointCount, *m_header) );
m_header_writer->write();
+
+ m_header = HeaderPtr(new liblas::Header(m_header_writer->GetHeader()));
}
void WriterImpl::UpdatePointCount(boost::uint32_t count)
diff -r 018aae9571f4 -r dc3cb1f372a2 src/factory.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/factory.cpp Fri Dec 17 09:18:22 2010 -0600
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project: libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose: LAS factories
+ * Author: Howard Butler, hobu.inc at gmail.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Mateusz Loskot
+ * Copyright (c) 2010, Howard Butler
+ *
+ * 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 the Martin Isenburg or Iowa Department
+ * of Natural Resources 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.
+ ****************************************************************************/
+
+#include <liblas/factory.hpp>
+#include <liblas/detail/reader/reader.hpp>
+#include <liblas/detail/reader/cachedreader.hpp>
+#include <liblas/utility.hpp>
+
+// boost
+#include <boost/cstdint.hpp>
+
+// std
+#include <stdexcept>
+#include <fstream>
+#include <string>
+#include <cstring> // std::memset
+#include <cassert>
+#include <iostream>
+
+using namespace boost;
+
+namespace liblas
+{
+
+Reader ReaderFactory::CreateWithImpl(ReaderIPtr r)
+{
+ liblas::Reader reader(r);
+ return reader;
+}
+
+Reader ReaderFactory::CreateCached(std::istream& stream, boost::uint32_t cache_size)
+{
+ ReaderIPtr r = ReaderIPtr(new detail::CachedReaderImpl(stream, cache_size) );
+ return liblas::Reader(r);
+}
+
+Reader ReaderFactory::Create(std::istream& stream)
+{
+ ReaderIPtr r = ReaderIPtr(new detail::ReaderImpl(stream) );
+ return liblas::Reader(r);
+}
+} // namespace liblas
+
diff -r 018aae9571f4 -r dc3cb1f372a2 src/las_c_api.cpp
--- a/src/las_c_api.cpp Thu Dec 16 12:13:27 2010 -0600
+++ b/src/las_c_api.cpp Fri Dec 17 09:18:22 2010 -0600
More information about the Liblas-commits
mailing list