[Liblas-commits] hg: 5 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 24 11:59:56 EDT 2010


changeset f7770978e9b5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f7770978e9b5
summary: add #ifdefs around #pragmas for _MSC_VER

changeset 9886b370b197 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9886b370b197
summary: oops, botched the merge

changeset c4401e07103e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c4401e07103e
summary: more namespace qualification

changeset 7913c2674eec in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=7913c2674eec
summary: Add Reader::Summarize method.  Header prototype was added in r2096

changeset eac1c086c112 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=eac1c086c112
summary: fix up to use new libas copy of property_tree

diffstat:

 apps/las2las2.cpp                                            |    6 +-
 apps/laskernel.cpp                                           |  332 +++++-----
 apps/laskernel.hpp                                           |    6 +-
 include/liblas/lasreader.hpp                                 |    2 +
 include/liblas/property_tree/detail/ptree_implementation.hpp |    7 +-
 include/liblas/property_tree/detail/xml_parser_write.hpp     |    2 +-
 include/liblas/property_tree/string_path.hpp                 |    6 +-
 src/lasreader.cpp                                            |  167 +++++
 8 files changed, 352 insertions(+), 176 deletions(-)

diffs (truncated from 666 to 300 lines):

diff -r 1993c9a1648d -r eac1c086c112 apps/las2las2.cpp
--- a/apps/las2las2.cpp	Tue Aug 24 16:40:49 2010 +0100
+++ b/apps/las2las2.cpp	Tue Aug 24 10:59:33 2010 -0500
@@ -175,11 +175,11 @@
         std::cout << std::endl;
     
     reader.Reset();
-    boost::property_tree::ptree pts = SummarizePoints(reader);
-    boost::property_tree::ptree top;
+    liblas::property_tree::ptree pts = reader.Summarize();
+    liblas::property_tree::ptree top;
     top.add_child("summary.header",reader.GetHeader().GetPTree());
     top.add_child("summary.points",pts);
-    boost::property_tree::write_xml("junk.xml", top);
+    liblas::property_tree::write_xml("junk.xml", top);
 
     delete writer;
     delete ofs;
diff -r 1993c9a1648d -r eac1c086c112 apps/laskernel.cpp
--- a/apps/laskernel.cpp	Tue Aug 24 16:40:49 2010 +0100
+++ b/apps/laskernel.cpp	Tue Aug 24 10:59:33 2010 -0500
@@ -565,171 +565,173 @@
 }
 
 
-boost::property_tree::ptree SummarizePoints(liblas::Reader& reader )
-{
-    using boost::property_tree::ptree;
-    ptree pt;
-    
-    boost::array<boost::uint32_t, 32> classes;
-    boost::uint32_t synthetic = 0;
-    boost::uint32_t withheld = 0;
-    boost::uint32_t keypoint = 0;
-    boost::uint32_t count = 0;
-    boost::array<boost::uint32_t, 8> points_by_return; 
-    boost::array<boost::uint32_t, 8> returns_of_given_pulse; 
-    
-    classes.assign(0);
-    points_by_return.assign(0);
-    returns_of_given_pulse.assign(0);
-        
-    bool read = reader.ReadNextPoint();
-    if (!read)
-    {
-        throw std::runtime_error("Unable to read any points from file.");
-    }
-    
-    bool first = true;
-    liblas::Point min;
-    liblas::Point max;
-    
-    while (read) 
-    {
+// boost::property_tree::ptree SummarizePoints(liblas::Reader& reader )
+// {
+//     using boost::property_tree::ptree;
+//     ptree pt;
+//     
+//     boost::array<boost::uint32_t, 32> classes;
+//     boost::uint32_t synthetic = 0;
+//     boost::uint32_t withheld = 0;
+//     boost::uint32_t keypoint = 0;
+//     boost::uint32_t count = 0;
+//     boost::array<boost::uint32_t, 8> points_by_return; 
+//     boost::array<boost::uint32_t, 8> returns_of_given_pulse; 
+//     
+//     classes.assign(0);
+//     points_by_return.assign(0);
+//     returns_of_given_pulse.assign(0);
+//         
+//     bool read = reader.ReadNextPoint();
+//     if (!read)
+//     {
+//         throw std::runtime_error("Unable to read any points from file.");
+//     }
+//     
+//     bool first = true;
+//     liblas::Point min;
+//     liblas::Point max;
+//     
+//     while (read) 
+//     {
+// 
+//         count++;
+//         liblas::Point const& p = reader.GetPoint();
+// 
+//         if (first) {
+//             min = p;
+//             max = p;
+//             first = false;
+//         }
+//         
+//         min.SetX(std::min(p.GetX(), min.GetX()));
+//         max.SetX(std::max(p.GetX(), max.GetX()));
+// 
+//         min.SetY(std::min(p.GetY(), min.GetY()));
+//         max.SetY(std::max(p.GetY(), max.GetY()));        
+// 
+//         min.SetZ(std::min(p.GetZ(), min.GetZ()));
+//         max.SetZ(std::max(p.GetZ(), max.GetZ()));
+// 
+//         min.SetIntensity(std::min(p.GetIntensity(), min.GetIntensity()));
+//         max.SetIntensity(std::max(p.GetIntensity(), max.GetIntensity()));
+// 
+//         min.SetTime(std::min(p.GetTime(), min.GetTime()));
+//         max.SetTime(std::max(p.GetTime(), max.GetTime()));
+// 
+//         min.SetReturnNumber(std::min(p.GetReturnNumber(), min.GetReturnNumber()));
+//         max.SetReturnNumber(std::max(p.GetReturnNumber(), max.GetReturnNumber()));
+// 
+//         min.SetNumberOfReturns(std::min(p.GetNumberOfReturns(), min.GetNumberOfReturns()));
+//         max.SetNumberOfReturns(std::max(p.GetNumberOfReturns(), max.GetNumberOfReturns()));
+// 
+//         min.SetScanDirection(std::min(p.GetScanDirection(), min.GetScanDirection()));
+//         max.SetScanDirection(std::max(p.GetScanDirection(), max.GetScanDirection()));
+// 
+//         min.SetFlightLineEdge(std::min(p.GetFlightLineEdge(), min.GetFlightLineEdge()));
+//         max.SetFlightLineEdge(std::max(p.GetFlightLineEdge(), max.GetFlightLineEdge()));
+// 
+//         min.SetScanAngleRank(std::min(p.GetScanAngleRank(), min.GetScanAngleRank()));
+//         max.SetScanAngleRank(std::max(p.GetScanAngleRank(), max.GetScanAngleRank()));
+// 
+//         min.SetUserData(std::min(p.GetUserData(), min.GetUserData()));
+//         max.SetUserData(std::max(p.GetUserData(), max.GetUserData()));
+// 
+//         min.SetPointSourceID(std::min(p.GetPointSourceID(), min.GetPointSourceID()));
+//         max.SetPointSourceID(std::max(p.GetPointSourceID(), max.GetPointSourceID()));
+//         
+//         liblas::Classification const& cls = p.GetClassification();
+//         
+//         boost::uint8_t minc = std::min(cls.GetClass(), min.GetClassification().GetClass());
+//         boost::uint8_t maxc = std::max(cls.GetClass(), max.GetClassification().GetClass());
+//         
+//         classes[cls.GetClass()]++;
+//         
+//         if (cls.IsWithheld()) withheld++;
+//         if (cls.IsKeyPoint()) keypoint++;
+//         if (cls.IsSynthetic()) synthetic++;
+//         
+//         min.SetClassification(liblas::Classification(minc));
+//         max.SetClassification(liblas::Classification(maxc));
+//         
+//         liblas::Color const& color = p.GetColor();
+//         
+//         liblas::Color::value_type red;
+//         liblas::Color::value_type green;
+//         liblas::Color::value_type blue;
+//         
+//         red = std::min(color.GetRed(), min.GetColor().GetRed());
+//         green = std::min(color.GetGreen(), min.GetColor().GetGreen());
+//         blue = std::min(color.GetBlue(), min.GetColor().GetBlue());
+//         
+//         min.SetColor(liblas::Color(red, green, blue));
+//         
+//         red = std::max(color.GetRed(), max.GetColor().GetRed());
+//         green = std::max(color.GetGreen(), max.GetColor().GetGreen());
+//         blue = std::max(color.GetBlue(), max.GetColor().GetBlue());        
+// 
+//         max.SetColor(liblas::Color(red, green, blue));
+// 
+//         points_by_return[p.GetReturnNumber()]++;
+//         returns_of_given_pulse[p.GetNumberOfReturns()]++;
+//         
+//         read = reader.ReadNextPoint();
+//     }
+// 
+//     ptree pmin = min.GetPTree();
+//     ptree pmax = max.GetPTree();
+//     
+// 
+//      
+//     pt.add_child("minimum", pmin);
+//     pt.add_child("maximum", pmax);
+//     
+//     ptree klasses;
+//     
+//     for (boost::array<boost::uint32_t,32>::size_type i=0; i < classes.size(); i++) {
+//         if (classes[i] != 0) {
+//             liblas::Classification c = liblas::Classification(i, false, false, false);
+//             std::string name = c.GetClassName();
+// 
+//             klasses.put("name", name);
+//             klasses.put("count", classes[i]);
+//             klasses.put("id", i);
+//             pt.add_child("classification.classification",klasses);            
+//         }
+//     }
+//     pt.put("classification.withheld", withheld);
+//     pt.put("classification.keypoint", keypoint);
+//     pt.put("classification.synthetic", synthetic);
+//     
+//     ptree returns;
+//     for (boost::array<boost::uint32_t,8>::size_type i=0; i < points_by_return.size(); i++) {
+//         if (i == 0) continue;
+// 
+//         if (points_by_return[i] != 0)
+//         {
+//             returns.put("id", i);
+//             returns.put("count", points_by_return[i]);
+//             pt.add_child("points_by_return.return", returns);
+//             
+//         }
+//     }
+//     
+//     ptree pulses;
+//     for (boost::array<boost::uint32_t,8>::size_type i=0; i < returns_of_given_pulse.size(); i++) {
+//         if (returns_of_given_pulse[i] != 0) {
+//             pulses.put("id",i);
+//             pulses.put("count", returns_of_given_pulse[i]);
+//             pt.add_child("returns_of_given_pulse.pulse", pulses);
+//         }
+//     }
+//     
+//     pt.put("count", count);
+//     
+//     std::cout << min;
+//     std::cout << reader.GetHeader();
+//     
+//     return pt;
+// }
 
-        count++;
-        liblas::Point const& p = reader.GetPoint();
 
-        if (first) {
-            min = p;
-            max = p;
-            first = false;
-        }
-        
-        min.SetX(std::min(p.GetX(), min.GetX()));
-        max.SetX(std::max(p.GetX(), max.GetX()));
 
-        min.SetY(std::min(p.GetY(), min.GetY()));
-        max.SetY(std::max(p.GetY(), max.GetY()));        
-
-        min.SetZ(std::min(p.GetZ(), min.GetZ()));
-        max.SetZ(std::max(p.GetZ(), max.GetZ()));
-
-        min.SetIntensity(std::min(p.GetIntensity(), min.GetIntensity()));
-        max.SetIntensity(std::max(p.GetIntensity(), max.GetIntensity()));
-
-        min.SetTime(std::min(p.GetTime(), min.GetTime()));
-        max.SetTime(std::max(p.GetTime(), max.GetTime()));
-
-        min.SetReturnNumber(std::min(p.GetReturnNumber(), min.GetReturnNumber()));
-        max.SetReturnNumber(std::max(p.GetReturnNumber(), max.GetReturnNumber()));
-
-        min.SetNumberOfReturns(std::min(p.GetNumberOfReturns(), min.GetNumberOfReturns()));
-        max.SetNumberOfReturns(std::max(p.GetNumberOfReturns(), max.GetNumberOfReturns()));
-
-        min.SetScanDirection(std::min(p.GetScanDirection(), min.GetScanDirection()));
-        max.SetScanDirection(std::max(p.GetScanDirection(), max.GetScanDirection()));
-
-        min.SetFlightLineEdge(std::min(p.GetFlightLineEdge(), min.GetFlightLineEdge()));
-        max.SetFlightLineEdge(std::max(p.GetFlightLineEdge(), max.GetFlightLineEdge()));
-
-        min.SetScanAngleRank(std::min(p.GetScanAngleRank(), min.GetScanAngleRank()));
-        max.SetScanAngleRank(std::max(p.GetScanAngleRank(), max.GetScanAngleRank()));
-
-        min.SetUserData(std::min(p.GetUserData(), min.GetUserData()));
-        max.SetUserData(std::max(p.GetUserData(), max.GetUserData()));
-
-        min.SetPointSourceID(std::min(p.GetPointSourceID(), min.GetPointSourceID()));
-        max.SetPointSourceID(std::max(p.GetPointSourceID(), max.GetPointSourceID()));
-        
-        liblas::Classification const& cls = p.GetClassification();
-        
-        boost::uint8_t minc = std::min(cls.GetClass(), min.GetClassification().GetClass());
-        boost::uint8_t maxc = std::max(cls.GetClass(), max.GetClassification().GetClass());
-        
-        classes[cls.GetClass()]++;
-        
-        if (cls.IsWithheld()) withheld++;
-        if (cls.IsKeyPoint()) keypoint++;
-        if (cls.IsSynthetic()) synthetic++;
-        
-        min.SetClassification(liblas::Classification(minc));
-        max.SetClassification(liblas::Classification(maxc));
-        
-        liblas::Color const& color = p.GetColor();
-        
-        liblas::Color::value_type red;
-        liblas::Color::value_type green;
-        liblas::Color::value_type blue;
-        
-        red = std::min(color.GetRed(), min.GetColor().GetRed());
-        green = std::min(color.GetGreen(), min.GetColor().GetGreen());
-        blue = std::min(color.GetBlue(), min.GetColor().GetBlue());
-        
-        min.SetColor(liblas::Color(red, green, blue));
-        
-        red = std::max(color.GetRed(), max.GetColor().GetRed());
-        green = std::max(color.GetGreen(), max.GetColor().GetGreen());
-        blue = std::max(color.GetBlue(), max.GetColor().GetBlue());        
-
-        max.SetColor(liblas::Color(red, green, blue));
-
-        points_by_return[p.GetReturnNumber()]++;


More information about the Liblas-commits mailing list