1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include <Standard_Stream.hxx>
24 #include <GEOM_Function.hxx>
25 #include <GEOM_Object.hxx>
26 #include <GEOM_Solver.hxx>
27 #include <GEOM_ISubShape.hxx>
29 #include <Basics_OCCTVersion.hxx>
31 #include "utilities.h"
34 #include <TDF_Tool.hxx>
35 #include <TDF_Data.hxx>
36 #include <TDF_ChildIterator.hxx>
37 #include <TDF_Reference.hxx>
38 #include <TDataStd_Integer.hxx>
39 #include <TDataStd_IntegerArray.hxx>
40 #include <TDataStd_Real.hxx>
41 #include <TDataStd_RealArray.hxx>
42 #include <TDataStd_Comment.hxx>
43 #include <TDataStd_TreeNode.hxx>
44 #include <TDataStd_UAttribute.hxx>
45 #include <TDataStd_ChildNodeIterator.hxx>
46 #include <TDataStd_ExtStringArray.hxx>
47 #include <TDataStd_ExtStringList.hxx>
48 #include <TDocStd_Owner.hxx>
49 #include <TDocStd_Document.hxx>
50 #include <TFunction_Function.hxx>
51 #include <TNaming_NamedShape.hxx>
52 #include <TNaming_Builder.hxx>
54 #include <TColStd_ListOfInteger.hxx>
55 #include <TColStd_ListIteratorOfListOfInteger.hxx>
56 #include <TColStd_HArray1OfReal.hxx>
57 #include <TColStd_HArray1OfInteger.hxx>
58 #include <TColStd_HSequenceOfTransient.hxx>
59 #include <TCollection_AsciiString.hxx>
60 #include <TCollection_ExtendedString.hxx>
62 #include <Standard_Failure.hxx>
63 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
65 // This modification was introduced in frame of Mantis issue 0021251.
66 // This line allows to keep shape orientation together with the shape itself.
67 // Otherwise orientation can be lost in some cases.
68 #define KEEP_ORIENTATION_0021251
70 #define ARGUMENT_LABEL 1
71 #define RESULT_LABEL 2
72 #define DESCRIPTION_LABEL 3
73 #define HISTORY_LABEL 4
74 #define SUBSHAPES_LABEL 5 // 0020756: GetGroups
75 #define NAMING_LABEL 6 // 0020750: Naming during STEP import
77 #ifdef KEEP_ORIENTATION_0021251
78 #define ORIENTATION_LABEL 7 // 0021251: TNaming_NamedShape doesn't store orientation
81 #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
82 #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
83 #define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
85 //=======================================================================
86 //function : GetFunctionTreeID
88 //=======================================================================
89 const Standard_GUID& GEOM_Function::GetFunctionTreeID()
91 static Standard_GUID aFunctionTreeID("FF1BBB00-5D14-4df2-980B-3A668264EA16");
92 return aFunctionTreeID;
96 //=======================================================================
97 //function : GetDependencyID
99 //=======================================================================
100 const Standard_GUID& GEOM_Function::GetDependencyID()
102 static Standard_GUID aDependencyID("E2620650-2354-41bd-8C2C-210CFCD00948");
103 return aDependencyID;
106 //=============================================================================
110 //=============================================================================
111 Handle(GEOM_Function) GEOM_Function::GetFunction(const TDF_Label& theEntry)
113 if(!theEntry.IsAttribute(TFunction_Function::GetID())) return NULL;
115 return new GEOM_Function(theEntry);
118 //=============================================================================
122 //=============================================================================
123 GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType)
126 TFunction_Function::Set(theEntry, theGUID);
127 TDataStd_Integer::Set(theEntry, theType);
129 //Add function to a function tree
130 Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theEntry.Data());
131 Handle(TDataStd_TreeNode) aRoot, aNode;
132 if(!aDoc->Main().FindAttribute(GetFunctionTreeID(), aRoot))
133 aRoot = TDataStd_TreeNode::Set(aDoc->Main(), GetFunctionTreeID());
135 aNode = TDataStd_TreeNode::Set(theEntry, GetFunctionTreeID());
136 aRoot->Append(aNode);
139 //=============================================================================
143 //=============================================================================
144 TDF_Label GEOM_Function::GetOwnerEntry()
146 TDF_Label aFather = _label.Father();
147 while(!aFather.IsRoot()) {
148 if(aFather.IsAttribute(GEOM_Object::GetObjectID())) return aFather;
149 aFather = aFather.Father();
155 //=============================================================================
159 //=============================================================================
160 int GEOM_Function::GetType()
163 Handle(TDataStd_Integer) aType;
164 if(!_label.FindAttribute(TDataStd_Integer::GetID(), aType)) return 0;
169 //=============================================================================
173 //=============================================================================
174 TopoDS_Shape GEOM_Function::GetValue()
179 TDF_Label aLabel = GetOwnerEntry();
180 if (aLabel.IsRoot()) return aShape;
181 Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
182 if (anObject.IsNull()) return aShape;
184 if (!anObject->IsMainShape()) {
185 bool isResult = false;
186 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
187 if (!aResultLabel.IsNull()) {
188 Handle(TNaming_NamedShape) aNS;
189 if (aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS))
196 Standard_Integer aTic = anObject->GetTic();
199 GEOM_ISubShape aCI (this);
200 TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
201 if (aLabelObjMainSh.IsRoot()) return aShape;
202 Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
203 if (anObjMainSh.IsNull()) return aShape;
204 Standard_Integer aTicMainSh = anObjMainSh->GetTic();
207 isResult = ((aTic == aTicMainSh) ? true : false);
212 #if OCC_VERSION_LARGE > 0x06010000
215 GEOM_Solver aSolver(GEOM_Engine::GetEngine());
216 if (!aSolver.ComputeFunction(this)) {
217 MESSAGE("GEOM_Object::GetValue Error : Can't build a sub-shape");
221 catch (Standard_Failure) {
222 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
223 MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString());
229 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
230 Handle(TNaming_NamedShape) aNS;
231 if (!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
235 #ifdef KEEP_ORIENTATION_0021251
236 // 0021251: TNaming_NamedShape doesn't store orientation
237 TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
238 Handle(TDataStd_Integer) anInteger;
239 if (anOrientationLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) {
240 aShape.Orientation((TopAbs_Orientation)anInteger->Get());
248 //=============================================================================
252 //=============================================================================
253 void GEOM_Function::SetValue(TopoDS_Shape& theShape)
256 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
257 TNaming_Builder aBuilder (aResultLabel);
259 aBuilder.Generated(theShape);
261 #ifdef KEEP_ORIENTATION_0021251
262 // 0021251: TNaming_NamedShape doesn't store orientation
263 TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
264 TDataStd_Integer::Set(anOrientationLabel, (int)theShape.Orientation());
267 // synchronisation between main shape and its sub-shapes
268 TDF_Label aLabel = GetOwnerEntry();
269 if (aLabel.IsRoot()) return;
270 Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
271 if (anObject.IsNull()) return;
272 if (anObject->IsMainShape()) {
273 // increase modifications counter of this (main) shape
274 anObject->IncrementTic();
277 // update modifications counter of this (sub-) shape to be the same as on main shape
278 GEOM_ISubShape aCI (this);
279 TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
280 if (aLabelObjMainSh.IsRoot()) return;
281 Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
282 if (anObjMainSh.IsNull()) return;
284 anObject->SetTic(anObjMainSh->GetTic());
290 //=============================================================================
294 //=============================================================================
295 Standard_GUID GEOM_Function::GetDriverGUID()
297 Handle(TFunction_Function) aFunction;
298 if(!_label.FindAttribute(TFunction_Function::GetID(), aFunction)) {
299 return TDF::LowestID();
302 return aFunction->GetDriverGUID();
305 //=============================================================================
309 //=============================================================================
310 TCollection_AsciiString GEOM_Function::GetDescription()
312 Handle(TDataStd_Comment) aComment;
313 TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
314 if(!aChild.FindAttribute(TDataStd_Comment::GetID(), aComment)) return TCollection_AsciiString();
315 TCollection_AsciiString aDescr(aComment->Get());
319 //=============================================================================
323 //=============================================================================
324 void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription)
326 TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
327 Handle(TDataStd_Comment) aComment =
328 TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription));
331 //=============================================================================
335 //=============================================================================
336 void GEOM_Function::SetReal(int thePosition, double theValue)
339 if(thePosition <= 0) return;
340 TDF_Label anArgLabel = ARGUMENT(thePosition);
341 TDataStd_Real::Set(anArgLabel, theValue);
345 //=============================================================================
349 //=============================================================================
350 void GEOM_Function::SetRealArray (int thePosition,
351 const Handle(TColStd_HArray1OfReal)& theArray)
354 if(thePosition <= 0) return;
355 TDF_Label anArgLabel = ARGUMENT(thePosition);
356 Handle(TDataStd_RealArray) anAttr =
357 TDataStd_RealArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
358 anAttr->ChangeArray(theArray);
362 //=============================================================================
366 //=============================================================================
367 double GEOM_Function::GetReal(int thePosition)
370 if(thePosition <= 0) return 0.0;
371 Handle(TDataStd_Real) aReal;
372 TDF_Label anArgLabel = ARGUMENT(thePosition);
373 if(!anArgLabel.FindAttribute(TDataStd_Real::GetID(), aReal)) return 0.0;
379 //=============================================================================
383 //=============================================================================
384 Handle(TColStd_HArray1OfReal) GEOM_Function::GetRealArray(int thePosition)
387 if(thePosition <= 0) return NULL;
388 Handle(TDataStd_RealArray) aRealArray;
389 TDF_Label anArgLabel = ARGUMENT(thePosition);
390 if(!anArgLabel.FindAttribute(TDataStd_RealArray::GetID(), aRealArray)) return NULL;
393 return aRealArray->Array();
396 //=============================================================================
400 //=============================================================================
401 void GEOM_Function::SetInteger(int thePosition, int theValue)
404 if(thePosition <= 0) return;
405 TDF_Label anArgLabel = ARGUMENT(thePosition);
406 TDataStd_Integer::Set(anArgLabel, theValue);
410 //=============================================================================
414 //=============================================================================
415 void GEOM_Function::SetIntegerArray (int thePosition,
416 const Handle(TColStd_HArray1OfInteger)& theArray)
419 if(thePosition <= 0) return;
420 TDF_Label anArgLabel = ARGUMENT(thePosition);
421 Handle(TDataStd_IntegerArray) anAttr =
422 TDataStd_IntegerArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
423 anAttr->ChangeArray(theArray);
427 //=============================================================================
431 //=============================================================================
432 int GEOM_Function::GetInteger(int thePosition)
435 if(thePosition <= 0) return 0;
436 Handle(TDataStd_Integer) anInteger;
437 TDF_Label anArgLabel = ARGUMENT(thePosition);
438 if(!anArgLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) return 0;
441 return anInteger->Get();
444 //=============================================================================
448 //=============================================================================
449 Handle(TColStd_HArray1OfInteger) GEOM_Function::GetIntegerArray(int thePosition)
452 if(thePosition <= 0) return 0;
453 Handle(TDataStd_IntegerArray) anIntegerArray;
454 TDF_Label anArgLabel = ARGUMENT(thePosition);
455 if(!anArgLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) return 0;
458 return anIntegerArray->Array();
461 //=============================================================================
465 //=============================================================================
466 void GEOM_Function::SetString(int thePosition, const TCollection_AsciiString& theValue)
469 if(thePosition <= 0) return;
470 TDF_Label anArgLabel = ARGUMENT(thePosition);
471 TDataStd_Comment::Set(anArgLabel, theValue);
475 //=============================================================================
479 //=============================================================================
480 TCollection_AsciiString GEOM_Function::GetString(int thePosition)
483 TCollection_AsciiString aRes;
484 if(thePosition <= 0) return aRes;
485 Handle(TDataStd_Comment) aString;
486 TDF_Label anArgLabel = ARGUMENT(thePosition);
487 if(!anArgLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) return aRes;
490 aRes = TCollection_AsciiString(aString->Get());
494 //=============================================================================
498 //=============================================================================
499 void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference)
502 if (thePosition <= 0) return;
503 if (theReference.IsNull()) return;
504 TDF_Label anArgLabel = ARGUMENT(thePosition);
505 TDF_Reference::Set(anArgLabel, theReference->GetEntry());
506 TDataStd_UAttribute::Set(anArgLabel, GetDependencyID());
511 //=============================================================================
515 //=============================================================================
516 Handle(GEOM_Function) GEOM_Function::GetReference(int thePosition)
519 if(thePosition <= 0) return NULL;
520 TDF_Label anArgLabel = ARGUMENT(thePosition);
521 Handle(TDF_Reference) aRef;
522 if(!anArgLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL;
525 return GetFunction(aRef->Get());
529 //=============================================================================
533 //=============================================================================
534 void GEOM_Function::SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray)
537 if(thePosition <= 0 || theArray.IsNull()) return;
538 TDF_Label anArgLabel = ARGUMENT(thePosition);
540 Handle(TDataStd_ExtStringArray) anArray = new TDataStd_ExtStringArray;
541 anArray->ChangeArray(theArray);
542 anArgLabel.AddAttribute(anArray);
548 //=============================================================================
552 //=============================================================================
553 Handle(TColStd_HArray1OfExtendedString) GEOM_Function::GetStringArray(int thePosition)
556 if(thePosition <= 0) return NULL;
557 TDF_Label anArgLabel = ARGUMENT(thePosition);
558 Handle(TDataStd_ExtStringArray) anArray;
559 if(!anArgLabel.FindAttribute(TDataStd_ExtStringArray::GetID(), anArray)) return NULL;
562 return anArray->Array();
565 //=======================================================================
566 //function : GetReferencesTreeID
568 //=======================================================================
569 const Standard_GUID& GEOM_Function::GetReferencesTreeID()
571 static Standard_GUID aReferencesTreeID("FF1BBB10-5D14-4df2-980B-3A668264EA16");
572 return aReferencesTreeID;
575 //=============================================================================
579 //=============================================================================
580 void GEOM_Function::SetReferenceList (int thePosition,
581 const Handle(TColStd_HSequenceOfTransient)& theRefList)
584 if(thePosition <= 0) return;
586 // parent label for the list of references
587 TDF_Label anArgLabel = ARGUMENT(thePosition);
588 anArgLabel.ForgetAllAttributes();
590 // set TreeNode on the parent label
591 Handle(TDataStd_TreeNode) aRoot, aNode;
592 aRoot = TDataStd_TreeNode::Set(anArgLabel, GetReferencesTreeID());
594 // store references on sub-labels of the parent label
595 Handle(GEOM_Function) aFunc;
596 Standard_Integer ind, len = theRefList->Length();
597 for (ind = 1; ind <= len; ind++) {
598 aFunc = Handle(GEOM_Function)::DownCast(theRefList->Value(ind));
599 if (aFunc.IsNull()) continue;
600 TDF_Label anArgLabel_i = SUB_ARGUMENT(thePosition, ind);
601 TDF_Reference::Set(anArgLabel_i, aFunc->GetEntry());
602 TDataStd_UAttribute::Set(anArgLabel_i, GetDependencyID());
604 // set TreeNode on the child label
605 aNode = TDataStd_TreeNode::Set(anArgLabel_i, GetReferencesTreeID());
606 aRoot->Append(aNode);
613 //=============================================================================
617 //=============================================================================
618 Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosition)
620 Handle(TColStd_HSequenceOfTransient) aResult = new TColStd_HSequenceOfTransient;
622 if(thePosition <= 0) return aResult;
624 // parent label for the list of references
625 TDF_Label anArgLabel = ARGUMENT(thePosition);
626 Handle(TDF_Reference) aRef;
628 // get TreeNode on the parent label
629 Handle(TDataStd_TreeNode) aRoot, aNode;
630 if(!anArgLabel.FindAttribute(GetReferencesTreeID(), aRoot))
633 // get references, stored on sub-labels of the parent label
635 TDataStd_ChildNodeIterator anIter (aRoot);
636 for (; anIter.More(); anIter.Next()) {
637 aNode = anIter.Value();
638 aLabel_i = aNode->Label();
639 if (!aLabel_i.FindAttribute(TDF_Reference::GetID(), aRef)) continue;
640 Handle(GEOM_Function) aFunc_i = GetFunction(aRef->Get());
641 if (aFunc_i.IsNull()) continue;
642 aResult->Append(aFunc_i);
649 //=============================================================================
653 //=============================================================================
654 //void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
657 // if(thePosition <= 0 || theShape.IsNull()) return;
659 // TDF_Label anArgLabel = ARGUMENT(thePosition);
660 // TNaming_Builder aBuilder(anArgLabel);
661 // aBuilder.Generated(theShape);
667 //=============================================================================
671 //=============================================================================
672 //TopoDS_Shape GEOM_Function::GetShape(int thePosition)
675 // TopoDS_Shape aShape;
676 // if(thePosition <= 0) return aShape;
678 // TDF_Label anArgLabel = ARGUMENT(thePosition);
679 // Handle(TNaming_NamedShape) aNS;
680 // if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
682 // aShape = aNS->Get();
688 //=============================================================================
692 //=============================================================================
693 void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
695 TDF_ChildIterator anIterator(ARGUMENTS, Standard_True);
696 for(; anIterator.More(); anIterator.Next()) {
697 if(anIterator.Value().IsAttribute(GetDependencyID())) theSeq.Append(anIterator.Value());
701 //=============================================================================
703 * AddSubShapeReference
705 //=============================================================================
706 void GEOM_Function::AddSubShapeReference(Handle(GEOM_Function) theSubShape)
710 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
712 Handle(TDataStd_ExtStringList) aList;
713 if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
714 aList = new TDataStd_ExtStringList;
715 aSubShapesLabel.AddAttribute(aList);
718 TCollection_AsciiString anEntry;
719 TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
720 aList->Append(anEntry);
725 //=============================================================================
727 * RemoveSubShapeReference
729 //=============================================================================
730 void GEOM_Function::RemoveSubShapeReference(Handle(GEOM_Function) theSubShape)
734 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
736 Handle(TDataStd_ExtStringList) aList;
737 if (aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
738 TCollection_AsciiString anEntry;
739 TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
740 aList->Remove(anEntry);
746 //=============================================================================
748 * HasSubShapeReferences
750 //=============================================================================
751 bool GEOM_Function::HasSubShapeReferences()
755 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
756 return aSubShapesLabel.IsAttribute(TDataStd_ExtStringList::GetID());
759 //=============================================================================
761 * GetSubShapeReferences
763 //=============================================================================
764 const TDataStd_ListOfExtendedString& GEOM_Function::GetSubShapeReferences()
768 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
770 Handle(TDataStd_ExtStringList) aList;
771 if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
772 aList = new TDataStd_ExtStringList;
773 aSubShapesLabel.AddAttribute(aList);
777 return aList->List();
780 //=============================================================================
784 //=============================================================================
785 TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create)
787 return _label.FindChild(HISTORY_LABEL, create);
790 //=============================================================================
792 * GetArgumentHistoryEntry
794 //=============================================================================
795 TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
796 const Standard_Boolean create)
798 TColStd_ListOfInteger anArgumentRefTags;
799 TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags);
800 Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent();
802 TDF_Label aHistoryLabel = GetHistoryEntry(create);
803 if (aHistoryLabel.IsNull())
804 return aHistoryLabel;
805 Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1;
807 Standard_Integer itag;
808 TDF_Label aHistoryCurLabel = aHistoryLabel;
809 TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags);
810 for (itag = 1; itag <= aHistoryLabelPos; itag++) {
813 for (; itag <= anArgumentRefLabelPos; itag++) {
814 aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create);
815 if (aHistoryCurLabel.IsNull())
816 return aHistoryCurLabel;
820 return aHistoryCurLabel;
823 //=============================================================================
827 //=============================================================================
828 TDF_Label GEOM_Function::GetNamingEntry (const Standard_Boolean create)
830 return _label.FindChild(NAMING_LABEL, create);
833 //=======================================================================
834 //function : GEOM_Function_Type_
836 //=======================================================================
837 Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
840 static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
841 if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
842 static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
843 if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
845 static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
846 static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
847 sizeof(GEOM_Function),
849 (Standard_Address)_Ancestors,
850 (Standard_Address)NULL);
855 //=======================================================================
856 //function : DownCast
858 //=======================================================================
860 const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standard_Transient)& AnObject)
862 Handle(GEOM_Function) _anOtherObject;
864 if (!AnObject.IsNull()) {
865 if (AnObject->IsKind(STANDARD_TYPE(GEOM_Function))) {
866 _anOtherObject = Handle(GEOM_Function)((Handle(GEOM_Function)&)AnObject);
870 return _anOtherObject;