Salome HOME
The selections of elements corrected.
authormzn <mzn@opencascade.com>
Fri, 24 Jun 2005 12:24:06 +0000 (12:24 +0000)
committermzn <mzn@opencascade.com>
Fri, 24 Jun 2005 12:24:06 +0000 (12:24 +0000)
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx

index 4860baeef08822edc19346087fbc58336f50cc9d..b5df5cc9442e274db537c266c71553c215e21624 100644 (file)
@@ -438,34 +438,19 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
     aMesh = myActor->GetObject()->GetMesh();
 
   if (aMesh) {
-    //mySelectionMgr->clearSelected();
-    //mySelectionMgr->AddIObject(myActor->getIO());
-    SALOME_ListIO aList;
-    aList.Append(myActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList, false);
-
     QStringList aListId = QStringList::split(" ", theNewText, false);
 
     if (send == LineEditElements) {
       const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
-      TColStd_IndexedMapOfInteger selectedIndices;
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex(anIO, selectedIndices);
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex(myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-      if (newIndices.Extent() > 0) {
-        mySelector->AddOrRemoveIndex(anIO, newIndices, true);
-       myViewWindow->highlight( anIO, true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
+      mySelector->AddOrRemoveIndex(anIO, newIndices, false);
+      myViewWindow->highlight( anIO, true, true );
       myElementsId = theNewText;
     }
   }
index 62ef4d6ad73c190cabe00902f06d4bee69b32256..baf1814d25bf1c28f332e06d684c2ea1d99713ea 100644 (file)
@@ -261,9 +261,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
     }
 
     if (aResult) {
-      SALOME_ListIO aList;
-      aList.Append(myActor->getIO());
-      mySelectionMgr->setSelectedObjects(aList, false);
+      myEditCurrentArgument->clear();
       SMESH::UpdateView();
     }
   }
@@ -314,36 +312,27 @@ void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText)
   if(myActor){
     if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-      SALOME_ListIO aList;
-      aList.Append(anIO);
-      mySelectionMgr->setSelectedObjects(aList, false);
       
-      TColStd_IndexedMapOfInteger selectedIndices;
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex(anIO,selectedIndices);
       
       QStringList aListId = QStringList::split(" ", theNewText, false);
       for (int i = 0; i < aListId.count(); i++) {
        if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
-         if (selectedIndices.Add(anElem->GetID())) {
-           newIndices.Add(anElem->GetID());
-         }
+         newIndices.Add(anElem->GetID());
          myNbOkElements++;
        }
       }
-    
-      if (newIndices.Extent() > 0){
-       mySelector->AddOrRemoveIndex(anIO,newIndices,true);
-       myViewWindow->highlight(anIO,true,true);
-      }
+      
+      mySelector->AddOrRemoveIndex(anIO,newIndices,false);
+      myViewWindow->highlight(anIO,true,true);
     }
   }
-
+  
   if (myNbOkElements) {
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
-
+  
   myBusy = false;
 }
 
index d07fc087dd29df7b95c90583c71baa0e7bf88668..7e913dbd5a84473bf51cfc0ab25ee90a028c5ebb 100644 (file)
@@ -214,7 +214,11 @@ void SMESHGUI_RemoveNodesDlg::Init()
   connect(SelectButtonC1A1, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
+  /* to close dialog if study change */
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
+         SLOT(onTextChange(const QString&)));
+  
   /* Move widget on the botton right corner of main widget */
   int x, y;
   mySMESHGUI->DefineDlgPosition(this, x, y);
@@ -259,9 +263,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply()
     }
 
     if (aResult) {
-      SALOME_ListIO aList;
-      aList.Append(myActor->getIO());
-      mySelectionMgr->setSelectedObjects(aList, false);
+      myEditCurrentArgument->clear();
       SMESH::UpdateView();
     }
 
@@ -311,28 +313,19 @@ void SMESHGUI_RemoveNodesDlg::onTextChange (const QString& theNewText)
   if(myActor){
     if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-      SALOME_ListIO aList;
-      aList.Append(anIO);
-      mySelectionMgr->setSelectedObjects(aList, false);
-      
-      TColStd_IndexedMapOfInteger selectedIndices;
+           
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex(anIO,selectedIndices);
-    
+      
       QStringList aListId = QStringList::split(" ", theNewText, false);
       for (int i = 0; i < aListId.count(); i++) {
-       if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[ i ].toInt())) {
-         if (selectedIndices.Add(aNode->GetID())) {
-           newIndices.Add(aNode->GetID());
-         }
+       if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[i].toInt())) {
+         newIndices.Add(aNode->GetID());
          myNbOkNodes++;
        }
       }
 
-      if(newIndices.Extent() > 0){
-       mySelector->AddOrRemoveIndex(anIO,newIndices,true);
-       myViewWindow->highlight(anIO,true,true);
-      }
+      mySelector->AddOrRemoveIndex(anIO,newIndices,false);
+      myViewWindow->highlight(anIO,true,true);
     }
   }
 
index 05fd466934a232ba4b6b597efab288bda23cf958..b2e4615b12e50744f045677b8b420403e8074245 100644 (file)
@@ -522,35 +522,22 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
 
   if (aMesh) {
     if (send == LineEditElements) {
-      //mySelectionMgr->clearSelected();
-      //mySelectionMgr->AddIObject(myActor->getIO());
-      SALOME_ListIO aList;
-      aList.Append(myActor->getIO());
-      mySelectionMgr->setSelectedObjects(aList, false);
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
-      TColStd_IndexedMapOfInteger selectedIndices;
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex(myActor->getIO(), selectedIndices);
 
       QStringList aListId = QStringList::split(" ", theNewText, false);
+      
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-
-      if (newIndices.Extent() > 0)
-      {
-        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
-       myViewWindow->highlight( myActor->getIO(), true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
 
+      mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
+      myViewWindow->highlight( myActor->getIO(), true, true );
+      
       myElementsId = theNewText;
     }
   }
index 8b9b6b70d89e93fa79ff65baa189f493ee5b32fe..cb43bf86c40c39746d46e857bc389d0e21f4b003 100644 (file)
@@ -479,34 +479,21 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
 
   if (aMesh) {
     if (send == LineEditElements) {
-      //mySelectionMgr->clearSelected();
-      //mySelectionMgr->AddIObject(myActor->getIO());
-      SALOME_ListIO aList;
-      aList.Append(myActor->getIO());
-      mySelectionMgr->setSelectedObjects(aList, false);
-
-      TColStd_IndexedMapOfInteger selectedIndices;
+      Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+      
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex( myActor->getIO(), selectedIndices);
-
+      
       QStringList aListId = QStringList::split(" ", theNewText, false);
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-
-      if (newIndices.Extent() > 0){
-       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
-       myViewWindow->highlight( myActor->getIO(), true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
 
+      mySelector->AddOrRemoveIndex( anIO, newIndices, false );
+      myViewWindow->highlight( anIO, true, true );
+      
       myElementsId = theNewText;
     }
   }
index a77ff9a407146f775b2884cf1da1aa480f7fbb8b..b52edf3fb679ec29bc528b954f893d29d342f3f5 100644 (file)
@@ -86,9 +86,9 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
   else if ( p=="hasReference" )  val = QtxValue( hasReference( ind ) );
   else if ( p=="isVisible" )     val = QtxValue( isVisible( ind ) );
 
-//   printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
-//   if ( val.type() == QVariant::List )
-//     cout << "size: " << val.toList().count() << endl;
+   printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
+   if ( val.type() == QVariant::List )
+     cout << "size: " << val.toList().count() << endl;
   return val;
 }
 
index caec59a2c5dcb99d14da9f98eb80c246a0d897b4..c1b4dea983589443facf46996ef61d2801a0b0a7 100644 (file)
@@ -321,6 +321,7 @@ void SMESHGUI_SmoothingDlg::Init()
 
   myEditCurrentArgument = LineEditElements;
   LineEditElements->setFocus();
+  LineEditElements->clear();
   LineEditNodes->clear();
   myElementsId = "";
   myNbOkElements = 0;
@@ -456,57 +457,33 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
     aMesh = myActor->GetObject()->GetMesh();
 
   if (aMesh) {
-    //mySelectionMgr->clearSelected();
-    //mySelectionMgr->AddIObject(myActor->getIO());
-    SALOME_ListIO aList;
-    aList.Append(myActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList, false);
-
+    
     QStringList aListId = QStringList::split(" ", theNewText, false);
 
     if (send == LineEditElements) {
       const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
-      TColStd_IndexedMapOfInteger selectedIndices;
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex( anIO, selectedIndices );
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex(myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-      if (newIndices.Extent() > 0) {
-        mySelector->AddOrRemoveIndex(anIO, newIndices, true);
-       myViewWindow->highlight( anIO, true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
+      mySelector->AddOrRemoveIndex(anIO, newIndices, false);
+      myViewWindow->highlight( anIO, true, true );
       myElementsId = theNewText;
 
     } else if (send == LineEditNodes) {
-      TColStd_IndexedMapOfInteger selectedIndices;
       TColStd_MapOfInteger newIndices;
-      mySelector->GetIndex(myActor->getIO(), selectedIndices);
-
+      
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshNode * n = aMesh->FindNode(aListId[ i ].toInt());
-       if (n) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), n->GetID())) {
-          if (selectedIndices.Add(n->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
-            newIndices.Add(n->GetID());
-          }
-         myNbOkNodes++;
-       }
-      }
-      if (newIndices.Extent() > 0)
-      {
-        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
-       myViewWindow->highlight( myActor->getIO(), true, true );
+       if (n)
+         newIndices.Add(n->GetID());
+       myNbOkNodes++;
       }
+      mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
+      myViewWindow->highlight( myActor->getIO(), true, true );
     }
   }
 
index 225586edd324fce3424c8a663d5573e0467c2f17..496a1573a51ebfdcf06b4bb8934041dd97fbd116 100644 (file)
@@ -537,36 +537,23 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
     aMesh = myActor->GetObject()->GetMesh();
 
   if (aMesh) {
-    //mySelectionMgr->clearSelected();
-    //mySelectionMgr->AddIObject(myActor->getIO());
-    SALOME_ListIO aList;
-    aList.Append(myActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList, false);
+    Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
-    TColStd_IndexedMapOfInteger selectedIndices;
     TColStd_MapOfInteger newIndices;
-    mySelector->GetIndex(myActor->getIO(), selectedIndices);
-
+    
     QStringList aListId = QStringList::split(" ", theNewText, false);
 
     if (send == LineEditElements) {
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-
-      if (newIndices.Extent() > 0){
-       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
-       myViewWindow->highlight( myActor->getIO(), true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
 
+      mySelector->AddOrRemoveIndex( anIO, newIndices, false );
+      myViewWindow->highlight( anIO, true, true );
+      
       myElementsId = theNewText;
     }
   }
index 649ae0d747ae5d85e49cdc86b3b7cd247051f990..8df40714e1c69be12e2201e8c4b7a8c0d1789ca8 100644 (file)
@@ -502,38 +502,25 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
     aMesh = myActor->GetObject()->GetMesh();
 
   if (aMesh) {
-    //mySelectionMgr->clearSelected();
-    //mySelectionMgr->AddIObject(myActor->getIO());
-    SALOME_ListIO aList;
-    aList.Append(myActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList, false);
-
-    TColStd_IndexedMapOfInteger selectedIndices;
+    Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+    
     TColStd_MapOfInteger newIndices;
-    mySelector->GetIndex( myActor->getIO(), selectedIndices );
 
     QStringList aListId = QStringList::split(" ", theNewText, false);
 
     if (send == LineEditElements) {
       for (int i = 0; i < aListId.count(); i++) {
        const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
-       if (e) {
-         //if (!mySelectionMgr->IsIndexSelected(myActor->getIO(), e->GetID())) {
-          if (selectedIndices.Add(e->GetID())) {
-           //mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
-            newIndices.Add(e->GetID());
-          }
-         myNbOkElements++;
-       }
-      }
-
-      if (newIndices.Extent() > 0){
-       mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
-       myViewWindow->highlight( myActor->getIO(), true, true );
+       if (e)
+         newIndices.Add(e->GetID());
+       myNbOkElements++;
       }
-
-      myElementsId = theNewText;
     }
+
+    mySelector->AddOrRemoveIndex( anIO, newIndices, false );
+    myViewWindow->highlight( anIO, true, true );
+    
+    myElementsId = theNewText;
   }
 
   if (myNbOkElements) {