From: apo Date: Thu, 25 Aug 2005 11:16:01 +0000 (+0000) Subject: To provide a way to introduce new type of presentation X-Git-Tag: BR-D5-38-2003_D2005-12-09~106 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=935186c356496ec0f86294650723d9c90dbce7bf;p=modules%2Fvisu.git To provide a way to introduce new type of presentation --- diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 1b0b0fc3..13cc9994 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -91,7 +91,7 @@ msgid "VisuGUI_Module::VISU_CAMERA_MOVE_PREF" msgstr "Number of steps between two positions" msgid "VisuGUI_Module::MEN_GAUSS_CREATE_PRS" -msgstr "Create Gauss Points" +msgstr "Gauss Points" msgid "VVTK_ViewManager::VTK_VIEW_TITLE" msgstr "VISU scene:%1 - viewer:%2" diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 5b77c115..b26c2686 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -45,15 +45,16 @@ #include "VisuGUI_Prs3dTools.h" -#include "VISU_ScalarMap_i.hh" +#include "VISU_GaussPoints_i.hh" #include "VisuGUI_ScalarBarDlg.h" #include "VISU_Gen_i.hh" #include "VISU_Result_i.hh" #include "VISU_CutLines_i.hh" -#include "VisuGUI_Tools.h" #include "VISU_Actor.h" +#include "VisuGUI_Tools.h" +#include "VisuGUI_ActionsDef.h" #ifdef _DEBUG_ static int MYDEBUG = 1; @@ -63,6 +64,10 @@ static int MYDEBUG = 0; #define GAUSS_NEW_VIEWER 5100 #define GAUSS_CREATE_PRS 5200 +#define GAUSS_EDIT_PRS 5300 +#define GAUSS_ERASE_PRS 5400 +#define GAUSS_DISPLAY_PRS 5500 +#define GAUSS_DISPLAY_ONLY_PRS 5600 void CreateCurves( SalomeApp_Module* theModule, @@ -152,16 +157,57 @@ VisuGUI_Module createAction( GAUSS_NEW_VIEWER, tr("MEN_GAUSS_NEW_VIEWER"), QIconSet(), tr("MEN_GAUSS_NEW_VIEWER"), "", 0, this, false, this, SLOT(onCreateViewManager())); - createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), QIconSet(), - tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false, - this, SLOT(OnCreateGaussPoints())); - int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 ); int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); int gaussMenu = createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 ); + // Add actions to menus int aMenuId = createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 ); - createMenu( GAUSS_CREATE_PRS, aMenuId, 10 ); + //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 ); + + // Prepare popup menus + QString aSel_One_ObjBr("client='ObjectBrowser' and selcount=1"); + QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TGAUSSPOINTS'"); + QtxPopupMgr* mgr = popupMgr(); + QString aRule; + + createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), QIconSet(), + tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false, + this, SLOT(OnCreateGaussPoints())); + mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 ); + mgr->setRule( action( GAUSS_CREATE_PRS ), + aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'", true ); + + createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(), + VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false, + this, SLOT(OnEditGaussPoints())); + mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 ); + mgr->setRule( action( GAUSS_EDIT_PRS ), + "selcount=1 and type='VISU::TGAUSSPOINTS'", true ); + + aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')"; + + createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(), + VisuGUI::tr("MEN_ERASE"), "", 0, this, false, + this, SLOT(OnErasePrs())); + mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase + mgr->setRule( action( GAUSS_ERASE_PRS ), + aRule + " and (isVisible=true)", true ); + + createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(), + VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false, + this, SLOT(OnDisplayPrs())); + mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display + mgr->setRule( action( GAUSS_DISPLAY_PRS ), + aRule + " and ((isVisible=false and isActiveView=true) or (isActiveView=false))", true ); + + createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(), + VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false, + this, SLOT(OnDisplayOnlyPrs())); + mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only + mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), + aRule, true ); } //--------------------------------------------------------------- @@ -281,6 +327,18 @@ void VisuGUI_Module ::OnCreateGaussPoints() { - CreatePrs3d(this); + CreatePrs3d(this); } +void +VisuGUI_Module:: +OnEditGaussPoints() +{ + Handle(SALOME_InteractiveObject) anIO; + if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ + EditPrs3d(this, aPrs3d); + if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + aViewWindow->highlight(anIO, 1); + } + } +} diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index 034c31ae..25c66540 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -86,6 +86,10 @@ protected slots: void OnCreateGaussPoints(); + virtual + void + OnEditGaussPoints(); + protected: VISU::TViewerMap myViewerMap; }; diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index cdc0d819..72f3d95a 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -31,6 +31,8 @@ #include "VisuGUI_ViewTools.h" +#include + namespace VISU { class CutLines_i; @@ -80,13 +82,12 @@ namespace VISU VISU::Result_var aResult; if (CheckResult(theModule,theTimeStamp,aResult)){ QApplication::setOverrideCursor(Qt::waitCursor); - typedef typename TPrs3d_i::TInterface TPrs3d; - typename TPrs3d::_var_type aPrs3d = - GetVisuGen(theModule)->template Prs3dOnField + TPrs3d_i* aPrs3d = + GetVisuGen(theModule)->template CreatePrs3d (aResult,theMeshName,theEntity,theFieldName,theTimeId); QApplication::restoreOverrideCursor(); - if (!CORBA::is_nil(aPrs3d.in())) - return dynamic_cast(VISU::GetServant(aPrs3d.in()).in()); + if(aPrs3d) + return aPrs3d; } SUIT_MessageBox::warn1(GetDesktop(theModule), QObject::tr("WRN_VISU"), diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 4606134b..a4f91d61 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -162,7 +162,7 @@ namespace VISU return aStr; } - //************************************************************ + //------------------------------------------------------------ // Selection CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy, @@ -206,6 +206,25 @@ namespace VISU return CORBA::Object::_nil(); } + VISU::Prs3d_i* + GetPrsToModify(const SalomeApp_Module* theModule, + Handle(SALOME_InteractiveObject)* theIO, + VISU::Storable::TRestoringMap* theMap) + { + if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + return NULL; + + CORBA::Object_var anObject = GetSelectedObj(theModule, theIO); + if (CORBA::is_nil(anObject)) + return NULL; + + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); + if (!aServant.in()) + return NULL; + + return dynamic_cast(aServant.in()); + } + void Add(SalomeApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO) diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 2af898e6..63a767f4 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -82,6 +82,9 @@ namespace VISU { CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule, Handle(SALOME_InteractiveObject)* theIO = NULL, VISU::Storable::TRestoringMap* theMap = NULL); + VISU::Prs3d_i* GetPrsToModify(const SalomeApp_Module* theModule, + Handle(SALOME_InteractiveObject)* theIO = NULL, + VISU::Storable::TRestoringMap* theMap = NULL); void Add(SalomeApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO);