]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Intorduce "Arange actors" functionality in Gauss Viewer
authorapo <apo@opencascade.com>
Thu, 30 Nov 2006 11:41:26 +0000 (11:41 +0000)
committerapo <apo@opencascade.com>
Thu, 30 Nov 2006 11:41:26 +0000 (11:41 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_TimeAnimation.h

index 56eeb5942bed40f8f26067d8574c4b3983617881..c3783b2a9e55d63e1b97c471a2203a9957458ab2 100644 (file)
@@ -1877,9 +1877,8 @@ void
 VisuGUI
 ::OnArrangeActors()
 {
-  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if (vw) {
-    ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
+  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+    ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
     aDlg->exec();
     delete aDlg;
   }
@@ -2452,7 +2451,7 @@ VisuGUI
   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'", true );
   //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
 
-  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
+  mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0", true );
 
   // 3D presentations commands
   QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
index 876ab8365137b01e6e31f368816c74432241757a..baee6873e043cffc6b95be74d534715e44e4b0cc 100644 (file)
@@ -105,30 +105,34 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   myFieldLst->setSelected(0, true);
 }
 
-ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow)
+ArrangeDlg::ArrangeDlg(QWidget* theParent, 
+                      const SalomeApp_Module* theModule,
+                      SVTK_ViewWindow* theViewWindow)
   : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize |
             WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-    myAnimator(NULL), myViewWindow(theViewWindow)
+    myAnimator(NULL), 
+    myViewWindow(theViewWindow)
 {
   myCurrent = 0;
   init();
   QStringList aPrsNames;
-  vtkActor* anActor;
-  vtkActorCollection *anActColl = myViewWindow->getRenderer()->GetActors();
-  for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;) {
-    VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor);
-    if (anVISUActor)
-      if (anVISUActor->GetVisibility() != 0) {
-       VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
-       if (aPrs) {
-         if (!myPrsMap.contains(aPrs)) {
-           SALOMEDS::SObject_var aSObject = aPrs->GetSObject();
-           if(!aSObject->_is_nil()){
-             SALOMEDS::GenericAttribute_var anAttr;
+  vtkActorCollection *aCollection = myViewWindow->getRenderer()->GetActors();
+  aCollection->InitTraversal();
+  while(vtkActor* anActor = aCollection->GetNextActor()){
+    if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+      if(anVISUActor->GetVisibility() != 0){
+       if (VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d()){
+         if(!myPrsMap.contains(aPrs)){
+           Handle(SALOME_InteractiveObject) anIO = aPrs->GetIO();
+           if(!anIO->hasEntry())
+             continue;
+           SalomeApp_Study* aStudy = VISU::GetAppStudy(theModule);
+           VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anIO->getEntry());
+           if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+             _PTR(GenericAttribute) anAttr;
              if (aSObject->FindAttribute(anAttr, "AttributeName")) {
-               SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-               string aNam = aName->Value();
-               QString strIn(aNam.c_str());
+               _PTR(AttributeName) aName(anAttr);
+               QString strIn(aName->Value().c_str());
                aPrsNames.append(strIn);
                myPrsMap[aPrs] = myOffsets.count();
                Offset aOffs;
index 604cd24bc4e01c096528a04d86dadc0eafbc2862..dcaea8a0777ec3284ae8e5f48f4bc08d057cb0a2 100644 (file)
 #include <map>
 
 class VisuGUI;
+class SalomeApp_Module;
 class VISU_TimeAnimation;
 
-namespace VISU {
+namespace VISU 
+{
   class Prs3d_i;
 }
 
@@ -64,8 +66,13 @@ class ArrangeDlg: public QDialog
   enum { AutoMode, ManualMode };
   enum { XAxis, YAxis, ZAxis };
 
-  ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
-  ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
+  ArrangeDlg(QWidget* theParent, 
+            VISU_TimeAnimation* theAnimator);
+
+  ArrangeDlg(QWidget* theParent, 
+            const SalomeApp_Module* theModule,
+            SVTK_ViewWindow* theViewWindow);
+
   ~ArrangeDlg() {};
 
   int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }