Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.cxx
index be640381fbeb962959ce9003666f052e98958222..7d1cb98084c17b4c326f064c97c461177cbdf571 100755 (executable)
@@ -51,7 +51,6 @@
 #include "SVTK_Selector.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
-#include "SVTK_InteractorStyle.h"
 
 // OCCT Includes
 #include <Precision.hxx>
@@ -71,6 +70,7 @@
 #include <vtkUnsignedCharArray.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
+#include <vtkProperty.h>
 
 // QT Includes
 #include <qframe.h>
@@ -388,6 +388,35 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
       anActor = myActor;
     if (anActor != 0)
     {
+      // skl 07.02.2006
+      SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
+      if( myFilterType == SMESHGUI_TriaFilter || 
+         myFilterType == SMESHGUI_QuadFilter ||
+         myFilterType == SMESHGUI_FaceFilter ) {
+       SMDS_FaceIteratorPtr it = aMesh->facesIterator();
+       while(it->more()) {
+         const SMDS_MeshFace* f = it->next();
+         if(myFilterType == SMESHGUI_FaceFilter) {
+           myIds.Add(f->GetID());
+         }
+         else if( myFilterType==SMESHGUI_TriaFilter &&
+                  ( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
+           myIds.Add(f->GetID());
+         }
+         else if( myFilterType==SMESHGUI_QuadFilter &&
+                  ( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
+           myIds.Add(f->GetID());
+         }
+       }
+      }
+      else if(myFilterType == SMESHGUI_VolumeFilter) {
+       SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
+       while(it->more()) {
+         const SMDS_MeshVolume* f = it->next();
+         myIds.Add(f->GetID());
+       }
+      }
+      /* commented by skl 07.02.2006
       TVisualObjPtr aVisualObj = anActor->GetObject();
       vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
       if (aGrid != 0) {
@@ -411,6 +440,7 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
           }
         }
       }
+      */
     }
   }
 
@@ -504,8 +534,8 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
     myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
     if (!myActor)
       myActor = SMESH::FindActorByObject(myMesh);
-    SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
-    Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter(myFilterType);
+    SVTK_Selector* aSelector = SMESH::GetSelector();
+    Handle(VTKViewer_Filter) aFilter = aSelector->GetFilter(myFilterType);
     if (!aFilter.IsNull())
       aFilter->SetActor(myActor);
   }
@@ -605,9 +635,9 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted()
 //=======================================================================
 bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
 {
-  SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle();
+  SVTK_Selector* aSelector = SMESH::GetSelector();
   Handle(SMESHGUI_Filter) aFilter =
-    Handle(SMESHGUI_Filter)::DownCast(aStyle->GetFilter(myFilterType));
+    Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
 
   return (!aFilter.IsNull() && aFilter->IsObjValid(theId));
 }
@@ -942,7 +972,10 @@ bool SMESHGUI_MultiEditDlg::onApply()
   bool aResult = process(aMeshEditor, anIds.inout());
   if (aResult) {
     if (myActor) {
-      //mySelectionMgr->clearSelected();
+      SALOME_ListIO sel;
+      mySelectionMgr->selectedObjects( sel );
+      mySelector->ClearIndex();
+      mySelectionMgr->setSelectedObjects( sel );
       SMESH::UpdateView();
     }