[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Mar 5 14:20:27 EST 2010


changeset 37cb1f6775c0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=37cb1f6775c0
summary: refactor away LAS prefix from all variables that are already within the liblas:: namespace

changeset 5a1467085fe5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5a1467085fe5
summary: implement compatibility typedefs for #172

diffstat:

 apps/las2oci.cpp                        |  114 +++++----
 apps/las2ogr.cpp                        |    4 +-
 apps/lasindex.cpp                       |   12 +-
 apps/ts2las.cpp                         |   16 +-
 include/Makefile.am                     |    1 +
 include/liblas/compatibility.hpp        |   64 +++++
 include/liblas/detail/fwd.hpp           |   16 +-
 include/liblas/detail/reader/header.hpp |    4 +-
 include/liblas/detail/reader/point.hpp  |   10 +-
 include/liblas/detail/reader/reader.hpp |   18 +-
 include/liblas/detail/writer/header.hpp |    6 +-
 include/liblas/detail/writer/point.hpp  |   12 +-
 include/liblas/detail/writer/writer.hpp |   16 +-
 include/liblas/index/datastream.hpp     |    4 +-
 include/liblas/index/index.hpp          |    8 +-
 include/liblas/index/storage.hpp        |   10 +-
 include/liblas/lasclassification.hpp    |   28 +-
 include/liblas/lascolor.hpp             |   28 +-
 include/liblas/lasformat.hpp            |   33 +-
 include/liblas/lasheader.hpp            |   32 +-
 include/liblas/laspoint.hpp             |   86 +++---
 include/liblas/lasreader.hpp            |   42 +-
 include/liblas/lasspatialreference.hpp  |   32 +-
 include/liblas/lasvariablerecord.hpp    |   18 +-
 include/liblas/laswriter.hpp            |   30 +-
 include/liblas/liblas.hpp               |   27 +-
 src/detail/reader/header.cpp            |    4 +-
 src/detail/reader/point.cpp             |   13 +-
 src/detail/reader/reader.cpp            |   21 +-
 src/detail/writer/header.cpp            |    6 +-
 src/detail/writer/point.cpp             |   18 +-
 src/detail/writer/writer.cpp            |   12 +-
 src/index/datastream.cpp                |    6 +-
 src/index/index.cpp                     |    6 +-
 src/index/storage.cpp                   |   16 +-
 src/las_c_api.cpp                       |  348 ++++++++++++++++----------------
 src/lasclassification.cpp               |    4 +-
 src/lascolor.cpp                        |    8 +-
 src/lasformat.cpp                       |   10 +-
 src/lasheader.cpp                       |  166 +++++++-------
 src/laspoint.cpp                        |   38 +-
 src/lasreader.cpp                       |   42 +-
 src/lasspatialreference.cpp             |   58 ++--
 src/lasvariablerecord.cpp               |   40 +-
 src/laswriter.cpp                       |   18 +-
 45 files changed, 794 insertions(+), 711 deletions(-)

diffs (truncated from 4982 to 300 lines):

diff -r 2d910533e6ec -r 5a1467085fe5 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Fri Mar 05 09:04:17 2010 -0600
+++ b/apps/las2oci.cpp	Fri Mar 05 13:14:54 2010 -0600
@@ -312,7 +312,7 @@
     return true;
 
 }
-bool GetPointData(  LASPoint const& p, 
+bool GetPointData(  liblas::Point const& p, 
                     bool bTime, 
                     std::vector<liblas::uint8_t>& point_data)
 {
@@ -366,7 +366,7 @@
     return true;
 }
 bool GetResultData( const LASQueryResult& result, 
-                    LASReader* reader, 
+                    liblas::Reader* reader, 
                     std::vector<liblas::uint8_t>& data, 
                     int nDimension)
 {
@@ -398,7 +398,7 @@
 
         bool doRead = reader->ReadPointAt(id);
         if (doRead) {
-            LASPoint const& p = reader->GetPoint();
+            liblas::Point const& p = reader->GetPoint();
 
             // d 8-byte IEEE  big-endian doubles, where d is the PC_TOT_DIMENSIONS value
             bool gotdata = GetPointData(p, bTime, point_data);
@@ -495,6 +495,7 @@
     
     return e;    
 }
+
 blocks* CreateBlock(int size)
 {
     blocks* b = (blocks*) malloc( sizeof(blocks));
@@ -508,13 +509,15 @@
     b->gtypes = (long*) malloc ( size * sizeof(long));
 
     b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
+
     b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
     return b;
 }
+
 bool FillBlock( OWConnection* connection, 
                 OWStatement* statement,
                 const LASQueryResult& result, 
-                LASReader* reader,
+                liblas::Reader* reader,
                 blocks* b,
                 long index,
                 int srid, 
@@ -528,37 +531,40 @@
 
 
     list<SpatialIndex::id_type> const& ids = result.GetIDs();
-   
-    b->pc_ids[index] = pc_id;
-    b->srids[index] = srid;
-    b->block_ids[index] = result.GetID();
-    b->num_points[index] = (long)ids.size();
     
     // TODO: This probably is a memory leak if the gotdata == false --mloskot
     std::vector<liblas::uint8_t>* blob = new std::vector<liblas::uint8_t>;
     
-    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_elem_info=0;
-    connection->CreateType(&sdo_elem_info, connection->GetElemInfoType());
-    SetElements(statement, sdo_elem_info, bUseSolidGeometry);
+    // 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();
     
-    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;
+    // std::vector<liblas::uint8_t>* blob = new std::vector<liblas::uint8_t>;
+    
+    // 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_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;
     
     return true;
 }
@@ -642,7 +648,7 @@
                 blocks* block,
                 long block_index,
                 int srid, 
-                LASReader* reader, 
+                liblas::Reader* reader, 
                 const char* tableName, 
                 long precision,
                 long pc_id,
@@ -757,7 +763,7 @@
                 const std::list<LASQueryResult>& results,
                 long nCommitInterval, 
                 int srid, 
-                LASReader* reader2, 
+                liblas::Reader* reader2, 
                 const std::string& table_name, 
                 long precision,
                 long pc_id,
@@ -784,24 +790,29 @@
     statement = con->CreateStatement(oss.str().c_str());
     long j = 0;
     bool inserted = false;
+
+    
+    for (int t = 0; t < commit_interval; t++) {
+        FillBlock( con, 
+                        statement,
+                        *i, 
+                        reader2,
+                        b,
+                        t,
+                        srid, 
+                         pc_id,
+                         GetGType(bUse3d, bUseSolidGeometry),
+                         bUseSolidGeometry,
+                         bUse3d,
+                         nDimensions
+                         );
+        
+    }
+        
+
+
     for (i=results.begin(); i!=results.end(); i++)
-    {
-        j++;
-        // 
-        // FillBlock( con, 
-        //                 statement,
-        //                 *i, 
-        //                 reader2,
-        //                 b,
-        //                 j,
-        //                 srid, 
-        //                  pc_id,
-        //                  GetGType(bUse3d, bUseSolidGeometry),
-        //                  bUseSolidGeometry,
-        //                  bUse3d,
-        //                  nDimensions
-        //                  );
-        
+    {        
         inserted = InsertBlock(con, 
                                     *i,
                                     b,
@@ -813,6 +824,7 @@
                                     pc_id, 
                                     bUseSolidGeometry, 
                                     bUse3d);
+        j++;
     }
     return inserted;
 }
@@ -1520,7 +1532,7 @@
 
     }
 
-    LASReader* reader = new LASReader(*istrm);
+    liblas::Reader* reader = new liblas::Reader(*istrm);
     LASQuery* query = 0;
     if (!KDTreeIndexExists(input)) {
 
@@ -1552,7 +1564,7 @@
     
     std::istream* istrm2;
     istrm2 = OpenInput(input, false);
-    LASReader* reader2 = new LASReader(*istrm2);
+    liblas::Reader* reader2 = new liblas::Reader(*istrm2);
     
 
     long pc_id = CreatePCEntry(  con, 
diff -r 2d910533e6ec -r 5a1467085fe5 apps/las2ogr.cpp
--- a/apps/las2ogr.cpp	Fri Mar 05 09:04:17 2010 -0600
+++ b/apps/las2ogr.cpp	Fri Mar 05 13:14:54 2010 -0600
@@ -295,7 +295,7 @@
         {
             throw std::runtime_error(std::string("Can not open \'") + in_file + "\'");
         }
-        liblas::LASReader reader(ifs);
+        liblas::Reader reader(ifs);
 
         //
         // Target
@@ -341,7 +341,7 @@
         
         while (reader.ReadNextPoint())
         {
-            liblas::LASPoint const& p = reader.GetPoint();   
+            liblas::Point const& p = reader.GetPoint();   
 
             OGR_F_SetFieldInteger(feat, 0, p.GetReturnNumber());
             OGR_F_SetFieldInteger(feat, 1, p.GetScanAngleRank());
diff -r 2d910533e6ec -r 5a1467085fe5 apps/lasindex.cpp
--- a/apps/lasindex.cpp	Fri Mar 05 09:04:17 2010 -0600
+++ b/apps/lasindex.cpp	Fri Mar 05 13:14:54 2010 -0600
@@ -49,19 +49,19 @@
 
 using namespace liblas;
 
-void LoadIndex (LASIndex* index, LASReader* reader, long dimension) 
+void LoadIndex (LASIndex* index, liblas::Reader* reader, long dimension) 
 {
 
     bool read = reader->ReadNextPoint();
     liblas::int64_t id = 0;
     if (read) {
-        const LASPoint& p = reader->GetPoint();
-        index->insert(const_cast<LASPoint&>(p), id);
+        const liblas::Point& p = reader->GetPoint();
+        index->insert(const_cast<liblas::Point&>(p), id);
     }
     while (reader->ReadNextPoint()) {
         id += 1;
-        const LASPoint& p = reader->GetPoint();
-        index->insert(const_cast<LASPoint&>(p), id);
+        const liblas::Point& p = reader->GetPoint();
+        index->insert(const_cast<liblas::Point&>(p), id);
     }
 }
 int main(int argc, char* argv[])
@@ -134,7 +134,7 @@
 
     // FIXME: Missing RAII and try-catch, no LAS throws exceptions.
     std::istream* istrm = OpenInput(input);
-    LASReader* reader = new LASReader(*istrm);
+    liblas::Reader* reader = new liblas::Reader(*istrm);
     std::cout << "Indexing " << input<< " "<<std::endl;
 
     LASIndexDataStream* idxstrm = 0;
diff -r 2d910533e6ec -r 5a1467085fe5 apps/ts2las.cpp
--- a/apps/ts2las.cpp	Fri Mar 05 09:04:17 2010 -0600
+++ b/apps/ts2las.cpp	Fri Mar 05 13:14:54 2010 -0600
@@ -66,12 +66,12 @@
     return ostrm;
 }
 
-LASHeader CreateHeader(ScanHdr* hdr)
+liblas::Header CreateHeader(ScanHdr* hdr)
 {
-    LASHeader header;
+    liblas::Header header;
     
     // Checks for time and color values
-    liblas::PointFormat format = liblas::ePointFormat0;
+    liblas::PointFormatName format = liblas::ePointFormat0;
     
     if (hdr->Time) {
         if (hdr->Color) {
@@ -123,7 +123,7 @@
     return true;
 }
 
-bool WritePoints(LASWriter* writer, std::istream* strm, ScanHdr* hdr) 
+bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr) 
 {
     ScanPnt* point = new ScanPnt;
     ScanRow* row = new ScanRow;
@@ -147,7 +147,7 @@


More information about the Liblas-commits mailing list