From: jfa Date: Wed, 20 Jul 2005 08:42:03 +0000 (+0000) Subject: Sinchronize clipped presentation in all 3D views; update highlighting box X-Git-Tag: V3_0_1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e8835498e5c78dfb6b134f1a2b5ed65c1723377;p=modules%2Fvisu.git Sinchronize clipped presentation in all 3D views; update highlighting box --- diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 68f4b0c2..02cdbb9a 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -63,10 +63,8 @@ namespace VISU { void RenderViewWindow (SVTK_ViewWindow* vw) { if (vw) { -//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { - vw->getRenderer()->ResetCameraClippingRange(); - vw->Repaint(); -//} + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); } } @@ -512,7 +510,8 @@ void VisuGUI_ClippingDlg::ClickOnApply() tr("BUT_OK") ); } - VISU::RenderViewWindow(aViewWindow); + //VISU::RenderViewWindow(aViewWindow); + VISU::RepaintViewWindows(myVisuGUI, myIO); } } @@ -544,6 +543,7 @@ void VisuGUI_ClippingDlg::onSelectionChanged() if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) { Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO); + myIO = anIO; if (CORBA::is_nil(anObject)) return; PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index c0786edb..b7f7fc5c 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -2,6 +2,8 @@ #ifndef DIALOGBOX_CLIPPING_H #define DIALOGBOX_CLIPPING_H +#include "SALOME_InteractiveObject.hxx" + #include "QtxDblSpinBox.h" // QT Includes @@ -67,6 +69,7 @@ public: private: SalomeApp_SelectionMgr* mySelectionMgr; + Handle(SALOME_InteractiveObject) myIO; VisuGUI * myVisuGUI; VISU::Prs3d_i * myPrs3d; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 419b7181..c53d8af9 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -627,7 +627,7 @@ namespace VISU return NULL; } - VISU_Actor* + VISU_Actor* PublishInView(const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs) { @@ -644,9 +644,9 @@ namespace VISU return aActor; } - VISU_Actor* + VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs, + VISU::Prs3d_i* thePrs, bool theDispOnly) { SVTK_ViewWindow* vw = GetViewWindow( theModule ); @@ -661,15 +661,15 @@ namespace VISU for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){ if(!SALOME_Actor::SafeDownCast(anActor)) continue; - if(anActor->IsA("VISU_Actor")){ + if(anActor->IsA("VISU_Actor")){ anVISUActor = VISU_Actor::SafeDownCast(anActor); - VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); + VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); if(aPrs == NULL) continue; if (thePrs == aPrs) { aResActor = anVISUActor->GetParent(); thePrs->UpdateActor(aResActor); aResActor->VisibilityOn(); - + } else if (theDispOnly) { anVISUActor->GetParent()->VisibilityOff(); } else { @@ -677,15 +677,42 @@ namespace VISU } else if (theDispOnly && anActor->GetVisibility()) { anActor->VisibilityOff(); } else { - } + } } - if (aResActor) + if (aResActor) return aResActor; anVISUActor = PublishInView( theModule, thePrs ); return anVISUActor; } + void + RepaintViewWindows (const SalomeApp_Module* theModule, + const Handle(SALOME_InteractiveObject)& theIObject) + { + TViewWindows aViewWindows; + if (SalomeApp_Application* anApp = theModule->getApp()) { + ViewManagerList aViewManagerList; + anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList); + QPtrListIterator anIter (aViewManagerList); + while (SUIT_ViewManager* aViewManager = anIter.current()) { + QPtrVector aViews = aViewManager->getViews(); + for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) { + if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) { + if (SVTK_ViewWindow* vw = dynamic_cast(aViewWindow)) { + if (vw->isVisible(theIObject)) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); + vw->highlight(theIObject, true, true); + } + } + } + } + ++anIter; + } + } + } + VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, const char* theEntry) @@ -732,8 +759,8 @@ namespace VISU } catch (std::runtime_error& ex) { INFOS(ex.what()); QApplication::restoreOverrideCursor(); - SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), + SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), QObject::tr("BUT_OK")); TViewWindows aViewWindows = GetViews(theModule); @@ -789,7 +816,7 @@ namespace VISU } if ( !theCurve->IsAuto() ) { plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() ); - plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); + plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); SALOMEDS::Color color = theCurve->GetColor(); plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) ); } @@ -813,9 +840,9 @@ namespace VISU } } - void - PlotTable(const SalomeApp_Module* theModule, - VISU::Table_i* table, + void + PlotTable(const SalomeApp_Module* theModule, + VISU::Table_i* table, int theDisplaying) { SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); // create if necessary @@ -825,7 +852,7 @@ namespace VISU if ( !aPlot ) return; - if ( theDisplaying == VISU::eDisplayOnly ) + if ( theDisplaying == VISU::eDisplayOnly ) aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); @@ -863,8 +890,8 @@ namespace VISU } void - PlotCurve(const SalomeApp_Module* theModule, - VISU::Curve_i* theCurve, + PlotCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* theCurve, int theDisplaying) { SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); @@ -874,7 +901,7 @@ namespace VISU if ( !aPlot ) return; -// if ( theDisplaying == VISU::eDisplayOnly ) +// if ( theDisplaying == VISU::eDisplayOnly ) // aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); @@ -896,8 +923,8 @@ namespace VISU } void - PlotContainer(const SalomeApp_Module* theModule, - VISU::Container_i* container, + PlotContainer(const SalomeApp_Module* theModule, + VISU::Container_i* container, int theDisplaying) { SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); @@ -907,7 +934,7 @@ namespace VISU if ( !aPlot ) return; - if ( theDisplaying == VISU::eDisplayOnly ) + if ( theDisplaying == VISU::eDisplayOnly ) aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); @@ -918,7 +945,7 @@ namespace VISU if ( theCurve && theCurve->IsValid() ) { SPlot2d_Curve* plotCurve = dynamic_cast (aView->getCurveByIO(new SALOME_InteractiveObject (theCurve->GetEntry(), "", ""))); - + UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); if ( plotCurve && theDisplaying == VISU::eErase ) { @@ -940,7 +967,7 @@ namespace VISU if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) { VISU::Table_i* pTable = dynamic_cast(VISU::GetServant(aTable).in()); VISU::Container_i* pContainer = dynamic_cast(VISU::GetServant(aContainer).in()); - + if ( pContainer && pTable ) { for ( int i = 2; i <= pTable->GetNbRows(); i++ ) { CORBA::Object_var aNewCurve = GetVisuGen( theModule )->CreateCurve( pTable->_this(), 1, i ); diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 4e8a5630..996776bb 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -132,6 +132,14 @@ namespace VISU { VISU::Prs3d_i* thePrs, bool theDispOnly = false); + /*! + * \brief Repaint all SVTK view windows, where the given object is displayed. + * \param theModule - is used to access application. + * \param theIObject - is supposed to be selected (is highlighted in this method). + */ + void RepaintViewWindows(const SalomeApp_Module* theModule, + const Handle(SALOME_InteractiveObject)& theIObject); + VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, const char* theEntry); VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,