-
-//=============================================================================
-/*!
- * AddFunction
- */
-//=============================================================================
-Handle(GEOM_Function) GEOM_Object::AddFunction(const Standard_GUID& theGUID,
- int theFunctionType,
- bool allowSubShape)
-{
- Standard_Integer nb = GetNbFunctions();
- if(!allowSubShape && nb == 1 && theGUID == GetSubShapeID()) return NULL; //It's impossible to add a function to sub-shape
- nb++;
- TDF_Label aChild = FUNCTION_LABEL(nb);
-
- Handle(TDataStd_TreeNode) aNode = TDataStd_TreeNode::Set(aChild);
- _root->Append(aNode);
-
- Handle(GEOM_Function) aFunction = new GEOM_Function(aChild, theGUID, theFunctionType);
-
- return aFunction;
-
-}
-
-//=============================================================================
-/*!
- * GetNbFunctions
- */
-//=============================================================================
-int GEOM_Object::GetNbFunctions()
-{
- Standard_Integer nb = 0;
- for(TDataStd_ChildNodeIterator CI(_root); CI.More(); CI.Next()) nb++;
- return nb;
-}
-
-//=============================================================================
-/*!
- * GetFunction
- */
-//=============================================================================
-Handle(GEOM_Function) GEOM_Object::GetFunction(int theFunctionNumber)
-{
- TDF_Label aChild = FUNCTION_LABEL(theFunctionNumber);
- return GEOM_Function::GetFunction(aChild);
-}
-
-//=============================================================================
-/*!
- * GetlastFunction
- */
-//=============================================================================
-Handle(GEOM_Function) GEOM_Object::GetLastFunction()
-{
- Standard_Integer nb = GetNbFunctions();
- if(nb) return GetFunction(nb);
-
- return NULL;
-}
-
-
-//=============================================================================
-/*!
- * GetAllDependency
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient) GEOM_Object::GetAllDependency()
-{
- Handle(TColStd_HSequenceOfTransient) anArray;
- TDF_LabelSequence aSeq;
- Standard_Integer nb = GetNbFunctions();
- if(nb == 0) return anArray;
- for(Standard_Integer i=1; i<=nb; i++) {
- Handle(GEOM_Function) aFunction = GetFunction(i);
- if(aFunction.IsNull()) continue;
- aFunction->GetDependency(aSeq);
- }
-
- Standard_Integer aLength = aSeq.Length();
- if(aLength > 0) {
- anArray = new TColStd_HSequenceOfTransient;
- for(Standard_Integer j =1; j<=aLength; j++) {
- Handle(GEOM_Object) aRefObj = GetReferencedObject(aSeq(j));
- if(!aRefObj.IsNull()) anArray->Append(aRefObj);
- }
- }
-
- return anArray;
-}
-
-//=============================================================================
-/*!
- * GetLastDependency
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient) GEOM_Object::GetLastDependency()
-{
- Handle(TColStd_HSequenceOfTransient) anArray;
- Handle(GEOM_Function) aFunction = GetLastFunction();
- if (aFunction.IsNull()) return anArray;
-
- TDF_LabelSequence aSeq;
- aFunction->GetDependency(aSeq);
- Standard_Integer aLength = aSeq.Length();
- if (aLength > 0) {
- anArray = new TColStd_HSequenceOfTransient;
- for (Standard_Integer i = 1; i <= aLength; i++)
- anArray->Append(GetReferencedObject(aSeq(i)));
- }
-
- return anArray;
-}
-