MCPcopy Create free account
hub / github.com/3DBAG/roofer / main

Function main

tests/test_reconstruct_api.cpp:48–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46void print_version() { std::cout << "roofer test_reconstruct_api\n"; }
47
48int main(int argc, const char* argv[]) {
49 auto cmdl = argh::parser();
50
51 cmdl.parse(argc, argv);
52 std::string program_name = cmdl[0];
53
54 bool verbose = cmdl[{"-v", "--verbose"}];
55 bool version = cmdl[{"-V", "--version"}];
56
57 if (cmdl[{"-h", "--help"}]) {
58 print_help(program_name);
59 return EXIT_SUCCESS;
60 }
61 if (version) {
62 print_version();
63 return EXIT_SUCCESS;
64 }
65
66 auto& logger = roofer::logger::Logger::get_logger();
67
68 if (verbose) {
69 logger.set_level(roofer::logger::LogLevel::debug);
70 } else {
71 logger.set_level(roofer::logger::LogLevel::warning);
72 }
73 std::string path_pointcloud =
74 "data/wippolder/objects/503100000030812/crop/"
75 "503100000030812_pointcloud.las";
76 std::string path_footprint =
77 "data/wippolder/objects/503100000030812/crop/503100000030812.gpkg";
78 float floor_elevation = -0.16899998486042023;
79
80 // read inputs
81 auto pj = roofer::misc::createProjHelper();
82 auto PointReader = roofer::io::createPointCloudReaderLASlib(*pj);
83 auto VectorReader = roofer::io::createVectorReaderOGR(*pj);
84
85 VectorReader->open(path_footprint);
86 std::vector<roofer::LinearRing> footprints;
87 VectorReader->readPolygons(footprints);
88
89 PointReader->open(path_pointcloud);
90 logger.info("Reading pointcloud from {}", path_pointcloud);
91 roofer::vec1i classification;
92 roofer::PointCollection points, points_ground, points_roof;
93 roofer::AttributeVecMap attributes;
94 PointReader->readPointCloud(points, &classification);
95 logger.info("Read {} points", points.size());
96
97 // split into ground and roof points
98 for (size_t i = 0; i < points.size(); ++i) {
99 if (2 == classification[i]) {
100 points_ground.push_back(points[i]);
101 } else if (6 == classification[i]) {
102 points_roof.push_back(points[i]);
103 }
104 }
105 logger.info("{} ground points and {} roof points", points_ground.size(),

Callers

nothing calls this directly

Calls 15

print_helpFunction · 0.85
print_versionFunction · 0.85
createProjHelperFunction · 0.85
createVectorReaderOGRFunction · 0.85
readPolygonsMethod · 0.80
readPointCloudMethod · 0.80
parserClass · 0.50
reconstructFunction · 0.50
parseMethod · 0.45
set_levelMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected