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
#include <liblas/liblas.hpp>
15
// Predicate testing LASPoint against given XY coordinates
19
is_xy(double x, double y, double tolerance)
20
: x(x), y(y), t(tolerance)
23
bool operator()(liblas::Point const& p)
25
double const dx = x - p.GetX();
26
double const dy = y - p.GetY();
28
return ((dx <= t && dx >= -t) && (dy <= t && dy >= -t));
36
// Functor to calculate bounding box of a set of points
37
struct bbox_calculator
39
bbox_calculator(liblas::Bounds<double>& bbox) : bbox(&bbox), empty(true) {}
41
void operator()(liblas::Point const& p)
44
throw std::invalid_argument("bbox is null");
46
// Box initialization during first iteration only
49
(bbox->min)(0, p.GetX());
50
(bbox->max)(0, p.GetX());
51
(bbox->min)(1, p.GetY());
52
(bbox->max)(1, p.GetY());
53
(bbox->min)(2, p.GetZ());
54
(bbox->max)(2, p.GetZ());
58
// Expand bounding box to include given point
59
(bbox->min)(0, (std::min)((bbox->min)(0), p.GetX()));
60
(bbox->min)(1, (std::min)((bbox->min)(1), p.GetY()));
61
(bbox->min)(2, (std::min)((bbox->min)(2), p.GetZ()));
62
(bbox->max)(0, (std::max)((bbox->max)(0), p.GetX()));
63
(bbox->max)(1, (std::max)((bbox->max)(1), p.GetY()));
64
(bbox->max)(2, (std::max)((bbox->max)(2), p.GetZ()));
68
liblas::Bounds<double>* bbox;
72
// Common test procedure for default constructed point data.
73
void test_default_point(liblas::Point const& p);
75
// Common test procedure for default constructed header data.
76
void test_default_header(liblas::Header const& h);
78
// Test of header data in trunk/test/data/TO_core_last_clip.las file
79
void test_file10_header(liblas::Header const& h);
81
// Test of 1st point record in trunk/test/data/TO_core_last_clip.las file
82
void test_file10_point1(liblas::Point const& p);
84
// Test of 2nd point record in trunk/test/data/TO_core_last_clip.las file
85
void test_file10_point2(liblas::Point const& p);
87
// Test of 4th point record in trunk/test/data/TO_core_last_clip.las file
88
void test_file10_point4(liblas::Point const& p);
90
// Test of 1st, 2nd, 3rd point record in trunk/test/data/1.2-with-color.laz file
91
void test_file_12Color_point0(liblas::Point const& p);
92
void test_file_12Color_point1(liblas::Point const& p);
93
void test_file_12Color_point2(liblas::Point const& p);
95
// make sure we have a valid laszip VLR block
96
void test_laszip_vlr(liblas::Header const& header);