]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
fix bug on selection highlight zones on calculation case edition
authorPaul RASCLE <paul.rascle@openfields.fr>
Mon, 16 Nov 2020 11:06:04 +0000 (12:06 +0100)
committerYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Fri, 4 Dec 2020 10:01:08 +0000 (11:01 +0100)
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operation.cxx
src/HYDROGUI/HYDROGUI_Operation.h

index 0beb4d140bd5f2ffaf9315982749f0b1f254ccc4..2481eba62129647e31d79a6e396f5776254cf5ce 100644 (file)
@@ -65,6 +65,9 @@
 #include <QTreeView>
 #include <QWizardPage>
 
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 
 HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool IsComplete )
 : HYDROGUI_Wizard( theModule, theTitle )
@@ -604,6 +607,7 @@ void HYDROGUI_CalculationDlg::onMergeTypeSelected( int theIndex )
 
 void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject )
 {
+  DEBTRACE("onSelected");
   bool doShow = false;
   HYDROGUI_Zone* aZone = dynamic_cast<HYDROGUI_Zone*>( theObject );
   if ( aZone )
index ebf31719c252b92dacd9609354d82070f6d438d3..695671dd7dfac83033051b10c681e46973e83229 100644 (file)
@@ -60,6 +60,9 @@
 
 #include <HYDROData_CompleteCalcCase.h>
 
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 
 HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit, bool IsComplete )
 : HYDROGUI_Operation( theModule ),
@@ -387,6 +390,7 @@ void HYDROGUI_CalculationOp::onStricklerTableSelected ( const QString & theObjNa
 
 void HYDROGUI_CalculationOp::onObjectsSelected()
 {
+  DEBTRACE("onObjectsSelected");
   HYDROGUI_CalculationDlg* aPanel = 
     ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
 
@@ -451,11 +455,13 @@ void HYDROGUI_CalculationOp::onLandCoverMapSelected( const QString & theObjName
 
 void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
 {
+  DEBTRACE("onClickedInZonesBrowser");
   HYDROGUI_Region* aRegionItem = dynamic_cast<HYDROGUI_Region*>(theItem);
   HYDROGUI_Zone* aZoneItem;
   selectionMgr()->clearSelected();
   if ( aRegionItem )
   {
+    DEBTRACE("Region");
     // Select a region in preview
     SUIT_DataOwnerPtrList aList( true );
     DataObjectList aZones = aRegionItem->children();
@@ -475,6 +481,7 @@ void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
     aZoneItem = dynamic_cast<HYDROGUI_Zone*>(theItem);
     if ( aZoneItem )
     {
+      DEBTRACE("Zone");
       SUIT_DataOwnerPtrList aList( true );
       aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) );
       selectionMgr()->setSelected( aList );
@@ -1298,6 +1305,7 @@ bool HYDROGUI_CalculationOp::createRegion( const QList<SUIT_DataObject*>& theZon
 
 void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fitAllFlag, bool onTopViewAndFit )
 {
+  DEBTRACE("createPreview " << theLandCoverMap << " " << fitAllFlag << " " << onTopViewAndFit);
   LightApp_Application* anApp = module()->getApp();
   HYDROData_SequenceOfObjects aSeq;
   if ( theLandCoverMap && myShowLandCoverMap )
@@ -1354,6 +1362,7 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fit
   {
     myPreviewViewManager = ::qobject_cast<OCCViewer_ViewManager*>( 
       anApp->createViewManager( OCCViewer_Viewer::Type() ) );
+    DEBTRACE("  createViewManager " << myPreviewViewManager);
     if ( myPreviewViewManager )
     {
       connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
@@ -1366,6 +1375,7 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fit
 
   if ( !myPreviewViewManager )
     return;
+  restoreOCCViewerSelection(myPreviewViewManager);
 
   if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
   {
index c6df7d3ba3ae21c0be4aa2406df18bda05d826be..776db8be097364b072b1029f429cd4369503cc5e 100755 (executable)
@@ -1930,7 +1930,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD
     return;
 
   QString aViewType = theViewManager->getType();
-  DEBTRACE("aViewType " << aViewType.toStdString() << " " << GraphicsView_Viewer::Type().toStdString() << " "  << OCCViewer_Viewer::Type().toStdString());
+  DEBTRACE("aViewType " << aViewType.toStdString());
   if( aViewType != GraphicsView_Viewer::Type() &&
       aViewType != OCCViewer_Viewer::Type())
     return;
@@ -1979,7 +1979,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD
     }
   }
 
-  if ( !isGV && aViewType == GraphicsView_Viewer::Type() )
+  if ( aViewType == GraphicsView_Viewer::Type() )
   {
     GraphicsView_ViewManager* aViewManager =
       ::qobject_cast<GraphicsView_ViewManager*>( theViewManager );
@@ -1990,7 +1990,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD
       sel->setEnabled( true );
     }
   }
-  else if ( !isOCC && aViewType == OCCViewer_Viewer::Type() )
+  else if ( aViewType == OCCViewer_Viewer::Type() )
   {
     OCCViewer_ViewManager* aViewManager =
       ::qobject_cast<OCCViewer_ViewManager*>( theViewManager );
index 2cecdcdea3e14ba129d4f7894754a26771a84b02..fcb94e13b4d4ae4ef0b62a8022455c582c4ad48d 100644 (file)
@@ -463,17 +463,18 @@ void HYDROGUI_Operation::onCancel()
   restoreOCCViewerSelection();
 }
 
-void HYDROGUI_Operation::restoreOCCViewerSelection()
+void HYDROGUI_Operation::restoreOCCViewerSelection(OCCViewer_ViewManager* theViewManager)
 {
-  DEBTRACE("restoreOCCViewerSelection");
+  DEBTRACE("restoreOCCViewerSelection " << theViewManager);
   LightApp_Application* anApp = module()->getApp();
   LightApp_SelectionMgr* sm = anApp->selectionMgr();
   if(sm)
   {
          sm->clearFilters(); // see GEOM_Displayer::GlobalSelection
   }
-  OCCViewer_ViewManager* aViewManager =
-      dynamic_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
+  OCCViewer_ViewManager* aViewManager = theViewManager;
+  if (!aViewManager)
+    aViewManager = dynamic_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
   if( aViewManager )
   {
        if( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
@@ -481,7 +482,7 @@ void HYDROGUI_Operation::restoreOCCViewerSelection()
          Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
          if( !aCtx.IsNull() )
          {
-                 DEBTRACE("AIScontext " << aCtx.get());
+                 DEBTRACE("aViewManager " << aViewManager << " AIScontext " << aCtx.get());
                  aCtx->Deactivate();
                  aCtx->Activate(0);
                  aCtx->SetAutomaticHilight( Standard_True );
index f8ac3643b633e7d457c3692dd320ca0ef2abeb24..d81affa53163e965b9c3c908a2db89a08a74b528 100644 (file)
@@ -132,7 +132,7 @@ protected:
    */
   virtual void                        apply();
 
-  virtual void                        restoreOCCViewerSelection();
+  virtual void                        restoreOCCViewerSelection(OCCViewer_ViewManager* theViewManager = 0);
 
 private: