#endif
#include <QSet>
+#include <QFuture>
+#include <QtConcurrent/QtConcurrent>
+#include <QThread>
#include <TopoDS.hxx>
#include <TopoDS_Shell.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TDataStd_Integer.hxx>
+#include <Message_ProgressSentry.hxx>
+
//#define DEB_CALCULATION 1
#ifdef DEB_CALCULATION
#include <BRepTools.hxx>
DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString());
NCollection_Sequence<double> aResSeq;
- for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
- {
- const gp_XY& thePnt = thePoints.Value( i );
+ Handle(Message_ProgressIndicator) aZIProgress = HYDROData_Tool::GetZIProgress();
+ if ( aZIProgress ) {
+ aZIProgress->Reset();
+ }
+
+ QFuture<void> aFuture = QtConcurrent::run([&]() {
+ int aNbPoints = thePoints.Length();
+
+ Message_ProgressSentry aPSentry(HYDROData_Tool::GetZIProgress(), "GetAltitudesForPoints", 0, aNbPoints, 1);
+ for ( int i = 1, n = aNbPoints; i <= n && aPSentry.More(); ++i, aPSentry.Next() )
+ {
+ const gp_XY& thePnt = thePoints.Value( i );
- double anAltitude = GetAltitudeForPoint( thePnt, theRegion, theMethod );
- aResSeq.Append( anAltitude );
+ double anAltitude = GetAltitudeForPoint( thePnt, theRegion, theMethod );
+ aResSeq.Append( anAltitude );
+ }
+ });
+
+ while( aFuture.isRunning() ) {
+ if ( aZIProgress ) {
+ aZIProgress->Show( Standard_True );
+ QThread::usleep(500);
+ }
}
+ aZIProgress->Show( Standard_True );
return aResSeq;
}
if( aLCM.IsNull() || aTable.IsNull() )
return theCoeffs;
- aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax );
+ Handle(Message_ProgressIndicator) aSIProgress = HYDROData_Tool::GetSIProgress();
+ if ( aSIProgress ) {
+ aSIProgress->Reset();
+ }
+
+ QFuture<void> aFuture = QtConcurrent::run([&]() {
+ aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax );
+ });
+
+ while( aFuture.isRunning() ) {
+ if ( aSIProgress ) {
+ aSIProgress->Show( Standard_True );
+ QThread::usleep(500);
+ }
+ }
return theCoeffs;
}