9ebaae37 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #include <XCAFDoc_Dimension.hxx> |
15 | |
16 | #include <TDF_RelocationTable.hxx> |
1c9d3225 |
17 | #include <TDF_ChildIterator.hxx> |
9ebaae37 |
18 | #include <XCAFDoc.hxx> |
19 | #include <TDataStd_TreeNode.hxx> |
20 | #include <Precision.hxx> |
21 | #include <TColgp_HArray1OfPnt.hxx> |
22 | #include <TDataStd_Integer.hxx> |
23 | #include <TDataStd_IntegerArray.hxx> |
7644c7f4 |
24 | #include <TDataStd_ExtStringArray.hxx> |
9ebaae37 |
25 | #include <TDataStd_Real.hxx> |
26 | #include <TDataStd_RealArray.hxx> |
27 | #include <TNaming_Builder.hxx> |
28 | #include <TNaming_NamedShape.hxx> |
29 | #include <TColStd_HArray1OfReal.hxx> |
30 | #include <TopoDS.hxx> |
31 | #include <XCAFDimTolObjects_DimensionObject.hxx> |
5df609e7 |
32 | #include <TNaming_Tool.hxx> |
33 | #include <TDataStd_Name.hxx> |
9ebaae37 |
34 | |
92efcf78 |
35 | IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Dimension,TDF_Attribute) |
36 | |
9ebaae37 |
37 | enum ChildLab |
38 | { |
39 | ChildLab_Type = 1, |
40 | ChildLab_Value, |
41 | ChildLab_Qualifier, |
42 | ChildLab_Class, |
43 | ChildLab_Dec, |
44 | ChildLab_Modifiers, |
45 | ChildLab_Path, |
46 | ChildLab_Dir, |
b7b2f85a |
47 | ChildLab_Pnt1, |
48 | ChildLab_Pnt2, |
fbcef69b |
49 | ChildLab_PlaneLoc, |
50 | ChildLab_PlaneN, |
51 | ChildLab_PlaneRef, |
5df609e7 |
52 | ChildLab_PntText, |
7644c7f4 |
53 | ChildLab_Presentation, |
54 | ChildLab_Descriptions, |
55 | ChildLab_DescriptionNames |
9ebaae37 |
56 | }; |
57 | |
58 | //======================================================================= |
59 | //function : XCAFDoc_Dimension |
60 | //purpose : |
61 | //======================================================================= |
62 | |
63 | XCAFDoc_Dimension::XCAFDoc_Dimension() |
64 | { |
65 | } |
66 | |
67 | |
68 | //======================================================================= |
69 | //function : GetID |
70 | //purpose : |
71 | //======================================================================= |
72 | |
73 | const Standard_GUID& XCAFDoc_Dimension::GetID() |
74 | { |
75 | static Standard_GUID DGTID ("58ed092c-44de-11d8-8776-001083004c77"); |
76 | //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b"); |
77 | return DGTID; |
78 | //return ID; |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : Set |
83 | //purpose : |
84 | //======================================================================= |
85 | Handle(XCAFDoc_Dimension) XCAFDoc_Dimension::Set(const TDF_Label& theLabel) |
86 | { |
87 | Handle(XCAFDoc_Dimension) A; |
88 | if (!theLabel.FindAttribute(XCAFDoc_Dimension::GetID(), A)) { |
89 | A = new XCAFDoc_Dimension(); |
90 | theLabel.AddAttribute(A); |
91 | } |
92 | return A; |
93 | } |
94 | |
95 | //======================================================================= |
96 | //function : SetObject |
97 | //purpose : |
98 | //======================================================================= |
99 | void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObject)& theObject) |
100 | { |
101 | Backup(); |
102 | |
eacdb38f |
103 | if (theObject->GetSemanticName()) |
104 | { |
105 | TCollection_ExtendedString str(theObject->GetSemanticName()->String()); |
106 | TDataStd_Name::Set(Label(), str); |
107 | } |
108 | |
1c9d3225 |
109 | TDF_ChildIterator anIter(Label()); |
110 | for(;anIter.More(); anIter.Next()) |
9ebaae37 |
111 | { |
1c9d3225 |
112 | anIter.Value().ForgetAllAttributes(); |
9ebaae37 |
113 | } |
fa53efef |
114 | Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->GetType()); |
9ebaae37 |
115 | |
1c9d3225 |
116 | if(!theObject->GetValues().IsNull()) |
9ebaae37 |
117 | { |
5a1271c8 |
118 | Handle(TDataStd_RealArray) aVal = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Value), theObject->GetValues()->Lower(), |
119 | theObject->GetValues()->Lower() + theObject->GetValues()->Length() - 1); |
120 | if(!aVal.IsNull()) |
121 | aVal->ChangeArray(theObject->GetValues()); |
9ebaae37 |
122 | } |
123 | |
fa53efef |
124 | Handle(TDataStd_Integer) aQualifier = TDataStd_Integer::Set(Label().FindChild(ChildLab_Qualifier), theObject->GetQualifier()); |
9ebaae37 |
125 | |
126 | Standard_Boolean aH; |
127 | XCAFDimTolObjects_DimensionFormVariance aF; |
128 | XCAFDimTolObjects_DimensionGrade aG; |
129 | theObject->GetClassOfTolerance(aH,aF,aG); |
1c9d3225 |
130 | Handle(TColStd_HArray1OfInteger) anArrI; |
131 | if(aF != XCAFDimTolObjects_DimensionFormVariance_None) |
9ebaae37 |
132 | { |
1c9d3225 |
133 | anArrI = new TColStd_HArray1OfInteger(1,3); |
134 | anArrI->SetValue(1,aH); |
135 | anArrI->SetValue(2,aF); |
136 | anArrI->SetValue(3,aG); |
5a1271c8 |
137 | Handle(TDataStd_IntegerArray) aClass = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Class), 1, 3); |
138 | if(!aClass.IsNull()) |
139 | aClass->ChangeArray(anArrI); |
9ebaae37 |
140 | } |
9ebaae37 |
141 | |
142 | Standard_Integer aL, aR; |
143 | theObject->GetNbOfDecimalPlaces(aL, aR); |
1c9d3225 |
144 | if (aL > 0 || aR > 0) |
9ebaae37 |
145 | { |
1c9d3225 |
146 | anArrI = new TColStd_HArray1OfInteger(1,2); |
147 | anArrI->SetValue(1,aL); |
148 | anArrI->SetValue(2,aR); |
5a1271c8 |
149 | Handle(TDataStd_IntegerArray) aDec = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Dec), 1, 2); |
150 | if(!aDec.IsNull()) |
151 | aDec->ChangeArray(anArrI); |
9ebaae37 |
152 | } |
1c9d3225 |
153 | |
154 | if(theObject->GetModifiers().Length() > 0) |
9ebaae37 |
155 | { |
9ebaae37 |
156 | anArrI = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length()); |
157 | for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++) |
158 | anArrI->SetValue(i,theObject->GetModifiers().Value(i)); |
5a1271c8 |
159 | Handle(TDataStd_IntegerArray) aModifiers = TDataStd_IntegerArray::Set(Label().FindChild(ChildLab_Modifiers), |
160 | 1, theObject->GetModifiers().Length()); |
161 | if(!aModifiers.IsNull()) |
162 | aModifiers->ChangeArray(anArrI); |
9ebaae37 |
163 | } |
164 | |
165 | if(!theObject->GetPath().IsNull()) |
166 | { |
1c9d3225 |
167 | TNaming_Builder tnBuild(Label().FindChild(ChildLab_Path)); |
168 | tnBuild.Generated(theObject->GetPath()); |
9ebaae37 |
169 | } |
170 | |
fbcef69b |
171 | Handle(TColStd_HArray1OfReal) anArrR; |
1c9d3225 |
172 | if(theObject->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented) |
9ebaae37 |
173 | { |
1c9d3225 |
174 | gp_Dir aD; |
175 | theObject->GetDirection(aD); |
fbcef69b |
176 | anArrR = new TColStd_HArray1OfReal(1, 3); |
177 | anArrR->SetValue(1, aD.X()); |
178 | anArrR->SetValue(2, aD.Y()); |
179 | anArrR->SetValue(3, aD.Z()); |
180 | Handle(TDataStd_RealArray) aDir = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Dir), 1, 3); |
181 | if (!aDir.IsNull()) |
182 | aDir->ChangeArray(anArrR); |
9ebaae37 |
183 | } |
1c9d3225 |
184 | |
b7b2f85a |
185 | if (theObject->HasPoint()) |
9ebaae37 |
186 | { |
fbcef69b |
187 | gp_Pnt aPnt1 = theObject->GetPoint(); |
188 | |
189 | Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3); |
190 | for (Standard_Integer i = 1; i <= 3; i++) |
191 | aPntArr->SetValue(i, aPnt1.Coord(i)); |
192 | Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt1), 1, 3); |
193 | if (!aPnt.IsNull()) |
194 | aPnt->ChangeArray(aPntArr); |
b7b2f85a |
195 | } |
196 | |
197 | if (theObject->HasPoint2()) |
198 | { |
fbcef69b |
199 | gp_Pnt aPnt2 = theObject->GetPoint2(); |
200 | |
201 | Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3); |
202 | for (Standard_Integer i = 1; i <= 3; i++) |
203 | aPntArr->SetValue(i, aPnt2.Coord(i)); |
204 | Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt2), 1, 3); |
205 | if (!aPnt.IsNull()) |
206 | aPnt->ChangeArray(aPntArr); |
9ebaae37 |
207 | } |
5df609e7 |
208 | |
209 | if (theObject->HasPlane()) |
210 | { |
fbcef69b |
211 | gp_Ax2 anAx = theObject->GetPlane(); |
212 | |
213 | Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3); |
214 | for (Standard_Integer i = 1; i <= 3; i++) |
215 | aLocArr->SetValue(i, anAx.Location().Coord(i)); |
216 | Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3); |
217 | if (!aLoc.IsNull()) |
218 | aLoc->ChangeArray(aLocArr); |
219 | |
220 | Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3); |
221 | for (Standard_Integer i = 1; i <= 3; i++) |
222 | aNArr->SetValue(i, anAx.Direction().Coord(i)); |
223 | Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3); |
224 | if (!aN.IsNull()) |
225 | aN->ChangeArray(aNArr); |
226 | |
227 | Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3); |
228 | for (Standard_Integer i = 1; i <= 3; i++) |
229 | aRArr->SetValue(i, anAx.XDirection().Coord(i)); |
230 | Handle(TDataStd_RealArray) aRAtt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3); |
231 | if (!aRAtt.IsNull()) |
232 | aRAtt->ChangeArray(aRArr); |
5df609e7 |
233 | } |
234 | |
235 | if (theObject->HasTextPoint()) |
236 | { |
fbcef69b |
237 | gp_Pnt aPntText = theObject->GetPointTextAttach(); |
238 | |
239 | Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3); |
240 | for (Standard_Integer i = 1; i <= 3; i++) |
241 | aLocArr->SetValue(i, aPntText.Coord(i)); |
242 | Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3); |
243 | if (!aLoc.IsNull()) |
244 | aLoc->ChangeArray(aLocArr); |
5df609e7 |
245 | } |
246 | |
247 | TopoDS_Shape aPresentation = theObject->GetPresentation(); |
248 | if( !aPresentation.IsNull()) |
249 | { |
250 | TDF_Label aLPres = Label().FindChild( ChildLab_Presentation); |
251 | TNaming_Builder tnBuild(aLPres); |
252 | tnBuild.Generated(aPresentation); |
253 | Handle(TCollection_HAsciiString) aName = theObject->GetPresentationName(); |
254 | if( !aName.IsNull() ) |
255 | { |
256 | TCollection_ExtendedString str ( aName->String() ); |
257 | TDataStd_Name::Set ( aLPres, str ); |
258 | } |
259 | } |
7644c7f4 |
260 | |
261 | if (theObject->HasDescriptions()) |
262 | { |
7644c7f4 |
263 | Handle(TColStd_HArray1OfExtendedString) aDescrArr = new TColStd_HArray1OfExtendedString(1, theObject->NbDescriptions()); |
264 | Handle(TColStd_HArray1OfExtendedString) aDescrNameArr = new TColStd_HArray1OfExtendedString(1, theObject->NbDescriptions()); |
265 | for (Standard_Integer i = 0; i < theObject->NbDescriptions(); i++) { |
266 | TCollection_ExtendedString aDescr(theObject->GetDescription(i)->String()); |
267 | aDescrArr->SetValue(i + 1, aDescr); |
268 | TCollection_ExtendedString aDescrName(theObject->GetDescriptionName(i)->String()); |
269 | aDescrNameArr->SetValue(i + 1, aDescrName); |
270 | } |
5a1271c8 |
271 | Handle(TDataStd_ExtStringArray) aDescriptions = TDataStd_ExtStringArray::Set(Label().FindChild(ChildLab_Descriptions), |
272 | 1, theObject->NbDescriptions()); |
273 | Handle(TDataStd_ExtStringArray) aDescriptionNames = TDataStd_ExtStringArray::Set(Label().FindChild(ChildLab_DescriptionNames), |
274 | 1, theObject->NbDescriptions()); |
275 | if(!aDescriptions.IsNull()) |
276 | aDescriptions->ChangeArray(aDescrArr); |
277 | if(!aDescriptionNames.IsNull()) |
278 | aDescriptionNames->ChangeArray(aDescrNameArr); |
7644c7f4 |
279 | } |
9ebaae37 |
280 | } |
281 | |
282 | //======================================================================= |
283 | //function : GetObject |
284 | //purpose : |
285 | //======================================================================= |
286 | Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const |
287 | { |
288 | Handle(XCAFDimTolObjects_DimensionObject) anObj = new XCAFDimTolObjects_DimensionObject(); |
289 | |
eacdb38f |
290 | Handle(TDataStd_Name) aSemanticNameAttr; |
291 | Handle(TCollection_HAsciiString) aSemanticName; |
292 | if (Label().FindAttribute(TDataStd_Name::GetID(), aSemanticNameAttr)) |
293 | { |
294 | const TCollection_ExtendedString& aName = aSemanticNameAttr->Get(); |
295 | if (!aName.IsEmpty()) |
296 | aSemanticName = new TCollection_HAsciiString(aName); |
297 | } |
298 | anObj->SetSemanticName(aSemanticName); |
299 | |
9ebaae37 |
300 | Handle(TDataStd_Integer) aType; |
301 | if(Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType)) |
302 | { |
303 | anObj->SetType((XCAFDimTolObjects_DimensionType)aType->Get()); |
304 | } |
305 | |
306 | Handle(TDataStd_RealArray) aVal; |
307 | if(Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_RealArray::GetID(), aVal) |
308 | && !aVal->Array().IsNull()) |
309 | { |
310 | anObj->SetValues(aVal->Array()); |
311 | } |
312 | |
313 | Handle(TDataStd_Integer) aQualifier; |
314 | if(Label().FindChild(ChildLab_Qualifier).FindAttribute(TDataStd_Integer::GetID(), aQualifier)) |
315 | { |
316 | anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)aQualifier->Get()); |
317 | } |
318 | |
319 | Handle(TDataStd_IntegerArray) aClass; |
320 | if(Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass) |
321 | && !aClass->Array().IsNull() && aClass->Array()->Length() > 0) |
322 | { |
dde68833 |
323 | anObj->SetClassOfTolerance(aClass->Array()->Value(1) != 0, (XCAFDimTolObjects_DimensionFormVariance)aClass->Array()->Value(2), (XCAFDimTolObjects_DimensionGrade)aClass->Array()->Value(3)); |
9ebaae37 |
324 | } |
325 | |
326 | Handle(TDataStd_IntegerArray) aDec; |
327 | if(Label().FindChild(ChildLab_Dec).FindAttribute(TDataStd_IntegerArray::GetID(), aDec) |
328 | && !aDec->Array().IsNull() && aDec->Array()->Length() > 0) |
329 | { |
330 | anObj->SetNbOfDecimalPlaces(aDec->Array()->Value(1), aDec->Array()->Value(2)); |
331 | } |
332 | |
333 | Handle(TDataStd_IntegerArray) aModifiers; |
334 | if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers) |
335 | && !aModifiers->Array().IsNull()) |
336 | { |
337 | XCAFDimTolObjects_DimensionModifiersSequence aM; |
338 | for(Standard_Integer i = 1; i <= aModifiers->Array()->Length(); i++) |
339 | aM.Append((XCAFDimTolObjects_DimensionModif)aModifiers->Array()->Value(i)); |
340 | anObj->SetModifiers(aM); |
341 | } |
342 | |
343 | Handle(TNaming_NamedShape) aShape; |
344 | if(Label().FindChild(ChildLab_Path).FindAttribute(TNaming_NamedShape::GetID(), aShape) |
345 | && !aShape.IsNull()) |
346 | { |
347 | anObj->SetPath(TopoDS::Edge(aShape->Get())); |
348 | } |
349 | |
fbcef69b |
350 | Handle(TDataStd_RealArray) aDir; |
351 | if (Label().FindChild(ChildLab_Dir).FindAttribute(TDataStd_RealArray::GetID(), aDir) |
352 | && !aDir->Array().IsNull() && aDir->Array()->Length() > 0) |
9ebaae37 |
353 | { |
fbcef69b |
354 | gp_Dir aD(aDir->Array()->Value(1), aDir->Array()->Value(2), aDir->Array()->Value(3)); |
355 | anObj->SetDirection(aD); |
9ebaae37 |
356 | } |
357 | |
fbcef69b |
358 | Handle(TDataStd_RealArray) aPnt1; |
359 | if (Label().FindChild(ChildLab_Pnt1).FindAttribute(TDataStd_RealArray::GetID(), aPnt1) && aPnt1->Length() == 3) |
9ebaae37 |
360 | { |
fbcef69b |
361 | gp_Pnt aP(aPnt1->Value(aPnt1->Lower()), aPnt1->Value(aPnt1->Lower() + 1), aPnt1->Value(aPnt1->Lower() + 2)); |
362 | anObj->SetPoint(aP); |
b7b2f85a |
363 | } |
364 | |
fbcef69b |
365 | Handle(TDataStd_RealArray) aPnt2; |
366 | if (Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataStd_RealArray::GetID(), aPnt2) && aPnt2->Length() == 3) |
b7b2f85a |
367 | { |
fbcef69b |
368 | gp_Pnt aP(aPnt2->Value(aPnt2->Lower()), aPnt2->Value(aPnt2->Lower() + 1), aPnt2->Value(aPnt2->Lower() + 2)); |
369 | anObj->SetPoint2(aP); |
9ebaae37 |
370 | } |
371 | |
b8bf9595 |
372 | |
fbcef69b |
373 | Handle(TDataStd_RealArray) aLoc, aN, aR; |
374 | if (Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 && |
375 | Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 && |
376 | Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3) |
5df609e7 |
377 | { |
fbcef69b |
378 | gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower() + 1), aLoc->Value(aLoc->Lower() + 2)); |
379 | gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower() + 1), aN->Value(aN->Lower() + 2)); |
380 | gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower() + 1), aR->Value(aR->Lower() + 2)); |
381 | gp_Ax2 anAx(aL, aD, aDR); |
5df609e7 |
382 | anObj->SetPlane(anAx); |
383 | } |
384 | |
fbcef69b |
385 | Handle(TDataStd_RealArray) aPntText; |
386 | if (Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3) |
5df609e7 |
387 | { |
fbcef69b |
388 | gp_Pnt aP(aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower() + 1), aPntText->Value(aPntText->Lower() + 2)); |
389 | anObj->SetPointTextAttach(aP); |
5df609e7 |
390 | } |
391 | |
392 | Handle(TNaming_NamedShape) aNS; |
393 | TDF_Label aLPres = Label().FindChild( ChildLab_Presentation); |
394 | if ( aLPres.FindAttribute(TNaming_NamedShape::GetID(), aNS) ) |
395 | { |
5df609e7 |
396 | TopoDS_Shape aPresentation = TNaming_Tool::GetShape(aNS); |
397 | if( !aPresentation.IsNull()) |
398 | { |
5df609e7 |
399 | Handle(TDataStd_Name) aNameAtrr; |
400 | Handle(TCollection_HAsciiString) aPresentName; |
401 | if (aLPres.FindAttribute(TDataStd_Name::GetID(),aNameAtrr)) |
402 | { |
403 | const TCollection_ExtendedString& aName = aNameAtrr->Get(); |
5df609e7 |
404 | if( !aName.IsEmpty()) |
405 | aPresentName = new TCollection_HAsciiString(aName); |
406 | } |
5df609e7 |
407 | anObj->SetPresentation(aPresentation, aPresentName); |
408 | } |
409 | } |
7644c7f4 |
410 | |
411 | Handle(TDataStd_ExtStringArray) aDescriptions, aDescriptionNames; |
412 | if (Label().FindChild(ChildLab_Descriptions).FindAttribute(TDataStd_ExtStringArray::GetID(), aDescriptions) && |
413 | Label().FindChild(ChildLab_DescriptionNames).FindAttribute(TDataStd_ExtStringArray::GetID(), aDescriptionNames)) { |
414 | for (Standard_Integer i = 1; i <= aDescriptions->Length(); i++) { |
415 | Handle(TCollection_HAsciiString) aDescription, aDescriptionName; |
416 | aDescription = new TCollection_HAsciiString(TCollection_AsciiString(aDescriptions->Value(i))); |
417 | aDescriptionName = new TCollection_HAsciiString(TCollection_AsciiString(aDescriptionNames->Value(i))); |
418 | anObj->AddDescription(aDescription, aDescriptionName); |
419 | } |
420 | } |
9ebaae37 |
421 | return anObj; |
422 | } |
423 | |
424 | //======================================================================= |
425 | //function : ID |
426 | //purpose : |
427 | //======================================================================= |
428 | |
429 | const Standard_GUID& XCAFDoc_Dimension::ID() const |
430 | { |
431 | return GetID(); |
432 | } |
433 | |
434 | //======================================================================= |
435 | //function : Restore |
436 | //purpose : |
437 | //======================================================================= |
438 | |
439 | void XCAFDoc_Dimension::Restore(const Handle(TDF_Attribute)& /*With*/) |
440 | { |
441 | } |
442 | |
443 | |
444 | //======================================================================= |
445 | //function : NewEmpty |
446 | //purpose : |
447 | //======================================================================= |
448 | |
449 | Handle(TDF_Attribute) XCAFDoc_Dimension::NewEmpty() const |
450 | { |
451 | return new XCAFDoc_Dimension(); |
452 | } |
453 | |
454 | |
455 | //======================================================================= |
456 | //function : Paste |
457 | //purpose : |
458 | //======================================================================= |
459 | |
460 | void XCAFDoc_Dimension::Paste(const Handle(TDF_Attribute)& /*Into*/, |
461 | const Handle(TDF_RelocationTable)& /*RT*/) const |
462 | { |
463 | } |
bc73b006 |
464 | |
465 | //======================================================================= |
466 | //function : DumpJson |
467 | //purpose : |
468 | //======================================================================= |
469 | void XCAFDoc_Dimension::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const |
470 | { |
471 | OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) |
472 | |
473 | OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute) |
474 | } |