]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Issue 0019874 (EDF 746 VISU: Picking alphanumeric Gauss):
authorrnv <rnv@opencascade.com>
Thu, 10 Jul 2008 06:49:51 +0000 (06:49 +0000)
committerrnv <rnv@opencascade.com>
Thu, 10 Jul 2008 06:49:51 +0000 (06:49 +0000)
When user creates a Gauss point presentation, the selection in the object browser should automatically switch to this presentation.

src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.h
src/VISUGUI/VisuGUI_InputPane.cxx
src/VISUGUI/VisuGUI_InputPane.h

index 8ab2fb390ebda492d769b51be061ed7648235bfc..e564110732ea18ba09f05a60beaf1f9d046fac51 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "LightApp_Application.h"
 #include "SalomeApp_Module.h"
+#include "LightApp_SelectionMgr.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
@@ -506,7 +507,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs,
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
 // "Title"
+ // "Title"
   myTextDlg->setTitleText(QString(thePrs->GetTitle()));
 
   vtkFloatingPointType R, G, B;
@@ -731,6 +732,7 @@ void VisuGUI_GaussScalarBarPane::onBarPref()
  * Constructor
  */
 VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule):
+  myModule(theModule),
   VisuGUI_Prs3dDlg(theModule)
 {
   setName("VisuGUI_GaussPointsDlg");
@@ -788,6 +790,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule):
 
   // Input pane
   myInputPane = new VisuGUI_InputPane(VISU::TGAUSSPOINTS, theModule, this);
+  myInputPane->SetRestoreInitialSelection(false);
 
   connect( myResultsButton,  SIGNAL( clicked() ),       mySizeBox,    SLOT( onToggleResults() ) );
   connect( myResultsButton,  SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
@@ -923,8 +926,22 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
   myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
   myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
 
-  VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
-
+  VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs); 
+  
+  //Set created Gauss points presentation selected,
+  //Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss)
+  if(thePrs){
+    SALOME_ListIO aListIO;
+    LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
+    Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO();
+    if(anIO && anIO->hasEntry()) {
+      aListIO.Append(anIO);
+      VISU::UpdateObjBrowser(myModule,true);
+      aSelectionMgr->setSelectedObjects(aListIO);
+    }
+    else
+      myInputPane->SetRestoreInitialSelection(true);
+  }
   return anIsOk;
 }
 
index d5c28d9903dad1d159a33eda0a9cca68896450b1..dd95b4bdccaa72bb26a0c580842ae091cd0c38c6 100644 (file)
@@ -167,6 +167,7 @@ private:
   QtxDblSpinBox*           myScaleSpinBox;
 
   SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
+  SalomeApp_Module*        myModule;
 };
 
 #endif // VISUGUI_GAUSSPOINTSDLS_H
index 6b1a68f80417a6674fc84d462327e900e94e03d9..029e803891116673701658976f5e785c5eac9478 100644 (file)
@@ -80,7 +80,8 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType,
   QGroupBox( theDialog ),
   myModule( theModule ),
   myDialog( theDialog ),
-  myPrs( NULL )
+  myPrs( NULL ),
+  isRestoreInitialSelection(true)
 {
   setFrameStyle( QFrame::NoFrame );
 
@@ -230,9 +231,17 @@ VisuGUI_InputPane::~VisuGUI_InputPane()
   }
 
   // Restore initial selection
-  aSelectionMgr->setSelectedObjects(mySavedSelection);
+  if(isRestoreInitialSelection)
+    aSelectionMgr->setSelectedObjects(mySavedSelection);
 }
 
+void VisuGUI_InputPane::SetRestoreInitialSelection(bool on){
+  isRestoreInitialSelection = on;
+}
+
+bool VisuGUI_InputPane::GetRestoreInitialSelection(){
+  return isRestoreInitialSelection;
+}
 
 //---------------------------------------------------------------
 /*!
index eea4df6410af2e895026b9d56408a5492b5da479..177a28e7b3c1e22d5274012168785ae5b3718d74 100644 (file)
@@ -71,6 +71,8 @@ public:
   int                storeToPrsObject( VISU::ColoredPrs3d_i* );
 
   bool               eventFilter (QObject* object, QEvent* event);
+  void               SetRestoreInitialSelection(bool on);
+  bool               GetRestoreInitialSelection();
 
 public slots:
   virtual void       onSelectionChanged();
@@ -104,6 +106,7 @@ private:
 
   VISU::Result_var   myResult;
   int                myEntity;
+  bool               isRestoreInitialSelection;
 
   VisuGUI_FieldFilter* myFieldFilter;
   SALOME_ListIO        mySavedSelection;