mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
update wrench
This commit is contained in:
parent
20c74165b1
commit
e7d32ea88c
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::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);
|
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,
|
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||||
// individual output file will be called /tmp/hello/z.las
|
// 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 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"))
|
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);
|
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;
|
pdal::Options options;
|
||||||
options.add(pdal::Option("forward", "all"));
|
options.add(pdal::Option("forward", "all"));
|
||||||
Stage* writer = &manager->makeWriter(tile->outputFilename, "", options);
|
Stage* writer = &manager->makeWriter(tile->outputFilename, "", options);
|
||||||
@ -138,8 +150,10 @@ void Merge::preparePipelines(std::vector<std::unique_ptr<PipelineManager>>& pipe
|
|||||||
|
|
||||||
VirtualPointCloud vpc;
|
VirtualPointCloud vpc;
|
||||||
if (!vpc.read(inputFile))
|
if (!vpc.read(inputFile))
|
||||||
|
{
|
||||||
std::cerr << "could not open input VPC: " << inputFile << std::endl;
|
std::cerr << "could not open input VPC: " << inputFile << std::endl;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (const VirtualPointCloud::File& vpcSingleFile : vpc.files)
|
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,
|
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||||
// individual output file will be called /tmp/hello/z.las
|
// 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"))
|
if (!ends_with(outputFile, ".vpc"))
|
||||||
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
|
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,
|
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||||
// individual output file will be called /tmp/hello/z.las
|
// 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";
|
tile.outputFilename = (outputSubdir / inputBasename).string() + ".gpkg";
|
||||||
|
|
||||||
tileOutputFiles.push_back(tile.outputFilename);
|
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,
|
// for input file /x/y/z.las that goes to /tmp/hello.vpc,
|
||||||
// individual output file will be called /tmp/hello/z.las
|
// 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"))
|
if (!ends_with(outputFile, ".vpc"))
|
||||||
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
|
tile.outputFilename = (outputSubdir / inputBasename).string() + ".las";
|
||||||
else
|
else
|
||||||
tile.outputFilename = (outputSubdir / inputBasename).string() + outputFormat;
|
tile.outputFilename = (outputSubdir / inputBasename).string() + "." + outputFormat;
|
||||||
|
|
||||||
tileOutputFiles.push_back(tile.outputFilename);
|
tileOutputFiles.push_back(tile.outputFilename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user