From: apo Date: Thu, 2 Nov 2006 09:38:27 +0000 (+0000) Subject: To provide GUI functionality for creation new kind of presentations X-Git-Tag: WP1_2_3_06-10-2006~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=720f0531eee04127aea1d4f0bef752ef0db2344e;p=modules%2Fvisu.git To provide GUI functionality for creation new kind of presentations --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index ab1727f5..9a0937f0 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2471,7 +2471,7 @@ createPopupMenus() mgr->setRule( action( VISU_PLOT2D ), aRule, true ); // timestamp commands - aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'"; + aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}"; mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true ); mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true ); mgr->setRule( action( VISU_CUT_PLANES ), aRule, true ); @@ -3286,8 +3286,13 @@ void VisuGUI::OnPlot3dFromCutPlane() } GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos); - VISU::Plot3D_i* aPrs3d = CreatePrs3d(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(), - aFieldName.latin1(), aTimeStampId.toInt()); + VISU::Plot3D_i* aPrs3d = CreatePrs3d(this, + aTimeStampSObj, + aMeshName.latin1(), + (Entity)anEntity.toInt(), + aFieldName.latin1(), + aTimeStampId.toInt(), + ColoredPrs3d_i::EPublishUnderTimeStamp); if (aPrs3d) { SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0); diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 3cab58e2..37d38e66 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -258,7 +258,7 @@ initialize( CAM_Application* theApp ) mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 ); mgr->setRule( action( GAUSS_CREATE_PRS ), "client='ObjectBrowser' and selcount=1 " - "and type='VISU::TTIMESTAMP' " + "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} " "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} " "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ", true ); diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 62b46d51..3e245ca9 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -116,14 +116,15 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - int theTimeId) + int theTimeId, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { VISU::Result_var aResult; if (CheckResult(theModule,theTimeStamp,aResult)){ QApplication::setOverrideCursor(Qt::waitCursor); TPrs3d_i* aPrs3d = GetVisuGen(theModule)->template CreatePrs3d - (aResult,theMeshName,theEntity,theFieldName,theTimeId); + (aResult,theMeshName,theEntity,theFieldName,theTimeId,thePublishInStudyMode); QApplication::restoreOverrideCursor(); if(aPrs3d) return aPrs3d; @@ -142,7 +143,8 @@ namespace VISU bool CreatePrs3d(VisuGUI* theModule, _PTR(SObject) theTimeStamp, - const Handle(SALOME_InteractiveObject)& theIO) + const Handle(SALOME_InteractiveObject)& theIO, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp); @@ -172,7 +174,8 @@ namespace VISU aMeshName.latin1(), (Entity)anEntity.toInt(), aFieldName.latin1(), - aTimeStampId.toInt()); + aTimeStampId.toInt(), + thePublishInStudyMode); QApplication::restoreOverrideCursor(); if (aPrs3d) { @@ -227,7 +230,8 @@ namespace VISU _PTR(SObject) aTimeStampSObj; Handle(SALOME_InteractiveObject) anIO; - if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO)) + ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode; + if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode)) return; // Create new TViewWindow instance, if it does not exist. @@ -235,7 +239,7 @@ namespace VISU if (!GetViewWindow(theModule)) return; - if (!CreatePrs3d(theModule,aTimeStampSObj,anIO)) + if (!CreatePrs3d(theModule,aTimeStampSObj,anIO,aPublishInStudyMode)) return; theModule->application()->putInfo(QObject::tr("INF_DONE")); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index f9ea32df..212654c1 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -549,18 +549,24 @@ namespace VISU bool CheckTimeStamp(const SalomeApp_Module* theModule, _PTR(SObject)& theSObject, - Handle(SALOME_InteractiveObject)* theIO) + const Handle(SALOME_InteractiveObject)& theIO, + ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode) { - Handle(SALOME_InteractiveObject) anIO; + Handle(SALOME_InteractiveObject) anIO = theIO; CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); - if (theIO) - *theIO = anIO; if (!anIO.IsNull() && anIO->hasEntry()){ _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); theSObject = aStudy->FindObjectID(anIO->getEntry()); QString aValue = getValue(theSObject,"myType"); - if (aValue.toInt() == int(VISU::TTIMESTAMP)) + if (aValue.toInt() == int(VISU::TTIMESTAMP)){ + thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp; return true; + } + if (aValue.toInt() == int(VISU::TFIELD)){ + thePublishInStudyMode = ColoredPrs3d_i::EPublishIndependently; + if(theSObject->FindSubObject(2,theSObject)) + return true; + } } SUIT_MessageBox::warn1(GetDesktop(theModule), QObject::tr("WRN_VISU"), diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 0e4258a0..fc53c2c2 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -31,6 +31,7 @@ #include "SALOME_InteractiveObject.hxx" #include "VISUConfig.hh" +#include "VISU_ColoredPrs3d_i.hh" #include "SALOMEDSClient_Study.hxx" @@ -52,7 +53,8 @@ class SalomeApp_Module; class SalomeApp_Study; class VisuGUI; -namespace VISU { +namespace VISU +{ class Prs3d_i; class Result_i; class Table_i; @@ -114,7 +116,8 @@ namespace VISU { // SObject type bool CheckTimeStamp(const SalomeApp_Module* theModule, _PTR(SObject)& theSObject, - Handle(SALOME_InteractiveObject)* theIO = NULL); + const Handle(SALOME_InteractiveObject)& theIO, + ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode); VISU::Result_i* CheckResult(const SalomeApp_Module* theModule, _PTR(SObject) theSource, VISU::Result_var& theResult); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 4041be75..be840816 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -980,13 +980,15 @@ VISU::ColoredPrs3d_i myName = GenerateName().latin1(); CORBA::String_var anIOR = GetID(); std::string aFatherEntry = FindOrCreate3DPresentationsFolder(GetStudyDocument()); + aComment.sprintf("myComment=%s", + GetComment()); CreateAttributes(GetStudyDocument(), aFatherEntry, "", anIOR.in(), myName, "", - "", + aComment.latin1(), true); SetSObject(GetStudyDocument()->FindObjectIOR(anIOR)); } diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 1b7b5e89..efce440a 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -166,7 +166,8 @@ namespace VISU const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, - CORBA::Double theIteration) + CORBA::Double theIteration, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp) { if(myStudyDocument->GetProperties()->IsLocked()) return NULL; @@ -176,7 +177,7 @@ namespace VISU Mutex mt(myMutex); if(Result_i* aResult = dynamic_cast(GetServant(theResult).in())){ if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){ - TPrs3d_i* aPresent = new TPrs3d_i(aResult); + TPrs3d_i* aPresent = new TPrs3d_i(aResult,thePublishInStudyMode); if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration)) return aPresent; aPresent->_remove_ref();