[Liblas-commits] hg: 7 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Nov 5 14:34:11 EDT 2010


changeset ec171b17b2dd in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ec171b17b2dd
summary: only display summary info if the summary has points

changeset ede177039ee3 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ede177039ee3
summary: revert to using comma- or space-separated quoted strings for --extent and --offset

changeset 8d51159167fd in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=8d51159167fd
summary: add space to SEPARATORS

changeset cfaea7180f13 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=cfaea7180f13
summary: revert to using comma- or space-separated values for --extent and --offset.  Also add --minx, --miny, etc specializations for filter options

changeset 9e7bc3df43ed in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9e7bc3df43ed
summary: remove references to lasinfo2

changeset 160c3fd97c56 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=160c3fd97c56
summary: make las2oci show help if no LAS file is given

changeset a083ee0f3af5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a083ee0f3af5
summary: update docs

diffstat:

 apps/las2oci.cpp             |   27 ++----
 apps/lasinfo.cpp             |    6 +-
 apps/laskernel.cpp           |  149 +++++++++++++++++++++++++++++++++++-------
 apps/laskernel.hpp           |    2 +-
 doc/utilities/las2las.txt    |   52 ++++++++++++--
 doc/utilities/las2oci.txt    |   42 +++++++++--
 doc/utilities/lasinfo.txt    |   40 ++++++++---
 include/liblas/lasbounds.hpp |    2 +
 src/utility.cpp              |    5 +
 9 files changed, 246 insertions(+), 79 deletions(-)

diffs (truncated from 585 to 300 lines):

diff -r f155552b9405 -r a083ee0f3af5 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Thu Nov 04 13:08:42 2010 -0500
+++ b/apps/las2oci.cpp	Fri Nov 05 13:26:23 2010 -0500
@@ -666,7 +666,7 @@
     ("base-table-aux-values", po::value< string >(), "Quoted, comma-separated list of values to add to the SQL that gets executed as part of the point cloud insertion into the base-table-name")
     ("solid", po::value<bool>()->zero_tokens(), "Define the point cloud's PC_EXTENT geometry gtype as (1,1007,3) instead of the normal (1,1003,3), and use gtype 3008/2008 vs 3003/2003 for BLK_EXTENT geometry values.")
     ("3d", po::value<bool>()->zero_tokens(), "Use Z values for insertion of all extent (PC_EXTENT, BLK_EXTENT, USER_SDO_GEOM_METADATA) entries")
-    ("global-extent", po::value< std::vector<double> >(), "Extent window to define for the PC_EXTENT.\nUse a list, for example, \n  --global-extent minx miny maxx maxy\n  or \n  --global-extent minx miny minz maxx maxy maxz")
+    ("global-extent", po::value< std::vector<double> >(), "Extent window to define for the PC_EXTENT.\nUse a comma-separated or quoted, space-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz\n -e \"minx miny minz maxx maxy maxz\"")
     ("cached", po::value<bool>()->zero_tokens(), "Cache the entire file on the first read")
 
 
@@ -800,6 +800,7 @@
             header = reader.GetHeader();
         } else {
             std::cerr << "Input LAS file not specified!\n";
+            std::cout << GetInvocationHeader()<<file_options<<transform_options<<filtering_options<<"\n";
             return 1;
         }
 
@@ -971,20 +972,14 @@
         }
         if (vm.count("global-extent")) 
         {
-            std::vector<double> vbounds = vm["global-extent"].as< std::vector<double> >();
+            std::string bounds_string = vm["global-extent"].as< string >();
 
-            liblas::Bounds<double> bounds;
-            
-            if (verbose)
-            {
-                std::cout << "Setting global bounds to : ";
+            boost::char_separator<char> sep(SEPARATORS);
 
-                for (std::vector<double>::const_iterator t = vbounds.begin(); 
-                     t != vbounds.end(); 
-                     ++t) {
-                    std::cout << *t;
-                }
-                std::cout << std::endl;
+            std::vector<double> vbounds;
+            tokenizer tokens(bounds_string, sep);
+            for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+                vbounds.push_back(atof((*t).c_str()));
             }
             if (vbounds.size() == 4) 
             {
@@ -1004,10 +999,8 @@
                 ostringstream oss;
                 oss << "Bounds must be specified as a 4-tuple or "
                        "6-tuple, not a "<< vbounds.size()<<"-tuple" << "\n";
-                std::cerr << oss.str();
-            }            
-            if (verbose)
-                std::cout << "Storing 3D geometries... " << std::endl;
+                throw std::runtime_error(oss.str());
+            }
         }
 
         if (vm.count("xmin")) 
diff -r f155552b9405 -r a083ee0f3af5 apps/lasinfo.cpp
--- a/apps/lasinfo.cpp	Thu Nov 04 13:08:42 2010 -0500
+++ b/apps/lasinfo.cpp	Fri Nov 05 13:26:23 2010 -0500
@@ -69,9 +69,9 @@
 
     oss << options;
 
-    oss <<"\nFor more information, see the full documentation for lasinfo2 at:\n";
+    oss <<"\nFor more information, see the full documentation for lasinfo at:\n";
     
-    oss << " http://liblas.org/utilities/lasinfo2.html\n";
+    oss << " http://liblas.org/utilities/lasinfo.html\n";
     oss << "----------------------------------------------------------\n";
 
 }
@@ -115,7 +115,7 @@
 
     try {
 
-        po::options_description file_options("lasinfo2 options");
+        po::options_description file_options("lasinfo options");
         po::options_description filtering_options = GetFilteringOptions();
         po::options_description header_options = GetHeaderOptions();
 
diff -r f155552b9405 -r a083ee0f3af5 apps/laskernel.cpp
--- a/apps/laskernel.cpp	Thu Nov 04 13:08:42 2010 -0500
+++ b/apps/laskernel.cpp	Fri Nov 05 13:26:23 2010 -0500
@@ -255,7 +255,13 @@
 po::options_description filtering_options("Filtering options");
 
 filtering_options.add_options()
-    ("extent,e", po::value< std::vector<double> >()->multitoken(), "Extent window that points must fall within to keep.\nFor example, \n  -e minx miny maxx maxy\n  or \n  -e minx miny minz maxx maxy maxz")
+    ("extent,e", po::value< string >(), "Extent window that points must fall within to keep.\nUse a comma-separated or quoted, space-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz\n -e \"minx miny minz maxx maxy maxz\"")     
+    ("minx", po::value< double >(), "Extent must be greater than or equal to minx to be kept. \n --minx 1234.0")
+    ("miny", po::value< double >(), "Extent must be greater than or equal to miny to be kept. \n --miny 5678.0")
+    ("minz", po::value< double >(), "Extent must be greater than or equal to minz to be kept. If maxx and maxy are set but not minz *and maxz, all z values are kept. \n --minz 0.0")
+    ("maxx", po::value< double >(), "Extent must be less than or equal to maxx to be kept. \n --maxx 1234.0")
+    ("maxy", po::value< double >(), "Extent must be less than or equal to maxy to be kept. \n --maxy 5678.0")
+    ("maxz", po::value< double >(), "Extent must be less than or equal to maxz to be kept. If maxx and maxy are set but not maxz *and minz, all z values are kept. \n --maxz 10.0")
     ("thin,t", po::value<boost::uint32_t>()->default_value(0), "Simple decimation-style thinning.\nThin the file by removing every t'th point from the file.")
     ("last_return_only", po::value<bool>()->zero_tokens(), "Keep last returns (cannot be used with --first_return_only)")
     ("first_return_only", po::value<bool>()->zero_tokens(), "Keep first returns (cannot be used with --last_return_only")
@@ -294,8 +300,8 @@
     transform_options.add_options()
         ("a_srs", po::value< string >(), "Coordinate system to assign to input LAS file")
         ("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< std::vector<double> >()->multitoken(), "A list of offsets to set on the output file: \n--offset 0 0 0")
-        ("scale", po::value< std::vector<double> >()->multitoken(), "A list of scales to set on the output file: \n--scale 0.1 0.1 0.00001")
+        ("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")
         ("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.")
@@ -314,6 +320,8 @@
 std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
 {
     std::vector<liblas::FilterPtr> filters;
+    liblas::Bounds<double> extent;
+    bool bSetExtent = false;
     
     if (vm.count("keep-classes")) 
     {
@@ -409,14 +417,73 @@
                                                             liblas::FilterI::eExclusion);
         filters.push_back(return_filter); 
     }
-            
+
+    if (vm.count("minx")) 
+    {
+        double minx = vm["minx"].as< double >();
+        extent.min(0, minx);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting minx to: " << minx << std::endl;
+    }
+
+    if (vm.count("maxx")) 
+    {
+        double maxx = vm["maxx"].as< double >();
+        extent.max(0, maxx);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxx to: " << maxx << std::endl;
+    }
+
+    if (vm.count("miny")) 
+    {
+        double miny = vm["miny"].as< double >();
+        extent.min(1, miny);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting miny to: " << miny << std::endl;
+    }
+
+    if (vm.count("maxx")) 
+    {
+        double maxy = vm["maxy"].as< double >();
+        extent.max(1, maxy);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxy to: " << maxy << std::endl;
+    }
+
+    if (vm.count("minz")) 
+    {
+        double minz = vm["minz"].as< double >();
+        extent.min(2, minz);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting minz to: " << minz << std::endl;
+    }
+
+    if (vm.count("maxz")) 
+    {
+        double maxz = vm["maxz"].as< double >();
+        extent.max(2, maxz);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxz to: " << maxz << std::endl;
+    }
+    
     if (vm.count("extent")) 
     {
+        std::string bounds_string = vm["extent"].as< string >();
 
-        std::vector<double> vbounds = vm["extent"].as< std::vector<double> >();
+        boost::char_separator<char> sep(SEPARATORS);
 
+        std::vector<double> vbounds;
+        tokenizer tokens(bounds_string, sep);
         liblas::Bounds<double> bounds;
-
+        for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+            vbounds.push_back(atof((*t).c_str()));
+        }
         if (vbounds.size() == 4) 
         {
             bounds = liblas::Bounds<double>(vbounds[0], 
@@ -437,6 +504,15 @@
                    "6-tuple, not a "<< vbounds.size()<<"-tuple" << "\n";
             throw std::runtime_error(oss.str());
         }
+        
+        if ( bSetExtent ) 
+        {
+            if (verbose) 
+            {
+                std::cout << " Growing --extent bounds with those that were set via --[x|y|z][min|max]" << std::endl;
+            }
+            bounds.grow(extent);
+        }
     
         if (verbose)
         {
@@ -459,6 +535,11 @@
         }
 
         liblas::FilterPtr bounds_filter = MakeBoundsFilter(bounds, liblas::FilterI::eInclusion);
+        // Set to false because we are using this opportunity to set the filter
+        // If it were still true after this point, *another* BoundsFilter would be 
+        // added to the filters list at the end of this function
+        if (bSetExtent)
+            bSetExtent = false; 
         filters.push_back(bounds_filter);
         
     }
@@ -683,6 +764,15 @@
         filters.push_back(valid_filter);            
     }
 
+
+    // If we have bSetExtent and we haven't turned it off by merging with a --extent 
+    // BoundsFilter, make a filter
+    if (bSetExtent)
+    {
+        liblas::FilterPtr bounds_filter = MakeBoundsFilter(extent, liblas::FilterI::eInclusion);
+        filters.push_back(bounds_filter);
+    }
+    
     return filters;
 }
 
@@ -692,32 +782,37 @@
 
     if (vm.count("offset")) 
     {
+        std::string offset_string = vm["offset"].as< string >();
+        if (verbose)
+            std::cout << "Setting offsets to: " << offset_string << std::endl;
+        boost::char_separator<char> sep(SEPARATORS);
+        std::vector<double> offsets;
+        tokenizer tokens(offset_string, sep);
+        bool mins = false;
+        std::string m("min");
+        for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+            // Check if the user set --offset min,min,min
+            // FIXME: make this so the user could do --offset min,min,20.00
+            if (!(*t).compare(m))
+            {   
+                mins = true;
+                continue;
+            }
+            else
+            {
+                mins = false;
+                offsets.push_back(atof((*t).c_str()));
+            }
+        }
+        if (offsets.size() != 3) 
+        {
+            throw std::runtime_error("All three values for setting the offset must be floats, and there must be three values");
 
-        std::vector<double> offsets = vm["offset"].as< std::vector<double> >();
-        if (offsets.size() != 3) {
-            ostringstream oss;
-            oss << "Three arguments must be given to offset. "
-                << "--offset x y z";
-
-            throw std::runtime_error(oss.str());
         }
-
-        
-        if (verbose)
-        {
-            ostringstream oss;
-            for (std::vector<double>::const_iterator i = offsets.begin();
-                 i != offsets.end();
-                 i++) 
-                {
-                    oss << *i << " ";
-                }
-                std::cout << "Setting offsets to: " << oss.str() << std::endl;
-        }
-
         header.SetOffset(offsets[0], offsets[1], offsets[2]);
     }
 
+
     if (vm.count("scale")) 


More information about the Liblas-commits mailing list