[Liblas-commits] hg: 6 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jul 30 13:51:12 EDT 2010


changeset 1bdca304a540 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=1bdca304a540
summary: Replaced assertion with paranoid check of gmtime result.

changeset d3e02611697e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d3e02611697e
summary: Defined SCL_SECURE_NO_WARNINGS for Visual C++

changeset d6cd132f1c3d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d6cd132f1c3d
summary: Test if bbox is nullptr in bbox_calculator used in tests.

changeset 4174dc592d7a in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4174dc592d7a
summary: Test if reader is not nullptr in iterator

changeset d735fee3480c in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=d735fee3480c
summary: Simplified implementation of guid and sha1 replacing static sized C-array with boost::array.

changeset 806bf114f336 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=806bf114f336
summary: merge

diffstat:

 CMakeLists.txt                 |    1 +
 apps/las2oci.cpp               |  836 +++++++++++++++++--------------------
 apps/oci_wrapper.cpp           |  897 +++++++++++++++++++++-------------------
 apps/oci_wrapper.h             |  195 ++++++--
 include/liblas/detail/sha1.hpp |   29 +-
 include/liblas/exception.hpp   |    6 +-
 include/liblas/guid.hpp        |   46 +-
 include/liblas/iterator.hpp    |    7 +-
 src/lasclassification.cpp      |    2 +-
 src/lasheader.cpp              |   12 +-
 test/unit/common.hpp           |    3 +-
 11 files changed, 1060 insertions(+), 974 deletions(-)

diffs (truncated from 3140 to 300 lines):

diff -r 6c316ce9fb1c -r 806bf114f336 CMakeLists.txt
--- a/CMakeLists.txt	Fri Jul 30 17:05:09 2010 +0100
+++ b/CMakeLists.txt	Fri Jul 30 18:54:46 2010 +0100
@@ -89,6 +89,7 @@
         if (MSVC80 OR MSVC90 OR MSVC10)
             add_definitions(-D_CRT_SECURE_NO_WARNINGS)
             add_definitions(-D_CRT_NONSTDC_NO_WARNING)
+            add_definitions(-D_SCL_SECURE_NO_WARNINGS)
         endif()
 
         # Generate dot-user file with user-specific settings for Visual Studio project
diff -r 6c316ce9fb1c -r 806bf114f336 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Fri Jul 30 17:05:09 2010 +0100
+++ b/apps/las2oci.cpp	Fri Jul 30 18:54:46 2010 +0100
@@ -1,3 +1,6 @@
+
+#include <stdlib.h>
+
 
 // god-awful hack because of GDAL/GeoTIFF's shitty include structure
 #define CPL_SERV_H_INCLUDED
@@ -10,7 +13,6 @@
 #include <liblas/laspoint.hpp>
 #include <liblas/lasreader.hpp>
 #include <liblas/lasheader.hpp>
-#include <liblas/lasbounds.hpp>
 
 #include <string>
 #include <sstream>
@@ -24,6 +26,8 @@
 
 #include <sys/stat.h>
 
+#include <liblas/lasbounds.hpp>
+
 #include <oci.h>
 
 using namespace std;
@@ -35,12 +39,46 @@
 #define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
 #endif
 
+// #define MAX_POINTS_PER_ROW 1000
+
+
 #include <boost/array.hpp>
 #include <boost/shared_ptr.hpp>
 
 typedef std::vector<liblas::uint32_t> IDVector;
 typedef boost::shared_ptr< IDVector > IDVectorPtr;
 
+typedef struct
+{
+    long* pc_ids;
+    long* block_ids;
+    long* num_points;
+    OCILobLocator** locators; // =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1 );
+
+    std::vector<liblas::uint8_t>** blobs;
+
+    long* srids;
+    long* gtypes;
+    OCIArray** element_arrays;
+    OCIArray** coordinate_arrays;
+    
+    long size;
+        
+} blocks;
+
+typedef struct
+{
+    double x0;
+    double x1;
+    double y0;
+    double y1;
+    double z0;
+    double z1;
+    bool bUse3d;
+   
+} extent;
+
+
 class IndexResult 
 {
 public:
@@ -126,41 +164,9 @@
         m_results.push_back(result);
     }
 
-    liblas::Bounds b2(mins[0], mins[1], maxs[0], maxs[1]);
-    (*bounds) = b2;
+    bounds = boost::shared_ptr<liblas::Bounds>(new liblas::Bounds(mins[0], mins[1], maxs[0], maxs[1]));
 }
 
-typedef struct
-{
-    long* pc_ids;
-    long* block_ids;
-    long* num_points;
-    OCILobLocator** locators; // =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1 );
-
-    std::vector<liblas::uint8_t>** blobs;
-
-    long* srids;
-    long* gtypes;
-    OCIArray** element_arrays;
-    OCIArray** coordinate_arrays;
-    
-    long size;
-        
-} blocks;
-
-typedef struct
-{
-    double x0;
-    double x1;
-    double y0;
-    double y1;
-    double z0;
-    double z1;
-    bool bUse3d;
-   
-} extent;
-
-    
 bool KDTreeIndexExists(std::string& filename)
 {
     struct stat stats;
@@ -177,7 +183,6 @@
     return output;
 }
 
-
 std::istream* OpenInput(std::string filename, bool bEnd) 
 {
     std::ios::openmode mode = std::ios::in | std::ios::binary;
@@ -246,6 +251,7 @@
     
     return true;
 }
+
 bool IsGeographic(OWConnection* connection, long srid) {
 
     ostringstream oss;
@@ -278,10 +284,11 @@
         return true;
     }
 
-    
     free(kind);
+
     return false;
 }
+
 OWStatement* Run(OWConnection* connection, ostringstream& command) 
 {
     OWStatement* statement = 0;
@@ -318,25 +325,24 @@
     if (statement != 0) delete statement; 
     oss.str("");
 
-    return true;
+    connection->Commit();
     
-    
+    return true;    
 }
 
-
 bool CreateBlockTable(OWConnection* connection, const char* tableName)
 {
     ostringstream oss;
     OWStatement* statement = 0;
     
-    oss << "CREATE TABLE "<< tableName <<" (OBJ_ID NUMBER, BLK_ID NUMBER, "
-                                         " BLK_EXTENT MDSYS.SDO_GEOMETRY, BLK_DOMAIN MDSYS.SDO_ORGSCL_TYPE,"
-                                         " PCBLK_MIN_RES NUMBER, PCBLK_MAX_RES NUMBER, NUM_POINTS NUMBER, "
-                                         " NUM_UNSORTED_POINTS NUMBER, PT_SORT_DIM NUMBER, POINTS BLOB)";
+    oss << "CREATE TABLE " << tableName << " AS SELECT * FROM MDSYS.SDO_PC_BLK_TABLE";
+
     statement = Run(connection, oss);
     if (statement != 0) delete statement; else return false;
     oss.str("");
 
+    connection->Commit();
+    
     return true;
 
 }
@@ -403,69 +409,19 @@
     if (statement != 0) delete statement; else return false;
     oss.str("");   
 
+    connection->Commit();
    
     return true;
 
 }
-bool GetPointData(  liblas::Point const& p, 
-                    bool bTime, 
-                    std::vector<liblas::uint8_t>& point_data)
-{
-    // This function returns an array of bytes describing the 
-    // x,y,z and optionally time values for the point.  
 
-    point_data.clear();
-
-    double x = p.GetX();
-    double y = p.GetY();
-    double z = p.GetZ();
-    double t = p.GetTime();
-
-    liblas::uint8_t* x_b =  reinterpret_cast<liblas::uint8_t*>(&x);
-    liblas::uint8_t* y_b =  reinterpret_cast<liblas::uint8_t*>(&y);
-    liblas::uint8_t* z_b =  reinterpret_cast<liblas::uint8_t*>(&z);
-
-    liblas::uint8_t* t_b =  reinterpret_cast<liblas::uint8_t*>(&t);
-
-    // 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]);
-    // }
-    // 
-
-    // big-endian
-    for (int i = sizeof(double) - 1; i >= 0; i--) {
-        point_data.push_back(x_b[i]);
-    }
-
-    for (int i = sizeof(double) - 1; i >= 0; i--) {
-        point_data.push_back(y_b[i]);
-    }   
-
-    for (int i = sizeof(double) - 1; i >= 0; i--) {
-        point_data.push_back(z_b[i]);
-    }
-
-    
-    if (bTime)
-    {
-        for (int i = sizeof(double) - 1; i >= 0; i--) {
-            point_data.push_back(t_b[i]);
-        }
-
-    }
-
-    return true;
-}
 bool GetResultData( const IndexResult& result, 
                     liblas::Reader* reader, 
-                    std::vector<liblas::uint8_t>& data, 
+                    std::vector<double>& data,
                     int nDimension)
 {
     IDVector const& ids = result.GetIDs();
+    // list<SpatialIndex::id_type> const& ids = result.GetIDs();
 
 
     // d 8-byte IEEE  big-endian doubles, where d is the PC_TOT_DIMENSIONS value
@@ -473,51 +429,38 @@
     // 4-byte big-endian integer for the PT_ID value
     
     bool bTime = false;
-    if (nDimension == 4)
-    {
-        bTime = true;
-    }
+    // if (nDimension == 4)
+    // {
+    //     bTime = true;
+    // }
     
     data.clear();
+
+    IDVector::const_iterator i;
+    vector<liblas::uint8_t>::iterator pi;    
     
-    IDVector::const_iterator i;
-    vector<liblas::uint8_t>::iterator pi;
+    // list<SpatialIndex::id_type>::const_iterator i;
+//    vector<liblas::uint8_t>::iterator pi;
     
-    liblas::uint32_t block_id = result.GetID();
+//    liblas::uint32_t block_id = result.GetID();
 
     std::vector<liblas::uint8_t> point_data;
     
     for (i=ids.begin(); i!=ids.end(); ++i) 
     {
         liblas::uint32_t id = *i;
+        // SpatialIndex::id_type id = *i;
 
         bool doRead = reader->ReadPointAt(id);
+
         if (doRead) {
+
             liblas::Point const& p = reader->GetPoint();


More information about the Liblas-commits mailing list