[pdal] API Progress
Kevin
zeno_42 at yahoo.com
Fri Feb 12 12:45:06 PST 2021
So I am a newcomer to PDAL, and I am attempting to implement GUI wrappers around various PDAL functionality using the C++ API. For now this is typically a user-determined combination of readers, decimation filters, crop filters, merge filters, reprojection filters, and a writer. Functionally its all working fine so far (with very limited testing). However since the user can kick off time-consuming operations in this manner its really desirable to have an active progress bar. So far the best I have managed in that regard is to stick a callbackfilter at the very end of the pipeline which updates my progress count (see below). This works nicely... save that in order to accurately space out the progress bar it requires that I know ahead of time how many points are going to make it through all the filters. I can make a passable guess based on initial quicklook analysis of the source files and knowing what the user set up, but it would be a lot easier and more dependable if there were a way to inject callbacks earlier in the stream to update the estimated count of points that pass the filters. Does anybody know a good way to accomplish that? From the outside looking in being able to simply pass in a reference to a counter variable with a filter - so that it updates a "points I've passed" count variable that I can monitor from another thread - would be perfect. But just a mid-stream callback filter could also work. I supposed I could implement some sort of custom filter that maintains a count for me, but that seems like a rather roundabout and overly complex way to accomplish it.
pdal::Stage* merger = myFactory.createStage("filters.merge"); double totPtsEstimate = 0;
for each source file
- add a reader stage - add filter stages
- add a merge stage
- add a writer stage
auto cb = [&](pdal::PointRef& point) {
return updateProgressBarCountByOne(); };
pdal::FixedPointTable t(1000);
pdal::StreamCallbackFilter scf; scf.setCallback(cb); scf.setInput(*(writer)); scf.prepare(t); scf.execute(t);
Regards,Kevin Murphy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20210212/1c806a03/attachment.html>
More information about the pdal
mailing list