I'll have to figure out how to run projectShape asynchronously so the main thread can continue on.
You can try it this way:
Code: Select all
QFutureWatcher<TopoDS_Shape> watcher;
watcher.setFuture(future);
QEventLoop loop;
QObject::connect(&watcher, &QFutureWatcher<TopoDS_Shape>::finished, &loop, &QEventLoop::quit);
loop.exec();
for (QFuture<TopoDS_Shape>::const_iterator it = future.begin(); it != future.end(); ++it) {
// use the results
}
Still not sure how to get progress reporting. We can't partition the workload by shape (as in your sample code) since hlr needs the whole input shape at the same time to calculate the occlusions.
If you have a single shape only then there is no way to show a progress indicator. There we would have to wait for OCC to implement it. However, if you have several shapes to be processed you can use the class Base::FutureWatcherProgress
Code: Select all
Base::FutureWatcherProgress progress("Hidden line removal...", numberOfShapes);
QFutureWatcher<TopoDS_Shape> watcher;
QObject::connect(&watcher, &QFutureWatcher<TopoDS_Shape>::progressValueChanged,
&progress, &Base::FutureWatcherProgress::progressValueChanged);
watcher.setFuture(future);
QEventLoop loop;
QObject::connect(&watcher, &QFutureWatcher<TopoDS_Shape>::finished, &loop, &QEventLoop::quit);
loop.exec();