From: apo Date: Wed, 4 Jul 2007 09:22:30 +0000 (+0000) Subject: To implement DumpPython functionality for VISU MULTIPR extension X-Git-Tag: T_MULTIPR_INDUS_Dump_python~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd60fd8fffb00006f37fa6a2062269ea034f07a0;p=modules%2Fvisu.git To implement DumpPython functionality for VISU MULTIPR extension --- diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index d40749fd..733b0a81 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -122,6 +122,17 @@ namespace VISU } + //--------------------------------------------------------------------------- + inline + std::string + GetBoolean(bool theArgument) + { + if(theArgument) + return "True"; + + return "False"; + } + //--------------------------------------------------------------------------- typedef void (*TDumpToPython)(SALOMEDS::Study_ptr theStudy, CORBA::Boolean theIsPublished, @@ -840,6 +851,7 @@ namespace VISU } } + //--------------------------------------------------------------------------- void @@ -880,15 +892,15 @@ namespace VISU theStr<IsGroupsDone()<<")"<< + GetBoolean(aServant->IsGroupsDone())<<")"<< endl; theStr<IsFieldsDone()<<", "<< - aServant->IsMinMaxDone()<<")"<< + GetBoolean(aServant->IsFieldsDone())<<", "<< + GetBoolean(aServant->IsMinMaxDone())<<")"<< endl; - theStr<GetMeshNames(); + if (aMeshNames->length() > 0) { + for(size_t aMeshId = 0; aMeshId < aMeshNames->length(); aMeshId++){ + CORBA::String_var aMeshName = aMeshNames[aMeshId]; + VISU::Result::EntityNames_var aParts = aServant->GetPartNames(aMeshName); + if (aParts->length() > 0) { + for(size_t aPartId = 0; aPartId < aParts->length(); aPartId++){ + CORBA::String_var aPart = aParts[aPartId]; + VISU::Result::Resolution aResolution = aServant->GetResolution(aMeshName, aPart); + std::string aParam; + switch(aResolution){ + case VISU::Result::FULL: + aParam = "VISU.Result.FULL"; + break; + case VISU::Result::MEDIUM: + aParam = "VISU.Result.MEDIUM"; + break; + case VISU::Result::LOW: + aParam = "VISU.Result.LOW"; + break; + case VISU::Result::HIDDEN: + aParam = "VISU.Result.HIDDEN"; + break; + } + theStr<second; if(aResolution == theResolution) return; diff --git a/src/VISU_I/VISU_MultiResult_i.hh b/src/VISU_I/VISU_MultiResult_i.hh index 40961be7..b98c962c 100644 --- a/src/VISU_I/VISU_MultiResult_i.hh +++ b/src/VISU_I/VISU_MultiResult_i.hh @@ -64,7 +64,7 @@ namespace VISU virtual VISU::Result::EntityNames* - GetParts(const char* theMeshName); + GetPartNames(const char* theMeshName); virtual VISU::Result::Resolutions* diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 915c63fc..e1ea7dfe 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -372,7 +372,7 @@ VISU::Result_i aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s", GetComment(), myFileInfo.filePath().latin1(), - myInitFileName.c_str()); // Restoring of Python dump + GetFileName().c_str()); // Restoring of Python dump std::string aResultEntry = CreateAttributes(myStudy, aSComponentEntry.in(), @@ -486,7 +486,8 @@ Create(const char* theFileName) { try { myFileInfo.setFile(theFileName); - myInitFileName = myFileInfo.filePath().latin1(); + if(!myIsBuildParts) + SetFileName(myFileInfo.filePath().latin1()); myName = VISU::GenerateName(myFileInfo.fileName()).latin1(); if(mySourceId == eRestoredFile){ std::string aTmpDir(SALOMEDS_Tool::GetTmpDir()); @@ -534,7 +535,7 @@ VISU::Result_i string aCompDataType = GetComponentDataType(theMedSObject); myFileInfo.setFile(aCompDataType.c_str()); - myInitFileName = aCompDataType; + SetFileName(aCompDataType); myName = VISU::GenerateName("aResult").latin1(); @@ -563,7 +564,7 @@ VISU::Result_i string aCompDataType = "MED"; myFileInfo.setFile(aCompDataType.c_str()); - myInitFileName = aCompDataType; + SetFileName(aCompDataType); myName = VISU::GenerateName("aResult").latin1(); @@ -716,7 +717,7 @@ VISU::Result_i myStudyDocument = mySObject->GetStudy(); mySComponent = mySObject->GetFatherComponent(); myName = VISU::Storable::FindValue(theMap, "myName").latin1(); - myInitFileName = VISU::Storable::FindValue(theMap, "myInitFileName").latin1(); + SetFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1()); SALOMEDS::SObject_var aRefSObj, aTargetRefSObj; if (mySObject->FindSubObject(1, aRefSObj) && @@ -828,7 +829,7 @@ VISU::Result_i aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s", GetComment(), myFileInfo.filePath().latin1(), - myInitFileName.c_str()); // Restoring of Python dump + GetFileName().c_str()); // Restoring of Python dump SALOMEDS::GenericAttribute_var anAttr; if (!theSObject->FindAttribute(anAttr, "AttributeString")) throw std::runtime_error("Build - There is no AttributeString for the SObject !!!"); @@ -1154,7 +1155,7 @@ VISU::Result_i VISU::Result::EntityNames* VISU::Result_i -::GetParts(const char* theMeshName) +::GetPartNames(const char* theMeshName) { VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames(); return aResult._retn(); @@ -1246,7 +1247,7 @@ VISU::Result_i { if(MYDEBUG) MESSAGE(GetComment()); Storable::DataToStream(theStr,"myName",myName.c_str()); - Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str()); + Storable::DataToStream(theStr,"myInitFileName",GetFileName().c_str()); Storable::DataToStream(theStr,"myCreationId",myCreationId); Storable::DataToStream(theStr,"myIsBuildFields",myIsFieldsDone); Storable::DataToStream(theStr,"myIsBuildMinMax",myIsMinMaxDone); @@ -1257,28 +1258,36 @@ VISU::Result_i //--------------------------------------------------------------- const std::string& VISU::Result_i -::GetName() const +::GetFileName() const { - return myName; + return myInitFileName; } -const QFileInfo& +void VISU::Result_i -::GetFileInfo() const +::SetFileName(const std::string& theFileName) { - return myFileInfo; + myInitFileName = theFileName; } +//--------------------------------------------------------------- const std::string& VISU::Result_i -::GetFileName() const +::GetName() const { - return myInitFileName; + return myName; } +const QFileInfo& +VISU::Result_i +::GetFileInfo() const +{ + return myFileInfo; +} + const VISU::Result_i::ECreationId& VISU::Result_i ::GetCreationId() const diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 31bdfae5..bfb6f9b7 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -160,7 +160,7 @@ namespace VISU virtual VISU::Result::EntityNames* - GetParts(const char* theMeshName); + GetPartNames(const char* theMeshName); virtual VISU::Result::Resolutions* @@ -326,15 +326,20 @@ namespace VISU const std::string& theFieldName = "", CORBA::Long theTimeStampNumber = -1); + virtual + const std::string& + GetFileName() const; + + virtual + void + SetFileName(const std::string& theFileName); + const std::string& GetName() const; const QFileInfo& GetFileInfo() const; - const std::string& - GetFileName() const; - const ECreationId& GetCreationId() const;