3
// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net
4
// Distributed under the BSD License
5
// (See accompanying file LICENSE.txt or copy at
6
// http://www.opensource.org/licenses/bsd-license.php)
8
#ifndef LIBLAS_SAMPLE_UTILITY_HPP_INCLUDED
9
#define LIBLAS_SAMPLE_UTILITY_HPP_INCLUDED
13
// Forward declarations
19
inline std::ostream& operator<<(std::ostream& os, typename std::pair<T, T> const& p)
21
os << p.first << " " << p.second;
25
inline std::ostream& operator<<(std::ostream& os, liblas::LASPoint const& p)
27
os << std::fixed << std::setprecision(6)
28
<< "\nx: " << p.GetX()
29
<< "\ny: " << p.GetY()
30
<< "\nz: " << p.GetZ()
31
<< "\nint: " << p.GetIntensity()
32
<< "\nrn: " << p.GetReturnNumber()
33
<< "\nnor: " << p.GetNumberOfReturns()
34
<< "\nsd: " << p.GetScanDirection()
35
<< "\neofl: " << p.GetFlightLineEdge()
36
<< "\ntime: " << p.GetTime()
42
inline void print_point(std::ostream& os, liblas::LASPoint const& p, liblas::uint8_t const& minor)
44
os << std::fixed << std::setprecision(6)
45
<< "\nx: " << p.GetX()
46
<< "\ny: " << p.GetY()
47
<< "\nz: " << p.GetZ()
48
<< "\nint: " << p.GetIntensity()
49
<< "\nrn: " << p.GetReturnNumber()
50
<< "\nnor: " << p.GetNumberOfReturns()
51
<< "\nsd: " << p.GetScanDirection()
52
<< "\neofl: " << p.GetFlightLineEdge()
53
<< "\ntime: " << p.GetTime();
58
static std::string meaning[len] =
60
"Created, never classified",
68
"Model Key-point (mass point)",
70
"Reserved for ASPRS Definition",
71
"Reserved for ASPRS Definition",
76
liblas::uint8_t chClass = p.GetClassification();
77
unsigned int idx = (unsigned int)((chClass >> 3) & 0x1F);
78
std::cout << "\nClassification: "
79
<< ((idx >= 0 && idx < len) ? meaning[idx] : "Reserved for ASPRS Definition");
80
std::cout << "\n- Synthetic: " << ((1 == (short)((chClass >> 2) & 0x1)) ? -1 : 0);
81
std::cout << "\n- Model_Key_Point: " << ((1 == (short)((chClass >> 1) & 0x1)) ? -1 : 0);
82
std::cout << "\n- Withheld: " << ((1 == (short)(chClass & 0x1)) ? -1 : 0);
86
std::cout << "\ncls: " << (int)p.GetClassification();
88
std::cout << std::endl;
91
#endif // LIBLAS_SAMPLE_UTILITY_HPP_INCLUDED