Salome HOME
Porting to BR-D5-38-2003 branch
authorapo <apo@opencascade.com>
Mon, 19 Sep 2005 12:06:06 +0000 (12:06 +0000)
committerapo <apo@opencascade.com>
Mon, 19 Sep 2005 12:06:06 +0000 (12:06 +0000)
src/SMESHFiltersSelection/Makefile.in
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h

index e9c388166552bc17097c66dcba5dee650e653b8b..c438321b7c66d9f75da276d7ed6d00bb8e2e2546 100644 (file)
@@ -64,7 +64,7 @@ EXPORT_HEADERS= SMESH_Type.h \
 # additionnal information to compil and link file
 CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \
             -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
-            -I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
+            -I${GEOM_ROOT_DIR}/include/salome ${BOOST_CPPFLAGS}
 CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
             -I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
 LDFLAGS  += $(OCC_KERNEL_LIBS) -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeApp -lsuit
index 49d6ff7958aef493981cf9e0bbc59d007e455ea7..81ca6c8de975089d36948c1b9b0b06982f768f7c 100755 (executable)
@@ -2216,17 +2216,17 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
 //=======================================================================
 void SMESHGUI_FilterDlg::insertFilterInViewer()
 {
-  if (SVTK_InteractorStyle* aStyle = SMESH::GetInteractorStyle()) {
+  if (SVTK_Selector* aSelector = SMESH::GetSelector()) {
     SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
 
     if (myFilter[ myTable->GetType() ]->_is_nil() ||
          myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
          !mySetInViewer->isChecked()) {
-      SMESH::RemoveFilter(getFilterId(anEntType), aStyle);
+      SMESH::RemoveFilter(getFilterId(anEntType), aSelector);
     } else {
       Handle(SMESHGUI_PredicateFilter) aFilter = new SMESHGUI_PredicateFilter();
       aFilter->SetPredicate(myFilter[ myTable->GetType() ]->GetPredicate());
-      SMESH::SetFilter(aFilter, aStyle);
+      SMESH::SetFilter(aFilter, aSelector);
     }
   }
 }
index 2887e3c592a1ba96eb12fbe264bb06f0fa56cbcd..4afe023f52b431317ab76d44ecd2c839153b5bac 100755 (executable)
@@ -504,8 +504,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 +605,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));
 }
index 014e88a5a224c77011c207fe20d021266716e1a1..5ff9b0ff00e01a4871d4526f3e9c0d79b2982fb4 100644 (file)
@@ -308,8 +308,8 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const
     QString entry = static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->entry();
     SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() );
     if ( actor && actor->hasIO() ) {
-      SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
-      return QVariant( renderInter->isVisible( actor->getIO() ), 0 );
+      if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView())
+       return QVariant( aViewWindow->isVisible( actor->getIO() ), 0 );
     }
   }
   return QVariant( false, 0 );
index c9141ec82f7b93eda661ae60c9d11522313002c1..8019096573e1fbf1e9e0464964272903a07a257f 100644 (file)
@@ -36,9 +36,7 @@
 #include "SVTK_Selector.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
-#include "SVTK_RenderWindow.h"
 #include "SVTK_InteractorStyle.h"
-#include "SVTK_RenderWindowInteractor.h"
 
 #include "utilities.h"
 
@@ -448,85 +446,83 @@ namespace SMESH{
     double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
            SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 );
 
-    for ( int i=0, n=views.count(); i<n; i++ ) {
-        SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] );
-       if (!aVtkView) continue;
-       // update VTK viewer properties
-       SVTK_RenderWindowInteractor* anInteractor = aVtkView->getRWInteractor();
-       if (anInteractor) {
-         // mesh element selection
-         anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
-                                        aSelColor.blue()/255., SW );
-
-         // tolerances
-         anInteractor->SetSelectionTolerance(SP1, SP2);
-
-         // pre-selection
-         SVTK_InteractorStyle* aStyle =
-           dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
-         if (aStyle) {
-           aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
-                                       aPreColor.blue()/255., PW);
-         }
-       }
+    for ( int i=0, n=views.count(); i<n; i++ ){
+      // update VTK viewer properties
+      if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
+       // mesh element selection
+       aVtkView->SetSelectionProp(aSelColor.red()/255., 
+                                  aSelColor.green()/255.,
+                                  aSelColor.blue()/255., 
+                                  SW );
+       // tolerances
+       aVtkView->SetSelectionTolerance(SP1, SP2);
+
+       // pre-selection
+       aVtkView->SetPreselectionProp(aPreColor.red()/255., 
+                                     aPreColor.green()/255.,
+                                     aPreColor.blue()/255., 
+                                     PW);
        // update actors
        vtkRenderer* aRenderer = aVtkView->getRenderer();
        vtkActorCollection *aCollection = aRenderer->GetActors();
        aCollection->InitTraversal();
        while(vtkActor *anAct = aCollection->GetNextActor()){
          if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
-           anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
+           anActor->SetHighlightColor(aHiColor.red()/255., 
+                                      aHiColor.green()/255.,
                                       aHiColor.blue()/255.);
-           anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
+           anActor->SetPreHighlightColor(aPreColor.red()/255., 
+                                         aPreColor.green()/255.,
                                          aPreColor.blue()/255.);
          }
        }
+      }
     }
   }
 
 
   //----------------------------------------------------------------------------
-  SVTK_InteractorStyle* GetInteractorStyle(SUIT_ViewWindow *theWindow){
-    if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow)){
-      if(SVTK_RenderWindowInteractor* anInteractor = aWnd->getRWInteractor()){
-       return dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
-      }
-    }
+  SVTK_Selector* 
+  GetSelector(SUIT_ViewWindow *theWindow)
+  {
+    if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow))
+      return aWnd->GetSelector();
+
     return NULL;
   }
 
   void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
-                SVTK_InteractorStyle* theStyle)
+                SVTK_Selector* theSelector)
   {
-    if (theStyle)
-      theStyle->SetFilter(theFilter);
+    if (theSelector)
+      theSelector->SetFilter(theFilter);
   }
 
-  Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_InteractorStyle* theStyle)
+  Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_Selector* theSelector)
   {
-    return theStyle->GetFilter(theId);
+    return theSelector->GetFilter(theId);
   }
 
-  bool IsFilterPresent(int theId, SVTK_InteractorStyle* theStyle)
+  bool IsFilterPresent(int theId, SVTK_Selector* theSelector)
   {
-    return theStyle->IsFilterPresent(theId);
+    return theSelector->IsFilterPresent(theId);
   }
 
-  void RemoveFilter(int theId, SVTK_InteractorStyle* theStyle)
+  void RemoveFilter(int theId, SVTK_Selector* theSelector)
   {
-    theStyle->RemoveFilter(theId);
+    theSelector->RemoveFilter(theId);
   }
 
-  void RemoveFilters(SVTK_InteractorStyle* theStyle)
+  void RemoveFilters(SVTK_Selector* theSelector)
   {
-    for ( int id = SMESHGUI_NodeFilter; theStyle && id < SMESHGUI_LastFilter; id++ )
-      theStyle->RemoveFilter( id );
+    for ( int id = SMESHGUI_NodeFilter; theSelector && id < SMESHGUI_LastFilter; id++ )
+      theSelector->RemoveFilter( id );
   }
 
   bool IsValid(SALOME_Actor* theActor, int theCellId,
-              SVTK_InteractorStyle* theStyle)
+              SVTK_Selector* theSelector)
   {
-    return theStyle->IsValid(theActor,theCellId);
+    return theSelector->IsValid(theActor,theCellId);
   }
 
 
index f94695cd58bd313e827965d3afc549aae22e2922..c597fade7c55f5b830d7d0519f2a185b1fb3ed8c 100644 (file)
@@ -34,7 +34,6 @@ class SUIT_Study;
 class SUIT_ViewWindow;
 class SUIT_ViewManager;
 
-class SVTK_InteractorStyle;
 class SVTK_ViewWindow;
 class SVTK_Selector;
 
@@ -119,25 +118,25 @@ namespace SMESH{
 
 
   //----------------------------------------------------------------------------
-  SVTK_InteractorStyle
-    GetInteractorStyle (SUIT_ViewWindow* = GetActiveWindow());
+  SVTK_Selector
+    GetSelector(SUIT_ViewWindow* = GetActiveWindow());
 
   void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
-                 SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+                 SVTK_Selector* theSelector = GetSelector());
 
   Handle(VTKViewer_Filter) 
-    GetFilter (int theId, SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+    GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
 
   bool IsFilterPresent (int theId, 
-                       SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+                       SVTK_Selector* theSelector = GetSelector());
 
   void RemoveFilter (int theId, 
-                    SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+                    SVTK_Selector* theSelector = GetSelector());
 
-  void RemoveFilters (SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+  void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
 
   bool IsValid (SALOME_Actor* theActor, int theCellId,
-               SVTK_InteractorStyle* theStyle = GetInteractorStyle());
+               SVTK_Selector* theSelector = GetSelector());
 
   //----------------------------------------------------------------------------
   int GetNameOfSelectedNodes(SVTK_Selector* theSelector,