[Liblas-commits] r986 - trunk/test/sample

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Feb 3 09:50:12 EST 2009


Author: mloskot
Date: Tue Feb  3 09:50:12 2009
New Revision: 986
URL: http://liblas.org/changeset/986

Log:
Added print_point() function to sample/utility.hpp header.

Modified:
   trunk/test/sample/utility.hpp

Modified: trunk/test/sample/utility.hpp
==============================================================================
--- trunk/test/sample/utility.hpp	(original)
+++ trunk/test/sample/utility.hpp	Tue Feb  3 09:50:12 2009
@@ -33,9 +33,59 @@
        << "\nnor: " << p.GetNumberOfReturns()
        << "\nsd: " << p.GetScanDirection()
        << "\neofl: " << p.GetFlightLineEdge()
-       << "\ncls: " << p.GetClassification()
-       << "\n";
+       << "\ntime: " << p.GetTime()
+       << std::endl;
+
     return os;
 }
 
+inline void print_point(std::ostream& os, liblas::LASPoint const& p, liblas::uint8_t const& minor)
+{
+    os << std::fixed << std::setprecision(6)
+       << "\nx: " << p.GetX()
+       << "\ny: " << p.GetY()
+       << "\nz: " << p.GetZ()
+       << "\nint: " << p.GetIntensity()
+       << "\nrn: " << p.GetReturnNumber()
+       << "\nnor: " << p.GetNumberOfReturns()
+       << "\nsd: " << p.GetScanDirection()
+       << "\neofl: " << p.GetFlightLineEdge()
+       << "\ntime: " << p.GetTime();
+
+    if (1 == minor)
+    {
+        const int len = 13;
+        static std::string meaning[len] =
+        {
+            "Created, never classified",
+            "Unclassified",
+            "Ground",
+            "Low Vegetation",
+            "Medium Vegetation",
+            "High Vegetation",
+            "Building",
+            "Low Point (noise)",
+            "Model Key-point (mass point)",
+            "Water",
+            "Reserved for ASPRS Definition",
+            "Reserved for ASPRS Definition",
+            "Overlap Points",
+        };
+
+        // bit 0:4
+        liblas::uint8_t chClass = p.GetClassification();
+        unsigned int idx = (unsigned int)((chClass >> 3) & 0x1F); 
+        std::cout << "\nClassification: "
+            << ((idx >= 0 && idx < len) ? meaning[idx] : "Reserved for ASPRS Definition");
+        std::cout << "\n- Synthetic: " << ((1 == (short)((chClass >> 2) & 0x1)) ? -1 : 0);
+        std::cout << "\n- Model_Key_Point: " << ((1 == (short)((chClass >> 1) & 0x1)) ? -1 : 0);
+        std::cout << "\n- Withheld: " << ((1 == (short)(chClass & 0x1)) ? -1 : 0);
+    }
+    else
+    {
+       std::cout << "\ncls: " << (int)p.GetClassification();
+    }
+    std::cout << std::endl;
+}
+
 #endif // LIBLAS_SAMPLE_UTILITY_HPP_INCLUDED


More information about the Liblas-commits mailing list