1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Precision.hxx>
16 #include <Standard_GUID.hxx>
17 #include <Standard_Type.hxx>
18 #include <TCollection_HAsciiString.hxx>
19 #include <TDataStd_Name.hxx>
20 #include <TDataStd_TreeNode.hxx>
21 #include <TDF_Attribute.hxx>
22 #include <TDF_ChildIDIterator.hxx>
23 #include <TDF_Label.hxx>
24 #include <TDF_RelocationTable.hxx>
25 #include <XCAFDoc.hxx>
26 #include <XCAFDoc_Dimension.hxx>
27 #include <XCAFDoc_GeomTolerance.hxx>
28 #include <XCAFDoc_Datum.hxx>
29 #include <XCAFDoc_DimTol.hxx>
30 #include <XCAFDoc_DimTolTool.hxx>
31 #include <XCAFDoc_DocumentTool.hxx>
32 #include <XCAFDoc_GraphNode.hxx>
33 #include <XCAFDoc_ShapeTool.hxx>
35 //=======================================================================
36 //function : XCAFDoc_DimTolTool
38 //=======================================================================
39 XCAFDoc_DimTolTool::XCAFDoc_DimTolTool()
44 //=======================================================================
47 //=======================================================================
49 Handle(XCAFDoc_DimTolTool) XCAFDoc_DimTolTool::Set(const TDF_Label& L)
51 Handle(XCAFDoc_DimTolTool) A;
52 if (!L.FindAttribute (XCAFDoc_DimTolTool::GetID(), A)) {
53 A = new XCAFDoc_DimTolTool ();
55 A->myShapeTool = XCAFDoc_DocumentTool::ShapeTool(L);
61 //=======================================================================
64 //=======================================================================
66 const Standard_GUID& XCAFDoc_DimTolTool::GetID()
68 static Standard_GUID DGTTblID ("72afb19b-44de-11d8-8776-001083004c77");
73 //=======================================================================
74 //function : BaseLabel
76 //=======================================================================
78 TDF_Label XCAFDoc_DimTolTool::BaseLabel() const
84 //=======================================================================
85 //function : ShapeTool
87 //=======================================================================
89 const Handle(XCAFDoc_ShapeTool)& XCAFDoc_DimTolTool::ShapeTool()
91 if(myShapeTool.IsNull())
92 myShapeTool = XCAFDoc_DocumentTool::ShapeTool(Label());
97 //=======================================================================
100 //=======================================================================
102 Standard_Boolean XCAFDoc_DimTolTool::IsDimTol(const TDF_Label& theDimTolL) const
104 Handle(XCAFDoc_DimTol) aDimTolAttr;
105 if(theDimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),aDimTolAttr)) {
106 return Standard_True;
108 return Standard_False;
111 //=======================================================================
112 //function : IsDimension
114 //=======================================================================
116 Standard_Boolean XCAFDoc_DimTolTool::IsDimension(const TDF_Label& theDimTolL) const
118 Handle(XCAFDoc_Dimension) aDimTolAttr;
119 if(theDimTolL.FindAttribute(XCAFDoc_Dimension::GetID(),aDimTolAttr)) {
120 return Standard_True;
122 return Standard_False;
125 //=======================================================================
126 //function : IsGeomTolerance
128 //=======================================================================
130 Standard_Boolean XCAFDoc_DimTolTool::IsGeomTolerance(const TDF_Label& theDimTolL) const
132 Handle(XCAFDoc_GeomTolerance) aDimTolAttr;
133 if(theDimTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(),aDimTolAttr)) {
134 return Standard_True;
136 return Standard_False;
139 //=======================================================================
140 //function : GetDimTolLabels
142 //=======================================================================
144 void XCAFDoc_DimTolTool::GetDimTolLabels(TDF_LabelSequence& theLabels) const
147 TDF_ChildIterator aChildIterator( Label() );
148 for (; aChildIterator.More(); aChildIterator.Next()) {
149 TDF_Label aL = aChildIterator.Value();
150 if ( IsDimTol(aL)) theLabels.Append(aL);
154 //=======================================================================
155 //function : GetDimensionLabels
157 //=======================================================================
159 void XCAFDoc_DimTolTool::GetDimensionLabels(TDF_LabelSequence& theLabels) const
162 TDF_ChildIterator aChildIterator( Label() );
163 for (; aChildIterator.More(); aChildIterator.Next()) {
164 TDF_Label aL = aChildIterator.Value();
165 if ( IsDimension(aL)) theLabels.Append(aL);
169 //=======================================================================
170 //function : GetGeomToleranceLabels
172 //=======================================================================
174 void XCAFDoc_DimTolTool::GetGeomToleranceLabels(TDF_LabelSequence& theLabels) const
177 TDF_ChildIterator aChildIterator( Label() );
178 for (; aChildIterator.More(); aChildIterator.Next()) {
179 TDF_Label aL = aChildIterator.Value();
180 if ( IsGeomTolerance(aL)) theLabels.Append(aL);
184 //=======================================================================
185 //function : FindDimTol
187 //=======================================================================
189 Standard_Boolean XCAFDoc_DimTolTool::FindDimTol(const Standard_Integer kind,
190 const Handle(TColStd_HArray1OfReal)& aVal,
191 const Handle(TCollection_HAsciiString)& aName,
192 const Handle(TCollection_HAsciiString)& aDescription,
193 TDF_Label& lab) const
195 TDF_ChildIDIterator it(Label(),XCAFDoc_DimTol::GetID());
196 for(; it.More(); it.Next()) {
197 TDF_Label DimTolL = it.Value()->Label();
198 Handle(XCAFDoc_DimTol) DimTolAttr;
199 if(!DimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),DimTolAttr)) continue;
200 Standard_Integer kind1 = DimTolAttr->GetKind();
201 Handle(TColStd_HArray1OfReal) aVal1 = DimTolAttr->GetVal();
202 Handle(TCollection_HAsciiString) aName1 = DimTolAttr->GetName();
203 Handle(TCollection_HAsciiString) aDescription1 = DimTolAttr->GetDescription();
204 Standard_Boolean IsEqual = Standard_True;
205 if(!(kind1==kind)) continue;
206 if(!(aName==aName1)) continue;
207 if(!(aDescription==aDescription1)) continue;
208 if(kind<20) { //dimension
209 for(Standard_Integer i=1; i<=aVal->Length(); i++) {
210 if(Abs(aVal->Value(i)-aVal1->Value(i))>Precision::Confusion())
211 IsEqual = Standard_False;
214 else if(kind<50) { //tolerance
215 if(Abs(aVal->Value(1)-aVal1->Value(1))>Precision::Confusion())
216 IsEqual = Standard_False;
220 return Standard_True;
223 return Standard_False;
227 //=======================================================================
228 //function : FindDimTol
230 //=======================================================================
232 TDF_Label XCAFDoc_DimTolTool::FindDimTol(const Standard_Integer kind,
233 const Handle(TColStd_HArray1OfReal)& aVal,
234 const Handle(TCollection_HAsciiString)& aName,
235 const Handle(TCollection_HAsciiString)& aDescription) const
238 FindDimTol(kind,aVal,aName,aDescription,L);
243 //=======================================================================
244 //function : AddDimTol
246 //=======================================================================
248 TDF_Label XCAFDoc_DimTolTool::AddDimTol(const Standard_Integer kind,
249 const Handle(TColStd_HArray1OfReal)& aVal,
250 const Handle(TCollection_HAsciiString)& aName,
251 const Handle(TCollection_HAsciiString)& aDescription) const
255 DimTolL = aTag.NewChild ( Label() );
256 XCAFDoc_DimTol::Set(DimTolL,kind,aVal,aName,aDescription);
257 TCollection_AsciiString str = "DGT:";
258 if(kind<20) str.AssignCat("Dimension");
259 else str.AssignCat("Tolerance");
260 TDataStd_Name::Set(DimTolL,str);
264 //=======================================================================
265 //function : AddDimension
267 //=======================================================================
269 TDF_Label XCAFDoc_DimTolTool::AddDimension()
273 aDimTolL = aTag.NewChild ( Label() );
274 Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aDimTolL);
275 TCollection_AsciiString aStr = "DGT:Dimension";
276 TDataStd_Name::Set(aDimTolL,aStr);
280 //=======================================================================
281 //function : AddGeomTolerance
283 //=======================================================================
285 TDF_Label XCAFDoc_DimTolTool::AddGeomTolerance()
289 aDimTolL = aTag.NewChild ( Label() );
290 Handle(XCAFDoc_GeomTolerance) aTol = XCAFDoc_GeomTolerance::Set(aDimTolL);
291 TCollection_AsciiString aStr = "DGT:Tolerance";
292 TDataStd_Name::Set(aDimTolL,aStr);
296 //=======================================================================
297 //function : SetDimension
299 //=======================================================================
301 void XCAFDoc_DimTolTool::SetDimension(const TDF_Label& theL,
302 const TDF_Label& theDimTolL) const
305 SetDimension(theL, nullLab, theDimTolL);
308 //=======================================================================
309 //function : SetDimension
311 //=======================================================================
313 void XCAFDoc_DimTolTool::SetDimension(const TDF_Label& theFirstL,
314 const TDF_Label& theSecondL,
315 const TDF_Label& theDimTolL) const
317 Handle(XCAFDoc_GraphNode) aChGNode;
318 Handle(XCAFDoc_GraphNode) aFGNode;
319 Handle(XCAFDoc_GraphNode) aSecondFGNode;
321 //Handle(XCAFDoc_GraphNode) ChGNode, FGNode;
322 if ( theDimTolL.FindAttribute (XCAFDoc::DimensionRefGUID(), aChGNode) ) {
323 while (aChGNode->NbFathers() > 0) {
324 aFGNode = aChGNode->GetFather(1);
325 aFGNode->UnSetChild(aChGNode);
327 theDimTolL.ForgetAttribute ( XCAFDoc::DimTolRefGUID() );
330 if(!IsDimension(theDimTolL))
335 if (!theDimTolL.FindAttribute(XCAFDoc::DimensionRefGUID(), aChGNode) ) {
336 aChGNode = new XCAFDoc_GraphNode;
337 aChGNode = XCAFDoc_GraphNode::Set(theDimTolL);
339 if (!theFirstL.FindAttribute(XCAFDoc::DimensionRefGUID(), aFGNode) ) {
340 aFGNode = new XCAFDoc_GraphNode;
341 aFGNode = XCAFDoc_GraphNode::Set(theFirstL);
343 aFGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
344 aChGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
345 aFGNode->SetChild(aChGNode);
346 aChGNode->SetFather(aFGNode);
348 if (!theSecondL.IsNull()){
349 if(!theSecondL.FindAttribute(XCAFDoc::DimensionRefGUID(), aSecondFGNode) ) {
350 aSecondFGNode = new XCAFDoc_GraphNode;
351 aSecondFGNode = XCAFDoc_GraphNode::Set(theSecondL);
353 aSecondFGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
354 aSecondFGNode->SetChild(aChGNode);
355 aChGNode->SetFather(aSecondFGNode);
359 //=======================================================================
360 //function : SetGeomTolerance
362 //=======================================================================
364 void XCAFDoc_DimTolTool::SetGeomTolerance(const TDF_Label& theL,
365 const TDF_Label& theDimTolL) const
368 Handle(TDataStd_TreeNode) refNode, mainNode;
369 refNode = TDataStd_TreeNode::Set ( theDimTolL, XCAFDoc::GeomToleranceRefGUID() );
370 mainNode = TDataStd_TreeNode::Set ( theL, XCAFDoc::GeomToleranceRefGUID() );
371 refNode->Remove(); // abv: fix against bug in TreeNode::Append()
372 mainNode->Append(refNode);
375 //=======================================================================
376 //function : SetDimTol
378 //=======================================================================
380 void XCAFDoc_DimTolTool::SetDimTol(const TDF_Label& theL,
381 const TDF_Label& theDimTolL) const
384 Handle(TDataStd_TreeNode) refNode, mainNode;
385 refNode = TDataStd_TreeNode::Set ( theDimTolL, XCAFDoc::DimTolRefGUID() );
386 mainNode = TDataStd_TreeNode::Set (theL, XCAFDoc::DimTolRefGUID() );
387 refNode->Remove(); // abv: fix against bug in TreeNode::Append()
388 mainNode->Append(refNode);
392 //=======================================================================
393 //function : SetDimTol
395 //=======================================================================
397 TDF_Label XCAFDoc_DimTolTool::SetDimTol(const TDF_Label& L,
398 const Standard_Integer kind,
399 const Handle(TColStd_HArray1OfReal)& aVal,
400 const Handle(TCollection_HAsciiString)& aName,
401 const Handle(TCollection_HAsciiString)& aDescription) const
403 TDF_Label DimTolL = AddDimTol(kind,aVal,aName,aDescription);
404 SetDimTol(L,DimTolL);
409 //=======================================================================
410 //function : GetRefShapeLabel
412 //=======================================================================
414 Standard_Boolean XCAFDoc_DimTolTool::GetRefShapeLabel(const TDF_Label& theL,
415 TDF_LabelSequence& theShapeL) const
418 Handle(TDataStd_TreeNode) aNode;
419 if( !theL.FindAttribute(XCAFDoc::DimTolRefGUID(),aNode) || !aNode->HasFather() ) {
420 if( !theL.FindAttribute(XCAFDoc::DatumRefGUID(),aNode) || !aNode->HasFather() ) {
421 if( !theL.FindAttribute(XCAFDoc::GeomToleranceRefGUID(),aNode) || !aNode->HasFather() ) {
422 Handle(XCAFDoc_GraphNode) aGNode;
423 if( theL.FindAttribute(XCAFDoc::DimensionRefGUID(),aGNode) && aGNode->NbFathers() > 0 ) {
424 for(Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
426 theShapeL.Append(aGNode->GetFather(i)->Label());
428 return Standard_True;
430 return Standard_False;
434 theShapeL.Append(aNode->Father()->Label());
435 return Standard_True;
438 //=======================================================================
439 //function : GetRefDimensionLabels
441 //=======================================================================
443 Standard_Boolean XCAFDoc_DimTolTool::GetRefDimensionLabels(const TDF_Label& theShapeL,
444 TDF_LabelSequence& theDimTols) const
446 Handle(XCAFDoc_GraphNode) aGNode;
447 if( theShapeL.FindAttribute(XCAFDoc::DimensionRefGUID(),aGNode) && aGNode->NbChildren() > 0 ) {
448 for(Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
450 theDimTols.Append(aGNode->GetChild(i)->Label());
452 return Standard_True;
454 return Standard_False;
457 //=======================================================================
458 //function : GetRefGeomToleranceLabels
460 //=======================================================================
462 Standard_Boolean XCAFDoc_DimTolTool::GetRefGeomToleranceLabels(const TDF_Label& theShapeL,
463 TDF_LabelSequence& theDimTols) const
465 Handle(TDataStd_TreeNode) aNode;
466 if( !theShapeL.FindAttribute(XCAFDoc::GeomToleranceRefGUID(),aNode) ||
467 !aNode->HasFirst() ) {
468 return Standard_False;
470 Handle(TDataStd_TreeNode) aLast = aNode->First();
471 theDimTols.Append(aLast->Label());
472 while(aLast->HasNext()) {
473 aLast = aLast->Next();
474 theDimTols.Append(aLast->Label());
476 return Standard_True;
479 //=======================================================================
480 //function : GetRefDatumLabel
482 //=======================================================================
484 Standard_Boolean XCAFDoc_DimTolTool::GetRefDatumLabel(const TDF_Label& theShapeL,
485 TDF_Label& theDatum) const
487 Handle(TDataStd_TreeNode) aNode;
488 if( !theShapeL.FindAttribute(XCAFDoc::DatumRefGUID(),aNode) ||
489 !aNode->HasFirst() ) {
490 return Standard_False;
492 Handle(TDataStd_TreeNode) aLast = aNode->First();
493 theDatum = aLast->Label();
494 return Standard_True;
497 //=======================================================================
498 //function : GetDimTol
500 //=======================================================================
502 Standard_Boolean XCAFDoc_DimTolTool::GetDimTol(const TDF_Label& DimTolL,
503 Standard_Integer& kind,
504 Handle(TColStd_HArray1OfReal)& aVal,
505 Handle(TCollection_HAsciiString)& aName,
506 Handle(TCollection_HAsciiString)& aDescription) const
508 Handle(XCAFDoc_DimTol) DimTolAttr;
509 if(!DimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),DimTolAttr)) {
510 return Standard_False;
512 kind = DimTolAttr->GetKind();
513 aVal = DimTolAttr->GetVal();
514 aName = DimTolAttr->GetName();
515 aDescription = DimTolAttr->GetDescription();
517 return Standard_True;
521 //=======================================================================
524 //=======================================================================
526 Standard_Boolean XCAFDoc_DimTolTool::IsDatum(const TDF_Label& theDimTolL) const
528 Handle(XCAFDoc_Datum) aDatumAttr;
529 if(theDimTolL.FindAttribute(XCAFDoc_Datum::GetID(),aDatumAttr)) {
530 return Standard_True;
532 return Standard_False;
536 //=======================================================================
537 //function : GetDatumLabels
539 //=======================================================================
541 void XCAFDoc_DimTolTool::GetDatumLabels(TDF_LabelSequence& theLabels) const
544 TDF_ChildIterator aChildIterator( Label() );
545 for (; aChildIterator.More(); aChildIterator.Next()) {
546 TDF_Label L = aChildIterator.Value();
547 if ( IsDatum(L)) theLabels.Append(L);
551 //=======================================================================
552 //function : FindDatum
554 //=======================================================================
556 Standard_Boolean XCAFDoc_DimTolTool::FindDatum(const Handle(TCollection_HAsciiString)& aName,
557 const Handle(TCollection_HAsciiString)& aDescription,
558 const Handle(TCollection_HAsciiString)& anIdentification,
559 TDF_Label& lab) const
561 TDF_ChildIDIterator it(Label(),XCAFDoc_Datum::GetID());
562 for(; it.More(); it.Next()) {
563 Handle(TCollection_HAsciiString) aName1, aDescription1, anIdentification1;
564 TDF_Label aLabel = it.Value()->Label();
565 if ( !GetDatum( aLabel, aName1, aDescription1, anIdentification1 ) )
567 if(!(aName==aName1)) continue;
568 if(!(aDescription==aDescription1)) continue;
569 if(!(anIdentification==anIdentification1)) continue;
571 return Standard_True;
573 return Standard_False;
577 //=======================================================================
578 //function : AddDatum
580 //=======================================================================
582 TDF_Label XCAFDoc_DimTolTool::AddDatum(const Handle(TCollection_HAsciiString)& aName,
583 const Handle(TCollection_HAsciiString)& aDescription,
584 const Handle(TCollection_HAsciiString)& anIdentification) const
588 DatumL = aTag.NewChild ( Label() );
589 XCAFDoc_Datum::Set(DatumL,aName,aDescription,anIdentification);
590 TDataStd_Name::Set(DatumL,"DGT:Datum");
594 //=======================================================================
595 //function : AddDatum
597 //=======================================================================
599 TDF_Label XCAFDoc_DimTolTool::AddDatum()
603 aDatumL = aTag.NewChild ( Label() );
604 Handle(XCAFDoc_Datum) aDat = XCAFDoc_Datum::Set(aDatumL);
605 TDataStd_Name::Set(aDatumL,"DGT:Datum");
609 //=======================================================================
610 //function : SetDatum
612 //=======================================================================
614 void XCAFDoc_DimTolTool::SetDatum(const TDF_Label& theL,
615 const TDF_Label& theDatumL) const
618 Handle(TDataStd_TreeNode) refNode, mainNode;
619 refNode = TDataStd_TreeNode::Set ( theDatumL, XCAFDoc::DatumRefGUID() );
620 mainNode = TDataStd_TreeNode::Set ( theL, XCAFDoc::DatumRefGUID() );
622 mainNode->Append(refNode);
625 //=======================================================================
626 //function : SetDatum
628 //=======================================================================
630 void XCAFDoc_DimTolTool::SetDatum(const TDF_Label& L,
631 const TDF_Label& TolerL,
632 const Handle(TCollection_HAsciiString)& aName,
633 const Handle(TCollection_HAsciiString)& aDescription,
634 const Handle(TCollection_HAsciiString)& anIdentification) const
637 if(!FindDatum(aName,aDescription,anIdentification,DatumL))
638 DatumL = AddDatum(aName,aDescription,anIdentification);
641 Handle(XCAFDoc_GraphNode) FGNode;
642 Handle(XCAFDoc_GraphNode) ChGNode;
643 if (! TolerL.FindAttribute( XCAFDoc::DatumTolRefGUID(), FGNode) ) {
644 FGNode = new XCAFDoc_GraphNode;
645 FGNode = XCAFDoc_GraphNode::Set(TolerL);
647 if (! DatumL.FindAttribute( XCAFDoc::DatumTolRefGUID(), ChGNode) ) {
648 ChGNode = new XCAFDoc_GraphNode;
649 ChGNode = XCAFDoc_GraphNode::Set(DatumL);
651 FGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
652 ChGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
653 FGNode->SetChild(ChGNode);
654 ChGNode->SetFather(FGNode);
657 //=======================================================================
658 //function : SetDatumToGeomTol
660 //=======================================================================
662 void XCAFDoc_DimTolTool::SetDatumToGeomTol(const TDF_Label& theDatumL,
663 const TDF_Label& theTolerL) const
666 Handle(XCAFDoc_GraphNode) aFGNode;
667 Handle(XCAFDoc_GraphNode) aChGNode;
668 if (! theTolerL.FindAttribute( XCAFDoc::DatumTolRefGUID(), aFGNode) ) {
669 aFGNode = new XCAFDoc_GraphNode;
670 aFGNode = XCAFDoc_GraphNode::Set(theTolerL);
672 if (! theDatumL.FindAttribute( XCAFDoc::DatumTolRefGUID(), aChGNode) ) {
673 aChGNode = new XCAFDoc_GraphNode;
674 aChGNode = XCAFDoc_GraphNode::Set(theDatumL);
676 aFGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
677 aChGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
678 aFGNode->SetChild(aChGNode);
679 aChGNode->SetFather(aFGNode);
682 //=======================================================================
683 //function : GetDatum
685 //=======================================================================
687 Standard_Boolean XCAFDoc_DimTolTool::GetDatum(const TDF_Label& theDatumL,
688 Handle(TCollection_HAsciiString)& theName,
689 Handle(TCollection_HAsciiString)& theDescription,
690 Handle(TCollection_HAsciiString)& theIdentification) const
692 Handle(XCAFDoc_Datum) aDatumAttr;
693 if( theDatumL.IsNull() ||
694 !theDatumL.FindAttribute(XCAFDoc_Datum::GetID(),aDatumAttr) )
695 return Standard_False;
697 theName = aDatumAttr->GetName();
698 theDescription = aDatumAttr->GetDescription();
699 theIdentification = aDatumAttr->GetIdentification();
700 return Standard_True;
703 //=======================================================================
704 //function : GetDatumTolerLabels
706 //=======================================================================
708 Standard_Boolean XCAFDoc_DimTolTool::GetDatumOfTolerLabels(const TDF_Label& theDimTolL,
709 TDF_LabelSequence& theDatums) const
711 Handle(XCAFDoc_GraphNode) aNode;
712 if( !theDimTolL.FindAttribute(XCAFDoc::DatumTolRefGUID(),aNode) )
713 return Standard_False;
714 for(Standard_Integer i=1; i<=aNode->NbChildren(); i++) {
715 Handle(XCAFDoc_GraphNode) aDatumNode = aNode->GetChild(i);
716 theDatums.Append(aDatumNode->Label());
718 return Standard_True;
721 //=======================================================================
722 //function : GetTolerDatumLabels
724 //=======================================================================
726 Standard_Boolean XCAFDoc_DimTolTool::GetTolerOfDatumLabels(const TDF_Label& theDatumL,
727 TDF_LabelSequence& theTols) const
729 Handle(XCAFDoc_GraphNode) aNode;
730 if( !theDatumL.FindAttribute(XCAFDoc::DatumTolRefGUID(),aNode) )
731 return Standard_False;
732 for(Standard_Integer i=1; i<=aNode->NbFathers(); i++) {
733 Handle(XCAFDoc_GraphNode) aDatumNode = aNode->GetFather(i);
734 theTols.Append(aDatumNode->Label());
736 return Standard_True;
740 //=======================================================================
743 //=======================================================================
745 const Standard_GUID& XCAFDoc_DimTolTool::ID() const
751 //=======================================================================
754 //=======================================================================
756 void XCAFDoc_DimTolTool::Restore(const Handle(TDF_Attribute)& /*with*/)
761 //=======================================================================
762 //function : NewEmpty
764 //=======================================================================
766 Handle(TDF_Attribute) XCAFDoc_DimTolTool::NewEmpty() const
768 return new XCAFDoc_DimTolTool;
772 //=======================================================================
775 //=======================================================================
777 void XCAFDoc_DimTolTool::Paste(const Handle(TDF_Attribute)& /*into*/,
778 const Handle(TDF_RelocationTable)& /*RT*/) const