Salome HOME
The selections of elements corrected.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_SewingDlg.cxx
index a84e3834d40326526fa171fdc64a2fc730051f42..6bbc5c7b141412b71efaed2cd471d7f9c7a92aa2 100644 (file)
@@ -79,11 +79,12 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name,
       myViewWindow( SMESH::GetViewWindow( theModule ) ),
       mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
-  QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
-  QPixmap image4 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
+  QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
+  QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
+  QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
+  QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_SewingDlg");
@@ -637,16 +638,8 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
     send->clear();
 
   if (aMesh) {
-    //mySelectionMgr->clearSelected();
-    //mySelectionMgr->AddIObject(myActor->getIO());
-    SALOME_ListIO aList;
-    aList.Append(myActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList, false);
-
-    TColStd_IndexedMapOfInteger selectedIndices;
     TColStd_MapOfInteger newIndices;
-    mySelector->GetIndex( myActor->getIO(), selectedIndices);
-
+    
     if (GetConstructorId() != 3 || (send != LineEdit1 && send != LineEdit4)) {
       SMESH::SetPointRepresentation(true);
 
@@ -654,14 +647,10 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
 
       const SMDS_MeshNode * n = aMesh->FindNode(theNewText.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());
-          mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
-         myViewWindow->highlight( myActor->getIO(), true, true );
-        }
-
+       newIndices.Add(n->GetID());
+       mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
+       myViewWindow->highlight( myActor->getIO(), true, true );
+       
         if      (send == LineEdit1)
           myOk1 = true;
         else if (send == LineEdit2)
@@ -686,23 +675,17 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText)
 
       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());
-          }
+        if (e) 
+         newIndices.Add(e->GetID());
+       
           if (!isEvenOneExists)
             isEvenOneExists = true;
-        }
-      }
-
-      if (newIndices.Extent() > 0)
-      {
-        mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, true);
-       myViewWindow->highlight( myActor->getIO(), true, true );
       }
+      
 
+      mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
+      myViewWindow->highlight( myActor->getIO(), true, true );
+      
       if (isEvenOneExists) {
         if (send == LineEdit1)
           myOk1 = true;