diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index c7494b8c7..234f1c6a4 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -53,11 +53,15 @@ QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const { - if ( p == "isVisible" ) return QtxValue( isVisible( ind ) ); - else if ( p == "type" ) return QtxValue( typeName( ind ) ); - else if ( p == "displaymode" ) return QtxValue( displayMode( ind ) ); - - return SalomeApp_Selection::param( ind, p ); +// if ( p == "isVisible" ) return QtxValue( isVisible( ind ) ); +// parameter isVisible is calculated in base SalomeApp_Selection +// else + if( p == "type" ) + return QtxValue( typeName( ind ) ); + else if ( p == "displaymode" ) + return QtxValue( displayMode( ind ) ); + else + return SalomeApp_Selection::param( ind, p ); } QString GEOMGUI_Selection::typeName( const int index ) const diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 18a2df6ec..4ee4823dd 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -256,26 +256,6 @@ GEOM_Displayer::~GEOM_Displayer() { } -//================================================================= -/*! - * GetActiveView - * Get active study frame, returns 0 if no open study frame - */ -//================================================================= -SALOME_View* GEOM_Displayer::GetActiveView() -{ - SUIT_Session* session = SUIT_Session::session(); - if ( SUIT_Application* app = session->activeApplication() ) { - if ( SalomeApp_Application* sApp = dynamic_cast( app ) ) { - if( SUIT_ViewManager* vman = sApp->activeViewManager() ) { - if ( SUIT_ViewModel* vmod = vman->getViewModel() ) - return dynamic_cast( vmod ); - } - } - } - return 0; -} - //================================================================= /*! * GEOM_Displayer::Display @@ -289,7 +269,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) { - SALOME_Prs* prs = buildPresentation( theIO, vf ); + SALOME_Prs* prs = buildPresentation( theIO->getEntry(), vf ); if ( prs ) { @@ -369,25 +349,6 @@ void GEOM_Displayer::Erase( GEOM::GEOM_Object_ptr theObj, } } -//================================================================= -/*! - * GEOM_Displayer::EraseAll - * Erase all objects in the current viewer - */ -//================================================================= -void GEOM_Displayer::EraseAll ( const bool forced, - const bool updateViewer, - SALOME_View* theViewFrame ) -{ - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - - if ( vf ) { - vf->EraseAll( forced ); - if ( updateViewer ) - vf->Repaint(); - } -} - //================================================================= /*! * GEOM_Displayer::Redisplay @@ -479,19 +440,6 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, const bool updat UpdateViewer(); } -//================================================================= -/*! - * GEOM_Displayer::UpdateViewer - * Update current viewer - */ -//================================================================= -void GEOM_Displayer::UpdateViewer() -{ - SALOME_View* vf = GetActiveView(); - if ( vf ) - vf->Repaint(); -} - //================================================================= /*! * GEOM_Displayer::Update @@ -801,7 +749,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) * [ internal ] */ //================================================================= -SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, +SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame ) { SALOME_Prs* prs = 0; @@ -811,9 +759,11 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveOb if ( myViewFrame ) { - prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 ); + prs = SalomeApp_Displayer::buildPresentation( entry, theViewFrame ); if ( prs ) { + Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject(); + theIO->setEntry( entry.latin1() ); if ( !theIO.IsNull() ) { // set interactive object diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 18be72e31..4091324b3 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -34,6 +34,7 @@ #include "SALOME_ListIO.hxx" #include #include +#include #include @@ -63,7 +64,7 @@ class SUIT_SelectionFilter; #define GEOMGUI_WNT_EXPORT #endif -class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SALOME_Displayer +class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SalomeApp_Displayer { public: @@ -107,14 +108,6 @@ public: void Redisplay ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); - /* Erase all objects displayed in the given or active view */ - void EraseAll ( const bool forced = false, - const bool updateViewer = true, - SALOME_View* theViewFrame = 0 ); - - /* Update current viewer */ - void UpdateViewer(); - /* build presentation accordint to the current viewer type*/ SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr ); SALOME_Prs* BuildPrs ( const TopoDS_Shape& ); @@ -153,14 +146,12 @@ public: void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); void GlobalSelection( const TColStd_MapOfInteger&, const bool = false ); - static SALOME_View* GetActiveView(); SalomeApp_Study* getStudy() const {return myStudy;} protected: /* internal methods */ /* Builds presentation accordint to the current viewer type */ - SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, - SALOME_View* theViewFrame = 0 ); + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); /* Sets interactive object */ void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 4f72ceb79..79c0e3868 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -29,6 +29,7 @@ #include "GeometryGUI.h" #include "GEOMGUI_OCCSelector.h" #include "GEOMGUI_Selection.h" +#include "GEOM_Displayer.h" #include #include @@ -180,6 +181,8 @@ GeometryGUI::GeometryGUI() : myOCCSelectors.setAutoDelete( true ); myVTKSelectors.setAutoDelete( true ); + + myDisplayer = 0; } //======================================================================= @@ -1065,10 +1068,10 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( 8034 ), "client='OCCViewer' and selcount>0", true ); mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( 216 ), -1, -1 ); // display - mgr->setRule( action( 216 ), "(selcount>0) and (((isActiveView=true) and (($type in {'Shape' 'Group'} and isVisible=false) or type='Component'))" + mgr->setRule( action( 216 ), "(selcount>0) and (((isActiveView=true) and (($type in {'Shape' 'Group'} and (not isVisible)) or type='Component'))" "or ((isActiveView=false) and ($type in {'Shape' 'Group' 'Component'})))", true ); mgr->insert( action( 215 ), -1, -1 ); // erase - mgr->setRule( action( 215 ), "(isActiveView=true) and (($type in {'Shape' 'Group'} and isVisible=true and selcount>0) or (type='Component' and selcount=1))", true ); + mgr->setRule( action( 215 ), "(isActiveView=true) and (($type in {'Shape' 'Group'} and isVisible and selcount>0) or (type='Component' and selcount=1))", true ); mgr->insert( action( 214 ), -1, -1 ); // erase All mgr->setRule( action( 214 ), "client='OCCViewer' or client='VTKViewer'", true ); mgr->insert( action( 213 ), -1, -1 ); // display only @@ -1613,3 +1616,10 @@ void GeometryGUI::createPreferences() void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) { } + +SalomeApp_Displayer* GeometryGUI::displayer() +{ + if( !myDisplayer ) + myDisplayer = new GEOM_Displayer( dynamic_cast( getApp()->activeStudy() ) ); + return myDisplayer; +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 854dbc615..d671e02ab 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -88,6 +88,7 @@ public: // Destructor ~GeometryGUI(); + virtual SalomeApp_Displayer* displayer(); virtual void initialize( CAM_Application* ); virtual QString engineIOR() const; @@ -181,6 +182,8 @@ private: QPtrList myOCCSelectors; QPtrList myVTKSelectors; + + SalomeApp_Displayer* myDisplayer; }; #endif