Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement solution for #91 #92

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions apps/roofer-app/config.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2024 TU Delft 3D geoinformation group, Ravi Peters (3DGI),

Check notice on line 1 in apps/roofer-app/config.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on apps/roofer-app/config.hpp

File apps/roofer-app/config.hpp does not conform to Custom style guidelines. (lines 225, 238, 258, 757, 768, 770, 772, 783)
// and Balazs Dukai (3DGI)

// This file is part of roofer (https://github.com/3DBAG/roofer)
Expand Down Expand Up @@ -335,7 +335,8 @@

std::vector<std::string> find_filepaths(
const std::list<std::string>& filepath_parts,
std::initializer_list<std::string> extensions) {
std::initializer_list<std::string> extensions,
bool no_throw_on_missing = false) {
std::vector<std::string> files;
for (const auto& filepath_part : filepath_parts) {
if (fs::is_directory(filepath_part)) {
Expand All @@ -350,7 +351,7 @@
} else {
if (fs::exists(filepath_part)) {
files.push_back(filepath_part);
} else {
} else if (!no_throw_on_missing) {
throw std::runtime_error("File not found: " + filepath_part + ".");
}
}
Expand Down Expand Up @@ -606,6 +607,7 @@
bool _print_version = false;
bool _crop_only = false;
bool _no_tiling = false;
bool _skip_pc_check = false;
std::string _loglevel = "info";
size_t _trace_interval = 10;
std::string _config_path;
Expand Down Expand Up @@ -719,10 +721,12 @@
if (_input_pointclouds.empty()) {
throw std::runtime_error("No input pointclouds specified.");
}
for (auto& ipc : _input_pointclouds) {
if (ipc.paths.empty()) {
throw std::runtime_error(
"No files found for one of the input pointclouds.");
if (!_skip_pc_check) {
for (auto& ipc : _input_pointclouds) {
if (ipc.paths.empty()) {
throw std::runtime_error(
"No files found for one of the input pointclouds.");
}
}
}
// if (auto error_msg = roofer::v::PathExists(_cfg.source_footprints)) {
Expand Down Expand Up @@ -797,6 +801,8 @@
"pointclouds. Implies --crop-output.\n";
std::cout << " --index Output index.gpkg file with "
"crop analytics.\n";
std::cout << " --skip-pc-check Do not check if pointcloud "
"files exist\n";
std::cout << "\n";
for (auto& [name, param] : _pmap) {
std::cout << " --" << std::setw(33) << std::left
Expand Down Expand Up @@ -884,6 +890,9 @@
} else if (arg == "--no-tiling") {
_no_tiling = true;
it = c.args.erase(it);
} else if (arg == "--skip-pc-check") {
_skip_pc_check = true;
it = c.args.erase(it);
} else if (arg == "--crop-only") {
_crop_only = true;
_cfg.write_crop_outputs = true;
Expand Down Expand Up @@ -959,7 +968,8 @@

_input_pointclouds.clear();
_input_pointclouds.emplace_back(InputPointcloud{
.paths = find_filepaths(c.args, {".las", ".LAS", ".laz", ".LAZ"})});
.paths = find_filepaths(c.args, {".las", ".LAS", ".laz", ".LAZ"},
_skip_pc_check)});
} else {
throw std::runtime_error(
"Unable set all inputs and output. Need to provide at least <ouput "
Expand Down Expand Up @@ -1024,7 +1034,8 @@
"strings.");
}
pc.paths = find_filepaths(input_paths,
{".las", ".LAS", ".laz", ".LAZ"});
{".las", ".LAS", ".laz", ".LAZ"},
_skip_pc_check);
} else {
throw std::runtime_error(fmt::format(
"Unknown parameter in [[pointcloud]] table in "
Expand Down
Loading