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
{
}
-//=================================================================
-/*!
- * 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
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf )
{
- SALOME_Prs* prs = buildPresentation( theIO, vf );
+ SALOME_Prs* prs = buildPresentation( theIO->getEntry(), vf );
if ( prs )
{
}
}
-//=================================================================
-/*!
- * 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
UpdateViewer();
}
-//=================================================================
-/*!
- * GEOM_Displayer::UpdateViewer
- * Update current viewer
- */
-//=================================================================
-void GEOM_Displayer::UpdateViewer()
-{
- SALOME_View* vf = GetActiveView();
- if ( vf )
- vf->Repaint();
-}
-
//=================================================================
/*!
* GEOM_Displayer::Update
* [ 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;
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
#include "SALOME_ListIO.hxx"
#include <TopoDS_Shape.hxx>
#include <Quantity_Color.hxx>
+#include <SalomeApp_Displayer.h>
#include <list>
#define GEOMGUI_WNT_EXPORT
#endif
-class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SALOME_Displayer
+class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SalomeApp_Displayer
{
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& );
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; }
#include "GeometryGUI.h"
#include "GEOMGUI_OCCSelector.h"
#include "GEOMGUI_Selection.h"
+#include "GEOM_Displayer.h"
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
myOCCSelectors.setAutoDelete( true );
myVTKSelectors.setAutoDelete( true );
+
+ myDisplayer = 0;
}
//=======================================================================
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
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;
+}
// Destructor
~GeometryGUI();
+ virtual SalomeApp_Displayer* displayer();
virtual void initialize( CAM_Application* );
virtual QString engineIOR() const;
QPtrList<GEOMGUI_OCCSelector> myOCCSelectors;
QPtrList<SalomeApp_VTKSelector> myVTKSelectors;
+
+ SalomeApp_Displayer* myDisplayer;
};
#endif