[Liblas-commits] hg: Temp commit.

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jun 22 12:31:15 EDT 2011


details:   http://hg.liblas.orghg/rev/012a8d3967f3
changeset: 2987:012a8d3967f3
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Wed Mar 23 15:42:28 2011 -0500
description:
Temp commit.
Subject: hg: Temp commit.

details:   http://hg.liblas.orghg/rev/7f429e663eed
changeset: 2988:7f429e663eed
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Mon Apr 18 14:42:48 2011 -0500
description:
Temp commit.
Subject: hg: merge

details:   http://hg.liblas.orghg/rev/dec1b5e304da
changeset: 2989:dec1b5e304da
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Mon Apr 18 14:44:22 2011 -0500
description:
merge
Subject: hg: Integrated allocator into chipper.  Still need cleanup of allocator.

details:   http://hg.liblas.orghg/rev/6c3f85c47d00
changeset: 2990:6c3f85c47d00
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Wed Jun 22 10:35:31 2011 -0500
description:
Integrated allocator into chipper.  Still need cleanup of allocator.
Subject: hg: Clean up allocator.

details:   http://hg.liblas.orghg/rev/7507dda4c1a0
changeset: 2991:7507dda4c1a0
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Wed Jun 22 11:20:42 2011 -0500
description:
Clean up allocator.
Subject: hg: merge

details:   http://hg.liblas.orghg/rev/6bb00e9076ce
changeset: 2992:6bb00e9076ce
user:      Andrew Bell <andrew.bell.ia at gmail.com>
date:      Wed Jun 22 11:22:19 2011 -0500
description:
merge

diffstat:

 AUTHORS                                     |    2 +-
 CMakeLists.txt                              |    2 +-
 apps/kdx_util.cpp                           |   92 ++-
 apps/las2las.cpp                            |    6 +-
 apps/las2oci.cpp                            |  119 +++-
 apps/lasinfo.cpp                            |    7 +-
 apps/laskernel.cpp                          |    4 +-
 apps/oci_wrapper.cpp                        |  512 ++++++++++++++++-
 apps/oci_wrapper.h                          |   62 ++-
 apps/txt2las.c                              |    3 +
 doc/compilation.txt                         |    2 +-
 doc/download.txt                            |   24 +-
 include/liblas/bounds.hpp                   |    2 +-
 include/liblas/capi/las_version.h           |    6 +-
 include/liblas/capi/liblas.h                |   10 +
 include/liblas/chipper.hpp                  |   51 +-
 include/liblas/detail/fwd.hpp               |    4 +
 include/liblas/detail/index/indexoutput.hpp |    8 +-
 include/liblas/detail/opt_allocator.hpp     |  200 ++++++
 include/liblas/detail/reader/zipreader.hpp  |    5 +-
 include/liblas/detail/rt_allocator.hpp      |  153 +++++
 include/liblas/detail/writer/zipwriter.hpp  |    2 +
 include/liblas/detail/zippoint.hpp          |   11 +-
 include/liblas/dimension.hpp                |    3 +
 include/liblas/point.hpp                    |   12 +-
 include/liblas/schema.hpp                   |    4 +
 include/liblas/spatialreference.hpp         |    5 +
 include/liblas/transform.hpp                |   10 +-
 python/liblas/core.py                       |   35 +-
 python/liblas/file.py                       |   18 +-
 python/liblas/header.py                     |    5 +
 python/liblas/point.py                      |  116 +++-
 python/setup.py                             |    2 +-
 python/tests/File.txt                       |    5 +
 python/tests/Header.txt                     |    4 +-
 python/tests/Point.txt                      |   55 +-
 python/tests/VLR.txt                        |    2 +-
 schemas/8-dimension-schema.xml              |  109 +++
 schemas/LAS-example.xsd                     |  105 ---
 schemas/LAS.xsd                             |   74 +--
 schemas/las.xml                             |  141 ++++-
 schemas/prop_tree.xml                       |  410 ++++++++++++++
 src/c_api.cpp                               |   72 +-
 src/chipper.cpp                             |   70 +-
 src/detail/index/indexoutput.cpp            |    2 +-
 src/detail/reader/header.cpp                |    2 +
 src/detail/reader/reader.cpp                |   14 +-
 src/detail/reader/zipreader.cpp             |  804 +++++++++++++--------------
 src/detail/writer/header.cpp                |    4 +-
 src/detail/writer/zipwriter.cpp             |   91 +-
 src/detail/zippoint.cpp                     |  276 +++------
 src/dimension.cpp                           |   22 +
 src/header.cpp                              |   25 +-
 src/point.cpp                               |  222 ++-----
 src/schema.cpp                              |   23 +-
 src/spatialreference.cpp                    |   36 +
 src/transform.cpp                           |   16 +-
 src/utility.cpp                             |  103 +-
 test/unit/point_test.cpp                    |   72 ++-
 test/unit/spatialreference_test.cpp         |   46 +-
 test/unit/transform_test.cpp                |    3 +-
 test/unit/zipreader_test.cpp                |    8 +-
 62 files changed, 3013 insertions(+), 1300 deletions(-)

diffs (truncated from 6309 to 300 lines):

diff -r 53c7842d609f -r 6bb00e9076ce AUTHORS
--- a/AUTHORS	Fri Mar 18 08:32:45 2011 -0500
+++ b/AUTHORS	Wed Jun 22 11:22:19 2011 -0500
@@ -14,4 +14,4 @@
 warmerdam at pobox.com
 
 Michael P. Gerlek
-mpg at flaxen.com
+mpg at flaxen.com 
diff -r 53c7842d609f -r 6bb00e9076ce CMakeLists.txt
--- a/CMakeLists.txt	Fri Mar 18 08:32:45 2011 -0500
+++ b/CMakeLists.txt	Wed Jun 22 11:22:19 2011 -0500
@@ -10,7 +10,7 @@
 
 
 SET(LIBLAS_VERSION_MAJOR "1")
-SET(LIBLAS_VERSION_MINOR "6")
+SET(LIBLAS_VERSION_MINOR "7")
 SET(LIBLAS_VERSION_PATCH "0")
 set(VERSION "${LIBLAS_VERSION_MAJOR}.${LIBLAS_VERSION_MINOR}.${LIBLAS_VERSION_PATCH}")
 SET(LIBLAS_LIB_SOVERSION "2.0.0")
diff -r 53c7842d609f -r 6bb00e9076ce apps/kdx_util.cpp
--- a/apps/kdx_util.cpp	Fri Mar 18 08:32:45 2011 -0500
+++ b/apps/kdx_util.cpp	Wed Jun 22 11:22:19 2011 -0500
@@ -105,30 +105,65 @@
 
     point_data.clear();
 
+    // Full 8-byte dimension - Dim #1
     double x = p.GetX();
+
+    // Full 8-byte dimension - Dim #2
     double y = p.GetY();
+
+    // Full 8-byte dimension - Dim #3
     double z = p.GetZ();
+
+    // Full 8-byte dimension - Dim #4
     double t = p.GetTime();
+
+    // Full 8-byte dimension - Dim #5
+    double c = static_cast<double>(p.GetClassification().GetClass());
+
+    // Full 8-byte dimension - Dim #6
+    double intensity = static_cast<double>(p.GetIntensity());
+    // double intensity = 34.0;
+
+    // Composed 8-byte dimension - Dim #7
+    boost::int8_t returnNumber = (boost::int8_t)p.GetReturnNumber(); // 1 byte
+    boost::int8_t numberOfReturns = (boost::int8_t)p.GetNumberOfReturns(); // 1 byte
+    boost::int8_t scanDirFlag = (boost::int8_t)p.GetScanDirection(); // 1 byte
+    boost::int8_t edgeOfFlightLine = (boost::int8_t)p.GetFlightLineEdge(); // 1 byte
+    boost::int8_t scanAngleRank = p.GetScanAngleRank(); // 1 byte
+    boost::uint8_t userData = p.GetUserData(); // 1 byte
+    boost::uint16_t pointSourceId = p.GetPointSourceID(); // 2 bytes
+
+
+    // Composed 8-byte dimension - Dim #8
+    liblas::Color const& color = p.GetColor();
+    boost::uint16_t red = color.GetRed();
+    boost::uint16_t green = color.GetGreen();
+    boost::uint16_t blue = color.GetBlue();
+    boost::uint16_t alpha = 0;
     
-    // std::cout.precision(6);
-    // std::cout.setf(std::ios::fixed);
-    // // std::cout << "X: " << x << " y: " << y << " z: " << z << std::endl;
-    double c = static_cast<double>(p.GetClassification().GetClass());
 
     boost::uint8_t* x_b =  reinterpret_cast<boost::uint8_t*>(&x);
     boost::uint8_t* y_b =  reinterpret_cast<boost::uint8_t*>(&y);
     boost::uint8_t* z_b =  reinterpret_cast<boost::uint8_t*>(&z);
     boost::uint8_t* t_b =  reinterpret_cast<boost::uint8_t*>(&t);
     boost::uint8_t* c_b =  reinterpret_cast<boost::uint8_t*>(&c);
+    
+    boost::uint8_t* intensity_b =  reinterpret_cast<boost::uint8_t*>(&intensity);
+    
+    boost::uint8_t* returnNumber_b =  reinterpret_cast<boost::uint8_t*>(&returnNumber);
+    boost::uint8_t* numberOfReturns_b =  reinterpret_cast<boost::uint8_t*>(&numberOfReturns);
+    boost::uint8_t* scanDirFlag_b =  reinterpret_cast<boost::uint8_t*>(&scanDirFlag);
+    boost::uint8_t* edgeOfFlightLine_b =  reinterpret_cast<boost::uint8_t*>(&edgeOfFlightLine);
+    boost::uint8_t* scanAngleRank_b =  reinterpret_cast<boost::uint8_t*>(&scanAngleRank);
+    boost::uint8_t* userData_b =  reinterpret_cast<boost::uint8_t*>(&userData);
+    boost::uint8_t* pointSourceId_b =  reinterpret_cast<boost::uint8_t*>(&pointSourceId);
 
-    // doubles are 8 bytes long.  For each double, push back the 
-    // byte.  We do this for all four values (x,y,z,t)
 
-    // // little-endian
-    // for (int i=0; i<sizeof(double); i++) {
-    //     point_data.push_back(y_b[i]);
-    // }
-    // 
+    boost::uint8_t* red_b =  reinterpret_cast<boost::uint8_t*>(&red);
+    boost::uint8_t* green_b =  reinterpret_cast<boost::uint8_t*>(&green);
+    boost::uint8_t* blue_b =  reinterpret_cast<boost::uint8_t*>(&blue);
+    boost::uint8_t* alpha_b =  reinterpret_cast<boost::uint8_t*>(&alpha);
+ 
 
     // big-endian
     for (int i = sizeof(double) - 1; i >= 0; i--) {
@@ -142,7 +177,6 @@
     for (int i = sizeof(double) - 1; i >= 0; i--) {
         point_data.push_back(z_b[i]);
     }
-
     
     for (int i = sizeof(double) - 1; i >= 0; i--) {
         point_data.push_back(t_b[i]);
@@ -155,6 +189,40 @@
         point_data.push_back(c_b[i]);
     }
 
+    // Intensity is only two bytes, but 
+    // we need to store it in an 8 byte big-endian 
+    // double to satisfy OPC
+    for (int i = sizeof(double) - 1; i >= 0; i--) {
+        point_data.push_back(intensity_b[i]);
+    }
+
+
+    // Pack dimension with a number of fields totalling 8 bytes
+    point_data.push_back(returnNumber_b[0]);
+    point_data.push_back(numberOfReturns_b[0]);
+    point_data.push_back(scanDirFlag_b[0]);
+    point_data.push_back(edgeOfFlightLine_b[0]);
+    point_data.push_back(scanAngleRank_b[0]);
+    point_data.push_back(userData_b[0]);
+    for (int i = sizeof(uint16_t) - 1; i >= 0; i--) {
+        point_data.push_back(pointSourceId_b[i]);
+    }
+
+    // Pack dimension with RGBA for a total of 8 bytes
+    for (int i = sizeof(uint16_t) - 1; i >= 0; i--) {
+        point_data.push_back(red_b[i]);
+    }    
+    for (int i = sizeof(uint16_t) - 1; i >= 0; i--) {
+        point_data.push_back(green_b[i]);
+    }    
+    for (int i = sizeof(uint16_t) - 1; i >= 0; i--) {
+        point_data.push_back(blue_b[i]);
+    }    
+    for (int i = sizeof(uint16_t) - 1; i >= 0; i--) {
+        point_data.push_back(alpha_b[i]);
+    }    
+
+    
     return true;
 }
 
diff -r 53c7842d609f -r 6bb00e9076ce apps/las2las.cpp
--- a/apps/las2las.cpp	Fri Mar 18 08:32:45 2011 -0500
+++ b/apps/las2las.cpp	Wed Jun 22 11:22:19 2011 -0500
@@ -101,7 +101,7 @@
             
             if (dynamic_cast<liblas::ReprojectionTransform*>(transform.get()))
             {
-                dynamic_cast<liblas::ReprojectionTransform*>(transform.get())->SetHeaderPtr(liblas::HeaderPtr(new liblas::Header(header)));
+                dynamic_cast<liblas::ReprojectionTransform*>(transform.get())->SetHeader(liblas::HeaderOptionalConstRef(header));
             }
             new_transforms.push_back(transform);
         }
@@ -137,7 +137,7 @@
     boost::uint32_t split_points_count = 0;
     int fileno = 2;
     
-    liblas::HeaderPtr ptr = liblas::HeaderPtr(new liblas::Header(header));
+    liblas::HeaderOptionalConstRef ptr(header);
     
     while (reader.ReadNextPoint())
     {
@@ -145,7 +145,7 @@
         {
             liblas::Point p = reader.GetPoint();
             summary->AddPoint(p);
-            p.SetHeaderPtr(ptr);
+            p.SetHeader(ptr);
             writer->WritePoint(p);
         }
         else 
diff -r 53c7842d609f -r 6bb00e9076ce apps/las2oci.cpp
--- a/apps/las2oci.cpp	Fri Mar 18 08:32:45 2011 -0500
+++ b/apps/las2oci.cpp	Wed Jun 22 11:22:19 2011 -0500
@@ -387,7 +387,8 @@
                     std::string const& header_blob_column,
                     std::vector<boost::uint8_t> const& header_data,
                     std::string const& boundary_column,
-                    std::string const& bounary_wkt)
+                    std::string const& boundary_wkt,
+                    std::string const& point_schema_override)
 {
     ostringstream oss;
 
@@ -405,7 +406,12 @@
     
     ostringstream columns;
     ostringstream values;
+    bool bHaveSchemaOverride(false);
     
+    if (point_schema_override.size() > 0)
+        bHaveSchemaOverride = true;
+
+
     if (!aux_columns_u.empty() ) {
         columns << cloudColumnName_u << "," << aux_columns_u;
     
@@ -415,22 +421,32 @@
         values << "pc";
     }
     
+    int nPCPos = 1;
+    int nSchemaPos = 1;
+    if (bHaveSchemaOverride)
+        nSchemaPos++; // PC ID is now bound second
+        
+    int nPos = nSchemaPos+1; // Bind column position    
     if (!header_blob_column_u.empty()){
         columns << "," << header_blob_column_u;
-        values <<", :2";
+        values <<", :" << nPos;
+        nPos++;
     }
 
     if (!boundary_column_u.empty()){
-        columns << "," << header_blob_column_u;
-        values <<", SDO_GEOMETRY(:3, :4)";
+        columns << "," << boundary_column_u;
+        values <<", SDO_GEOMETRY(:"<<nPos;
+        nPos++;
+        values <<", :"<<nPos<<")";
     }
+    
 
 
     ostringstream s_srid;
     ostringstream s_gtype;
     ostringstream s_eleminfo;
     ostringstream s_geom;
-
+    ostringstream s_schema;
 
     IsGeographic(connection, srid);
 
@@ -467,6 +483,13 @@
         }
     }
     
+    if (bHaveSchemaOverride)
+    {
+        s_schema << "xmltype(:"<<nSchemaPos<<")";
+    } else
+    {
+        s_schema << "NULL";
+    }
 
     // extent* e = GetExtent(  *(query->bounds.get()), bUse3d );
     liblas::Bounds<double> e =  *(query->bounds.get());
@@ -492,22 +515,24 @@
     
     
 oss << "declare\n"
-"  pc_id NUMBER := :1;\n"
+"  pc_id NUMBER := :"<<nPCPos<<";\n"
 "  pc sdo_pc;\n"
 
 "begin\n"
 "  -- Initialize the Point Cloud object.\n"
 "  pc := sdo_pc_pkg.init( \n"
-"          '"<< pcTableName_u<<"', -- Table that has the SDO_POINT_CLOUD column defined\n"
-"          '"<< cloudColumnName_u<<"',   -- Column name of the SDO_POINT_CLOUD object\n"
-"          '"<<blkTableName_u<<"', -- Table to store blocks of the point cloud\n"
+"          '"<< pcTableName_u <<"', -- Table that has the SDO_POINT_CLOUD column defined\n"
+"          '"<< cloudColumnName_u <<"',   -- Column name of the SDO_POINT_CLOUD object\n"
+"          '"<< blkTableName_u <<"', -- Table to store blocks of the point cloud\n"
 "           'blk_capacity="<<blk_capacity<<"', -- max # of points per block\n"
 << s_geom.str() <<
 ",  -- Extent\n"
 "     0.5, -- Tolerance for point cloud\n"
 "           "<<nDimension<<", -- Total number of dimensions\n"
-"           null);\n"
-"  :1 := pc.pc_id;\n"
+"           NULL,"
+"            NULL,"
+"            "<< s_schema.str() <<");\n"
+"  :"<<nPCPos<<" := pc.pc_id;\n"
 
 "  -- Insert the Point Cloud object  into the \"base\" table.\n"
 "  insert into " << pcTableName_u << " ( ID, "<< columns.str() <<
@@ -521,6 +546,16 @@
     long output = 0;
     statement = connection->CreateStatement(oss.str().c_str());
     statement->Bind(&pc_id);
+    OCILobLocator* schema_locator ; 
+    OCILobLocator* boundary_locator ; 
+    if (bHaveSchemaOverride)
+    {
+        char* schema = (char*) malloc(point_schema_override.size() * sizeof(char) + 1);
+        strncpy(schema, point_schema_override.c_str(), point_schema_override.size());
+        schema[point_schema_override.size()] = '\0';
+        statement->WriteCLob( &schema_locator, schema ); 


More information about the Liblas-commits mailing list