1 // Copyright (C) 2007-2012 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
23 #include <Standard_Stream.hxx>
25 #include <GEOM_Function.hxx>
26 #include <GEOM_Object.hxx>
27 #include <GEOM_Solver.hxx>
28 #include <GEOM_ISubShape.hxx>
30 #include <Basics_OCCTVersion.hxx>
32 #include "utilities.h"
35 #include <TDF_Tool.hxx>
36 #include <TDF_Data.hxx>
37 #include <TDF_ChildIterator.hxx>
38 #include <TDF_Reference.hxx>
39 #include <TDataStd_Integer.hxx>
40 #include <TDataStd_IntegerArray.hxx>
41 #include <TDataStd_Real.hxx>
42 #include <TDataStd_RealArray.hxx>
43 #include <TDataStd_Comment.hxx>
44 #include <TDataStd_TreeNode.hxx>
45 #include <TDataStd_UAttribute.hxx>
46 #include <TDataStd_ChildNodeIterator.hxx>
47 #include <TDataStd_ExtStringArray.hxx>
48 #include <TDataStd_ExtStringList.hxx>
49 #include <TDocStd_Owner.hxx>
50 #include <TDocStd_Document.hxx>
51 #include <TFunction_Function.hxx>
52 #include <TNaming_NamedShape.hxx>
53 #include <TNaming_Builder.hxx>
55 #include <TColStd_ListOfInteger.hxx>
56 #include <TColStd_ListIteratorOfListOfInteger.hxx>
57 #include <TColStd_HArray1OfReal.hxx>
58 #include <TColStd_HArray1OfInteger.hxx>
59 #include <TColStd_HSequenceOfTransient.hxx>
60 #include <TCollection_AsciiString.hxx>
61 #include <TCollection_ExtendedString.hxx>
63 #include <Standard_Failure.hxx>
64 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
66 // This modification was introduced in frame of Mantis issue 0021251.
67 // This line allows to keep shape orientation together with the shape itself.
68 // Otherwise orientation can be lost in some cases.
69 #define KEEP_ORIENTATION_0021251
71 #define ARGUMENT_LABEL 1
72 #define RESULT_LABEL 2
73 #define DESCRIPTION_LABEL 3
74 #define HISTORY_LABEL 4
75 #define SUBSHAPES_LABEL 5 // 0020756: GetGroups
76 #define NAMING_LABEL 6 // 0020750: Naming during STEP import
78 #ifdef KEEP_ORIENTATION_0021251
79 #define ORIENTATION_LABEL 7 // 0021251: TNaming_NamedShape doesn't store orientation
82 #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
83 #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
84 #define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
86 //=======================================================================
87 //function : GetFunctionTreeID
89 //=======================================================================
90 const Standard_GUID& GEOM_Function::GetFunctionTreeID()
92 static Standard_GUID aFunctionTreeID("FF1BBB00-5D14-4df2-980B-3A668264EA16");
93 return aFunctionTreeID;
97 //=======================================================================
98 //function : GetDependencyID
100 //=======================================================================
101 const Standard_GUID& GEOM_Function::GetDependencyID()
103 static Standard_GUID aDependencyID("E2620650-2354-41bd-8C2C-210CFCD00948");
104 return aDependencyID;
107 //=============================================================================
111 //=============================================================================
112 Handle(GEOM_Function) GEOM_Function::GetFunction(const TDF_Label& theEntry)
114 if(!theEntry.IsAttribute(TFunction_Function::GetID())) return NULL;
116 return new GEOM_Function(theEntry);
119 //=============================================================================
123 //=============================================================================
124 GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType)
127 TFunction_Function::Set(theEntry, theGUID);
128 TDataStd_Integer::Set(theEntry, theType);
130 //Add function to a function tree
131 Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theEntry.Data());
132 Handle(TDataStd_TreeNode) aRoot, aNode;
133 if(!aDoc->Main().FindAttribute(GetFunctionTreeID(), aRoot))
134 aRoot = TDataStd_TreeNode::Set(aDoc->Main(), GetFunctionTreeID());
136 aNode = TDataStd_TreeNode::Set(theEntry, GetFunctionTreeID());
137 aRoot->Append(aNode);
140 //=============================================================================
144 //=============================================================================
145 TDF_Label GEOM_Function::GetOwnerEntry()
147 TDF_Label aFather = _label.Father();
148 while(!aFather.IsRoot()) {
149 if(aFather.IsAttribute(GEOM_Object::GetObjectID())) return aFather;
150 aFather = aFather.Father();
156 //=============================================================================
160 //=============================================================================
161 int GEOM_Function::GetType()
164 Handle(TDataStd_Integer) aType;
165 if(!_label.FindAttribute(TDataStd_Integer::GetID(), aType)) return 0;
170 //=============================================================================
174 //=============================================================================
175 TopoDS_Shape GEOM_Function::GetValue()
180 TDF_Label aLabel = GetOwnerEntry();
181 if (aLabel.IsRoot()) return aShape;
182 Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
183 if (anObject.IsNull()) return aShape;
185 if (!anObject->IsMainShape()) {
186 bool isResult = false;
187 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
188 if (!aResultLabel.IsNull()) {
189 Handle(TNaming_NamedShape) aNS;
190 if (aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS))
197 Standard_Integer aTic = anObject->GetTic();
200 GEOM_ISubShape aCI (this);
201 TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
202 if (aLabelObjMainSh.IsRoot()) return aShape;
203 Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
204 if (anObjMainSh.IsNull()) return aShape;
205 Standard_Integer aTicMainSh = anObjMainSh->GetTic();
208 isResult = ((aTic == aTicMainSh) ? true : false);
213 #if OCC_VERSION_LARGE > 0x06010000
216 GEOM_Solver aSolver(GEOM_Engine::GetEngine());
217 if (!aSolver.ComputeFunction(this)) {
218 MESSAGE("GEOM_Object::GetValue Error : Can't build a sub-shape");
222 catch (Standard_Failure) {
223 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
224 MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString());
230 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
231 Handle(TNaming_NamedShape) aNS;
232 if (!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
236 #ifdef KEEP_ORIENTATION_0021251
237 // 0021251: TNaming_NamedShape doesn't store orientation
238 TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
239 Handle(TDataStd_Integer) anInteger;
240 if (anOrientationLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) {
241 aShape.Orientation((TopAbs_Orientation)anInteger->Get());
249 //=============================================================================
253 //=============================================================================
254 void GEOM_Function::SetValue(TopoDS_Shape& theShape)
257 TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
258 TNaming_Builder aBuilder (aResultLabel);
260 aBuilder.Generated(theShape);
262 #ifdef KEEP_ORIENTATION_0021251
263 // 0021251: TNaming_NamedShape doesn't store orientation
264 TDF_Label anOrientationLabel = _label.FindChild(ORIENTATION_LABEL);
265 TDataStd_Integer::Set(anOrientationLabel, (int)theShape.Orientation());
268 // synchronisation between main shape and its sub-shapes
269 TDF_Label aLabel = GetOwnerEntry();
270 if (aLabel.IsRoot()) return;
271 Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
272 if (anObject.IsNull()) return;
273 if (anObject->IsMainShape()) {
274 // increase modifications counter of this (main) shape
275 anObject->IncrementTic();
278 // update modifications counter of this (sub-) shape to be the same as on main shape
279 GEOM_ISubShape aCI (this);
280 TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
281 if (aLabelObjMainSh.IsRoot()) return;
282 Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
283 if (anObjMainSh.IsNull()) return;
285 anObject->SetTic(anObjMainSh->GetTic());
291 //=============================================================================
295 //=============================================================================
296 Standard_GUID GEOM_Function::GetDriverGUID()
298 Handle(TFunction_Function) aFunction;
299 if(!_label.FindAttribute(TFunction_Function::GetID(), aFunction)) {
300 return TDF::LowestID();
303 return aFunction->GetDriverGUID();
306 //=============================================================================
310 //=============================================================================
311 TCollection_AsciiString GEOM_Function::GetDescription()
313 Handle(TDataStd_Comment) aComment;
314 TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
315 if(!aChild.FindAttribute(TDataStd_Comment::GetID(), aComment)) return TCollection_AsciiString();
316 TCollection_AsciiString aDescr(aComment->Get());
320 //=============================================================================
324 //=============================================================================
325 void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription)
327 TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
328 Handle(TDataStd_Comment) aComment =
329 TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription));
332 //=============================================================================
336 //=============================================================================
337 void GEOM_Function::SetReal(int thePosition, double theValue)
340 if(thePosition <= 0) return;
341 TDF_Label anArgLabel = ARGUMENT(thePosition);
342 TDataStd_Real::Set(anArgLabel, theValue);
346 //=============================================================================
350 //=============================================================================
351 void GEOM_Function::SetRealArray (int thePosition,
352 const Handle(TColStd_HArray1OfReal)& theArray)
355 if(thePosition <= 0) return;
356 TDF_Label anArgLabel = ARGUMENT(thePosition);
357 Handle(TDataStd_RealArray) anAttr =
358 TDataStd_RealArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
359 anAttr->ChangeArray(theArray);
363 //=============================================================================
367 //=============================================================================
368 double GEOM_Function::GetReal(int thePosition)
371 if(thePosition <= 0) return 0.0;
372 Handle(TDataStd_Real) aReal;
373 TDF_Label anArgLabel = ARGUMENT(thePosition);
374 if(!anArgLabel.FindAttribute(TDataStd_Real::GetID(), aReal)) return 0.0;
380 //=============================================================================
384 //=============================================================================
385 Handle(TColStd_HArray1OfReal) GEOM_Function::GetRealArray(int thePosition)
388 if(thePosition <= 0) return NULL;
389 Handle(TDataStd_RealArray) aRealArray;
390 TDF_Label anArgLabel = ARGUMENT(thePosition);
391 if(!anArgLabel.FindAttribute(TDataStd_RealArray::GetID(), aRealArray)) return NULL;
394 return aRealArray->Array();
397 //=============================================================================
401 //=============================================================================
402 void GEOM_Function::SetInteger(int thePosition, int theValue)
405 if(thePosition <= 0) return;
406 TDF_Label anArgLabel = ARGUMENT(thePosition);
407 TDataStd_Integer::Set(anArgLabel, theValue);
411 //=============================================================================
415 //=============================================================================
416 void GEOM_Function::SetIntegerArray (int thePosition,
417 const Handle(TColStd_HArray1OfInteger)& theArray)
420 if(thePosition <= 0) return;
421 TDF_Label anArgLabel = ARGUMENT(thePosition);
422 Handle(TDataStd_IntegerArray) anAttr =
423 TDataStd_IntegerArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
424 anAttr->ChangeArray(theArray);
428 //=============================================================================
432 //=============================================================================
433 int GEOM_Function::GetInteger(int thePosition)
436 if(thePosition <= 0) return 0;
437 Handle(TDataStd_Integer) anInteger;
438 TDF_Label anArgLabel = ARGUMENT(thePosition);
439 if(!anArgLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) return 0;
442 return anInteger->Get();
445 //=============================================================================
449 //=============================================================================
450 Handle(TColStd_HArray1OfInteger) GEOM_Function::GetIntegerArray(int thePosition)
453 if(thePosition <= 0) return 0;
454 Handle(TDataStd_IntegerArray) anIntegerArray;
455 TDF_Label anArgLabel = ARGUMENT(thePosition);
456 if(!anArgLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) return 0;
459 return anIntegerArray->Array();
462 //=============================================================================
466 //=============================================================================
467 void GEOM_Function::SetString(int thePosition, const TCollection_AsciiString& theValue)
470 if(thePosition <= 0) return;
471 TDF_Label anArgLabel = ARGUMENT(thePosition);
472 TDataStd_Comment::Set(anArgLabel, theValue);
476 //=============================================================================
480 //=============================================================================
481 TCollection_AsciiString GEOM_Function::GetString(int thePosition)
484 TCollection_AsciiString aRes;
485 if(thePosition <= 0) return aRes;
486 Handle(TDataStd_Comment) aString;
487 TDF_Label anArgLabel = ARGUMENT(thePosition);
488 if(!anArgLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) return aRes;
491 aRes = TCollection_AsciiString(aString->Get());
495 //=============================================================================
499 //=============================================================================
500 void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference)
503 if (thePosition <= 0) return;
504 if (theReference.IsNull()) return;
505 TDF_Label anArgLabel = ARGUMENT(thePosition);
506 TDF_Reference::Set(anArgLabel, theReference->GetEntry());
507 TDataStd_UAttribute::Set(anArgLabel, GetDependencyID());
512 //=============================================================================
516 //=============================================================================
517 Handle(GEOM_Function) GEOM_Function::GetReference(int thePosition)
520 if(thePosition <= 0) return NULL;
521 TDF_Label anArgLabel = ARGUMENT(thePosition);
522 Handle(TDF_Reference) aRef;
523 if(!anArgLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL;
526 return GetFunction(aRef->Get());
530 //=============================================================================
534 //=============================================================================
535 void GEOM_Function::SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray)
538 if(thePosition <= 0 || theArray.IsNull()) return;
539 TDF_Label anArgLabel = ARGUMENT(thePosition);
541 Handle(TDataStd_ExtStringArray) anArray = new TDataStd_ExtStringArray;
542 anArray->ChangeArray(theArray);
543 anArgLabel.AddAttribute(anArray);
549 //=============================================================================
553 //=============================================================================
554 Handle(TColStd_HArray1OfExtendedString) GEOM_Function::GetStringArray(int thePosition)
557 if(thePosition <= 0) return NULL;
558 TDF_Label anArgLabel = ARGUMENT(thePosition);
559 Handle(TDataStd_ExtStringArray) anArray;
560 if(!anArgLabel.FindAttribute(TDataStd_ExtStringArray::GetID(), anArray)) return NULL;
563 return anArray->Array();
566 //=======================================================================
567 //function : GetReferencesTreeID
569 //=======================================================================
570 const Standard_GUID& GEOM_Function::GetReferencesTreeID()
572 static Standard_GUID aReferencesTreeID("FF1BBB10-5D14-4df2-980B-3A668264EA16");
573 return aReferencesTreeID;
576 //=============================================================================
580 //=============================================================================
581 void GEOM_Function::SetReferenceList (int thePosition,
582 const Handle(TColStd_HSequenceOfTransient)& theRefList)
585 if(thePosition <= 0) return;
587 // parent label for the list of references
588 TDF_Label anArgLabel = ARGUMENT(thePosition);
589 anArgLabel.ForgetAllAttributes();
591 // set TreeNode on the parent label
592 Handle(TDataStd_TreeNode) aRoot, aNode;
593 aRoot = TDataStd_TreeNode::Set(anArgLabel, GetReferencesTreeID());
595 // store references on sub-labels of the parent label
596 Handle(GEOM_Function) aFunc;
597 Standard_Integer ind, len = theRefList->Length();
598 for (ind = 1; ind <= len; ind++) {
599 aFunc = Handle(GEOM_Function)::DownCast(theRefList->Value(ind));
600 if (aFunc.IsNull()) continue;
601 TDF_Label anArgLabel_i = SUB_ARGUMENT(thePosition, ind);
602 TDF_Reference::Set(anArgLabel_i, aFunc->GetEntry());
603 TDataStd_UAttribute::Set(anArgLabel_i, GetDependencyID());
605 // set TreeNode on the child label
606 aNode = TDataStd_TreeNode::Set(anArgLabel_i, GetReferencesTreeID());
607 aRoot->Append(aNode);
614 //=============================================================================
618 //=============================================================================
619 Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosition)
621 Handle(TColStd_HSequenceOfTransient) aResult = new TColStd_HSequenceOfTransient;
623 if(thePosition <= 0) return aResult;
625 // parent label for the list of references
626 TDF_Label anArgLabel = ARGUMENT(thePosition);
627 Handle(TDF_Reference) aRef;
629 // get TreeNode on the parent label
630 Handle(TDataStd_TreeNode) aRoot, aNode;
631 if(!anArgLabel.FindAttribute(GetReferencesTreeID(), aRoot))
634 // get references, stored on sub-labels of the parent label
636 TDataStd_ChildNodeIterator anIter (aRoot);
637 for (; anIter.More(); anIter.Next()) {
638 aNode = anIter.Value();
639 aLabel_i = aNode->Label();
640 if (!aLabel_i.FindAttribute(TDF_Reference::GetID(), aRef)) continue;
641 Handle(GEOM_Function) aFunc_i = GetFunction(aRef->Get());
642 if (aFunc_i.IsNull()) continue;
643 aResult->Append(aFunc_i);
650 //=============================================================================
654 //=============================================================================
655 //void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
658 // if(thePosition <= 0 || theShape.IsNull()) return;
660 // TDF_Label anArgLabel = ARGUMENT(thePosition);
661 // TNaming_Builder aBuilder(anArgLabel);
662 // aBuilder.Generated(theShape);
668 //=============================================================================
672 //=============================================================================
673 //TopoDS_Shape GEOM_Function::GetShape(int thePosition)
676 // TopoDS_Shape aShape;
677 // if(thePosition <= 0) return aShape;
679 // TDF_Label anArgLabel = ARGUMENT(thePosition);
680 // Handle(TNaming_NamedShape) aNS;
681 // if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
683 // aShape = aNS->Get();
689 //=============================================================================
693 //=============================================================================
694 void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
696 TDF_ChildIterator anIterator(ARGUMENTS, Standard_True);
697 for(; anIterator.More(); anIterator.Next()) {
698 if(anIterator.Value().IsAttribute(GetDependencyID())) theSeq.Append(anIterator.Value());
702 //=============================================================================
704 * AddSubShapeReference
706 //=============================================================================
707 void GEOM_Function::AddSubShapeReference(Handle(GEOM_Function) theSubShape)
711 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
713 Handle(TDataStd_ExtStringList) aList;
714 if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
715 aList = new TDataStd_ExtStringList;
716 aSubShapesLabel.AddAttribute(aList);
719 TCollection_AsciiString anEntry;
720 TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
721 aList->Append(anEntry);
726 //=============================================================================
728 * RemoveSubShapeReference
730 //=============================================================================
731 void GEOM_Function::RemoveSubShapeReference(Handle(GEOM_Function) theSubShape)
735 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
737 Handle(TDataStd_ExtStringList) aList;
738 if (aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
739 TCollection_AsciiString anEntry;
740 TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
741 aList->Remove(anEntry);
747 //=============================================================================
749 * HasSubShapeReferences
751 //=============================================================================
752 bool GEOM_Function::HasSubShapeReferences()
756 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
757 return aSubShapesLabel.IsAttribute(TDataStd_ExtStringList::GetID());
760 //=============================================================================
762 * GetSubShapeReferences
764 //=============================================================================
765 const TDataStd_ListOfExtendedString& GEOM_Function::GetSubShapeReferences()
769 TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
771 Handle(TDataStd_ExtStringList) aList;
772 if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
773 aList = new TDataStd_ExtStringList;
774 aSubShapesLabel.AddAttribute(aList);
778 return aList->List();
781 //=============================================================================
785 //=============================================================================
786 TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create)
788 return _label.FindChild(HISTORY_LABEL, create);
791 //=============================================================================
793 * GetArgumentHistoryEntry
795 //=============================================================================
796 TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
797 const Standard_Boolean create)
799 TColStd_ListOfInteger anArgumentRefTags;
800 TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags);
801 Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent();
803 TDF_Label aHistoryLabel = GetHistoryEntry(create);
804 if (aHistoryLabel.IsNull())
805 return aHistoryLabel;
806 Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1;
808 Standard_Integer itag;
809 TDF_Label aHistoryCurLabel = aHistoryLabel;
810 TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags);
811 for (itag = 1; itag <= aHistoryLabelPos; itag++) {
814 for (; itag <= anArgumentRefLabelPos; itag++) {
815 aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create);
816 if (aHistoryCurLabel.IsNull())
817 return aHistoryCurLabel;
821 return aHistoryCurLabel;
824 //=============================================================================
828 //=============================================================================
829 TDF_Label GEOM_Function::GetNamingEntry (const Standard_Boolean create)
831 return _label.FindChild(NAMING_LABEL, create);
834 //=======================================================================
835 //function : GEOM_Function_Type_
837 //=======================================================================
838 Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
841 static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
842 if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
843 static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
844 if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
846 static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
847 static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
848 sizeof(GEOM_Function),
850 (Standard_Address)_Ancestors,
851 (Standard_Address)NULL);
856 //=======================================================================
857 //function : DownCast
859 //=======================================================================
861 const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standard_Transient)& AnObject)
863 Handle(GEOM_Function) _anOtherObject;
865 if (!AnObject.IsNull()) {
866 if (AnObject->IsKind(STANDARD_TYPE(GEOM_Function))) {
867 _anOtherObject = Handle(GEOM_Function)((Handle(GEOM_Function)&)AnObject);
871 return _anOtherObject;