[Liblas-commits] hg-main-tree: refactoring support functions

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 15 17:14:37 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/ad5cad8c99ab
changeset: 572:ad5cad8c99ab
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 15 14:00:25 2011 -0700
description:
refactoring support functions
Subject: hg-main-tree: added IDE grouping

details:   http://hg.libpc.orghg-main-tree/rev/04d4c9344434
changeset: 573:04d4c9344434
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 15 14:14:19 2011 -0700
description:
added IDE grouping
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/a21269125167
changeset: 574:a21269125167
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Apr 15 14:14:28 2011 -0700
description:
merge

diffstat:

 include/libpc/drivers/oci/Schema.hpp |   72 +++++++++++++
 src/CMakeLists.txt                   |    5 +-
 src/drivers/oci/Schema.cpp           |   61 +++++++++++
 test/unit/CMakeLists.txt             |   45 +++++++-
 test/unit/ChipperTest.cpp            |    4 +-
 test/unit/LiblasReaderTest.cpp       |  143 ++++++---------------------
 test/unit/LiblasWriterTest.cpp       |   12 +-
 test/unit/OCITest.cpp                |    6 +-
 test/unit/Support.cpp                |  181 +++++++++++++++++++++++++++++++++++
 test/unit/Support.hpp                |   80 +++++++++++++++
 test/unit/TestConfig.cpp             |   54 ++++++++++
 test/unit/TestConfig.hpp             |   48 +++++++++
 test/unit/main.cpp                   |    7 +-
 test/unit/support.cpp                |  106 --------------------
 test/unit/support.hpp                |   58 -----------
 15 files changed, 589 insertions(+), 293 deletions(-)

diffs (truncated from 1297 to 300 lines):

diff -r a2c06e450ba2 -r a21269125167 include/libpc/drivers/oci/Schema.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/drivers/oci/Schema.hpp	Fri Apr 15 14:14:28 2011 -0700
@@ -0,0 +1,72 @@
+/******************************************************************************
+* Copyright (c) 2011, Howard Butler, hobu.inc at 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_OCI_SCHEMA_HPP
+#define INCLUDED_DRIVERS_OCI_SCHEMA_HPP
+
+#include <libpc/libpc.hpp>
+
+#include <libpc/drivers/oci/Common.hpp>
+#include <libpc/drivers/oci/Reader.hpp>
+
+#include <string>
+
+#include <libxml/parser.h>
+#include <libxml/xmlschemas.h>
+
+
+
+namespace libpc { namespace drivers { namespace oci {
+
+
+class Schema
+{
+public:
+    Schema();
+    ~Schema();
+
+
+private:
+    
+    Schema& operator=(const Schema&); // not implemented
+    Schema(const Schema&); // not implemented;
+    
+
+};
+
+
+
+} } } // namespaces
+
+#endif
diff -r a2c06e450ba2 -r a21269125167 src/CMakeLists.txt
--- a/src/CMakeLists.txt	Fri Apr 15 14:49:00 2011 -0500
+++ b/src/CMakeLists.txt	Fri Apr 15 14:14:28 2011 -0700
@@ -175,6 +175,7 @@
   ${LIBPC_HEADERS_DIR}/drivers/oci/Iterator.hpp
   ${LIBPC_HEADERS_DIR}/drivers/oci/oci_wrapper.h
   ${LIBPC_HEADERS_DIR}/drivers/oci/Common.hpp
+  ${LIBPC_HEADERS_DIR}/drivers/oci/Schema.hpp
 )
 
 set (LIBPC_DRIVERS_OCI_CPP 
@@ -183,6 +184,7 @@
   ./drivers/oci/Reader.cpp
   ./drivers/oci/Iterator.cpp
   ./drivers/oci/Writer.cpp
+  ./drivers/oci/Schema.cpp
 )
    
 FOREACH(file ${LIBPC_DRIVERS_OCI_HPP})
@@ -348,7 +350,8 @@
   ${GEOTIFF_LIBRARY}
   ${GDAL_LIBRARY}
   ${LASZIP_LIBRARY}
-  ${Boost_LIBRARIES})
+  ${Boost_LIBRARIES}
+  ${LIBXML2_LIBRARIES})
 
 
 set_target_properties(${LIBPC_LIB_NAME}
diff -r a2c06e450ba2 -r a21269125167 src/drivers/oci/Schema.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/drivers/oci/Schema.cpp	Fri Apr 15 14:14:28 2011 -0700
@@ -0,0 +1,61 @@
+/******************************************************************************
+* Copyright (c) 2011, Howard Butler, hobu.inc at 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.
+****************************************************************************/
+
+#include <libpc/drivers/oci/Schema.hpp>
+#include <libpc/exceptions.hpp>
+#include <libpc/Utils.hpp>
+
+#include <sstream>
+#include <map>
+#include <algorithm>
+
+
+namespace libpc { namespace drivers { namespace oci {
+
+Schema::Schema()
+
+{
+
+    LIBXML_TEST_VERSION
+    return;
+}
+
+
+Schema::~Schema()
+{
+}
+
+
+
+} } } // namespaces
diff -r a2c06e450ba2 -r a21269125167 test/unit/CMakeLists.txt
--- a/test/unit/CMakeLists.txt	Fri Apr 15 14:49:00 2011 -0500
+++ b/test/unit/CMakeLists.txt	Fri Apr 15 14:14:28 2011 -0700
@@ -7,7 +7,7 @@
 ###############################################################################
 SET(LIBPC_UNIT_TEST libpc_test)
 
-SET(LIBPC_UNIT_TEST_SRC
+SET(LIBPC_UNITTEST_TEST_SRC
     BoundsTest.cpp
     CacheFilterTest.cpp
     ChipperTest.cpp
@@ -31,27 +31,60 @@
     SignallerTest.cpp
     UtilsTest.cpp
     VectorTest.cpp
-    support.cpp
-    support.hpp
-    main.cpp)
+    )
+
+SET(LIBPC_UNITTEST_TEST_INC
+    )
+    
+SET(LIBPC_UNITTEST_CONFIG_SRC
+    Support.cpp
+    TestConfig.cpp
+    main.cpp
+    )
+
+SET(LIBPC_UNITTEST_CONFIG_INC
+    Support.hpp
+    TestConfig.hpp
+    )
+
 
 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")
+            SET(LIBPC_UNITTEST_TEST_SRC "${LIBPC_UNITTEST_TEST_SRC};${file}" CACHE INTERNAL "source files for test")
     ENDFOREACH(file)
     
 endif (WITH_ORACLE)
 
 
+set(LIBPC_UNITTEST_SOURCES "")
+FOREACH(file ${LIBPC_UNITTEST_TEST_SRC})
+        SET(LIBPC_UNITTEST_SOURCES "${LIBPC_UNITTEST_SOURCES};${file}" CACHE INTERNAL "source files for test")
+ENDFOREACH(file)
+FOREACH(file ${LIBPC_UNITTEST_TEST_INC})
+        SET(LIBPC_UNITTEST_SOURCES "${LIBPC_UNITTEST_SOURCES};${file}" CACHE INTERNAL "source files for test")
+ENDFOREACH(file)
+FOREACH(file ${LIBPC_UNITTEST_CONFIG_SRC})
+        SET(LIBPC_UNITTEST_SOURCES "${LIBPC_UNITTEST_SOURCES};${file}" CACHE INTERNAL "source files for test")
+ENDFOREACH(file)
+FOREACH(file ${LIBPC_UNITTEST_CONFIG_INC})
+        SET(LIBPC_UNITTEST_SOURCES "${LIBPC_UNITTEST_SOURCES};${file}" CACHE INTERNAL "source files for test")
+ENDFOREACH(file)
+
+source_group("Header Files" FILES ${LIBPC_UNITTEST_TEST_INC})
+source_group("Header Files\\config" FILES ${LIBPC_UNITTEST_CONFIG_INC})
+source_group("Source Files" FILES ${LIBPC_UNITTEST_TEST_SRC})
+source_group("Source Files\\config" FILES ${LIBPC_UNITTEST_CONFIG_SRC})
+
+
 INCLUDE_DIRECTORIES(
     .
     ../../include
     ${GDAL_INCLUDE_DIR}
     ${GEOTIFF_INCLUDE_DIR})
 
-ADD_EXECUTABLE(${LIBPC_UNIT_TEST} ${LIBPC_UNIT_TEST_SRC} )
+ADD_EXECUTABLE(${LIBPC_UNIT_TEST} ${LIBPC_UNITTEST_SOURCES})
 
 set_target_properties(${LIBPC_UNIT_TEST} PROPERTIES COMPILE_DEFINITIONS LIBPC_DLL_IMPORT)
 
diff -r a2c06e450ba2 -r a21269125167 test/unit/ChipperTest.cpp
--- a/test/unit/ChipperTest.cpp	Fri Apr 15 14:49:00 2011 -0500
+++ b/test/unit/ChipperTest.cpp	Fri Apr 15 14:14:28 2011 -0700
@@ -39,7 +39,7 @@
 #include <libpc/drivers/liblas/Writer.hpp>
 #include <libpc/drivers/liblas/Reader.hpp>
 
-#include "support.hpp"
+#include "Support.hpp"
 
 using namespace libpc;
 using namespace libpc::drivers::liblas;
@@ -49,7 +49,7 @@
 
 BOOST_AUTO_TEST_CASE(test_construction)
 {
-    LiblasReader reader(TestConfig::g_data_path + "1.2-with-color.las");
+    LiblasReader reader(Support::datapath("1.2-with-color.las"));
 
     {
         const boost::uint64_t num_points = reader.getNumPoints();
diff -r a2c06e450ba2 -r a21269125167 test/unit/LiblasReaderTest.cpp
--- a/test/unit/LiblasReaderTest.cpp	Fri Apr 15 14:49:00 2011 -0500
+++ b/test/unit/LiblasReaderTest.cpp	Fri Apr 15 14:14:28 2011 -0700
@@ -40,7 +40,7 @@
 #include <libpc/SchemaLayout.hpp>
 #include <libpc/drivers/liblas/Reader.hpp>
 #include <libpc/filters/CacheFilter.hpp>
-#include "support.hpp"
+#include "Support.hpp"
 
 using namespace libpc;
 using namespace libpc::drivers::liblas;
@@ -50,88 +50,9 @@
 BOOST_AUTO_TEST_SUITE(LiblasReaderTest)
 
 
-#define Compare(x,y)    BOOST_CHECK(Utils::compare_approx((x),(y),0.001));
-
-
-static void check_pN(const PointBuffer& data, const Schema& schema, 
-                     size_t index, 
-                     double xref, double yref, double zref)
-{
-    int offsetX = schema.getDimensionIndex(Dimension::Field_X, Dimension::Int32);
-    int offsetY = schema.getDimensionIndex(Dimension::Field_Y, Dimension::Int32);
-    int offsetZ = schema.getDimensionIndex(Dimension::Field_Z, Dimension::Int32);
-
-    boost::int32_t x0raw = data.getField<boost::int32_t>(index, offsetX);
-    boost::int32_t y0raw = data.getField<boost::int32_t>(index, offsetY);
-    boost::int32_t z0raw = data.getField<boost::int32_t>(index, offsetZ);
-    double x0 = schema.getDimension(offsetX).applyScaling<boost::int32_t>(x0raw);


More information about the Liblas-commits mailing list