This commit is contained in:
asl 2005-09-27 06:32:15 +00:00
parent 94656de789
commit 76e11e9eb1
5 changed files with 32 additions and 74 deletions

View File

@ -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

View File

@ -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<SalomeApp_Application*>( app ) ) {
if( SUIT_ViewManager* vman = sApp->activeViewManager() ) {
if ( SUIT_ViewModel* vmod = vman->getViewModel() )
return dynamic_cast<SALOME_View*>( 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

View File

@ -34,6 +34,7 @@
#include "SALOME_ListIO.hxx"
#include <TopoDS_Shape.hxx>
#include <Quantity_Color.hxx>
#include <SalomeApp_Displayer.h>
#include <list>
@ -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; }

View File

@ -29,6 +29,7 @@
#include "GeometryGUI.h"
#include "GEOMGUI_OCCSelector.h"
#include "GEOMGUI_Selection.h"
#include "GEOM_Displayer.h"
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
@ -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<SalomeApp_Study*>( getApp()->activeStudy() ) );
return myDisplayer;
}

View File

@ -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<GEOMGUI_OCCSelector> myOCCSelectors;
QPtrList<SalomeApp_VTKSelector> myVTKSelectors;
SalomeApp_Displayer* myDisplayer;
};
#endif