- DisplayGUI* myDisplayGUI = new DisplayGUI();
-
- switch (theCommandID)
- {
- case 211: // MENU VIEW - WIREFRAME/SHADING
- {
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- QApplication::setOverrideCursor(waitCursor);
-
- VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- int themode = myRenderInter->GetDisplayMode();
- if(themode==0) {
- myRenderInter->SetDisplayMode(1);
- QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
- }
- else {
- myRenderInter->SetDisplayMode(0);
- QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
- }
-
- QApplication::restoreOverrideCursor();
- }
- else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- QApplication::setOverrideCursor(Qt::waitCursor);
-
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
- AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode();
- AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame);
-
- AIS_ListOfInteractive List;
- ic->DisplayedObjects(List);
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector(List1);
- List.Append(List1);
-
- AIS_ListIteratorOfListOfInteractive ite(List);
- while(ite.More()) {
- if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- ic->SetDisplayMode(aSh,Standard_Integer(newmode),true);
- }
- ite.Next();
- }
-
- ic->SetDisplayMode(newmode, Standard_False);
- if(newmode == 1)
- QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
- else
- QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
-
- QApplication::restoreOverrideCursor();
- }
- break;
- }
- case 212: // MENU VIEW - DISPLAY ALL
- {
- myDisplayGUI->OnDisplayAll();
- break;
- }
- case 213: // MENU VIEW - DISPLAY ONLY
- {
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
- myDisplayGUI->OnVTKDisplayOnly();
- else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
- myDisplayGUI->OnDisplayOnly();
- break;
- }
- case 214: // MENU VIEW - ERASE ALL
- {
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
- ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
- else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-
- ic->EraseAll(Standard_True, Standard_False);
- ic->Display(v3d->getTrihedron());
- }
- break;
- }
- case 215: // MENU VIEW - ERASE ONLY
- {
- myDisplayGUI->OnErase();
- break;
- }
- case 8031: // POPUP VIEWER - WIREFRAME/SHADING
- {
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- // VTK
- VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-
- QApplication::setOverrideCursor(Qt::waitCursor);
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IOS = It.Value();
- myRenderInter->SwitchRepresentation(IOS, false);
- }
- myRenderInter->Render();
- QApplication::restoreOverrideCursor();
- }
- else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- Standard_Boolean found;
- Handle(GEOM_AISShape) Shape = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true);
- if(!Shape.IsNull()) {
- AIS_DisplayMode mode = (AIS_DisplayMode)Shape->DisplayMode();
- if(mode == -1)
- mode = (AIS_DisplayMode)ic->DisplayMode();
-
- ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false);
- }
- }
- ic->UpdateCurrentViewer();
- }
- QApplication::restoreOverrideCursor();
- break;
- }
- default:
- {
- parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
- break;
- }
- }
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if (!app) return false;
+
+ LightApp_SelectionMgr *Sel = app->selectionMgr();
+ SALOME_ListIO selected;
+ Sel->selectedObjects( selected );
+
+ switch ( theCommandID ) {
+ case GEOMOp::OpDMWireframe: // MENU VIEW - DISPLAY MODE - WIREFRAME
+ SetDisplayMode( 0 );
+ break;
+ case GEOMOp::OpDMShading: // MENU VIEW - DISPLAY MODE - SHADING
+ SetDisplayMode( 1 );
+ break;
+ case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES
+ SetDisplayMode( 2 );
+ break;
+ case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+ DisplayAll();
+ break;
+ case GEOMOp::OpShowOnly: // POPUP MENU - SHOW ONLY
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+ DisplayOnly();
+ break;
+ case GEOMOp::OpHideAll: // MENU VIEW - HIDE ALL
+ EraseAll();
+ break;
+ case GEOMOp::OpHide: // POPUP MENU - HIDE
+ Erase();
+ break;
+ case GEOMOp::OpShow: // POPUP MENU - SHOW
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+ Display();
+ break;
+ case GEOMOp::OpSwitchVectors: // MENU VIEW - DISPLAY MODE - SHOW EDGE DIRECTION
+ SetVectorMode(!GetVectorMode());
+ getGeometryGUI()->action( GEOMOp::OpSwitchVectors )->setText
+ ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) );
+ getGeometryGUI()->menuMgr()->update();
+ break;
+ case GEOMOp::OpWireframe: // POPUP MENU - DISPLAY MODE - WIREFRAME
+ ChangeDisplayMode( 0 );
+ break;
+ case GEOMOp::OpShading: // POPUP MENU - DISPLAY MODE - SHADING
+ ChangeDisplayMode( 1 );
+ break;
+ case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
+ ChangeDisplayMode( 2 );
+ break;
+ case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE
+ ChangeDisplayMode( 3 );
+ break;
+ case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
+ ChangeDisplayMode( 4 );
+ break;
+ default:
+ app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+ break;
+ }
+ Sel->setSelectedObjects( selected );