[Liblas-commits] hg-main-tree: LASzip's version has increased to
1.2.0, this mean...
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Apr 12 12:41:29 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/d294fc2ebc06
changeset: 534:d294fc2ebc06
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:37:23 2011 -0500
description:
LASzip's version has increased to 1.2.0, this means updating the test file
Subject: hg-main-tree: move connection to the database at construction time
details: http://hg.libpc.orghg-main-tree/rev/e46a731703a0
changeset: 535:e46a731703a0
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:38:01 2011 -0500
description:
move connection to the database at construction time
Subject: hg-main-tree: convenience function to fetch the connection
details: http://hg.libpc.orghg-main-tree/rev/feb2da09eb36
changeset: 536:feb2da09eb36
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:38:15 2011 -0500
description:
convenience function to fetch the connection
Subject: hg-main-tree: reset the point count to 0 for each readBuffer call
details: http://hg.libpc.orghg-main-tree/rev/c365c4cee374
changeset: 537:c365c4cee374
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:38:38 2011 -0500
description:
reset the point count to 0 for each readBuffer call
Subject: hg-main-tree: hop out of readImpl before resetting the buffer's count to 0
details: http://hg.libpc.orghg-main-tree/rev/185d4061a455
changeset: 538:185d4061a455
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:40:43 2011 -0500
description:
hop out of readImpl before resetting the buffer's count to 0
Subject: hg-main-tree: lint and operator precedence
details: http://hg.libpc.orghg-main-tree/rev/cc3eea665e99
changeset: 539:cc3eea665e99
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:41:08 2011 -0500
description:
lint and operator precedence
Subject: hg-main-tree: Start on an OCI test case
details: http://hg.libpc.orghg-main-tree/rev/2ec6ae0b42f6
changeset: 540:2ec6ae0b42f6
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 12 11:41:18 2011 -0500
description:
Start on an OCI test case
diffstat:
include/libpc/drivers/oci/Writer.hpp | 2 +
src/drivers/oci/Iterator.cpp | 6 +-
src/drivers/oci/Writer.cpp | 7 +-
src/filters/ChipperIterator.cpp | 7 +-
test/data/simple.laz | 0
test/unit/CMakeLists.txt | 54 +++++++-----
test/unit/OCITest.cpp | 149 +++++++++++++++++++++++++++++++++++
test/unit/support.cpp | 6 +-
test/unit/support.hpp | 1 +
9 files changed, 201 insertions(+), 31 deletions(-)
diffs (truncated from 336 to 300 lines):
diff -r d7d228219024 -r 2ec6ae0b42f6 include/libpc/drivers/oci/Writer.hpp
--- a/include/libpc/drivers/oci/Writer.hpp Mon Apr 11 16:30:25 2011 -0500
+++ b/include/libpc/drivers/oci/Writer.hpp Tue Apr 12 11:41:18 2011 -0500
@@ -61,6 +61,8 @@
void run(std::ostringstream const& command);
inline void setBounds(libpc::Bounds<double> bounds) {m_bounds = bounds; }
inline libpc::Bounds<double> getBounds() const { return m_bounds; }
+
+ inline Connection getConnection() const { return m_connection;}
protected:
// this is called once before the loop with the writeBuffer calls
virtual void writeBegin();
diff -r d7d228219024 -r 2ec6ae0b42f6 src/drivers/oci/Iterator.cpp
--- a/src/drivers/oci/Iterator.cpp Mon Apr 11 16:30:25 2011 -0500
+++ b/src/drivers/oci/Iterator.cpp Tue Apr 12 11:41:18 2011 -0500
@@ -181,6 +181,10 @@
// if (getReader().isVerbose())
// std::cout << " Existing block has " << m_block->num_points << " points" << std::endl;
+ // should have 37427853
+ // we have 49898796
+
+ // capacity is 5000 num blocks = 7488
if (!m_block->num_points)
{
// We still have a block of data from the last readBuffer call
@@ -206,7 +210,7 @@
while (bDidRead)
{
boost::uint32_t numReadThisBlock = m_block->num_points;
- if (numPointsRead + numReadThisBlock > (data.getCapacity() - data.getNumPoints()))
+ if ((numPointsRead + numReadThisBlock) > (data.getCapacity() - data.getNumPoints()))
{
// We're done. We still have more data, but the
// user is going to have to request another buffer.
diff -r d7d228219024 -r 2ec6ae0b42f6 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp Mon Apr 11 16:30:25 2011 -0500
+++ b/src/drivers/oci/Writer.cpp Tue Apr 12 11:41:18 2011 -0500
@@ -52,6 +52,9 @@
, m_doCreateIndex(false)
{
+ Debug();
+
+ m_connection = Connect(m_options);
return;
}
@@ -599,9 +602,7 @@
// }
// Set up debugging info
- Debug();
-
- m_connection = Connect(m_options);
+
if (m_options.GetPTree().get<bool>("overwrite"))
{
diff -r d7d228219024 -r 2ec6ae0b42f6 src/filters/ChipperIterator.cpp
--- a/src/filters/ChipperIterator.cpp Mon Apr 11 16:30:25 2011 -0500
+++ b/src/filters/ChipperIterator.cpp Tue Apr 12 11:41:18 2011 -0500
@@ -60,13 +60,12 @@
// We will read from our previous stage until we get that amount (or
// until the previous stage runs out of points).
-
- assert(buffer.getNumPoints() == 0);
-
-
if (m_currentBlockId == m_chipper.GetBlockCount())
return 0; // we're done.
+
+ buffer.setNumPoints(0);
+
filters::chipper::Block const& block = m_chipper.GetBlock(m_currentBlockId);
std::size_t numPointsThisBlock = block.GetIDs().size();
m_currentPointCount = m_currentPointCount + numPointsThisBlock;
diff -r d7d228219024 -r 2ec6ae0b42f6 test/data/simple.laz
Binary file test/data/simple.laz has changed
diff -r d7d228219024 -r 2ec6ae0b42f6 test/unit/CMakeLists.txt
--- a/test/unit/CMakeLists.txt Mon Apr 11 16:30:25 2011 -0500
+++ b/test/unit/CMakeLists.txt Tue Apr 12 11:41:18 2011 -0500
@@ -8,33 +8,43 @@
SET(LIBPC_UNIT_TEST libpc_test)
SET(LIBPC_UNIT_TEST_SRC
- BoundsTest.cpp
+ BoundsTest.cpp
CacheFilterTest.cpp
- ChipperTest.cpp
- ColorTest.cpp
- ColorFilterTest.cpp
- ConfigTest.cpp
- CropFilterTest.cpp
- DecimationFilterTest.cpp
- DimensionLayoutTest.cpp
- DimensionTest.cpp
- FauxReaderTest.cpp
- FauxWriterTest.cpp
- LiblasReaderTest.cpp
- LiblasWriterTest.cpp
- MosaicFilterTest.cpp
- PointBufferCacheTest.cpp
- PointBufferTest.cpp
- RangeTest.cpp
- SchemaLayoutTest.cpp
- SchemaTest.cpp
- SignallerTest.cpp
- UtilsTest.cpp
- VectorTest.cpp
+ ChipperTest.cpp
+ ColorTest.cpp
+ ColorFilterTest.cpp
+ ConfigTest.cpp
+ CropFilterTest.cpp
+ DecimationFilterTest.cpp
+ DimensionLayoutTest.cpp
+ DimensionTest.cpp
+ FauxReaderTest.cpp
+ FauxWriterTest.cpp
+ LiblasReaderTest.cpp
+ LiblasWriterTest.cpp
+ MosaicFilterTest.cpp
+ PointBufferCacheTest.cpp
+ PointBufferTest.cpp
+ RangeTest.cpp
+ SchemaLayoutTest.cpp
+ SchemaTest.cpp
+ SignallerTest.cpp
+ UtilsTest.cpp
+ VectorTest.cpp
support.cpp
support.hpp
main.cpp)
+if (WITH_ORACLE)
+ set(LIBPC_OCI_TEST_CPP OCITest.cpp)
+
+ FOREACH(file ${LIBPC_OCI_TEST_CPP})
+ SET(LIBPC_UNIT_TEST_SRC "${LIBPC_UNIT_TEST_SRC};${file}" CACHE INTERNAL "source files for test")
+ ENDFOREACH(file)
+
+endif (WITH_ORACLE)
+
+
INCLUDE_DIRECTORIES(
.
../../include
diff -r d7d228219024 -r 2ec6ae0b42f6 test/unit/OCITest.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/OCITest.cpp Tue Apr 12 11:41:18 2011 -0500
@@ -0,0 +1,149 @@
+/******************************************************************************
+* Copyright (c) 2011, Michael P. Gerlek (mpg at flaxen.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.
+****************************************************************************/
+
+#include <boost/test/unit_test.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/property_tree/ptree.hpp>
+
+#include <libpc/drivers/oci/Reader.hpp>
+#include <libpc/drivers/oci/Writer.hpp>
+#include <libpc/drivers/oci/Common.hpp>
+
+#include <libpc/drivers/liblas/Reader.hpp>
+
+#include <libpc/filters/CacheFilter.hpp>
+#include <libpc/filters/Chipper.hpp>
+
+#include <libpc/drivers/faux/Reader.hpp>
+#include <libpc/drivers/faux/Writer.hpp>
+
+
+#include "support.hpp"
+
+using namespace libpc;
+
+using namespace libpc::drivers::oci;
+
+Options GetOptions()
+{
+ Options options;
+ boost::property_tree::ptree& tree = options.GetPTree();
+
+ tree.put("capacity", 333);
+ tree.put("overwrite", false);
+ tree.put("connection", TestConfig::g_oracle_connection);
+ tree.put("debug", true);
+ tree.put("verbose", true);
+ tree.put("scale.x", 0.0000001);
+ tree.put("scale.y", 0.0000001);
+ tree.put("scale.z", 0.001);
+ tree.put("block_table_name", "LIBPC_TEST_BLOCKS");
+ tree.put("base_table_name", "LIBPC_TEST_BASE");
+ tree.put("select_sql", "SELECT * FROM LIBPC_TEST_BLOCKS");
+ return options;
+}
+
+void RunSQL(Connection connection, std::string sql)
+{
+ Statement statement = Statement(connection->CreateStatement(sql.c_str()));
+ statement->Execute();
+}
+
+BOOST_AUTO_TEST_SUITE(OCITest)
+
+
+
+
+BOOST_AUTO_TEST_CASE(initialize)
+{
+ Options options = GetOptions();
+
+ Connection connection = Connect(options);
+
+ std::string base_table_name = options.GetPTree().get<std::string>("base_table_name");
+ std::string create_pc_table("CREATE TABLE " + base_table_name +" (id number, CLOUD SDO_PC, DESCRIPTION VARCHAR2(20), HEADER BLOB, BOUNDARY SDO_GEOMETRY)");
+ RunSQL(connection, create_pc_table);
+
+ std::string block_table_name = options.GetPTree().get<std::string>("block_table_name");
+ std::string create_block_table = "CREATE TABLE " + block_table_name + " AS SELECT * FROM MDSYS.SDO_PC_BLK_TABLE";
+ RunSQL(connection, create_block_table);
+}
+
+
+BOOST_AUTO_TEST_CASE(test_writer)
+{
+ Options options = GetOptions();
+ libpc::drivers::liblas::LiblasReader reader(TestConfig::g_data_path + "1.2-with-color.las");
+
+ boost::uint32_t capacity = GetOptions().GetPTree().get<boost::uint32_t>("capacity");
+ libpc::filters::CacheFilter cache(reader, 1, 1024);
+ libpc::filters::Chipper chipper(cache, capacity);
+ libpc::drivers::oci::Writer writer(chipper, options);
+
+ BOOST_CHECK_MESSAGE(writer.getConnection().get(), "Unable to connect to Oracle" );
+
+ writer.write(0);
+
+}
+
+BOOST_AUTO_TEST_CASE(test_reader)
+{
+ Options options = GetOptions();
+
+
+ libpc::drivers::oci::Reader reader(options);
+ const boost::uint64_t numPoints = reader.getNumPoints();
+
+ libpc::drivers::faux::Writer writer(reader);
+ writer.write(0);
+
+
+}
+
+BOOST_AUTO_TEST_CASE(clean_up)
+{
+ libpc::drivers::oci::Options options = GetOptions();
+
+ Connection connection = Connect(options);
+
+ std::string base_table_name = options.GetPTree().get<std::string>("base_table_name");
+ std::string block_table_name = options.GetPTree().get<std::string>("block_table_name");
+
+ std::string drop_base_table = "DROP TABLE " + base_table_name;
+ std::string drop_block_table = "DROP TABLE " + block_table_name;
+ RunSQL(connection, drop_base_table);
+ RunSQL(connection, drop_block_table);
More information about the Liblas-commits
mailing list