[Liblas-commits] hg: add schemas to source control

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Mar 17 16:37:07 EDT 2010


changeset 864b87e78b9d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=864b87e78b9d
summary: add schemas to source control

diffstat:

 README                       |   21 +++-
 apps/las2oci.cpp             |  157 ++++++++++++++++++++------------
 apps/oci_wrapper.cpp         |   24 ++++-
 apps/oci_wrapper.h           |    2 +
 schemas/LAS.xsd              |  101 +++++++++++++++++++++
 schemas/las.xml              |  203 +++++++++++++++++++++++++++++++++++++++++++
 src/detail/writer/header.cpp |    3 -
 7 files changed, 441 insertions(+), 70 deletions(-)

diffs (truncated from 684 to 300 lines):

diff -r 1c5cd5588c9e -r 864b87e78b9d README
--- a/README	Wed Mar 17 11:17:08 2010 -0500
+++ b/README	Wed Mar 17 15:31:17 2010 -0500
@@ -1,4 +1,5 @@
-
+ 
+   
 libLAS - LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset
 ==============================================================================
 
@@ -7,13 +8,20 @@
 and as intermediate processing storage by some `LiDAR`_-related applications.  
 
 libLAS is available under the terms of the `BSD License`_. It builds on work 
-by `Martin Isenburg and Jonathan Shewchuk`_ of the  University of North 
-Carolina in their `LAStools`_ project by replacing the base C++ library 
+by `Martin Isenburg and Jonathan Shewchuk`_ of LLNL/UC Berkeley in their `LAStools`_
+project by replacing the base C++ library 
 with new development and porting Martin's tools this new code.
 
 libLAS' initial development was supported by the `IGSB`_ of the Iowa DNR 
 for use in its state-wide `LIDAR`_ project.
 
+.. image:: http://2010.foss4g.org/images/logo_125x125.jpg
+   :height: 125px
+   :width: 125px
+   :alt: FOSS4G 2010 in Barcelona, Spain
+   :align: right
+   :target: http://2010.foss4g.org/
+
 
 Download
 ------------------------------------------------------------------------------
@@ -67,12 +75,15 @@
 The LAS Format Standard is maintained by `ASPRS Standards Committee`_. LAS 
 format standard documents are available in PDF format:
 
-* `LAS 1.3 Format Standard`_ (2009-07-14)
 * `LAS 1.2 Format Standard`_ (2008-09-02)
 * `LAS 1.1 Format Standard`_ (2005-05-07)
 * `LAS 1.0 Format Standard`_ (2003-05-09)
 * `LAS permutation matrix`_
 
+Installing liblas Python bindings using setuptools
+..............................................................................
+A quick `Python howto`_ for installing Python bindings and the Win32 liblas package
+
 License
 ------------------------------------------------------------------------------
 
@@ -189,7 +200,6 @@
 .. _`LAStools`: http://www.cs.unc.edu/~isenburg/lastools/
 .. _`Martin Isenburg and Jonathan Shewchuk`: http://www.cs.unc.edu/~isenburg/lastools/
 .. _`LAS Format`: http://www.lasformat.org/
-.. _`LAS 1.3 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v13.pdf
 .. _`LAS 1.2 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v12.pdf
 .. _`LAS 1.1 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v11.pdf
 .. _`LAS 1.0 Format Standard`: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v10.pdf
@@ -226,3 +236,4 @@
 .. _`FOSS4G 2008`: http://liblas.org/raw-attachment/wiki/WikiStart/liblas_foss4g_2008.pdf
 .. _`ASPRS Workshop Demo`: http://liblas.org/raw-attachment/wiki/WikiStart/ASPRS-Workshop-NOAA-Demo.pdf
 .. _`vertical coordinate systems`: http://liblas.org/wiki/VerticalCS
+.. _`Python howto`: http://liblas.org/wiki/PythonHowTo
\ No newline at end of file
diff -r 1c5cd5588c9e -r 864b87e78b9d apps/las2oci.cpp
--- a/apps/las2oci.cpp	Wed Mar 17 11:17:08 2010 -0500
+++ b/apps/las2oci.cpp	Wed Mar 17 15:31:17 2010 -0500
@@ -44,12 +44,16 @@
     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;
 
@@ -504,6 +508,7 @@
     b->block_ids = (long*) malloc ( size * sizeof(long));
     b->num_points = (long*) malloc ( size * sizeof(long));
     b->blobs = (std::vector<liblas::uint8_t>**) malloc ( size * sizeof(std::vector<liblas::uint8_t>*));
+    b->locators =(OCILobLocator**) malloc( sizeof(OCILobLocator*) * size );
 
     b->srids = (long*) malloc ( size * sizeof(long));
     b->gtypes = (long*) malloc ( size * sizeof(long));
@@ -511,10 +516,13 @@
     b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
 
     b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
+
+    b->size = size;
+    
     return b;
 }
 
-bool FillBlock( OWConnection* connection, 
+bool FillBlocks( OWConnection* connection, 
                 OWStatement* statement,
                 const LASQueryResult& result, 
                 liblas::Reader* reader,
@@ -532,40 +540,39 @@
 
     list<SpatialIndex::id_type> const& ids = result.GetIDs();
     
-    // TODO: This probably is a memory leak if the gotdata == false --mloskot
+    
+    b->pc_ids[index] = pc_id;
+    b->srids[index] = (long)srid;
+    b->block_ids[index] = result.GetID();
+    b->num_points[index] = (long)ids.size();
+    
     std::vector<liblas::uint8_t>* blob = new std::vector<liblas::uint8_t>;
     
-    // b->pc_ids[index] = pc_id;
-    printf("Index: %d\n", index);
-    b->srids[index] = (long)srid;
-    // b->block_ids[index] = result.GetID();
-    // b->num_points[index] = (long)ids.size();
+    bool gotdata = GetResultData(result, reader, *blob, nDimensions);
+    if (! gotdata) throw std::runtime_error("unable to fetch point data byte array");
     
-    // std::vector<liblas::uint8_t>* blob = new std::vector<liblas::uint8_t>;
+    b->blobs[index] = blob;
+    // // FIXME: null srids not supported 
+    b->srids[index] = srid;
+    b->gtypes[index] = gtype;
+    // 
+    OCIArray* sdo_elem_info=0;
+    connection->CreateType(&sdo_elem_info, connection->GetElemInfoType());
+    SetElements(statement, sdo_elem_info, bUseSolidGeometry);
+    // 
+    b->element_arrays[index] = sdo_elem_info;
     
-    // bool gotdata = GetResultData(result, reader, *blob, nDimensions);
-    // if (! gotdata) throw std::runtime_error("unable to fetch point data byte array");
-    // b->blobs[index] = blob;
-    // // FIXME: null srids not supported 
-    // b->srids[index] = srid;
-    // b->gtypes[index] = gtype;
+    OCIArray* sdo_ordinates=0;
+    connection->CreateType(&sdo_ordinates, connection->GetOrdinateType());
     // 
-    // OCIArray* sdo_elem_info=0;
-    // connection->CreateType(&sdo_elem_info, connection->GetElemInfoType());
-    // SetElements(statement, sdo_elem_info, bUseSolidGeometry);
     // 
-    // b->element_arrays[index] = sdo_elem_info;
     // 
-    // OCIArray* sdo_ordinates=0;
-    // connection->CreateType(&sdo_ordinates, connection->GetOrdinateType());
-    // 
-    // 
-    // 
-    // extent* e = GetExtent(result.GetBounds(), bUse3d);
-    // SetOrdinates(statement, sdo_ordinates, e);
-    // 
-    // b->coordinate_arrays[index] = sdo_ordinates;
+    extent* e = GetExtent(result.GetBounds(), bUse3d);
+    SetOrdinates(statement, sdo_ordinates, e);
     
+    b->coordinate_arrays[index] = sdo_ordinates;
+    
+
     return true;
 }
 
@@ -591,7 +598,7 @@
     return gtype;   
 }
 
-bool BindBlock(OWStatement* statement, blocks* b, OCILobLocator** locator, long commit_interval)
+bool BindBlock(OWStatement* statement, blocks* b, long index)
 {
     // oss << "INSERT INTO "<< table_name << 
     //         "(OBJ_ID, BLK_ID, NUM_POINTS, POINTS,   "
@@ -609,10 +616,10 @@
     statement->Bind( b->num_points);
        
     // :4
-    statement->Define( locator, (int)commit_interval ); 
+    statement->Define( b->locators, (int)b->size ); 
     
     long max_size = 0;
-    for (int i = 0; i < commit_interval; i++) {
+    for (int i = 0; i < b->size; i++) {
         max_size = std::max(max_size, (long)b->blobs[i]->size());
     }
 
@@ -790,42 +797,70 @@
     statement = con->CreateStatement(oss.str().c_str());
     long j = 0;
     bool inserted = false;
+    
+    std::vector<LASQueryResult> results_vec = std::vector<LASQueryResult>();
+    for (i = results.begin(); i != results.end(); i++) {
+        results_vec.push_back(*i);
+    }
+    
+    long total_blocks = results.size();
+    long blocks_written = 0;
+    long blocks_left= 0;
+    long to_fill = 0;
+    
+    
+    for (j = 0; j < total_blocks; j+=commit_interval) {
+        blocks_left = total_blocks - blocks_written;
+        if (blocks_left < commit_interval) {
+            // only fill to this level
+            to_fill = blocks_left;
+        } else {
+            to_fill = commit_interval;
+        }
+        
+        
+        for (int t = 0; t< to_fill; t++) {
+            FillBlocks( con, 
+                            statement,
+                            results_vec[t], 
+                            reader2,
+                            b,
+                            t,
+                            srid, 
+                             pc_id,
+                             GetGType(bUse3d, bUseSolidGeometry),
+                             bUseSolidGeometry,
+                             bUse3d,
+                             nDimensions
+                             );
 
-    
-    for (int t = 0; t < commit_interval; t++) {
-        FillBlock( con, 
-                        statement,
-                        *i, 
-                        reader2,
-                        b,
-                        t,
-                        srid, 
-                         pc_id,
-                         GetGType(bUse3d, bUseSolidGeometry),
-                         bUseSolidGeometry,
-                         bUse3d,
-                         nDimensions
-                         );
+
+            t++;
         
+        
+        }
+        
+        
+        
+        blocks_written = blocks_written + to_fill;
     }
-        
 
 
-    for (i=results.begin(); i!=results.end(); i++)
-    {        
-        inserted = InsertBlock(con, 
-                                    *i,
-                                    b,
-                                    j, 
-                                    srid, 
-                                    reader2, 
-                                    table_name.c_str(), 
-                                    precision, 
-                                    pc_id, 
-                                    bUseSolidGeometry, 
-                                    bUse3d);
-        j++;
-    }
+    // for (i=results.begin(); i!=results.end(); i++)
+    // {        
+    //     inserted = InsertBlock(con, 
+    //                                 *i,
+    //                                 b,
+    //                                 j, 
+    //                                 srid, 
+    //                                 reader2, 
+    //                                 table_name.c_str(), 
+    //                                 precision, 
+    //                                 pc_id, 
+    //                                 bUseSolidGeometry, 
+    //                                 bUse3d);
+    //     j++;
+    // }
     return inserted;
 }
 
diff -r 1c5cd5588c9e -r 864b87e78b9d apps/oci_wrapper.cpp
--- a/apps/oci_wrapper.cpp	Wed Mar 17 11:17:08 2010 -0500
+++ b/apps/oci_wrapper.cpp	Wed Mar 17 15:31:17 2010 -0500


More information about the Liblas-commits mailing list