mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 18:00:35 +05:00
bug fixes with popup menus.
This commit is contained in:
parent
8ace3710d8
commit
5013150a88
@ -19,6 +19,9 @@
|
|||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
|
|
||||||
#include <SOCC_Prs.h>
|
#include <SOCC_Prs.h>
|
||||||
|
#include <SVTK_Prs.h>
|
||||||
|
#include <SALOME_Actor.h>
|
||||||
|
#include <vtkActorCollection.h>
|
||||||
|
|
||||||
#include <OCCViewer_ViewModel.h>
|
#include <OCCViewer_ViewModel.h>
|
||||||
|
|
||||||
@ -38,13 +41,14 @@ QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
|
|||||||
{
|
{
|
||||||
QtxValue val( SalomeApp_Selection::param( ind, p ) );
|
QtxValue val( SalomeApp_Selection::param( ind, p ) );
|
||||||
if ( !val.isValid() ) {
|
if ( !val.isValid() ) {
|
||||||
if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) );
|
if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) );
|
||||||
else if ( p == "isOCC" ) val = QtxValue( isOCC() );
|
else if ( p == "isOCC" ) val = QtxValue( isOCC() );
|
||||||
else if ( p == "type" ) val = QtxValue( typeName( ind ) );
|
else if ( p == "type" ) val = QtxValue( typeName( ind ) );
|
||||||
else if ( p == "displaymode" ) val = QtxValue( displayMode( ind ) );
|
else if ( p == "displaymode" ) val = QtxValue( displayMode( ind ) );
|
||||||
|
else if ( p == "isActiveViewer" ) val = QtxValue( isActiveViewer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
|
printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -113,8 +117,23 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // assuming VTK
|
else { // assuming VTK
|
||||||
|
SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
|
||||||
}
|
vtkActorCollection* lst = vtkPrs->GetObjects();
|
||||||
|
if ( lst ) {
|
||||||
|
lst->InitTraversal();
|
||||||
|
vtkActor* actor = lst->GetNextActor();
|
||||||
|
if ( actor ) {
|
||||||
|
SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
|
||||||
|
if ( salActor ) {
|
||||||
|
int dm = salActor->getDisplayMode();
|
||||||
|
if ( dm == 0 )
|
||||||
|
return "Wireframe";
|
||||||
|
else if ( dm == 1 )
|
||||||
|
return "Shading";
|
||||||
|
} // if ( salome actor )
|
||||||
|
} // if ( actor )
|
||||||
|
} // if ( lst == vtkPrs->GetObjects() )
|
||||||
|
} // if VTK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -157,3 +176,8 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
|
|||||||
}
|
}
|
||||||
return GEOM::GEOM_Object::_nil();
|
return GEOM::GEOM_Object::_nil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GEOMGUI_Selection::isActiveViewer() const
|
||||||
|
{
|
||||||
|
return ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() != 0 );
|
||||||
|
}
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool isVisible( const int ) const;
|
bool isVisible( const int ) const;
|
||||||
bool isOCC() const;
|
bool isOCC() const;
|
||||||
|
bool isActiveViewer() const;
|
||||||
QString typeName( const int ) const;
|
QString typeName( const int ) const;
|
||||||
QString displayMode( const int ) const;
|
QString displayMode( const int ) const;
|
||||||
|
|
||||||
|
@ -955,13 +955,13 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
mgr->setRule( action( 8034 ), "$client in {'OCCViewer'} and selcount>0", true );
|
mgr->setRule( action( 8034 ), "$client in {'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 (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true );
|
mgr->setRule( action( 216 ), "$isActiveViewer in {true} and selcount>0 and (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true );
|
||||||
mgr->insert( action( 215 ), -1, -1 ); // erase
|
mgr->insert( action( 215 ), -1, -1 ); // erase
|
||||||
mgr->setRule( action( 215 ), "selcount>0 and (($type in {'Shape' 'Group'} and $isVisible in {true}) or ($type in {'Component'} and selcount=1))", true );
|
mgr->setRule( action( 215 ), "$isActiveViewer in {true} and selcount>0 and (($type in {'Shape' 'Group'} and $isVisible in {true}) or ($type in {'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 in {'OCCViewer' 'VTKViewer'}", true );
|
mgr->setRule( action( 214 ), "$isActiveViewer in {true} and $client in {'OCCViewer' 'VTKViewer'}", true );
|
||||||
mgr->insert( action( 213 ), -1, -1 ); // display only
|
mgr->insert( action( 213 ), -1, -1 ); // display only
|
||||||
mgr->setRule( action( 213 ), "selcount>0 and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true );
|
mgr->setRule( action( 213 ), "$isActiveViewer in {true} and selcount>0 and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true );
|
||||||
mgr->insert( separator(), -1, -1 );
|
mgr->insert( separator(), -1, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user