string aRefFatherEntry = GetRefFatherEntry();
QString aComment;
aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
- GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
+ GetComment(),
+ VISU::TRESULT,
+ myFileInfo.filePath().latin1(),
myInitFileName.c_str()); // Restoring of Python dump
- string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
- anIOR,myName.c_str(),"",aComment.latin1(),true);
+ string aResultEntry =
+ CreateAttributes(myStudyDocument,
+ aSComponentEntry,
+ aRefFatherEntry.c_str(),
+ anIOR,
+ myName.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aResultEntry;
mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
if(!CORBA::is_nil(theSObject)){
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
- aMeshName.c_str(),aMesh.myDim);
- string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
- "",aMeshName.c_str(),"",aComment.latin1(),true);
- if(aMeshOnEntityMap.empty()) continue;
- aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
- string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
- "","Families","",aComment.latin1(),true);
+ aMeshName.c_str(),
+ aMesh.myDim);
+ string aMeshEntry =
+ CreateAttributes(myStudyDocument,
+ aResultEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ aMeshName.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aMeshEntry;
+ if(aMeshOnEntityMap.empty())
+ continue;
+ aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
+ aMeshName.c_str());
+ string aSubMeshesEntry =
+ CreateAttributes(myStudyDocument,
+ aMeshEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ "Families",
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aSubMeshesEntry;
//Import entities and according families
aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
typedef map<VISU::TEntity,string> TEntity2Entry;
for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
- VISU::TENTITY,aMeshName.c_str(),anEntity);
+ VISU::TENTITY,
+ aMeshName.c_str(),
+ anEntity);
string anEntityName;
switch(anEntity){
case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
default:
throw std::runtime_error("Build >> Value of entity is incorrect!");
}
- aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
- "",anEntityName.c_str(),"",aComment.latin1(),true);
+ string aTmpEntry =
+ CreateAttributes(myStudyDocument,
+ aSubMeshesEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ anEntityName.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ aEntity2Entry[anEntity] = aTmpEntry;
+ myComment2EntryMap[aComment.latin1()] = aTmpEntry;
const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
const string& aFamilyName = aFamilyMapIter->first;
const VISU::TFamily& aFamily = aFamilyMapIter->second;
aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
- "",aFamilyName.c_str(),"",aComment.latin1(),true);
+ VISU::TFAMILY,
+ aMeshName.c_str(),
+ anEntity,
+ aFamilyName.c_str());
+ aTmpEntry =
+ CreateAttributes(myStudyDocument,
+ aEntity2Entry[anEntity].c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ aFamilyName.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aTmpEntry;
}
}
//Importing groups
const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
if(aGroupMap.size() > 0){
- aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
- string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
- "","Groups","",aComment.latin1(),true);
+ aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+ aMeshName.c_str());
+ string aGroupsEntry =
+ CreateAttributes(myStudyDocument,
+ aMeshEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ "Groups",
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aGroupsEntry;
VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
const string& aGroupName = aGroupMapIter->first;
aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
- VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
- string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
- "",aGroupName.c_str(),"",aComment.latin1(),true);
+ VISU::TGROUP,
+ aMeshName.c_str(),
+ aGroupName.c_str());
+ string aGroupEntry =
+ CreateAttributes(myStudyDocument,
+ aGroupsEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ aGroupName.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aGroupEntry;
const VISU::TGroup& aGroup = aGroupMapIter->second;
const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
const string& aFamilyName = aFamilyAndEntity.first;
const VISU::TEntity& anEntity = aFamilyAndEntity.second;
aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
+ VISU::TFAMILY,
+ aMeshName.c_str(),
+ anEntity,
+ aFamilyName.c_str());
+ string anEntry = myComment2EntryMap[aComment.latin1()];
CreateReference(myStudyDocument,aGroupEntry,anEntry);
}
}
VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
if(!isFieldEntryCreated){
- aComment.sprintf("myComment=FIELDS;myMeshName=%s",aMeshName.c_str());
- aFieldsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
- "","Fields","",aComment.latin1(),true);
+ aComment.sprintf("myComment=FIELDS;myMeshName=%s",
+ aMeshName.c_str());
+ aFieldsEntry =
+ CreateAttributes(myStudyDocument,
+ aMeshEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ "Fields",
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aFieldsEntry;
isFieldEntryCreated = true;
}
const string& aFieldName = aFieldMapIter->first;
const VISU::TField::TValField& aValField = aField.myValField;
QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField.myUnitNames[0]);
aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
- VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
- string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
- "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
+ VISU::TFIELD,
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aValField.size(),
+ aField.myNbComp);
+ string aFieldEntry =
+ CreateAttributes(myStudyDocument,
+ aFieldsEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ aFieldNameWithUnit.latin1(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aFieldEntry;
CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
for(; aValFieldIter != aValField.end(); aValFieldIter++){
int aTimeStamp = aValFieldIter->first;
const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
- VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
+ VISU::TTIMESTAMP,
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aTimeStamp,
+ aField.myNbComp);
string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
- CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
- "",aTimeStampId.c_str(),"",aComment.latin1(),true);
+ string aTimeStampEntry =
+ CreateAttributes(myStudyDocument,
+ aFieldEntry.c_str(),
+ aRefFatherEntry.c_str(),
+ "",
+ aTimeStampId.c_str(),
+ "",
+ aComment.latin1(),
+ true);
+ myComment2EntryMap[aComment.latin1()] = aTimeStampEntry;
}
}
}
const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
+std::string VISU::Result_i::GetEntry(const std::string& theComment) const
+{
+ TComment2EntryMap::const_iterator aComment2EntryMapIter = myComment2EntryMap.find(theComment);
+ if(aComment2EntryMapIter == myComment2EntryMap.end())
+ return "";
+ return aComment2EntryMapIter->second;
+}
VISU::Result_i::~Result_i() {
MESSAGE("Result_i::~Result_i() - this = "<<this);