]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
22623: [CEA 1198] Select graphically a point to set him a local size
authoreap <eap@opencascade.com>
Wed, 2 Jul 2014 11:52:51 +0000 (15:52 +0400)
committereap <eap@opencascade.com>
Wed, 2 Jul 2014 11:52:51 +0000 (15:52 +0400)
   deactivate all selection widgets at tab change

src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h

index 6798a807d1f3831afe14da689e92b3aa74fbfbae..91013ff309e42852a26aaccab80bf72bf78281d9 100644 (file)
@@ -471,7 +471,7 @@ BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator()
 /**
  * \brief {Get or create the geom selection tool for active study}
  * */
-GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool()
+GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const
 {
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
   _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
@@ -1133,7 +1133,8 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   connect( mySizeMapTable,      SIGNAL( itemChanged (QTreeWidgetItem *, int)),this,  SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
   connect( myAttractorCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onAttractorClicked( int ) ) );
   connect( myConstSizeCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onConstSizeClicked( int ) ) );
-  connect( smpTab,              SIGNAL( currentChanged ( int )),       this,         SLOT( onSmpTabChanged( int ) ) );
+  connect( smpTab,              SIGNAL( currentChanged ( int )),       this,         SLOT( onTabChanged( int ) ) );
+  connect( myTabWidget,         SIGNAL( currentChanged ( int )),       this,         SLOT( onTabChanged( int ) ) );
 
   // Enforced vertices
   connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this,  SLOT( synchronizeCoords() ) );
@@ -1423,7 +1424,7 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
 
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
 
-  that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+  getGeomSelectionTool()->selectionMgr()->clearFilters();
   myEnfFaceWdg->deactivateSelection();
   myEnfVertexWdg->deactivateSelection();
 
@@ -2812,20 +2813,41 @@ void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item,
   } 
 }
 
-void BLSURFPluginGUI_HypothesisCreator::onSmpTabChanged(int tab)
+void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab)
 {
-  myAttDistSpin->setValue(0.);           // Reinitialize widgets 
-  myAttSizeSpin->setValue(0.);
-  myAttDistSpin2->setValue(0.);
-  mySmpSizeSpin->setValue(0.); 
-  myGeomSelWdg1->deactivateSelection();
-  myGeomSelWdg2->deactivateSelection();
-  myAttSelWdg->deactivateSelection();
-  myGeomSelWdg1->SetObject(CORBA::Object::_nil());
-  myGeomSelWdg2->SetObject(CORBA::Object::_nil());
-  myAttSelWdg->SetObject(CORBA::Object::_nil());
-  myAttractorCheck->setChecked(false);
-  myConstSizeCheck->setChecked(false);
+  getGeomSelectionTool()->selectionMgr()->clearFilters();// rm other tab filters
+  if ( sender() == myTabWidget )
+  {
+    myGeomSelWdg1             ->deactivateSelection();
+    myGeomSelWdg2             ->deactivateSelection();
+    myAttSelWdg               ->deactivateSelection();
+    myEnfFaceWdg              ->deactivateSelection();
+    myEnfVertexWdg            ->deactivateSelection();
+    myPeriodicitySourceFaceWdg->deactivateSelection();
+    myPeriodicityTargetFaceWdg->deactivateSelection();
+    myPeriodicityP1SourceWdg  ->deactivateSelection();
+    myPeriodicityP2SourceWdg  ->deactivateSelection();
+    myPeriodicityP3SourceWdg  ->deactivateSelection();
+    myPeriodicityP1TargetWdg  ->deactivateSelection();
+    myPeriodicityP2TargetWdg  ->deactivateSelection();
+    myPeriodicityP3TargetWdg  ->deactivateSelection();
+    return;
+  }
+  else if ( sender() == smpTab )
+  {
+    myAttDistSpin->setValue(0.);           // Reinitialize widgets
+    myAttSizeSpin->setValue(0.);
+    myAttDistSpin2->setValue(0.);
+    mySmpSizeSpin->setValue(0.);
+    myGeomSelWdg1->deactivateSelection();
+    myGeomSelWdg2->deactivateSelection();
+    myAttSelWdg->deactivateSelection();
+    myGeomSelWdg1->SetObject(CORBA::Object::_nil());
+    myGeomSelWdg2->SetObject(CORBA::Object::_nil());
+    myAttSelWdg->SetObject(CORBA::Object::_nil());
+    myAttractorCheck->setChecked(false);
+    myConstSizeCheck->setChecked(false);
+  }
 }
 
 void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)
@@ -2969,8 +2991,7 @@ void BLSURFPluginGUI_HypothesisCreator::onAddMap()
     SUIT_MessageBox::critical( dlg(),"Error" , msg );
     return;
   }
-  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;  
-  that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+  getGeomSelectionTool()->selectionMgr()->clearFilters();
   myAttDistSpin->setValue(0.);
   myAttSizeSpin->setValue(0.);
   myAttDistSpin2->setValue(0.);
@@ -3008,8 +3029,7 @@ void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
     SUIT_MessageBox::critical( dlg(),"Error" , msg );
     return;
   }
-  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;  
-  that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+  getGeomSelectionTool()->selectionMgr()->clearFilters();
   myAttDistSpin->setValue(0.);
   myAttSizeSpin->setValue(0.);
   myAttDistSpin2->setValue(0.);
index db44322d28c3b6b8ad79dd81a40e6db54548b104..e936a56cbc896cfdfa1d65c310e233c8c4b9fab5 100644 (file)
@@ -199,7 +199,7 @@ protected slots:
   // Sizemap tab
   void                onMapGeomContentModified();
   void                onSmpItemClicked( QTreeWidgetItem *, int );
-  void                onSmpTabChanged(int);
+  void                onTabChanged(int);
   void                onAttractorClicked(int);
   void                onConstSizeClicked(int);
   void                onAddMap();
@@ -233,7 +233,7 @@ private:
   bool                sizeMapsValidation();
   bool                sizeMapValidationFromRow(int,bool displayError = true);
   bool                sizeMapValidationFromEntry(QString,bool displayError = true);
-  GeomSelectionTools* getGeomSelectionTool();
+  GeomSelectionTools* getGeomSelectionTool() const;
   GEOM::GEOM_Gen_var  getGeomEngine();
   //void                insertElementType( TopAbs_ShapeEnum );
   bool                insertElement( GEOM::GEOM_Object_var, bool modify = false );