aStudyBuilder->Addreference(aNewObj,aRefSObj);
}
- string
+ std::string
CreateAttributes(_PTR(Study) theStudyDocument,
const string& theFatherEntry,
const string& theIOR,
const string& theName,
- const string& thePersistentRef,
const string& theComment,
CORBA::Boolean theCreateNew)
{
_PTR(AttributeName) aName (anAttr);
aName->SetValue(theName);
}
- if (thePersistentRef != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePersistentRef");
- _PTR(AttributePersistentRef) aPRef (anAttr);
- aPRef->SetValue(thePersistentRef);
- }
if (theComment != "") {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeComment");
_PTR(AttributeComment) aCmnt (anAttr);
return aNewObj->GetID();
}
+ void
+ UpdateAttributes(_PTR(Study) theStudyDocument,
+ const string& theEntry,
+ const string& theIOR,
+ const string& theName,
+ const string& theComment)
+ {
+ TLock aLock(myMutex);
+
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry);
+
+ _PTR(GenericAttribute) anAttr;
+ if (theIOR != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
+ _PTR(AttributeIOR) anIOR (anAttr);
+ anIOR->SetValue(theIOR);
+ }
+ if (theName != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeName");
+ _PTR(AttributeName) aName (anAttr);
+ aName->SetValue(theName);
+ }
+ if (theComment != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeComment");
+ _PTR(AttributeComment) aCmnt (anAttr);
+ aCmnt->SetValue(theComment);
+ }
+ }
+
+
//---------------------------------------------------------------
struct TResultManager
{
VISU_Convertor* theInput,
CORBA::Boolean* theIsDone,
std::string theResultEntry,
+ CORBA::Boolean theIsBuildGroups,
+ CORBA::Boolean theIsBuildFields,
_PTR(Study) theStudy)
{
if(*theIsDone)
theResultEntry,
"",
aMeshName,
- "",
aComment.latin1(),
true);
aMesh->myEntry,
"",
"Families",
- "",
aComment.latin1(),
true);
+
+ if(theIsBuildGroups){
+ aMesh->myGroupsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ "",
+ "",
+ "",
+ true);
+ }
+
+ if(theIsBuildFields){
+ aMesh->myFieldsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ "",
+ "",
+ "",
+ true);
+ }
+
//Import entities
TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
aSubMeshesEntry,
"",
anEntityName.c_str(),
- "",
aComment.latin1(),
true);
}
aMeshOnEntity->myEntry,
"",
aFamilyName,
- "",
aComment.latin1(),
true);
}
if(!aGroupMap.empty()){
aComment.sprintf("myComment=GROUPS;myMeshName=%s",
aMeshName.c_str());
- string aGroupsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "Groups",
- "",
- aComment.latin1(),
- true);
+ UpdateAttributes(theStudy,
+ aMesh->myGroupsEntry,
+ "",
+ "Groups",
+ aComment.latin1());
TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
const string& aGroupName = aGroupMapIter->first;
TGROUP,aMeshName.c_str(),aGroupName.c_str());
aGroup->myEntry =
CreateAttributes(theStudy,
- aGroupsEntry,
+ aMesh->myGroupsEntry,
"",
aGroupName,
- "",
aComment.latin1(),
true);
const TFamilySet& aFamilySet = aGroup->myFamilySet;
continue;
//Import fields
- string aFieldsEntry;
- bool anIsFieldsEntryCreated = false;
+ bool anIsFieldsEntryUpdated = false;
TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
- if(!anIsFieldsEntryCreated){
+ if(!anIsFieldsEntryUpdated){
aComment.sprintf("myComment=FIELDS;myMeshName=%s",
aMeshName.c_str());
- aFieldsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "Fields",
- "",
- aComment.latin1(),
- true);
- anIsFieldsEntryCreated = true;
+ UpdateAttributes(theStudy,
+ aMesh->myFieldsEntry,
+ "",
+ "Fields",
+ aComment.latin1());
+ anIsFieldsEntryUpdated = true;
}
const string& aFieldName = aFieldMapIter->first;
const PField& aField = aFieldMapIter->second;
aField->myNbComp);
aField->myEntry =
CreateAttributes(theStudy,
- aFieldsEntry,
+ aMesh->myFieldsEntry,
"",
aFieldNameWithUnit.latin1(),
- "",
aComment.latin1(),
true);
CreateReference(theStudy,
aField->myEntry,
"",
aTimeStampId,
- "",
aComment.latin1(),
true);
}
theBuildArgs.myInput,
theBuildArgs.myIsEntitiesDone,
theBuildArgs.myResultEntry,
+ theBuildArgs.myIsBuildGroups,
+ theBuildArgs.myIsBuildFields,
theBuildArgs.myStudy);
{
boost::thread aThread(boost::bind(&BuildGroups,
aSComponentEntry.in(),
anIOR.in(),
myName,
- "",
aComment.latin1(),
true);
mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
myInput,
&myIsEntitiesDone,
aResultEntry,
+ myIsBuildGroups,
+ myIsBuildFields,
myStudy);
BuildGroups(this,