mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-31 03:40:35 +05:00
Fix for imp 0020845: EDF 1376 GUI : More shortcuts.
This commit is contained in:
parent
343553810e
commit
35a3b96395
@ -377,7 +377,11 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
||||||
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
||||||
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
|
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
|
||||||
|
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||||
|
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||||
case GEOMOp::OpIsos: // POPUP MENU - ISOS
|
case GEOMOp::OpIsos: // POPUP MENU - ISOS
|
||||||
|
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS
|
||||||
|
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
|
||||||
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
|
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
|
||||||
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
|
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
|
||||||
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
|
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
|
||||||
@ -572,7 +576,8 @@ void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e )
|
|||||||
// function : createGeomAction
|
// function : createGeomAction
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, const int accel, const bool toggle )
|
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel,
|
||||||
|
const int accel, const bool toggle, const QString& shortcutAction )
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
|
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
|
||||||
@ -585,11 +590,12 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS
|
|||||||
accel,
|
accel,
|
||||||
application()->desktop(),
|
application()->desktop(),
|
||||||
toggle,
|
toggle,
|
||||||
this, SLOT( OnGUIEvent() ) );
|
this, SLOT( OnGUIEvent() ),
|
||||||
|
shortcutAction );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : createGeomAction
|
// function : createOriginAndBaseVectors
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GeometryGUI::createOriginAndBaseVectors()
|
void GeometryGUI::createOriginAndBaseVectors()
|
||||||
@ -768,6 +774,19 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
||||||
|
|
||||||
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
||||||
|
|
||||||
|
// Create actions for increase/decrease transparency shortcuts
|
||||||
|
createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false,
|
||||||
|
"Geometry:Increase transparency");
|
||||||
|
createGeomAction( GEOMOp::OpDecrTransparency, "", "", 0, false,
|
||||||
|
"Geometry:Decrease transparency");
|
||||||
|
|
||||||
|
// Create actions for increase/decrease number of isolines
|
||||||
|
createGeomAction( GEOMOp::OpIncrNbIsos, "", "", 0, false,
|
||||||
|
"Geometry:Increase number of isolines");
|
||||||
|
createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false,
|
||||||
|
"Geometry:Decrease number of isolines");
|
||||||
|
|
||||||
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
|
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
|
||||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||||
|
|
||||||
|
@ -147,7 +147,8 @@ private:
|
|||||||
GEOMGUI* getLibrary( const QString& libraryName );
|
GEOMGUI* getLibrary( const QString& libraryName );
|
||||||
void createGeomAction( const int id, const QString& po_id,
|
void createGeomAction( const int id, const QString& po_id,
|
||||||
const QString& icon_id = QString(""),
|
const QString& icon_id = QString(""),
|
||||||
const int key = 0, const bool toggle = false );
|
const int key = 0, const bool toggle = false,
|
||||||
|
const QString& shortcutAction = QString() );
|
||||||
void createPopupItem( const int, const QString& clients, const QString& types,
|
void createPopupItem( const int, const QString& clients, const QString& types,
|
||||||
const bool isSingle = false, const int isVisible = -1,
|
const bool isSingle = false, const int isVisible = -1,
|
||||||
const bool isExpandAll = false, const bool isOCC = false,
|
const bool isExpandAll = false, const bool isOCC = false,
|
||||||
|
@ -40,10 +40,14 @@ namespace GEOMOp {
|
|||||||
OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT
|
OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT
|
||||||
OpColor = 1201, // POPUP MENU - COLOR
|
OpColor = 1201, // POPUP MENU - COLOR
|
||||||
OpTransparency = 1202, // POPUP MENU - TRANSPARENCY
|
OpTransparency = 1202, // POPUP MENU - TRANSPARENCY
|
||||||
OpIsos = 1203, // POPUP MENU - ISOS
|
OpIncrTransparency = 1203, // SHORTCUT - INCREASE TRANSPARENCY
|
||||||
OpAutoColor = 1204, // POPUP MENU - AUTO COLOR
|
OpDecrTransparency = 1204, // SHORTCUT - DECREASE TRANSPARENCY
|
||||||
OpNoAutoColor = 1205, // POPUP MENU - DISABLE AUTO COLOR
|
OpIsos = 1205, // POPUP MENU - ISOS
|
||||||
OpPointMarker = 1206, // POPUP MENU - POINT MARKER
|
OpIncrNbIsos = 1206, // SHORTCUT - INCREASE NB ISOS
|
||||||
|
OpDecrNbIsos = 1207, // SHORTCUT - DECREASE NB ISOS
|
||||||
|
OpAutoColor = 1208, // POPUP MENU - AUTO COLOR
|
||||||
|
OpNoAutoColor = 1209, // POPUP MENU - DISABLE AUTO COLOR
|
||||||
|
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
||||||
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
|
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
|
||||||
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
|
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
|
||||||
OpRename = 1252, // POPUP MENU - RENAME
|
OpRename = 1252, // POPUP MENU - RENAME
|
||||||
|
@ -334,9 +334,21 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
|||||||
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
|
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
|
||||||
OnTransparency();
|
OnTransparency();
|
||||||
break;
|
break;
|
||||||
|
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||||
|
OnChangeTransparency( true );
|
||||||
|
break;
|
||||||
|
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||||
|
OnChangeTransparency( false );
|
||||||
|
break;
|
||||||
case GEOMOp::OpIsos: // POPUP - ISOS
|
case GEOMOp::OpIsos: // POPUP - ISOS
|
||||||
OnNbIsos();
|
OnNbIsos();
|
||||||
break;
|
break;
|
||||||
|
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOLINES
|
||||||
|
OnNbIsos( INCR );
|
||||||
|
break;
|
||||||
|
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOLINES
|
||||||
|
OnNbIsos( DECR );
|
||||||
|
break;
|
||||||
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
||||||
OnAutoColor();
|
OnAutoColor();
|
||||||
break;
|
break;
|
||||||
|
@ -52,6 +52,8 @@ public:
|
|||||||
bool OnGUIEvent( int, SUIT_Desktop* );
|
bool OnGUIEvent( int, SUIT_Desktop* );
|
||||||
virtual void deactivate();
|
virtual void deactivate();
|
||||||
|
|
||||||
|
enum ActionType { SHOWDLG, INCR, DECR };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Import and export topology methods
|
// Import and export topology methods
|
||||||
bool Import();
|
bool Import();
|
||||||
@ -67,12 +69,15 @@ private:
|
|||||||
void OnDisableAutoColor();
|
void OnDisableAutoColor();
|
||||||
void OnColor();
|
void OnColor();
|
||||||
void OnTransparency();
|
void OnTransparency();
|
||||||
void OnNbIsos();
|
void OnNbIsos( ActionType actionType = SHOWDLG );
|
||||||
void OnDeflection();
|
void OnDeflection();
|
||||||
void OnSelectOnly(int mode);
|
void OnSelectOnly(int mode);
|
||||||
void OnShowHideChildren( bool );
|
void OnShowHideChildren( bool );
|
||||||
void OnPointMarker();
|
void OnPointMarker();
|
||||||
|
|
||||||
|
// Shortcut commands
|
||||||
|
void OnChangeTransparency( bool );
|
||||||
|
|
||||||
// Recursive deletion of object with children
|
// Recursive deletion of object with children
|
||||||
void removeObjectWithChildren( _PTR(SObject),
|
void removeObjectWithChildren( _PTR(SObject),
|
||||||
_PTR(Study),
|
_PTR(Study),
|
||||||
|
@ -399,7 +399,86 @@ void GEOMToolsGUI::OnTransparency()
|
|||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMToolsGUI::OnNbIsos()
|
void GEOMToolsGUI::OnChangeTransparency( bool increase )
|
||||||
|
{
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if ( !app )
|
||||||
|
return;
|
||||||
|
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||||
|
if ( !aSelMgr )
|
||||||
|
return;
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
aSelMgr->selectedObjects( selected );
|
||||||
|
if ( selected.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) FirstIOS = selected.First();
|
||||||
|
if ( FirstIOS.IsNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Delta
|
||||||
|
float delta = 0.01;
|
||||||
|
if ( !increase )
|
||||||
|
delta *= -1;
|
||||||
|
|
||||||
|
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||||
|
bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
|
||||||
|
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
||||||
|
|
||||||
|
if ( isVTK ) {
|
||||||
|
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
||||||
|
if ( !vtkVW )
|
||||||
|
return;
|
||||||
|
SVTK_View* aView = vtkVW->getView();
|
||||||
|
|
||||||
|
float transp = aView->GetTransparency(FirstIOS);
|
||||||
|
|
||||||
|
// Compute new transparency value
|
||||||
|
transp = transp + delta;
|
||||||
|
if ( transp < 0 )
|
||||||
|
transp = 0;
|
||||||
|
else if ( transp > 1 )
|
||||||
|
transp = 1;
|
||||||
|
|
||||||
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
|
aView->SetTransparency( It.Value(), transp );
|
||||||
|
}
|
||||||
|
aView->Repaint();
|
||||||
|
} // if ( isVTK )
|
||||||
|
|
||||||
|
else if ( isOCC ) {
|
||||||
|
GEOMBase* gb = new GEOMBase();
|
||||||
|
Standard_Boolean found;
|
||||||
|
Handle(GEOM_AISShape) aisShape;
|
||||||
|
|
||||||
|
aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, found );
|
||||||
|
if( !found )
|
||||||
|
return;
|
||||||
|
float transp = aisShape->Transparency();
|
||||||
|
|
||||||
|
// Compute new transparency value
|
||||||
|
transp = transp + delta;
|
||||||
|
if ( transp < 0 )
|
||||||
|
transp = 0;
|
||||||
|
else if ( transp > 1 )
|
||||||
|
transp = 1;
|
||||||
|
|
||||||
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
||||||
|
if ( !vm )
|
||||||
|
return;
|
||||||
|
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
|
aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), found );
|
||||||
|
if ( found ) {
|
||||||
|
ic->SetTransparency( aisShape, transp, false );
|
||||||
|
ic->Redisplay( aisShape, Standard_False, Standard_True );
|
||||||
|
}
|
||||||
|
} // for...
|
||||||
|
ic->UpdateCurrentViewer();
|
||||||
|
} // if ( isOCC )
|
||||||
|
}
|
||||||
|
|
||||||
|
void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||||
{
|
{
|
||||||
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||||
|
|
||||||
@ -419,27 +498,44 @@ void GEOMToolsGUI::OnNbIsos()
|
|||||||
int UIso = CurDrawer->UIsoAspect()->Number();
|
int UIso = CurDrawer->UIsoAspect()->Number();
|
||||||
int VIso = CurDrawer->VIsoAspect()->Number();
|
int VIso = CurDrawer->VIsoAspect()->Number();
|
||||||
|
|
||||||
GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
|
int newNbUIso = -1;
|
||||||
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
|
int newNbVIso = -1;
|
||||||
|
|
||||||
NbIsosDlg->setU( UIso );
|
if ( actionType == SHOWDLG ) {
|
||||||
NbIsosDlg->setV( VIso );
|
GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
|
||||||
|
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
|
||||||
|
|
||||||
if ( NbIsosDlg->exec() ) {
|
NbIsosDlg->setU( UIso );
|
||||||
SUIT_OverrideCursor();
|
NbIsosDlg->setV( VIso );
|
||||||
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
|
||||||
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
|
||||||
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
|
||||||
|
|
||||||
int nbUIso = NbIsosDlg->getU();
|
if ( NbIsosDlg->exec() ) {
|
||||||
int nbVIso = NbIsosDlg->getV();
|
SUIT_OverrideCursor();
|
||||||
|
|
||||||
|
newNbUIso = NbIsosDlg->getU();
|
||||||
|
newNbVIso = NbIsosDlg->getV();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( actionType == INCR || actionType == DECR ) {
|
||||||
|
int delta = 1;
|
||||||
|
if (actionType == DECR)
|
||||||
|
delta = -1;
|
||||||
|
|
||||||
|
newNbUIso = UIso + delta;
|
||||||
|
newNbVIso = VIso + delta;
|
||||||
|
|
||||||
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
|
if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
|
||||||
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ic->SetLocalAttributes(CurObject, CurDrawer);
|
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
||||||
ic->Redisplay(CurObject);
|
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
}
|
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
||||||
|
|
||||||
|
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) );
|
||||||
|
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) );
|
||||||
|
|
||||||
|
ic->SetLocalAttributes(CurObject, CurDrawer);
|
||||||
|
ic->Redisplay(CurObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -492,27 +588,45 @@ void GEOMToolsGUI::OnNbIsos()
|
|||||||
anActor->GetNbIsos(UIso,VIso);
|
anActor->GetNbIsos(UIso,VIso);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int newNbUIso = -1;
|
||||||
|
int newNbVIso = -1;
|
||||||
|
|
||||||
GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
|
if ( actionType == SHOWDLG ) {
|
||||||
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
|
GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
|
||||||
|
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
|
||||||
|
|
||||||
NbIsosDlg->setU( UIso );
|
NbIsosDlg->setU( UIso );
|
||||||
NbIsosDlg->setV( VIso );
|
NbIsosDlg->setV( VIso );
|
||||||
|
|
||||||
if ( NbIsosDlg->exec() ) {
|
if ( NbIsosDlg->exec() ) {
|
||||||
SUIT_OverrideCursor();
|
SUIT_OverrideCursor();
|
||||||
|
|
||||||
while( anAct!=NULL ) {
|
newNbUIso = NbIsosDlg->getU();
|
||||||
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
|
newNbVIso = NbIsosDlg->getV();
|
||||||
// There are no casting to needed actor.
|
|
||||||
UIso = NbIsosDlg->getU();
|
|
||||||
VIso = NbIsosDlg->getV();
|
|
||||||
int aIsos[2]={UIso,VIso};
|
|
||||||
anActor->SetNbIsos(aIsos);
|
|
||||||
}
|
|
||||||
anAct = aCollection->GetNextActor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( actionType == INCR || actionType == DECR ) {
|
||||||
|
int delta = 1;
|
||||||
|
if (actionType == DECR)
|
||||||
|
delta = -1;
|
||||||
|
|
||||||
|
newNbUIso = UIso + delta;
|
||||||
|
newNbVIso = VIso + delta;
|
||||||
|
|
||||||
|
if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( anAct!=NULL ) {
|
||||||
|
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
|
||||||
|
// There are no casting to needed actor.
|
||||||
|
int aIsos[2]={newNbUIso,newNbVIso};
|
||||||
|
anActor->SetNbIsos(aIsos);
|
||||||
|
}
|
||||||
|
anAct = aCollection->GetNextActor();
|
||||||
|
}
|
||||||
|
view->Repaint();
|
||||||
} // end vtkviewer
|
} // end vtkviewer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user