From c0790b80d51ab5ee2655b6cfe2ea7c91b4feb8e5 Mon Sep 17 00:00:00 2001 From: gdd Date: Mon, 26 Sep 2011 16:22:58 +0000 Subject: [PATCH] rnc : added Texture in the available display modes of the pop up menu --- src/DisplayGUI/DisplayGUI.cxx | 19 ++++++++++++------- .../EntityGUI_FeatureDetectorDlg.cxx | 2 +- src/GEOMGUI/GEOM_Displayer.cxx | 2 ++ src/GEOMGUI/GeometryGUI.cxx | 5 +++++ src/GEOMGUI/GeometryGUI_Operations.h | 1 + src/OBJECT/GEOM_AISShape.cxx | 14 +++++++------- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 53c04c204..bbcd7853b 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -128,6 +128,9 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) case GEOMOp::OpShading: // POPUP MENU - DISPLAY MODE - SHADING ChangeDisplayMode( 1 ); break; + case GEOMOp::OpTexture: // POPUP MENU - DISPLAY MODE - TEXTURE + ChangeDisplayMode( 3 ); + break; case GEOMOp::OpVectors: // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION ChangeDisplayMode( 2 ); break; @@ -543,20 +546,22 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); else if ( mode == 1 ) ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); - if (mode == 2 ) { + else if ( mode == 3 ) + ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false ); + else if (mode == 2 ) { Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); if ( !aSh.IsNull() ) { - vectorMode = !aSh->isShowVectors(); + vectorMode = !aSh->isShowVectors(); aSh->SetDisplayVectors(vectorMode); ic->RecomputePrsOnly(interIter.Value()); } } } - if(mode == 0 || mode == 1) { - aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode); - } else if (mode == 2) { - aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode); - } + if(mode == 0 || mode == 1) { + aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode); + } else if (mode == 2) { + aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode); + } } } ic->UpdateCurrentViewer(); diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx index e597f78e2..62376c1a8 100644 --- a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -740,7 +740,7 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects ) GEOM::GEOM_IBlocksOperations_var aBlocksOperations = myGeomGUI->GetGeomGen()->GetIBlocksOperations( getStudyId() ); GEOM::GEOM_Object_var aFace = aBlocksOperations->MakeQuad4Vertices(P1,P2,P3,P4); getDisplayer()->SetTexture(theImgFileName.toStdString()); - getDisplayer()->SetDisplayMode((Standard_Integer) StdSelect_DM_HLR); + getDisplayer()->SetDisplayMode( 3 ); // OCCViewer_Viewer* anOCCViewer =((OCCViewer_ViewWindow*)theViewWindow)->getViewManager())->getOCCViewer(); // Handle(AIS_InteractiveContext) aContext = anOCCViewer->getAISContext(); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 880b98a3e..2769ab63d 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -652,6 +652,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) } else useObjColor = true; }else { + MESSAGE("myDisplayMode = "<< myDisplayMode) AISShape->SetDisplayMode( myDisplayMode ); AISShape->SetShadingColor( myShadingColor ); } @@ -731,6 +732,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str())); AISShape->SetTextureMapOn(); AISShape->DisableTextureModulate(); + AISShape->SetDisplayMode(3); // AISShape->SetDisplayMode( (Standard_Integer) StdSelect_DM_HLR ); } else diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 4881c4e10..db3aba2b1 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -428,6 +428,7 @@ void GeometryGUI::OnGUIEvent( int id ) case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME case GEOMOp::OpShading: // POPUP MENU - SHADING + case GEOMOp::OpTexture: // POPUP MENU - TEXTURE case GEOMOp::OpVectors: // POPUP MENU - VECTORS libName = "DisplayGUI"; break; @@ -797,6 +798,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true ); createGeomAction( GEOMOp::OpShading, "POP_SHADING", "", 0, true ); + createGeomAction( GEOMOp::OpTexture, "POP_TEXTURE", "", 0, true ); createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true ); createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" ); createGeomAction( GEOMOp::OpColor, "POP_COLOR" ); @@ -1146,6 +1148,9 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule ); + mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe + mgr->setRule( action( GEOMOp::OpTexture ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpTexture), clientOCCorVTK + " and displaymode='Texture'", QtxPopupMgr::ToggleRule ); mgr->insert( separator(), dispmodeId, -1 ); mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule ); diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index f891de5a7..93bfd2a42 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -64,6 +64,7 @@ namespace GEOMOp { OpWireframe = 2200, // POPUP MENU - DISPLAY MODE - WIREFRAME OpShading = 2201, // POPUP MENU - DISPLAY MODE - SHADING OpVectors = 2202, // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION + OpTexture = 2203, // POPUP MENU - DISPLAY MODE - TEXTURE // BasicGUI ------------------//-------------------------------- OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index 860d6c14c..f50b29ed0 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -168,15 +168,15 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent { if (IsInfinite()) aPrs->SetInfiniteState(Standard_True); //pas de prise en compte lors du FITALL - StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode; - - switch (d) { - case StdSelect_DM_Wireframe: +// StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode; + std::cout<<"aMode = "<ShadingAspect()->Aspect()->SetDistinguishOn(); @@ -207,9 +207,9 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent AIS_Shape::Compute(aPresentationManager, aPrs, aMode); break; } - case StdSelect_DM_HLR: + case 3: //StdSelect_DM_HLR: { - AIS_TexturedShape::Compute(aPresentationManager, aPrs, 3); + AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode); break; } } -- 2.39.2