[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Nov 16 12:55:05 EST 2010


changeset 27a80bb2fa52 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=27a80bb2fa52
summary: file-format instead of --format, which is confusing with point-format

changeset 50d7bae327ba in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=50d7bae327ba
summary: store 5d data for OPC -- X, Y, Z, t, Class

diffstat:

 apps/kdx_util.cpp  |  28 ++++++++++++++++++----------
 apps/las2las.cpp   |   2 +-
 apps/las2oci.cpp   |   2 +-
 apps/laskernel.cpp |   6 +++---
 4 files changed, 23 insertions(+), 15 deletions(-)

diffs (97 lines):

diff -r 59f5f131affb -r 50d7bae327ba apps/kdx_util.cpp
--- a/apps/kdx_util.cpp	Tue Nov 16 10:30:15 2010 -0600
+++ b/apps/kdx_util.cpp	Tue Nov 16 11:54:41 2010 -0600
@@ -108,13 +108,18 @@
     double x = p.GetX();
     double y = p.GetY();
     double z = p.GetZ();
-    // double t = p.GetTime();
+    double t = p.GetTime();
+    
+    // std::cout.precision(6);
+    // std::cout.setf(std::ios::fixed);
+    // // std::cout << "X: " << x << " y: " << y << " z: " << z << std::endl;
+    boost::uint8_t c = 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);
-
-    // liblas::uint8_t* t_b =  reinterpret_cast<liblas::uint8_t*>(&t);
+    boost::uint8_t* t_b =  reinterpret_cast<boost::uint8_t*>(&t);
+    boost::uint8_t* c_b =  reinterpret_cast<boost::uint8_t*>(&c);
 
     // doubles are 8 bytes long.  For each double, push back the 
     // byte.  We do this for all four values (x,y,z,t)
@@ -139,13 +144,16 @@
     }
 
     
-    // if (bTime)
-    // {
-    //     for (int i = sizeof(double) - 1; i >= 0; i--) {
-    //         point_data.push_back(t_b[i]);
-    //     }
-    // 
-    // }
+    for (int i = sizeof(double) - 1; i >= 0; i--) {
+        point_data.push_back(t_b[i]);
+    }
+
+    // Classification is only a single byte, 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(c_b[i]);
+    }
 
     return true;
 }
diff -r 59f5f131affb -r 50d7bae327ba apps/las2las.cpp
--- a/apps/las2las.cpp	Tue Nov 16 10:30:15 2010 -0600
+++ b/apps/las2las.cpp	Tue Nov 16 11:54:41 2010 -0600
@@ -288,7 +288,7 @@
             std::ifstream ifs;
             if (!liblas::Open(ifs, input.c_str()))
             {
-                std::cerr << "Cannot open " << input << "for read.  Exiting...";
+                std::cerr << "Cannot open " << input << "for read.  Exiting..." << std::endl;
                 return 1;
             }
             // set_ifstream_buffer(ifs, default_buffer_size);
diff -r 59f5f131affb -r 50d7bae327ba apps/las2oci.cpp
--- a/apps/las2oci.cpp	Tue Nov 16 10:30:15 2010 -0600
+++ b/apps/las2oci.cpp	Tue Nov 16 11:54:41 2010 -0600
@@ -1148,7 +1148,7 @@
                         point_cloud_name,
                         aux_columns,
                         aux_values,
-                        3, // we're assuming 3d for now
+                        5, // we're assuming 5d for now (x, y, z, time, classification)
                         srid,
                         nCapacity,
                         precision,
diff -r 59f5f131affb -r 50d7bae327ba apps/laskernel.cpp
--- a/apps/laskernel.cpp	Tue Nov 16 10:30:15 2010 -0600
+++ b/apps/laskernel.cpp	Tue Nov 16 11:54:41 2010 -0600
@@ -306,7 +306,7 @@
         ("a_vertcs", po::value< std::vector<string> >()->multitoken(), "Override vertical coordinate system information.  Use --a_vertcs \"verticalCSType [citation [verticalDatum [verticalUnits]]]\"\nFor example: --a_vertcs 5703 \"North American Vertical Datum of 1988 (NAVD88)\" 5103 9001")   
         ("offset", po::value< string >(), "A comma-separated or quoted, space-separated list of offsets to set on the output file: \n--offset 0,0,0\n--offset \"1234 5678 91011\"")
         ("scale", po::value< std::vector<double> >()->multitoken(), "A list of scales to set on the output file. Scales *cannot* be negative, and should always be a negative power of 10 \n--scale 0.1 0.1 0.00001")
-        ("format,f", po::value< string >(), "Set the LAS format of the new file (only 1.0-1.2 supported at this time): \n--format 1.2\n-f 1.1")
+        ("file-format,f", po::value< string >(), "Set the LAS format of the new file (only 1.0-1.2 supported at this time): \n--file-format 1.2\n-f 1.1")
         ("point-format", po::value< boost::uint32_t >(), "Set the LAS point format of the new file (0, 1, 2, 3): \n--point-format 3\n")
         ("pad-header", po::value< string >(), "Add extra bytes to the existing header")
         ("min-offset", po::value<bool>()->zero_tokens(), "Set the offset of the header to the minimums of all values in the file.  Note that this requires multiple read passes through the file to achieve.")
@@ -845,9 +845,9 @@
         header.SetScale(scales[0], scales[1], scales[2]);
     }
     
-    if (vm.count("format")) 
+    if (vm.count("file-format")) 
     {
-        std::string format_string = vm["format"].as< string >();
+        std::string format_string = vm["file-format"].as< string >();
         if (verbose)
             std::cout << "Setting format to: " << format_string << std::endl;
             


More information about the Liblas-commits mailing list