mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
Bug fixed: if Plot2D viewer is active, then "computation" of popup crashed.
This commit is contained in:
parent
a28e157934
commit
0bfe0b990b
@ -24,6 +24,7 @@
|
||||
#include <vtkActorCollection.h>
|
||||
|
||||
#include <OCCViewer_ViewModel.h>
|
||||
#include <VTKViewer_ViewModel.h>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
@ -82,14 +83,13 @@ bool GEOMGUI_Selection::isVisible( const int index ) const
|
||||
|
||||
bool GEOMGUI_Selection::isOCC() const
|
||||
{
|
||||
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
return ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
|
||||
return activeViewType( OCCViewer_Viewer::Type() );
|
||||
}
|
||||
|
||||
QString GEOMGUI_Selection::displayMode( const int index ) const
|
||||
{
|
||||
SALOME_View* view = GEOM_Displayer::GetActiveView();
|
||||
if ( view ) {
|
||||
if ( view /*fix for 9320==>*/&& ( isOCC() || activeViewType( VTKViewer_Viewer::Type() ) ) ) {
|
||||
SALOME_Prs* prs = view->CreatePrs( entry( index ) );
|
||||
if ( prs ) {
|
||||
if ( isOCC() ) { // assuming OCC
|
||||
@ -117,7 +117,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // assuming VTK
|
||||
else if ( activeViewType( VTKViewer_Viewer::Type() ) ) { // assuming VTK
|
||||
SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
|
||||
vtkActorCollection* lst = vtkPrs->GetObjects();
|
||||
if ( lst ) {
|
||||
@ -178,8 +178,31 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::isActiveViewer() const
|
||||
SUIT_ViewWindow* activeVW()
|
||||
{
|
||||
return ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() != 0 );
|
||||
SUIT_Session* session = SUIT_Session::session();
|
||||
if ( session ) {
|
||||
SUIT_Application* app = session->activeApplication();
|
||||
if ( app ) {
|
||||
SUIT_Desktop* desk = app->desktop();
|
||||
if ( desk )
|
||||
return desk->activeWindow();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::isActiveViewer() const
|
||||
{
|
||||
return ( activeVW != 0 );
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::activeViewType( const QString& type ) const
|
||||
{
|
||||
SUIT_ViewWindow* win = activeVW();
|
||||
if ( win ) {
|
||||
SUIT_ViewManager* vm = win->getViewManager();
|
||||
return ( vm && vm->getType() == type );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ private:
|
||||
|
||||
bool isComponent( const int ) const;
|
||||
GEOM::GEOM_Object_ptr getObject( const int ) const;
|
||||
bool activeViewType( const QString& ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -953,10 +953,10 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
|
||||
mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe
|
||||
mgr->setRule( action( 80311 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true );
|
||||
mgr->setRule( action( 80311 ), "$displaymode in {'Wireframe'}", false );
|
||||
mgr->setRule( action( 80311 ), "$client in {'OCCViewer' 'VTKViewer'} and $displaymode in {'Wireframe'}", false );
|
||||
mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading
|
||||
mgr->setRule( action( 80312 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true );
|
||||
mgr->setRule( action( 80312 ), "$displaymode in {'Shading'}", false );
|
||||
mgr->setRule( action( 80312 ), "$client in {'OCCViewer' 'VTKViewer'} and $displaymode in {'Shading'}", false );
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
mgr->insert( action( 8032 ), -1, -1 ); // color
|
||||
mgr->setRule( action( 8032 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true );
|
||||
|
Loading…
Reference in New Issue
Block a user