1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_Result_i.cc
24 // Author : Alexey PETROV
27 #include "VISU_Result_i.hh"
28 #include "VISU_Convertor_impl.hxx"
29 #include "VISU_CorbaMedConvertor.hxx"
31 #include "QAD_Config.h"
32 #include "SALOMEDS_Tool.hxx"
33 #include "HDFascii.hxx"
36 #include <qfileinfo.h>
40 #include <vtkUnstructuredGridReader.h>
41 #include <vtkUnstructuredGridWriter.h>
47 static int MYDEBUG = 0;
48 static int MYDEBUGWITHFILES = 0;
50 static int MYDEBUG = 0;
51 static int MYDEBUGWITHFILES = 0;
54 VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){
55 SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
56 SALOMEDS::SObject_var aFather = theSObject->GetFather();
57 CORBA::String_var aComponentID(aSComponent->GetID());
58 CORBA::String_var aFatherID(aFather->GetID());
59 VISU::Result_var aResult;
60 while(strcmp(aComponentID,aFatherID) != 0){
61 CORBA::Object_var anObject = VISU::SObjectToObject(aFather);
62 if(!CORBA::is_nil(anObject)){
63 aResult = VISU::Result::_narrow(anObject);
64 if(!aResult->_is_nil()) return aResult;
66 aFather = aFather->GetFather();
71 QString GenerateName(const char* theName){
72 typedef map<string,int> TNameMap;
74 TNameMap::const_iterator i = aMap.find(theName);
80 tmp = VISU::GenerateName(theName,++aMap[theName]);
82 if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
86 QString GenerateFieldName(const string& theName, const string& theUnits){
88 const string tmp(theUnits.size(),' ');
89 if(theUnits == "" || theUnits == tmp)
90 aName.sprintf("%s, -",theName.c_str());
92 aName.sprintf("%s, %s",theName.c_str(),theUnits.c_str());
93 aName = aName.simplifyWhiteSpace();
94 return aName.latin1();
97 void CreateReference(SALOMEDS::Study_ptr theStudyDocument,
98 const string& theFatherEntry, const string& theRefEntry)
100 SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
101 SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
102 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
103 SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
104 aStudyBuilder->Addreference(newObj,aRefSObj);
107 string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){
108 SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
109 CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
110 return aDataType.in();
113 //==============================================================================
115 const string VISU::Result_i::myComment = "RESULT";
116 const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
118 VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
119 myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
124 CORBA::Boolean VISU::Result_i::BuildAll(){
125 if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
126 if(myIsDone) return 1;
128 const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
129 VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
130 for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
131 const string& aMeshName = aMeshMapIter->first;
132 const VISU::TMesh& aMesh = aMeshMapIter->second;
133 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
134 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
136 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
137 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
138 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
139 const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
140 const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
141 VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
142 for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
143 const string& aFieldName = aFieldMapIter->first;
144 const VISU::TField& aField = aFieldMapIter->second;
145 const VISU::TField::TValField& aValField = aField.myValField;
146 VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
147 for(; aValFieldIter != aValField.end(); aValFieldIter++){
148 int aTimeStamp = aValFieldIter->first;
149 myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
154 const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
155 VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
156 for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
157 const string& aGroupName = aGroupMapIter->first;
158 myInput->GetMeshOnGroup(aMeshName,aGroupName);
161 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
162 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
163 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
164 const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
165 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
166 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
167 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
168 const string& aFamilyName = aFamilyMapIter->first;
169 myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
172 //Import mesh on entity
173 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
174 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
175 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
176 myInput->GetMeshOnEntity(aMeshName,anEntity);
180 }catch(std::runtime_error& exc){
181 INFOS("Follow exception was accured :\n"<<exc.what());
183 INFOS("Unknown exception was accured!");
188 VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
189 throw (std::runtime_error&)
191 if(MYDEBUG) MESSAGE("Result_i::Build");
192 const TMeshMap& aMeshMap = myInput->GetMeshMap();
193 if(!aMeshMap.empty()) {//apo
194 mySComponent = FindOrCreateVisuComponent(myStudyDocument);
195 CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
196 string aRefFatherEntry = GetRefFatherEntry();
198 aComment.sprintf("myComment=%s;myType=%d;myFileName=%s",
199 GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1());
200 string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
201 anIOR,myName.c_str(),"",aComment.latin1(),true);
202 mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
203 if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
204 if(!CORBA::is_nil(theSObject)){
205 CORBA::String_var aString = theSObject->GetID();
206 CreateReference(myStudyDocument,aResultEntry,aString.in());
208 TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
209 for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
210 const string& aMeshName = aMeshMapIter->first;
211 const VISU::TMesh& aMesh = aMeshMapIter->second;
212 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
213 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
214 aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
215 aMeshName.c_str(),aMesh.myDim);
216 string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
217 "",aMeshName.c_str(),"",aComment.latin1(),true);
218 if(aMeshOnEntityMap.empty()) continue;
219 aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
220 string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
221 "","Families","",aComment.latin1(),true);
222 //Import entities and according families
223 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
224 typedef map<VISU::TEntity,string> TEntity2Entry;
225 TEntity2Entry aEntity2Entry;
226 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
227 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
228 aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
229 VISU::TENTITY,aMeshName.c_str(),anEntity);
232 case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
233 case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
234 case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
235 case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
237 throw std::runtime_error("Build >> Value of entity is incorrect!");
239 aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
240 "",anEntityName.c_str(),"",aComment.latin1(),true);
241 const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
242 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
243 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
244 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
245 const string& aFamilyName = aFamilyMapIter->first;
246 aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
247 VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
248 CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
249 "",aFamilyName.c_str(),"",aComment.latin1(),true);
253 const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
254 if(aGroupMap.size() > 0){
255 aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
256 string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
257 "","Groups","",aComment.latin1(),true);
258 VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
259 for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
260 const string& aGroupName = aGroupMapIter->first;
261 aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
262 VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
263 string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
264 "",aGroupName.c_str(),"",aComment.latin1(),true);
265 const VISU::TGroup& aGroup = aGroupMapIter->second;
266 const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
267 VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
268 for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
269 const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
270 const string& aFamilyName = aFamilyAndEntity.first;
271 const VISU::TEntity& anEntity = aFamilyAndEntity.second;
272 aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
273 VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
274 string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
275 CreateReference(myStudyDocument,aGroupEntry,anEntry);
281 bool isFieldEntryCreated = 0;
282 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
283 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
284 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
285 const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
286 const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
287 VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
288 for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
289 if(!isFieldEntryCreated){
290 aComment.sprintf("myComment=FIELDS;myMeshName=%s",aMeshName.c_str());
291 aFieldsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
292 "","Fields","",aComment.latin1(),true);
293 isFieldEntryCreated = true;
295 const string& aFieldName = aFieldMapIter->first;
296 const VISU::TField& aField = aFieldMapIter->second;
297 const VISU::TField::TValField& aValField = aField.myValField;
298 QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField.myUnitNames[0]);
299 aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
300 VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
301 string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
302 "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
303 CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
304 VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
305 for(; aValFieldIter != aValField.end(); aValFieldIter++){
306 int aTimeStamp = aValFieldIter->first;
307 const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
308 aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
309 VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
310 string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
311 CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
312 "",aTimeStampId.c_str(),"",aComment.latin1(),true);
318 QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
319 if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
323 VISU::Storable* VISU::Result_i::Create(const char* theFileName){
326 myInput = CreateConvertor(theFileName);
327 if(myInput == NULL) return NULL;
328 myFileInfo.setFile(theFileName);
329 myName = ::GenerateName(myFileInfo.fileName()).latin1();
330 VISU::Storable* aStorable = Build();
332 }catch(std::runtime_error& exc){
333 INFOS("Follow exception was accured :\n"<<exc.what());
335 INFOS("Unknown exception was accured!");
340 VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
341 if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
343 mySourceId = eComponent;
344 myInput = CreateMEDConvertor(theMedSObject);
345 if(myInput == NULL) return NULL;
346 string aCompDataType = GetComponentDataType(theMedSObject);
347 myFileInfo.setFile(aCompDataType.c_str());
348 myName = ::GenerateName("aResult").latin1();
349 VISU::Storable* aStorable = Build(theMedSObject);
351 }catch(std::runtime_error& exc){
352 INFOS("Follow exception was accured :\n"<<exc.what());
354 INFOS("Unknown exception was accured!");
359 VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
360 if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
362 mySourceId = eComponent;
363 myInput = CreateMEDFieldConvertor(theField);
364 if(myInput == NULL) return NULL;
365 string aCompDataType = "Med";
366 myFileInfo.setFile(aCompDataType.c_str());
367 myName = ::GenerateName("aResult").latin1();
368 VISU::Storable* aStorable = Build();
370 }catch(std::runtime_error& exc){
371 INFOS("Follow exception was accured :\n"<<exc.what());
373 INFOS("Unknown exception was accured!");
378 VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
379 const Storable::TRestoringMap& theMap, const string& thePrefix)
380 throw(std::logic_error&)
382 if(MYDEBUG) MESSAGE("Result_i::Restore - "<<thePrefix);
384 mySObject = SALOMEDS::SObject::_duplicate(theSObject);
385 myStudyDocument = mySObject->GetStudy();
386 mySComponent = mySObject->GetFatherComponent();
387 myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
388 SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
389 if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
390 mySourceId = eRestoredComponent;
391 if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
392 SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
393 CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
394 myFileInfo.setFile(aDataType.in());
395 if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = "<<aDataType);
396 Engines::Component_var aEngComp = Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
397 if (CORBA::is_nil(aEngComp))
398 throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
399 SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
400 SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
401 aStudyBuilder->LoadWith(aCompRefSObj,aDriver);
402 if(strcmp(aDataType,"Med") == 0){
403 myInput = CreateMEDConvertor(aTargetRefSObj);
405 throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
407 myFileInfo.setFile(thePrefix.c_str());
409 string aStudyPrefix(SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
410 if(!myFileInfo.isFile()){
411 string aFileName = thePrefix + aStudyPrefix + "_" + myName;
412 myFileInfo.setFile(aFileName.c_str());
415 MESSAGE("Result_i::Restore - aFileName = "<<myFileInfo.filePath()<<"; "<<myFileInfo.isFile());
417 if (HDFascii::isASCII(myFileInfo.filePath().latin1())) {
418 char* aResultPath = HDFascii::ConvertFromASCIIToHDF(myFileInfo.filePath().latin1());
419 char* aHDFFileName = new char[strlen(aResultPath) + 19];
420 sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath);
422 if (IsMultifile()) { // set this file as new - temporary
423 static QString aCommand;
424 aCommand.sprintf("mv %s %s%s",aHDFFileName, aResultPath, myFileInfo.baseName().latin1());
425 if(system(aCommand) == -1){
426 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :"<<aCommand);
428 } else if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - "<<aCommand);
429 myFileInfo.setFile(QString(aResultPath)+QString(myFileInfo.baseName().latin1()));
430 } else { // change current temporary file to the new: with hdf-format
431 static QString aCommand;
432 aCommand.sprintf("mv %s %s\0",aHDFFileName, myFileInfo.filePath().latin1());
433 if(system(aCommand.latin1()) == -1) {
434 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :"<<aCommand);
436 } else if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - "<<aCommand);
437 SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
438 SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList, true);
440 mySourceId = eRestoredFile;
442 delete(aHDFFileName);
443 } else if (!IsMultifile()) mySourceId = eRestoredFile;
444 else mySourceId = eFile;
446 myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
448 aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
449 GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
450 SALOMEDS::GenericAttribute_var anAttr;
451 if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
452 throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
453 SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
454 aCmnt->SetValue(aComment.latin1());
456 QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
457 if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
459 }catch(std::runtime_error& exc){
460 INFOS("Follow exception was accured :\n"<<exc.what());
462 INFOS("Unknown exception was accured!");
467 VISU::Result_i::TInput* VISU::Result_i::GetInput() {
471 void VISU::Result_i::ToStream(std::ostringstream& theStr){
472 if(MYDEBUG) MESSAGE(GetComment());
473 Storable::DataToStream(theStr,"myName",myName.c_str());
476 VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
477 const string& thePrefix, const Storable::TRestoringMap& theMap)
478 throw(std::logic_error&)
480 SALOMEDS::Study_var aStudy = theSObject->GetStudy();
481 VISU::Result_i* pResult = new VISU::Result_i(aStudy);
482 if(pResult == NULL) return NULL;
483 return pResult->Restore(theSObject,theMap,thePrefix);
486 string VISU::Result_i::GetRefFatherEntry() {
487 //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry();
491 string VISU::Result_i::GetEntry(){
492 CORBA::String_var anEntry = mySObject->GetID();
493 return string(anEntry);
496 const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
497 const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
498 const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
500 VISU::Result_i::~Result_i() {
501 if(MYDEBUG) MESSAGE("Result_i::~Result_i()");
502 if(myInput) delete myInput;