From fe7d04d7ef72489b7276c289b6aecf9a091456d2 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 30 Nov 2006 11:41:26 +0000 Subject: [PATCH] Intorduce "Arange actors" functionality in Gauss Viewer --- src/VISUGUI/VisuGUI.cxx | 7 +++-- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 38 +++++++++++++++------------ src/VISUGUI/VisuGUI_TimeAnimation.h | 13 ++++++--- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 56eeb594..c3783b2a 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1877,9 +1877,8 @@ void VisuGUI ::OnArrangeActors() { - SVTK_ViewWindow* vw = GetActiveViewWindow(this); - if (vw) { - ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw); + if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(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 + "}"; diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 876ab836..baee6873 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -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(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(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; diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 604cd24b..dcaea8a0 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -37,9 +37,11 @@ #include 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()); } -- 2.39.2