#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;
}