2 // File : SALOMEDS_SObject_i.cxx
3 // Created : Thu Nov 29 21:03:39 2001
4 // Author : Yves FRICAUD
8 // Copyright : Open CASCADE 2001
11 #include "utilities.h"
12 #include "SALOMEDS_SObject_i.hxx"
14 #include "SALOMEDS_SComponent_i.hxx"
15 #include "SALOMEDS_IORAttribute.hxx"
16 #include "SALOMEDS_PersRefAttribute.hxx"
17 #include "SALOMEDS_SequenceOfRealAttribute.hxx"
18 #include "SALOMEDS_SequenceOfIntegerAttribute.hxx"
19 #include "SALOMEDS_TableOfRealAttribute.hxx"
20 #include "SALOMEDS_TableOfIntegerAttribute.hxx"
21 #include "SALOMEDS_IORAttribute.hxx"
22 #include "SALOMEDS_PersRefAttribute.hxx"
23 #include "SALOMEDS_StudyPropertiesAttribute.hxx"
24 #include "SALOMEDS_PythonObjectAttribute.hxx"
25 #include "SALOMEDS_AttributePersistentRef_i.hxx"
26 #include "SALOMEDS_AttributeIOR_i.hxx"
27 #include "SALOMEDS_AttributeComment_i.hxx"
28 #include "SALOMEDS_AttributeName_i.hxx"
29 #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
30 #include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
31 #include "SALOMEDS_AttributeInteger_i.hxx"
32 #include "SALOMEDS_AttributeReal_i.hxx"
33 #include "SALOMEDS_AttributeDrawable_i.hxx"
34 #include "SALOMEDS_AttributeSelectable_i.hxx"
35 #include "SALOMEDS_AttributeExpandable_i.hxx"
36 #include "SALOMEDS_AttributeOpened_i.hxx"
37 #include "SALOMEDS_AttributeTextColor_i.hxx"
38 #include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
39 #include "SALOMEDS_AttributePixMap_i.hxx"
40 #include "SALOMEDS_AttributeTreeNode_i.hxx"
41 #include "SALOMEDS_AttributeLocalID_i.hxx"
42 #include "SALOMEDS_AttributeUserID_i.hxx"
43 #include "SALOMEDS_AttributeTarget_i.hxx"
44 #include "SALOMEDS_AttributeTableOfInteger_i.hxx"
45 #include "SALOMEDS_AttributeTableOfReal_i.hxx"
46 #include "SALOMEDS_AttributeTableOfString_i.hxx"
47 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
48 #include "SALOMEDS_AttributePythonObject_i.hxx"
49 #include <TDF_AttributeIterator.hxx>
51 //============================================================================
52 /*! Function : ReturnGUIDForAttribute
55 //============================================================================
58 SALOMEDS_SObject_i::ReturnGUIDForAttribute(const char* aTypeOfAttribute)
62 if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) return TDataStd_Real::GetID();
63 else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) return TDataStd_Integer::GetID();
64 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) return SALOMEDS_SequenceOfRealAttribute::GetID();
65 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) return SALOMEDS_SequenceOfIntegerAttribute::GetID();
66 else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) return TDataStd_Name::GetID();
67 else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) return TDataStd_Comment::GetID();
68 else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) return SALOMEDS_IORAttribute::GetID();
69 else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) return SALOMEDS_PersRefAttribute::GetID();
70 else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) return SALOMEDS_DrawableAttribute::GetID();
71 else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 ) return SALOMEDS_SelectableAttribute::GetID();
72 else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 ) return SALOMEDS_ExpandableAttribute::GetID();
73 else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 ) return SALOMEDS_OpenedAttribute::GetID();
74 else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) return SALOMEDS_TextColorAttribute::GetID();
75 else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) return SALOMEDS_TextHighlightColorAttribute::GetID();
76 else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) return SALOMEDS_PixMapAttribute::GetID();
77 else if (strcmp(aTypeOfAttribute, "AttributeTreeNode") == 0 ) return TDataStd_TreeNode::GetDefaultTreeID();
78 else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) return SALOMEDS_LocalIDAttribute::GetID();
79 else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 ) return SALOMEDS_TargetAttribute::GetID();
80 else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) return SALOMEDS_TableOfIntegerAttribute::GetID();
81 else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) return SALOMEDS_TableOfRealAttribute::GetID();
82 else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) return SALOMEDS_TableOfStringAttribute::GetID();
83 else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) return SALOMEDS_StudyPropertiesAttribute::GetID();
84 else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) return SALOMEDS_PythonObjectAttribute::GetID();
85 else if (strcmp(aTypeOfAttribute, "AttributeUserID") == 0 ) return SALOMEDS_AttributeUserID_i::DefaultID();
86 else if (strncmp(aTypeOfAttribute,"AttributeTreeNodeGUID",21) == 0) {
87 char* aGUIDString = new char[40];
88 sprintf(aGUIDString, &(aTypeOfAttribute[21]));
89 Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
93 else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::ReturnGUIDForAttribute");
96 //============================================================================
97 /*! Function : AttributeIDToType
100 //============================================================================
101 char* SALOMEDS_SObject_i::AttributeIDToType(Standard_GUID ID)
103 if (ID == TDataStd_Name::GetID()) return "AttributeName";
104 else if (ID == TDataStd_Comment::GetID()) return "AttributeComment";
105 else if (ID == SALOMEDS_IORAttribute::GetID()) return "AttributeIOR";
106 else if (ID == SALOMEDS_PersRefAttribute::GetID()) return "AttributePersistentRef";
107 else if (ID == TDataStd_Real::GetID()) return "AttributeReal";
108 else if (ID == TDataStd_Integer::GetID()) return "AttributeInteger";
109 else if (ID == SALOMEDS_SequenceOfRealAttribute::GetID()) return "AttributeSequenceOfReal";
110 else if (ID == SALOMEDS_SequenceOfIntegerAttribute::GetID()) return "AttributeSequenceOfInteger";
111 else if (ID == SALOMEDS_DrawableAttribute::GetID()) return "AttributeDrawable";
112 else if (ID == SALOMEDS_SelectableAttribute::GetID()) return "AttributeSelectable";
113 else if (ID == SALOMEDS_ExpandableAttribute::GetID()) return "AttributeExpandable";
114 else if (ID == SALOMEDS_OpenedAttribute::GetID()) return "AttributeOpened";
115 else if (ID == SALOMEDS_TextColorAttribute::GetID()) return "AttributeTextColor";
116 else if (ID == SALOMEDS_TextHighlightColorAttribute::GetID()) return "AttributeTextHighlightColor";
117 else if (ID == SALOMEDS_PixMapAttribute::GetID()) return "AttributePixMap";
118 else if (ID == TDataStd_TreeNode::GetDefaultTreeID()) return "AttributeTreeNode";
119 else if (ID == SALOMEDS_LocalIDAttribute::GetID()) return "AttributeLocalID";
120 else if (ID == SALOMEDS_TargetAttribute::GetID()) return "AttributeTarget";
121 else if (ID == SALOMEDS_TableOfIntegerAttribute::GetID()) return "AttributeTableOfInteger";
122 else if (ID == SALOMEDS_TableOfRealAttribute::GetID()) return "AttributeTableOfReal";
123 else if (ID == SALOMEDS_TableOfStringAttribute::GetID()) return "AttributeTableOfString";
124 else if (ID == SALOMEDS_StudyPropertiesAttribute::GetID()) return "AttributeStudyProperties";
125 else if (ID == SALOMEDS_PythonObjectAttribute::GetID()) return "AttributePythonObject";
126 else if (ID == SALOMEDS_AttributeUserID_i::DefaultID()) return "AttributeUserID";
127 // 08.01.2003 mpv: this method must be called only for attributes with constant GUID
128 else Standard_NoSuchObject::Raise("SALOMEDS_SObject_i::AttributeIDToType");
132 //============================================================================
133 /*! Function : constructor
136 //============================================================================
137 SALOMEDS_SObject_i::SALOMEDS_SObject_i(const TDF_Label lab, CORBA::ORB_ptr orb)
140 _orb = CORBA::ORB::_duplicate(orb);
144 _liste_ba_type.resize(0);
148 //============================================================================
149 /*! Function : destructor
152 //============================================================================
153 SALOMEDS_SObject_i::~SALOMEDS_SObject_i()
155 CORBA::string_free(_value);
156 CORBA::string_free(_type);
157 CORBA::string_free(_name);
161 //============================================================================
165 //============================================================================
166 char* SALOMEDS_SObject_i::GetID()
168 TCollection_AsciiString anEntry;
169 TDF_Tool::Entry (_lab,anEntry);
170 return CORBA::string_dup(anEntry.ToCString());
173 //============================================================================
177 //============================================================================
178 SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent()
181 while (!SALOMEDS_SComponent_i::IsA(LF) && !LF.IsRoot()) {
184 SALOMEDS_SComponent_i * so_servant = new SALOMEDS_SComponent_i (LF,_orb);
185 SALOMEDS::SComponent_var so;
186 so= SALOMEDS::SComponent::_narrow(so_servant->SComponent::_this());
190 //============================================================================
194 //============================================================================
195 SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather()
197 TDF_Label LF = _lab.Father();
199 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (LF,_orb);
200 SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
204 //============================================================================
208 //============================================================================
209 SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
211 TDF_Label Root = _lab.Root();
212 Handle(SALOMEDS_IORAttribute) Att;
214 if (Root.FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
215 TCollection_AsciiString ch(Att->Get());
216 IOR = CORBA::string_dup(ch.ToCString());
217 CORBA::Object_var obj = _orb->string_to_object(IOR);
218 SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
219 ASSERT(!CORBA::is_nil(Study));
220 return SALOMEDS::Study::_duplicate(Study); //return Study = abort...
222 INFOS("Problem GetStudy");
223 return SALOMEDS::Study::_nil();
226 //============================================================================
227 /*! Function : FindAttribute
228 * Purpose : Find attribute of given type on this SObject
230 //============================================================================
231 CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute,
232 const char* aTypeOfAttribute)
234 Handle(TDF_Attribute) anAttr;
235 Standard_Boolean found = _lab.FindAttribute(SALOMEDS_SObject_i::ReturnGUIDForAttribute(aTypeOfAttribute), anAttr);
237 if (strcmp(aTypeOfAttribute, "AttributeReal") == 0 ) {
238 SALOMEDS_AttributeReal_i* Attr = new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
239 anAttribute = Attr->AttributeReal::_this();
240 return Standard_True;
242 else if (strcmp(aTypeOfAttribute, "AttributeInteger") == 0 ) {
243 SALOMEDS_AttributeInteger_i* Attr = new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
244 anAttribute = Attr->AttributeInteger::_this();
245 return Standard_True;
247 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfReal") == 0 ) {
248 SALOMEDS_AttributeSequenceOfReal_i* Attr = new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
249 anAttribute = Attr->AttributeSequenceOfReal::_this();
250 return Standard_True;
252 else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) {
253 SALOMEDS_AttributeSequenceOfInteger_i* Attr = new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
254 anAttribute = Attr->AttributeSequenceOfInteger::_this();
255 return Standard_True;
257 else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) {
258 SALOMEDS_AttributeName_i* Attr = new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
259 anAttribute = Attr->AttributeName::_this();
260 return Standard_True;
262 else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) {
263 SALOMEDS_AttributeComment_i* Attr = new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
264 anAttribute = Attr->AttributeComment::_this();
265 return Standard_True;
267 else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) {
268 SALOMEDS_AttributeIOR_i* Attr = new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
269 anAttribute = Attr->AttributeIOR::_this();
270 return Standard_True;
272 else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) {
273 SALOMEDS_AttributePersistentRef_i* Attr = new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
274 anAttribute = Attr->AttributePersistentRef::_this();
275 return Standard_True;
277 else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) {
278 SALOMEDS_AttributeDrawable_i* Attr = new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
279 anAttribute = Attr->AttributeDrawable::_this();
280 return Standard_True;
282 else if (strcmp(aTypeOfAttribute, "AttributeSelectable") == 0 ) {
283 SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
284 anAttribute = Attr->AttributeSelectable::_this();
285 return Standard_True;
287 else if (strcmp(aTypeOfAttribute, "AttributeExpandable") == 0 ) {
288 SALOMEDS_AttributeExpandable_i* Attr = new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
289 anAttribute = Attr->AttributeExpandable::_this();
290 return Standard_True;
292 else if (strcmp(aTypeOfAttribute, "AttributeOpened") == 0 ) {
293 SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
294 anAttribute = Attr->AttributeOpened::_this();
295 return Standard_True;
297 else if (strcmp(aTypeOfAttribute, "AttributeTextColor") == 0 ) {
298 SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
299 anAttribute = Attr->AttributeTextColor::_this();
300 return Standard_True;
302 else if (strcmp(aTypeOfAttribute, "AttributeTextHighlightColor") == 0 ) {
303 SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
304 anAttribute = Attr->AttributeTextHighlightColor::_this();
305 return Standard_True;
307 else if (strcmp(aTypeOfAttribute, "AttributePixMap") == 0 ) {
308 SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
309 anAttribute = Attr->AttributePixMap::_this();
310 return Standard_True;
312 else if (strncmp(aTypeOfAttribute, "AttributeTreeNode",17) == 0 ) {
313 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
314 anAttribute = Attr->AttributeTreeNode::_this();
315 return Standard_True;
317 else if (strcmp(aTypeOfAttribute, "AttributeLocalID") == 0 ) {
318 SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
319 anAttribute = Attr->AttributeLocalID::_this();
320 return Standard_True;
322 else if (strncmp(aTypeOfAttribute, "AttributeUserID",15) == 0 ) {
323 SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
324 anAttribute = Attr->AttributeUserID::_this();
325 return Standard_True;
327 else if (strcmp(aTypeOfAttribute, "AttributeTarget") == 0 ) {
328 SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
329 anAttribute = Attr->AttributeTarget::_this();
330 return Standard_True;
332 else if (strcmp(aTypeOfAttribute, "AttributeTableOfInteger") == 0 ) {
333 SALOMEDS_AttributeTableOfInteger_i* Attr = new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
334 anAttribute = Attr->AttributeTableOfInteger::_this();
335 return Standard_True;
337 else if (strcmp(aTypeOfAttribute, "AttributeTableOfReal") == 0 ) {
338 SALOMEDS_AttributeTableOfReal_i* Attr = new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
339 anAttribute = Attr->AttributeTableOfReal::_this();
340 return Standard_True;
342 else if (strcmp(aTypeOfAttribute, "AttributeTableOfString") == 0 ) {
343 SALOMEDS_AttributeTableOfString_i* Attr = new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
344 anAttribute = Attr->AttributeTableOfString::_this();
345 return Standard_True;
347 else if (strcmp(aTypeOfAttribute, "AttributeStudyProperties") == 0 ) {
348 SALOMEDS_AttributeStudyProperties_i* Attr = new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
349 anAttribute = Attr->AttributeStudyProperties::_this();
350 return Standard_True;
352 else if (strcmp(aTypeOfAttribute, "AttributePythonObject") == 0 ) {
353 SALOMEDS_AttributePythonObject_i* Attr = new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
354 anAttribute = Attr->AttributePythonObject::_this();
355 return Standard_True;
357 } else return Standard_False;
360 //============================================================================
361 /*! Function : GetAllAttributes
362 * Purpose : Returns list of all attributes for this sobject
364 //============================================================================
366 SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
368 Standard_Integer NumAttr = _lab.NbAttributes();
369 SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes;
370 SeqOfAttr->length(NumAttr);
372 Standard_Integer i = 0;
373 for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
374 Handle(TDF_Attribute) anAttr = iter.Value();
375 SALOMEDS::GenericAttribute_var anAttribute;
376 if (ReturnGUIDForAttribute("AttributeReal") == anAttr->ID()) {
377 SALOMEDS_AttributeReal_i* Attr= new SALOMEDS_AttributeReal_i(Handle(TDataStd_Real)::DownCast(anAttr), _orb);
378 anAttribute = Attr->AttributeReal::_this();
380 else if (ReturnGUIDForAttribute("AttributeInteger") == anAttr->ID()) {
381 SALOMEDS_AttributeInteger_i* Attr= new SALOMEDS_AttributeInteger_i(Handle(TDataStd_Integer)::DownCast(anAttr), _orb);
382 anAttribute = Attr->AttributeInteger::_this();
384 else if (ReturnGUIDForAttribute("AttributeSequenceOfReal") == anAttr->ID()) {
385 SALOMEDS_AttributeSequenceOfReal_i* Attr= new SALOMEDS_AttributeSequenceOfReal_i(Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(anAttr), _orb);
386 anAttribute = Attr->AttributeSequenceOfReal::_this();
388 else if (ReturnGUIDForAttribute("AttributeSequenceOfInteger") == anAttr->ID()) {
389 SALOMEDS_AttributeSequenceOfInteger_i* Attr= new SALOMEDS_AttributeSequenceOfInteger_i(Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(anAttr), _orb);
390 anAttribute = Attr->AttributeSequenceOfInteger::_this();
392 else if (ReturnGUIDForAttribute("AttributeName") == anAttr->ID()) {
393 SALOMEDS_AttributeName_i* Attr= new SALOMEDS_AttributeName_i(Handle(TDataStd_Name)::DownCast(anAttr), _orb);
394 anAttribute = Attr->AttributeName::_this();
396 else if (ReturnGUIDForAttribute("AttributeComment") == anAttr->ID()) {
397 SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb);
398 anAttribute = Attr->AttributeComment::_this();
400 else if (ReturnGUIDForAttribute("AttributeIOR") == anAttr->ID()) {
401 SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb);
402 anAttribute = Attr->AttributeIOR::_this();
404 else if (ReturnGUIDForAttribute("AttributePersistentRef") == anAttr->ID()) {
405 SALOMEDS_AttributePersistentRef_i* Attr= new SALOMEDS_AttributePersistentRef_i(Handle(SALOMEDS_PersRefAttribute)::DownCast(anAttr), _orb);
406 anAttribute = Attr->AttributePersistentRef::_this();
408 else if (ReturnGUIDForAttribute("AttributeDrawable") == anAttr->ID()) {
409 SALOMEDS_AttributeDrawable_i* Attr= new SALOMEDS_AttributeDrawable_i(Handle(SALOMEDS_DrawableAttribute)::DownCast(anAttr), _orb);
410 anAttribute = Attr->AttributeDrawable::_this();
412 else if (ReturnGUIDForAttribute("AttributeSelectable") == anAttr->ID()) {
413 SALOMEDS_AttributeSelectable_i* Attr= new SALOMEDS_AttributeSelectable_i(Handle(SALOMEDS_SelectableAttribute)::DownCast(anAttr), _orb);
414 anAttribute = Attr->AttributeSelectable::_this();
416 else if (ReturnGUIDForAttribute("AttributeExpandable") == anAttr->ID()) {
417 SALOMEDS_AttributeExpandable_i* Attr= new SALOMEDS_AttributeExpandable_i(Handle(SALOMEDS_ExpandableAttribute)::DownCast(anAttr), _orb);
418 anAttribute = Attr->AttributeExpandable::_this();
420 else if (ReturnGUIDForAttribute("AttributeOpened") == anAttr->ID()) {
421 SALOMEDS_AttributeOpened_i* Attr= new SALOMEDS_AttributeOpened_i(Handle(SALOMEDS_OpenedAttribute)::DownCast(anAttr), _orb);
422 anAttribute = Attr->AttributeOpened::_this();
424 else if (ReturnGUIDForAttribute("AttributeTextColor") == anAttr->ID()) {
425 SALOMEDS_AttributeTextColor_i* Attr= new SALOMEDS_AttributeTextColor_i(Handle(SALOMEDS_TextColorAttribute)::DownCast(anAttr), _orb);
426 anAttribute = Attr->AttributeTextColor::_this();
428 else if (ReturnGUIDForAttribute("AttributeTextHighlightColor") == anAttr->ID()) {
429 SALOMEDS_AttributeTextHighlightColor_i* Attr= new SALOMEDS_AttributeTextHighlightColor_i(Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(anAttr), _orb);
430 anAttribute = Attr->AttributeTextHighlightColor::_this();
432 else if (ReturnGUIDForAttribute("AttributePixMap") == anAttr->ID()) {
433 SALOMEDS_AttributePixMap_i* Attr= new SALOMEDS_AttributePixMap_i(Handle(SALOMEDS_PixMapAttribute)::DownCast(anAttr), _orb);
434 anAttribute = Attr->AttributePixMap::_this();
436 else if (ReturnGUIDForAttribute("AttributeTreeNode") == anAttr->ID()) {
437 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
438 anAttribute = Attr->AttributeTreeNode::_this();
440 else if (ReturnGUIDForAttribute("AttributeLocalID") == anAttr->ID()) {
441 SALOMEDS_AttributeLocalID_i* Attr= new SALOMEDS_AttributeLocalID_i(Handle(SALOMEDS_LocalIDAttribute)::DownCast(anAttr), _orb);
442 anAttribute = Attr->AttributeLocalID::_this();
444 else if (ReturnGUIDForAttribute("AttributeTarget") == anAttr->ID()) {
445 SALOMEDS_AttributeTarget_i* Attr= new SALOMEDS_AttributeTarget_i(Handle(SALOMEDS_TargetAttribute)::DownCast(anAttr), _orb);
446 anAttribute = Attr->AttributeTarget::_this();
448 else if (ReturnGUIDForAttribute("AttributeTableOfInteger") == anAttr->ID()) {
449 SALOMEDS_AttributeTableOfInteger_i* Attr= new SALOMEDS_AttributeTableOfInteger_i(Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(anAttr), _orb);
450 anAttribute = Attr->AttributeTableOfInteger::_this();
452 else if (ReturnGUIDForAttribute("AttributeTableOfReal") == anAttr->ID()) {
453 SALOMEDS_AttributeTableOfReal_i* Attr= new SALOMEDS_AttributeTableOfReal_i(Handle(SALOMEDS_TableOfRealAttribute)::DownCast(anAttr), _orb);
454 anAttribute = Attr->AttributeTableOfReal::_this();
456 else if (ReturnGUIDForAttribute("AttributeTableOfString") == anAttr->ID()) {
457 SALOMEDS_AttributeTableOfString_i* Attr= new SALOMEDS_AttributeTableOfString_i(Handle(SALOMEDS_TableOfStringAttribute)::DownCast(anAttr), _orb);
458 anAttribute = Attr->AttributeTableOfString::_this();
460 else if (ReturnGUIDForAttribute("AttributeStudyProperties") == anAttr->ID()) {
461 SALOMEDS_AttributeStudyProperties_i* Attr= new SALOMEDS_AttributeStudyProperties_i(Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(anAttr), _orb);
462 anAttribute = Attr->AttributeStudyProperties::_this();
464 else if (ReturnGUIDForAttribute("AttributePythonObject") == anAttr->ID()) {
465 SALOMEDS_AttributePythonObject_i* Attr= new SALOMEDS_AttributePythonObject_i(Handle(SALOMEDS_PythonObjectAttribute)::DownCast(anAttr), _orb);
466 anAttribute = Attr->AttributePythonObject::_this();
468 else if (!Handle(TDataStd_UAttribute)::DownCast(anAttr).IsNull()) {
469 SALOMEDS_AttributeUserID_i* Attr= new SALOMEDS_AttributeUserID_i(Handle(TDataStd_UAttribute)::DownCast(anAttr), _orb);
470 anAttribute = Attr->AttributeUserID::_this();
472 else if (!Handle(TDataStd_TreeNode)::DownCast(anAttr).IsNull()) {
473 SALOMEDS_AttributeTreeNode_i* Attr= new SALOMEDS_AttributeTreeNode_i(Handle(TDataStd_TreeNode)::DownCast(anAttr), _orb);
474 anAttribute = Attr->AttributeTreeNode::_this();
477 SeqOfAttr[i] = anAttribute;
481 return SeqOfAttr._retn();
485 //============================================================================
486 /*! Function : ReferencedObject
489 //============================================================================
490 CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj)
492 Handle(TDF_Reference) Ref;
493 if (!_lab.FindAttribute(TDF_Reference::GetID(),Ref))
496 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (Ref->Get(),_orb);
497 obj = SALOMEDS::SObject::_narrow(so_servant->_this());
501 //============================================================================
505 //============================================================================
506 CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_out obj)
508 TDF_Label L = _lab.FindChild(atag,false);
509 if (L.IsNull()) return false;
511 SALOMEDS_SObject_i * so_servant = new SALOMEDS_SObject_i (L,_orb);
512 obj = SALOMEDS::SObject::_narrow(so_servant->_this());
517 //============================================================================
521 //============================================================================
522 char* SALOMEDS_SObject_i::Name()
524 return CORBA::string_dup(_name);
527 //============================================================================
531 //============================================================================
532 void SALOMEDS_SObject_i::Name(const char* name)
534 _name = CORBA::string_dup(name);
537 //============================================================================
541 //============================================================================
542 CORBA::Short SALOMEDS_SObject_i::Tag()