mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-03 00:04:47 -04:00
update wrench
This commit is contained in:
parent
8f5e635e97
commit
a26b91b364
12
external/pdal_wrench/alg.cpp
vendored
12
external/pdal_wrench/alg.cpp
vendored
@ -173,3 +173,15 @@ void removeFiles(const std::vector<std::string> &tileOutputFiles, bool removePar
|
||||
fs::remove(outputDir);
|
||||
}
|
||||
}
|
||||
|
||||
fs::path fileStem(const std::string &filename)
|
||||
{
|
||||
fs::path inputBasename = fs::path(filename).stem();
|
||||
|
||||
while(inputBasename.has_extension())
|
||||
{
|
||||
inputBasename = inputBasename.stem();
|
||||
}
|
||||
|
||||
return inputBasename;
|
||||
}
|
2
external/pdal_wrench/alg.hpp
vendored
2
external/pdal_wrench/alg.hpp
vendored
@ -93,6 +93,8 @@ bool runAlg(std::vector<std::string> args, Alg &alg);
|
||||
|
||||
void removeFiles(const std::vector<std::string> &tileOutputFiles, bool removeParentDirIfEmpty = true);
|
||||
|
||||
fs::path fileStem(const std::string &filename);
|
||||
|
||||
//////////////
|
||||
|
||||
|
||||
|
2
external/pdal_wrench/clip.cpp
vendored
2
external/pdal_wrench/clip.cpp
vendored
@ -191,7 +191,7 @@ void Clip::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
|
||||
|
||||
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||
// individual output file will be called /tmp/hello/z.las
|
||||
fs::path inputBasename = fs::path(f.filename).stem();
|
||||
fs::path inputBasename = fileStem(f.filename);
|
||||
|
||||
// if the output is not VPC las file format is forced to avoid time spent on compression, files will be later merged into single output and removed anyways
|
||||
if (!ends_with(outputFile, ".vpc"))
|
||||
|
14
external/pdal_wrench/merge.cpp
vendored
14
external/pdal_wrench/merge.cpp
vendored
@ -99,6 +99,18 @@ static std::unique_ptr<PipelineManager> pipeline(ParallelJobInfo *tile)
|
||||
last.push_back(filterExpr);
|
||||
}
|
||||
|
||||
// this is a special case for merging COPC files
|
||||
// writers.copc does not support multiple inputs
|
||||
// merge step is necessary before writing the output
|
||||
if (ends_with(tile->outputFilename, ".copc.laz"))
|
||||
{
|
||||
Stage *merge = &manager->makeFilter("filters.merge");
|
||||
for (Stage *stage : last)
|
||||
merge->setInput(*stage);
|
||||
last.clear();
|
||||
last.push_back(merge);
|
||||
}
|
||||
|
||||
pdal::Options options;
|
||||
options.add(pdal::Option("forward", "all"));
|
||||
Stage* writer = &manager->makeWriter(tile->outputFilename, "", options);
|
||||
@ -138,8 +150,10 @@ void Merge::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipe
|
||||
|
||||
VirtualPointCloud vpc;
|
||||
if (!vpc.read(inputFile))
|
||||
{
|
||||
std::cerr << "could not open input VPC: " << inputFile << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (const VirtualPointCloud::File& vpcSingleFile : vpc.files)
|
||||
{
|
||||
|
2
external/pdal_wrench/thin.cpp
vendored
2
external/pdal_wrench/thin.cpp
vendored
@ -167,7 +167,7 @@ void Thin::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipel
|
||||
|
||||
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||
// individual output file will be called /tmp/hello/z.las
|
||||
fs::path inputBasename = fs::path(f.filename).stem();
|
||||
fs::path inputBasename = fileStem(f.filename);
|
||||
|
||||
if (!ends_with(outputFile, ".vpc"))
|
||||
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
|
||||
|
2
external/pdal_wrench/to_vector.cpp
vendored
2
external/pdal_wrench/to_vector.cpp
vendored
@ -112,7 +112,7 @@ void ToVector::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& p
|
||||
|
||||
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||
// individual output file will be called /tmp/hello/z.las
|
||||
fs::path inputBasename = fs::path(f.filename).stem();
|
||||
fs::path inputBasename = fileStem(f.filename);
|
||||
tile.outputFilename = (outputSubdir / inputBasename).string() + ".gpkg";
|
||||
|
||||
tileOutputFiles.push_back(tile.outputFilename);
|
||||
|
4
external/pdal_wrench/translate.cpp
vendored
4
external/pdal_wrench/translate.cpp
vendored
@ -169,12 +169,12 @@ void Translate::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>&
|
||||
|
||||
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||
// individual output file will be called /tmp/hello/z.las
|
||||
fs::path inputBasename = fs::path(f.filename).stem();
|
||||
fs::path inputBasename = fileStem(f.filename);
|
||||
|
||||
if (!ends_with(outputFile, ".vpc"))
|
||||
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
|
||||
else
|
||||
tile.outputFilename = (outputSubdir / inputBasename).string() + outputFormat;
|
||||
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
|
||||
|
||||
tileOutputFiles.push_back(tile.outputFilename);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user