1
// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net
2
// Distributed under the BSD License
3
// (See accompanying file LICENSE.txt or copy at
4
// http://www.opensource.org/licenses/bsd-license.php)
6
#include <liblas/bounds.hpp>
7
#include <liblas/guid.hpp>
13
#include "liblas_test.hpp"
17
struct lastransform_data
19
std::string gdal_datasource;
20
std::string lidar_data;
23
: gdal_datasource(g_test_data_path + "//autzen.jpg")
24
, lidar_data(g_test_data_path + "//autzen.las")
29
typedef test_group<lastransform_data> tg;
30
typedef tg::object to;
32
tg test_group_lastransform("liblas::TransformI");
37
// Test default constructor
42
liblas::Header header;
43
liblas::TransformPtr color_fetch;
47
ifs.open(lidar_data.c_str(), std::ios::in | std::ios::binary);
48
liblas::Reader reader(ifs);
49
header = reader.GetHeader();
53
header.SetDataFormatId(liblas::ePointFormat3);
54
header.SetVersionMinor(2);
56
std::vector<boost::uint32_t> bands;
61
color_fetch = liblas::TransformPtr(new liblas::ColorFetchingTransform(gdal_datasource, bands, &header));
65
ifs.open(lidar_data.c_str(), std::ios::in | std::ios::binary);
66
liblas::Reader reader(ifs);
67
std::vector<liblas::TransformPtr> transforms;
68
transforms.push_back(color_fetch);
69
reader.SetTransforms(transforms);
71
reader.ReadNextPoint();
73
liblas::Point const& p = reader.GetPoint();
75
ensure_equals("Red is incorrect for point", p.GetColor().GetRed(), 210);
76
ensure_equals("Green is incorrect for point", p.GetColor().GetGreen(), 205);
77
ensure_equals("Blue is incorrect for point", p.GetColor().GetBlue(), 185);