From ab259fb906dc491712765e98efb34cc18b9fd183 Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Wed, 8 Sep 2021 14:02:37 +0200 Subject: [PATCH 1/1] Disabling message_progress --- src/HYDROData/HYDROData_Bathymetry.cxx | 9 +- src/HYDROData/HYDROData_CalculationCase.cxx | 23 +---- .../HYDROData_LCM_FaceClassifier.cxx | 5 +- src/HYDROData/HYDROData_LandCoverMap.cxx | 10 +-- src/HYDROData/HYDROData_Tree.hxx | 9 +- src/HYDROGUI/HYDROGUI_Module.cxx | 88 +++++++++---------- 6 files changed, 50 insertions(+), 94 deletions(-) diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index f7778992..96d953b9 100755 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -252,11 +252,6 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::ComputeQuadtreeNodes( int key) con DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute"); aQuadtree->setNodesAndCompute(aListOfNodes); - Message_ProgressRange aZIRange = HYDROData_Tool::GetZIProgress(); - if ( aZIRange.UserBreak() ) { - return 0; - } - myQuadtrees[key] = aQuadtree; return aQuadtree; @@ -485,10 +480,8 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM double anInvalidAltitude = GetInvalidAltitude(); double aResAltitude = anInvalidAltitude; - // --- find the nearest point in the bathymetry cloud, with quadtree - Message_ProgressRange aZIRange = HYDROData_Tool::GetZIProgress(); HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes(); - if (!aQuadtree || (aZIRange.UserBreak())) + if (!aQuadtree ) { DEBTRACE(" no Quadtree"); return aResAltitude; diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 8d5be17d..fb08ee39 100755 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -71,8 +71,6 @@ #include #include -#include - //#define DEB_CALCULATION 1 #ifdef DEB_CALCULATION #include @@ -1079,16 +1077,10 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString()); NCollection_Sequence aResSeq; - Message_ProgressRange aZIRange = HYDROData_Tool::GetZIProgress(); - - DEBTRACE("aZIProgress before running"); - - Message_ProgressScope *aZIScope = NULL; QFuture aFuture = QtConcurrent::run([&]() { int aNbPoints = thePoints.Length(); - aZIScope = new Message_ProgressScope(aZIRange, "GetAltitudesForPoints", aNbPoints); - for ( int i = 1, n = aNbPoints; i <= n && aZIScope->More(); ++i, aZIScope->Next() ) + for ( int i = 1, n = aNbPoints; i <= n; ++i) { const gp_XY& thePnt = thePoints.Value( i ); @@ -1098,14 +1090,8 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( }); while( aFuture.isRunning() ) { - if ( aZIScope ) { - aZIScope->Show(); - QThread::msleep(200); - } + } - DEBTRACE("ZI running finished"); - if ( aZIScope ) - aZIScope->Show(); return aResSeq; } @@ -1153,19 +1139,14 @@ std::vector HYDROData_CalculationCase::GetStricklerCoefficientForPoints( if( aLCM.IsNull() || aTable.IsNull() ) return theCoeffs; - Message_ProgressRange aSIRange = HYDROData_Tool::GetSIProgress(); - Message_ProgressScope aSIScope(aSIRange, "", 100); QFuture aFuture = QtConcurrent::run([&]() { aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax ); }); while( aFuture.isRunning() ) { - aSIScope.Show(); QThread::msleep(200); } - DEBTRACE("SI running finished"); - aSIScope.Show(); return theCoeffs; } diff --git a/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx b/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx index a7186256..3d0562f3 100755 --- a/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx +++ b/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx @@ -34,7 +34,6 @@ #include #include #include -#include Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Standard_Integer& theObj) @@ -120,10 +119,8 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector& thePoints theFaces->resize(pntsize); } - Message_ProgressScope aPSentry (HYDROData_Tool::GetSIProgress(), "Classify", pntsize - 1); - Standard_Integer aSel = 0; - for (size_t i = 0; i < pntsize && aPSentry.More(); i++, aPSentry.Next()) + for (size_t i = 0; i < pntsize; i++) { std::set aSet; diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 9ffa47a5..54681eac 100755 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -61,7 +61,6 @@ #include #include #include -#include #include #include @@ -1306,19 +1305,13 @@ void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints const Handle(HYDROData_StricklerTable)& theTable, std::vector& theCoeffs, double DefValue, bool UseMax ) const { - Message_ProgressScope aPSentryStages(HYDROData_Tool::GetSIProgress(), "ClassifyPoints", 2); - std::vector > Types; HYDROData_LCM_FaceClassifier FC(this); FC.Classify(thePoints, Types, NULL); - aPSentryStages.Next(); - theCoeffs.reserve(thePoints.size()); - Message_ProgressScope aPSentryCoeff(HYDROData_Tool::GetSIProgress(), "Assign coefficients", Types.size() - 1); - - for (size_t i = 0; i < Types.size() && aPSentryCoeff.More(); i++, aPSentryCoeff.Next()) + for (size_t i = 0; i < Types.size(); i++) { const std::set& SStr = Types[i]; if (SStr.empty()) @@ -1338,5 +1331,4 @@ void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints } } - aPSentryStages.Next(); } diff --git a/src/HYDROData/HYDROData_Tree.hxx b/src/HYDROData/HYDROData_Tree.hxx index ceb5b99b..659ce5d0 100755 --- a/src/HYDROData/HYDROData_Tree.hxx +++ b/src/HYDROData/HYDROData_Tree.hxx @@ -30,7 +30,6 @@ #define _HYDROData_Tree_HXX_ #include -#include //================================================================================ @@ -208,8 +207,6 @@ void HYDROData_Tree::buildChildren() rootSize = root->maxSize(); } - Message_ProgressRange aZIRange = HYDROData_Tool::GetZIProgress(); - Message_ProgressScope aPSentry(aZIRange, "QuadTree", NB_CHILDREN + 1); for (int i = 0; i < NB_CHILDREN; i++) { @@ -231,12 +228,8 @@ void HYDROData_Tree::buildChildren() // --- After building the NB_CHILDREN boxes, we put the data into the children. buildChildrenData(); - if (aPSentry.More()) { - aPSentry.Next(); - } - // --- After we pass to the next level of the Tree - for (int i = 0; i < NB_CHILDREN && aPSentry.More(); i++, aPSentry.Next()) { + for (int i = 0; i < NB_CHILDREN ; i++) { myChildren[i]->buildChildren(); } diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 46b99beb..f93e0cef 100755 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -167,8 +167,8 @@ void HYDROGUI_Module::initialize( CAM_Application* theApp ) myOCCDisplayer = new HYDROGUI_OCCDisplayer( this ); myVTKDisplayer = new HYDROGUI_VTKPrsDisplayer( this ); - HYDROData_Tool::SetSIProgress( new HYDROGUI_SIProgressIndicator( theApp->desktop() ) ); - HYDROData_Tool::SetZIProgress( new HYDROGUI_ZIProgressIndicator( theApp->desktop() ) ); + //HYDROData_Tool::SetSIProgress( new HYDROGUI_SIProgressIndicator( theApp->desktop() ) ); + //HYDROData_Tool::SetZIProgress( new HYDROGUI_ZIProgressIndicator( theApp->desktop() ) ); } bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) @@ -203,7 +203,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) // end of GEOM plugins loading #ifndef DISABLE_PYCONSOLE - aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ), + aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ), HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) ); #endif @@ -216,7 +216,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) while( anIter.hasNext() ) { size_t anId = anIter.next().key(); const ViewManagerInfo& anInfo = anIter.value(); - + aHydroViewManagers << anInfo.first; if ( !anAllViewManagers.contains( anInfo.first ) ) { @@ -252,7 +252,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) { connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ), this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); - connect( aViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), + connect( aViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), this, SLOT( onViewActivated( SUIT_ViewManager* ) ) ); OCCViewer_ViewManager* occ_mgr = dynamic_cast( aViewManager ); @@ -276,7 +276,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy ) preferencesChanged( "HYDRO", "chained_panning" ); // Load GEOM data - SalomeApp_Study* aStudy = + SalomeApp_Study* aStudy = dynamic_cast( getApp()->activeStudy() ); if ( aStudy ) { SALOMEDS::Study_var aDSStudy = GeometryGUI::getStudyServant(); @@ -315,7 +315,7 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy ) { disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ), this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); - disconnect( aViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), + disconnect( aViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), this, SLOT( onViewActivated( SUIT_ViewManager* ) ) ); OCCViewer_ViewManager* occ_mgr = dynamic_cast( aViewManager ); @@ -384,7 +384,7 @@ void HYDROGUI_Module::windows( QMap& theMap ) const LightApp_Application* app = getApp(); if( app && app->getWindow( OverviewWindow )==0 ) { - const_cast( this )->myOverview = + const_cast( this )->myOverview = new HYDROGUI_Overview( tr( "OVERVIEW" ), 0, app->desktop() ); app->insertDockWindow( OverviewWindow, myOverview ); app->placeDockWindow( OverviewWindow, Qt::LeftDockWidgetArea ); @@ -461,14 +461,14 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, // Check the selected GEOM objects (take into account the Object Browser only) if ( anIsObjectBrowser ) { - QList anObstacleTypes = + QList anObstacleTypes = HYDROGUI_ImportGeomObjectOp::getObstacleTypes(); - QList aPolylineTypes = + QList aPolylineTypes = HYDROGUI_ImportGeomObjectOp::getPolylineTypes(); - bool isCanBeImportedAsObstacle = + bool isCanBeImportedAsObstacle = !HYDROGUI_Tool::GetSelectedGeomObjects( this, anObstacleTypes ).isEmpty(); - bool isCanBeImportedAsPolyline = + bool isCanBeImportedAsPolyline = !HYDROGUI_Tool::GetSelectedGeomObjects( this, aPolylineTypes ).isEmpty(); // Add import as obstacle action @@ -537,7 +537,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsProfile = true; aNbOfSelectedProfiles++; - Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( anObject ); if( !aProfile.IsNull() && aProfile->IsValid() ) { anIsValidProfile = true; @@ -566,7 +566,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, else if( anObjectKind == KIND_STREAM ) { anIsStream = true; - Handle(HYDROData_Stream) aStream = + Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast( anObject ); if ( !aStream.IsNull() ) isStreamHasBottom = !aStream->GetBottomPolyline().IsNull(); @@ -617,11 +617,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( CreateCylinderId ) ); break; case KIND_STRICKLER_TABLE: - theMenu->addAction( action( ImportStricklerTableFromFileId ) ); + theMenu->addAction( action( ImportStricklerTableFromFileId ) ); break; case KIND_LAND_COVER_MAP: - theMenu->addAction( action( CreateLandCoverMapId ) ); - theMenu->addAction( action( ImportLandCoverMapId ) ); + theMenu->addAction( action( CreateLandCoverMapId ) ); + theMenu->addAction( action( ImportLandCoverMapId ) ); break; case KIND_CALCULATION: theMenu->addAction( action( CreateCalculationId ) ); @@ -777,9 +777,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( DuplicateStricklerTableId ) ); theMenu->addSeparator(); - Handle(HYDROData_StricklerTable) aTable = + Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aSeq.First() ); - QString aCurrentTable = + QString aCurrentTable = HYDROGUI_DataObject::dataObjectEntry( getLandCoverColoringTable( anActiveViewId ) ); bool isUsed = aCurrentTable == HYDROGUI_DataObject::dataObjectEntry( aTable ); @@ -800,7 +800,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, // theMenu->addAction( action( ExportToShapeFileID ) ); theMenu->addSeparator(); - } + } else if( anIsVisualState && anIsObjectBrowser ) { theMenu->addAction( action( SaveVisualStateId ) ); @@ -831,7 +831,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( SetTransparencyId ) ); theMenu->addSeparator(); } - } + } else if ( anAllAreProfiles ) { theMenu->addAction( action( EditProfileId ) ); @@ -856,7 +856,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addSeparator(); - if( anIsImage || anIsPolyline || anIsPolyline3D || + if( anIsImage || anIsPolyline || anIsPolyline3D || anIsImmersibleZone || anIsZone || anIsRegion || anIsBathymetry || anIsObstacle || anIsStream || anIsChannel || anIsDigue || anIsDummyObject3D || @@ -1012,7 +1012,7 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri SUIT_ResourceMgr* resMgr = application()->resourceMgr(); if ( theSection == "preferences" && thePref == "default_strickler_coefficient" ) { - + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(); if ( resMgr && !aDoc.IsNull() ) aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( theSection, thePref, 0 ) ); @@ -1053,7 +1053,7 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri if (anOCCViewMgr) anOCCViewMgr->setChainedOperations( aChainedPan ); } - + QList docW = getApp()->desktop()->findChildren(); foreach (QDockWidget* qw, docW) { @@ -1098,13 +1098,13 @@ void HYDROGUI_Module::update( const int flags ) } if( ( flags & UF_Viewer ) ) - updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll ); + updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll ); if( ( flags & UF_OCCViewer ) ) - updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll ); + updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll ); if( ( flags & UF_VTKViewer ) ) - updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll ); + updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll ); if( ( flags & UF_Model ) && getDataModel() && getApp() ) { @@ -1119,11 +1119,11 @@ void HYDROGUI_Module::update( const int flags ) bool isResizeOnExpandItem = aResMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false ); SUIT_DataBrowser* anObjectBrowser = getApp()->objectBrowser(); if ( isResizeOnExpandItem && anObjectBrowser ) { - anObjectBrowser->setResizeOnExpandItem( false ); // MZN: ISSUE #280 + anObjectBrowser->setResizeOnExpandItem( false ); // MZN: ISSUE #280 } getApp()->updateObjectBrowser( true ); if ( isResizeOnExpandItem && anObjectBrowser ) { - anObjectBrowser->setResizeOnExpandItem( true ); // MZN: ISSUE #280 + anObjectBrowser->setResizeOnExpandItem( true ); // MZN: ISSUE #280 } } @@ -1729,7 +1729,7 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager ) LightApp_Module::onViewManagerAdded( theViewManager ); if( theViewManager->getType() == GraphicsView_Viewer::Type() ) - { + { connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); } @@ -1742,7 +1742,7 @@ void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager ) this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) ); connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ), this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); - connect( theViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), + connect( theViewManager, SIGNAL( activated( SUIT_ViewManager* ) ), this, SLOT( onViewActivated( SUIT_ViewManager* ) ) ); } else if( theViewManager->getType() == SVTK_Viewer::Type() ) @@ -1894,9 +1894,9 @@ void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent ) */ } -void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, - const bool theIsInit, - const bool theIsForced, +void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, + const bool theIsInit, + const bool theIsForced, const bool theDoFitAll ) { DEBTRACE("HYDROGUI_Module::updateViewer"); @@ -1905,7 +1905,7 @@ void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, // currently, all views are updated ViewManagerMapIterator anIter( myViewManagerMap ); while( anIter.hasNext() ) - { + { SUIT_ViewManager* aViewManager = anIter.next().value().first; if ( theDisplayer->IsApplicable( aViewManager ) ) @@ -2032,7 +2032,7 @@ QStringList HYDROGUI_Module::storeSelection() const SUIT_DataOwnerPtrList::iterator anIter; for( anIter = aList.begin(); anIter != aList.end(); anIter++ ) { - const LightApp_DataOwner* anOwner = + const LightApp_DataOwner* anOwner = dynamic_cast( (*anIter).operator->() ); if( anOwner ) anEntryList.append( anOwner->entry() ); @@ -2162,16 +2162,16 @@ void HYDROGUI_Module::dropObjects( const DataObjectList& what, SUIT_DataObject* const int row, Qt::DropAction action ) { if ( action != Qt::CopyAction && action != Qt::MoveAction ) - return; + return; if (row == -1) return; if (where->level() < 2 ) - return; + return; DataObjectList::ConstIterator it = what.constBegin(); - for (;it != what.constEnd();++it) + for (;it != what.constEnd();++it) { if ((*it)->parent() != where) return; @@ -2180,7 +2180,7 @@ void HYDROGUI_Module::dropObjects( const DataObjectList& what, SUIT_DataObject* it = what.constBegin(); int i=0; - for (;it != what.constEnd();++it) + for (;it != what.constEnd();++it) { SUIT_DataObject* objWhat = *it; @@ -2201,11 +2201,11 @@ void HYDROGUI_Module::dropObjects( const DataObjectList& what, SUIT_DataObject* pos = row - 1; where->moveChildPos(objWhat, pos); //std::list t2 = where->children().toStdList(); //debug - } + } } getApp()->updateObjectBrowser(true); - + } Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const size_t theViewId ) const @@ -2244,11 +2244,11 @@ void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObjec } if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) { - Handle(HYDROData_StricklerTable) aTable = + Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( theObject ); QMutableMapIterator anIter( myLandCoverColoringMap ); while ( anIter.hasNext() ) { - if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == + if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == HYDROGUI_DataObject::dataObjectEntry( aTable ) ) { anIter.remove(); } -- 2.30.2