[Liblas-commits] hg: start reorganizing argument handling of las2oci

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Aug 14 15:49:41 EDT 2010


changeset 68ff6da9dfc4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=68ff6da9dfc4
summary: start reorganizing argument handling of las2oci

diffstat:

 apps/las2las2.cpp |   16 +-
 apps/las2oci.cpp  |  722 +++++++++++++++++++++++++++--------------------------
 2 files changed, 376 insertions(+), 362 deletions(-)

diffs (truncated from 826 to 300 lines):

diff -r 232af06e8630 -r 68ff6da9dfc4 apps/las2las2.cpp
--- a/apps/las2las2.cpp	Sat Aug 14 11:46:27 2010 -0500
+++ b/apps/las2las2.cpp	Sat Aug 14 14:49:33 2010 -0500
@@ -182,17 +182,23 @@
     
     return true;
 }
+
+std::string GetInvocationHeader()
+{
+    ostringstream oss;
+    oss << "--------------------------------------------------------------------\n";
+    oss << "    las2las (" << GetFullVersion() << ")\n";
+    oss << "--------------------------------------------------------------------\n";
+    return oss.str();    
+}
+
 int main(int argc, char* argv[])
 {
 
     uint32_t split_size;
-    // uint32_t thin;
     std::string input;
     std::string output;
     
-    // bool last_return_only;
-    // bool first_return_only;
-    // bool valid_only;
     bool verbose = false;
     std::vector<liblas::FilterI*> filters;
     std::vector<liblas::TransformI*> transforms;
@@ -230,7 +236,7 @@
 
         if (vm.count("help")) 
         {
-            std::cout << file_options<<transform_options<<filtering_options<<"\n";
+            std::cout << GetInvocationHeader()<<file_options<<transform_options<<filtering_options<<"\n";
             return 1;
         }
 
diff -r 232af06e8630 -r 68ff6da9dfc4 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Sat Aug 14 11:46:27 2010 -0500
+++ b/apps/las2oci.cpp	Sat Aug 14 14:49:33 2010 -0500
@@ -2,11 +2,20 @@
 
 
 #include <liblas/detail/utility.hpp>
+#include "laskernel.hpp"
 
 
 
 
 
+typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+
+namespace po = boost::program_options;
+
+using namespace liblas;
+using namespace std;
+
+
 
 
 
@@ -304,41 +313,6 @@
     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++) {
-    //          FillBlock(statement,
-    //                          results[t], 
-    //                          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++)
@@ -359,310 +333,6 @@
     return inserted;
 }
 
-
-// bool ArrayInsert( OWConnection* connection,
-//         const char* insertStatement,
-//         int* panObjId,
-//         int* panBlockId,
-//         int* panNumPoints,
-//         double** ppfdBuffer,
-//         int nArrayCols,
-//         int nRowsToInsert)
-// {
-//     OWStatement* statement = connection->CreateStatement( insertStatement );
-// 
-//     statement->Bind( panObjId );
-//     statement->Bind( panBlockId );
-//     statement->Bind( panNumPoints );
-//     statement->BindArray( ppfdBuffer, nArrayCols );
-// 
-//     if (statement->Execute(nRowsToInsert) == false) {
-//         delete statement;
-//         return false;
-//     }
-// 
-//     delete statement;
-//     return true;
-// }
-
-// bool InsertBlocks(OWConnection* connection,
-//                   IndexResult& result,
-//                   int srid,
-//                   liblas::Reader* reader,
-//                   const char* tableName,
-//                   long precision,
-//                   long pc_id,
-//                   bool bUseSolidGeometry,
-//                   bool bUse3d,
-//                   int max_points_per_row)
-// {
-//     ostringstream oss;
-//     IDVector const& ids = result.GetIDs();
-//     liblas::Bounds b = result.GetBounds();
-//     uint32_t num_points =ids.size();
-//     ostringstream oss_geom;
-// 
-//     ostringstream s_srid;
-//     ostringstream s_gtype;
-//     ostringstream s_eleminfo;
-//     bool bGeographic = false;
-// 
-//     if (srid == 0) {
-//         s_srid << "NULL";
-//         // bUse3d = true;
-//         // bUseSolidGeometry = true;
-//         }
-//     else if (srid == 4326) {
-//         // bUse3d = true;
-//         // bUseSolidGeometry = true;
-//         bGeographic = true;
-//         s_srid << srid;
-//         // s_srid << "NULL";
-//     }
-//     else {
-//         s_srid << srid;
-//         // bUse3d = false;
-//         // If the user set an srid and set it to solid, we're still 3d
-//         // if (bUseSolidGeometry == true)
-//         //     bUse3d = true;
-//     }
-// 
-//     if (bUse3d) {
-//         if (bUseSolidGeometry == true) {
-//             s_gtype << "3008";
-//             s_eleminfo << "(1,1007,3)";
-// 
-//         } else {
-//             s_gtype << "3003";
-//             s_eleminfo  << "(1,1003,3)";
-// 
-//         }
-//     } else {
-//         if (bUseSolidGeometry == true) {
-//             s_gtype << "2008";
-//             s_eleminfo << "(1,1007,3)";
-// 
-//         } else {
-//             s_gtype << "2003";
-//             s_eleminfo  << "(1,1003,3)";
-// 
-//         }
-//     }
-// 
-//     double x0, x1, y0, y1, z0, z1;
-//     double tolerance = 0.05;
-// 
-// 
-//     x0 = b.min(0);
-//     x1 = b.max(0);
-//     y0 = b.min(1);
-//     y1 = b.max(1);
-// 
-//     if (bUse3d) {
-// 
-//         z0 = b.min(2);
-//         z1 = b.max(2);
-// 
-//     } else if (bGeographic) {
-//         x0 = -180.0;
-//         x1 = 180.0;
-//         y0 = -90.0;
-//         y1 = 90.0;
-//         z0 = 0.0;
-//         z1 = 20000.0;
-//         tolerance = 0.000000005;
-//     } else {
-//         z0 = 0.0;
-//         z1 = 20000.0;
-//     }
-// 
-// 
-//     // std::cout << "use 3d?: " << bUse3d << " srid: " << s_srid.str() << std::endl;
-//     oss_geom.setf(std::ios_base::fixed, std::ios_base::floatfield);
-//     oss_geom.precision(precision);
-// 
-//     oss_geom << "mdsys.sdo_geometry(" << s_gtype.str() << ", " << s_srid.str() << ", null, "
-//         "mdsys.sdo_elem_info_array" << s_eleminfo.str() << ", "
-//         "mdsys.sdo_ordinate_array( ";
-// 
-//     oss_geom << x0 << ", " << y0 << ", ";
-// 
-//     if (bUse3d) {
-//         oss_geom << z0 << ", ";
-//     }
-// 
-//     oss_geom << x1 << ", " << y1 << "";
-// 
-//     if (bUse3d) {
-//         oss_geom << ", ";
-//         oss_geom << z1;
-//     }
-// 
-//     oss_geom << "))";
-// 
-//     oss << "INSERT INTO " << tableName << " (" <<
-//         "OBJ_ID, "
-//         "BLK_ID, "
-//         "BLK_EXTENT, "
-//         "BLK_DOMAIN, "
-//         "PCBLK_MIN_RES, "
-//         "PCBLK_MAX_RES, "
-//         "NUM_POINTS, "
-//         "NUM_UNSORTED_POINTS, "
-//         "PT_SORT_DIM, "
-//         "POINTS) "
-//         "VALUES (:1, :2, " << oss_geom.str() << ", NULL, 1, 1, :3, 0, 1, :4)";
-// 
-//     std::vector<uint8_t> data;
-// 
-//     result.GetData(reader, data);
-// 
-// 
-//     /*
-//      *  Assuming 3 Dimensions data
-//      */
-// 
-//     int nDims = 3;
-// 
-//     /*
-//      *  Allocate fixed width buffer dimensions
-//      */
-// 
-//     double** ppfdBuffer = NULL;
-// 
-//     int nPoints = num_points;
-//     int nFizedRows = nPoints / max_points_per_row;
-//     int nFixedCols = min(nPoints, max_points_per_row) * nDims;
-// 
-//     ppfdBuffer = (double**) malloc( sizeof(double*) * nFizedRows );
-// 
-//     if( ppfdBuffer == NULL )
-//         throw std::runtime_error("unable to allocate memory");
-// 
-//     for( int i = 0; i < nFizedRows; i++ )
-//     {
-//         ppfdBuffer[i] = (double*) malloc( sizeof(double) * nFixedCols );
-//         
-//         if( ppfdBuffer[i] == NULL )
-//             throw std::runtime_error("unable to allocate memory");
-//     }
-// 
-//     /*
-//      *  Allocate buffer for extra row


More information about the Liblas-commits mailing list