From 4e16cb08fb518932595877d368df6857bb3e804b Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 6 Aug 2008 06:02:40 +0000 Subject: [PATCH] Fix for bug 0016100 : EDF 429 VISU : Automatic creation of a view Plot2D when we display a curve. --- src/VISUGUI/VisuGUI_Displayer.cxx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 62e7f6c7..9593731e 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -28,6 +28,7 @@ #include "VisuGUI_Displayer.h" +#include "VisuGUI.h" #include "VisuGUI_Tools.h" #include "VISU_ViewManager_i.hh" #include "VISU_Actor.h" @@ -123,7 +124,12 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOM } } - if(SPlot2d_Viewer* aViewer = dynamic_cast(aView)){ + SPlot2d_Viewer* aViewer = dynamic_cast(aView); + if(!aViewer && (aType==VISU::TCURVE || aType==VISU::TCONTAINER || aType==VISU::TTABLE)) + if(VisuGUI* aVisuGUI = dynamic_cast(myApp->activeModule())) + aViewer = VISU::GetPlot2dViewer( (SalomeApp_Module*)aVisuGUI, true ); + + if(aViewer){ SUIT_ViewManager* aViewManager = aViewer->getViewManager(); SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); Plot2d_ViewWindow* aViewWindow = dynamic_cast( aWindow ); @@ -281,6 +287,13 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie if( study->isComponent( entry ) ) return true; + if( dynamic_cast( VISU::GetServant( anObj ).in() ) + || + dynamic_cast( VISU::GetServant( anObj ).in() ) + || + dynamic_cast(VISU::GetServant( anObj ).in() ) ) + return true; + if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type()) { VISU::Base_i* aBase = dynamic_cast(VISU::GetServant(anObj).in()); @@ -296,13 +309,6 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie return dynamic_cast(aBase); } - else if( viewer_type==SPlot2d_Viewer::Type() ) - { - VISU::Curve_i* aCurve = dynamic_cast( VISU::GetServant( anObj ).in() ); - VISU::Container_i* aCont = dynamic_cast( VISU::GetServant( anObj ).in() ); - VISU::Table_i* aTable = dynamic_cast(VISU::GetServant( anObj ).in() ); - return aCurve || aCont || aTable; - } else return false; } -- 2.39.2