mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
PAL9391
This commit is contained in:
parent
94656de789
commit
76e11e9eb1
@ -53,11 +53,15 @@ QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
|
|||||||
|
|
||||||
QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
|
QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
|
||||||
{
|
{
|
||||||
if ( p == "isVisible" ) return QtxValue( isVisible( ind ) );
|
// if ( p == "isVisible" ) return QtxValue( isVisible( ind ) );
|
||||||
else if ( p == "type" ) return QtxValue( typeName( ind ) );
|
// parameter isVisible is calculated in base SalomeApp_Selection
|
||||||
else if ( p == "displaymode" ) return QtxValue( displayMode( ind ) );
|
// else
|
||||||
|
if( p == "type" )
|
||||||
return SalomeApp_Selection::param( ind, p );
|
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
|
QString GEOMGUI_Selection::typeName( const int index ) const
|
||||||
|
@ -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
|
* GEOM_Displayer::Display
|
||||||
@ -289,7 +269,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
|
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
|
||||||
if ( vf )
|
if ( vf )
|
||||||
{
|
{
|
||||||
SALOME_Prs* prs = buildPresentation( theIO, vf );
|
SALOME_Prs* prs = buildPresentation( theIO->getEntry(), vf );
|
||||||
|
|
||||||
if ( prs )
|
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
|
* GEOM_Displayer::Redisplay
|
||||||
@ -479,19 +440,6 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, const bool updat
|
|||||||
UpdateViewer();
|
UpdateViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================
|
|
||||||
/*!
|
|
||||||
* GEOM_Displayer::UpdateViewer
|
|
||||||
* Update current viewer
|
|
||||||
*/
|
|
||||||
//=================================================================
|
|
||||||
void GEOM_Displayer::UpdateViewer()
|
|
||||||
{
|
|
||||||
SALOME_View* vf = GetActiveView();
|
|
||||||
if ( vf )
|
|
||||||
vf->Repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================
|
//=================================================================
|
||||||
/*!
|
/*!
|
||||||
* GEOM_Displayer::Update
|
* GEOM_Displayer::Update
|
||||||
@ -801,7 +749,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
|
|||||||
* [ internal ]
|
* [ internal ]
|
||||||
*/
|
*/
|
||||||
//=================================================================
|
//=================================================================
|
||||||
SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
|
SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
|
||||||
SALOME_View* theViewFrame )
|
SALOME_View* theViewFrame )
|
||||||
{
|
{
|
||||||
SALOME_Prs* prs = 0;
|
SALOME_Prs* prs = 0;
|
||||||
@ -811,9 +759,11 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveOb
|
|||||||
|
|
||||||
if ( myViewFrame )
|
if ( myViewFrame )
|
||||||
{
|
{
|
||||||
prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 );
|
prs = SalomeApp_Displayer::buildPresentation( entry, theViewFrame );
|
||||||
if ( prs )
|
if ( prs )
|
||||||
{
|
{
|
||||||
|
Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject();
|
||||||
|
theIO->setEntry( entry.latin1() );
|
||||||
if ( !theIO.IsNull() )
|
if ( !theIO.IsNull() )
|
||||||
{
|
{
|
||||||
// set interactive object
|
// set interactive object
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "SALOME_ListIO.hxx"
|
#include "SALOME_ListIO.hxx"
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <Quantity_Color.hxx>
|
#include <Quantity_Color.hxx>
|
||||||
|
#include <SalomeApp_Displayer.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class SUIT_SelectionFilter;
|
|||||||
#define GEOMGUI_WNT_EXPORT
|
#define GEOMGUI_WNT_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SALOME_Displayer
|
class GEOMGUI_WNT_EXPORT GEOM_Displayer : public SalomeApp_Displayer
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -107,14 +108,6 @@ public:
|
|||||||
void Redisplay ( const SALOME_ListIO& theIOList,
|
void Redisplay ( const SALOME_ListIO& theIOList,
|
||||||
const bool updateViewer = true );
|
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*/
|
/* build presentation accordint to the current viewer type*/
|
||||||
SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
|
SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
|
||||||
SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
|
SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
|
||||||
@ -153,14 +146,12 @@ public:
|
|||||||
void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
|
void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
|
||||||
void GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
|
void GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
|
||||||
|
|
||||||
static SALOME_View* GetActiveView();
|
|
||||||
SalomeApp_Study* getStudy() const {return myStudy;}
|
SalomeApp_Study* getStudy() const {return myStudy;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* internal methods */
|
/* internal methods */
|
||||||
/* Builds presentation accordint to the current viewer type */
|
/* Builds presentation accordint to the current viewer type */
|
||||||
SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
|
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
|
||||||
SALOME_View* theViewFrame = 0 );
|
|
||||||
|
|
||||||
/* Sets interactive object */
|
/* Sets interactive object */
|
||||||
void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; }
|
void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; }
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "GeometryGUI.h"
|
#include "GeometryGUI.h"
|
||||||
#include "GEOMGUI_OCCSelector.h"
|
#include "GEOMGUI_OCCSelector.h"
|
||||||
#include "GEOMGUI_Selection.h"
|
#include "GEOMGUI_Selection.h"
|
||||||
|
#include "GEOM_Displayer.h"
|
||||||
|
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
@ -180,6 +181,8 @@ GeometryGUI::GeometryGUI() :
|
|||||||
|
|
||||||
myOCCSelectors.setAutoDelete( true );
|
myOCCSelectors.setAutoDelete( true );
|
||||||
myVTKSelectors.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->setRule( action( 8034 ), "client='OCCViewer' and selcount>0", true );
|
||||||
mgr->insert( separator(), -1, -1 ); // -----------
|
mgr->insert( separator(), -1, -1 ); // -----------
|
||||||
mgr->insert( action( 216 ), -1, -1 ); // display
|
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 );
|
"or ((isActiveView=false) and ($type in {'Shape' 'Group' 'Component'})))", true );
|
||||||
mgr->insert( action( 215 ), -1, -1 ); // erase
|
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->insert( action( 214 ), -1, -1 ); // erase All
|
||||||
mgr->setRule( action( 214 ), "client='OCCViewer' or client='VTKViewer'", true );
|
mgr->setRule( action( 214 ), "client='OCCViewer' or client='VTKViewer'", true );
|
||||||
mgr->insert( action( 213 ), -1, -1 ); // display only
|
mgr->insert( action( 213 ), -1, -1 ); // display only
|
||||||
@ -1613,3 +1616,10 @@ void GeometryGUI::createPreferences()
|
|||||||
void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
|
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;
|
||||||
|
}
|
||||||
|
@ -88,6 +88,7 @@ public:
|
|||||||
// Destructor
|
// Destructor
|
||||||
~GeometryGUI();
|
~GeometryGUI();
|
||||||
|
|
||||||
|
virtual SalomeApp_Displayer* displayer();
|
||||||
virtual void initialize( CAM_Application* );
|
virtual void initialize( CAM_Application* );
|
||||||
virtual QString engineIOR() const;
|
virtual QString engineIOR() const;
|
||||||
|
|
||||||
@ -181,6 +182,8 @@ private:
|
|||||||
|
|
||||||
QPtrList<GEOMGUI_OCCSelector> myOCCSelectors;
|
QPtrList<GEOMGUI_OCCSelector> myOCCSelectors;
|
||||||
QPtrList<SalomeApp_VTKSelector> myVTKSelectors;
|
QPtrList<SalomeApp_VTKSelector> myVTKSelectors;
|
||||||
|
|
||||||
|
SalomeApp_Displayer* myDisplayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user