Salome HOME
03cd586af255e3e3ea3f446d4348c0bde0b4480a
[modules/geom.git] / src / GEOM / GEOM_Function.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20
21 #include <Standard_Stream.hxx>
22
23 #include <GEOM_Function.hxx>
24 #include <GEOM_Object.hxx>
25 #include <GEOM_Solver.hxx>
26
27 #include "utilities.h"
28
29 #include <TDF.hxx>
30 #include <TDF_Tool.hxx>
31 #include <TDF_Data.hxx>
32 #include <TDF_ChildIterator.hxx>
33 #include <TDF_Reference.hxx>
34 #include <TDataStd_Integer.hxx>
35 #include <TDataStd_IntegerArray.hxx>
36 #include <TDataStd_Real.hxx>
37 #include <TDataStd_RealArray.hxx>
38 #include <TDataStd_Comment.hxx>
39 #include <TDataStd_TreeNode.hxx>
40 #include <TDataStd_UAttribute.hxx>
41 #include <TDataStd_ChildNodeIterator.hxx>
42 #include <TDataStd_ExtStringArray.hxx>
43 #include <TDocStd_Owner.hxx>
44 #include <TDocStd_Document.hxx>
45 #include <TFunction_Function.hxx>
46 #include <TNaming_NamedShape.hxx>
47 #include <TNaming_Builder.hxx>
48
49 #include <TColStd_ListOfInteger.hxx>
50 #include <TColStd_ListIteratorOfListOfInteger.hxx>
51 #include <TColStd_HArray1OfReal.hxx>
52 #include <TColStd_HArray1OfInteger.hxx>
53 #include <TColStd_HSequenceOfTransient.hxx>
54 #include <TCollection_AsciiString.hxx>
55 #include <TCollection_ExtendedString.hxx>
56
57 #include <Standard_Failure.hxx>
58 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
59
60 #define ARGUMENT_LABEL 1
61 #define RESULT_LABEL 2
62 #define DESCRIPTION_LABEL 3
63 #define HISTORY_LABEL 4
64
65 #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
66 #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
67 #define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
68
69 //=======================================================================
70 //function : GetFunctionTreeID
71 //purpose  :
72 //=======================================================================
73 const Standard_GUID& GEOM_Function::GetFunctionTreeID()
74 {
75   static Standard_GUID aFunctionTreeID("FF1BBB00-5D14-4df2-980B-3A668264EA16");
76   return aFunctionTreeID;
77 }
78
79
80 //=======================================================================
81 //function : GetDependencyID
82 //purpose  :
83 //=======================================================================
84 const Standard_GUID& GEOM_Function::GetDependencyID()
85 {
86   static Standard_GUID aDependencyID("E2620650-2354-41bd-8C2C-210CFCD00948");
87   return aDependencyID;
88 }
89
90 //=============================================================================
91 /*!
92  *  GetFunction:
93  */
94 //=============================================================================
95 Handle(GEOM_Function) GEOM_Function::GetFunction(const TDF_Label& theEntry)
96 {
97   if(!theEntry.IsAttribute(TFunction_Function::GetID())) return NULL;
98
99   return new GEOM_Function(theEntry);
100 }
101
102 //=============================================================================
103 /*!
104  *  Constructor:
105  */
106 //=============================================================================
107 GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType)
108 : _label(theEntry)
109 {
110   TFunction_Function::Set(theEntry, theGUID);
111   TDataStd_Integer::Set(theEntry, theType);
112
113   //Add function to a function tree
114   Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theEntry.Data());
115   Handle(TDataStd_TreeNode) aRoot, aNode;
116   if(!aDoc->Main().FindAttribute(GetFunctionTreeID(), aRoot))
117     aRoot = TDataStd_TreeNode::Set(aDoc->Main(), GetFunctionTreeID());
118
119   aNode = TDataStd_TreeNode::Set(theEntry, GetFunctionTreeID());
120   aRoot->Append(aNode);
121 }
122
123 //=============================================================================
124 /*!
125  *  GetOwner
126  */
127 //=============================================================================
128 TDF_Label GEOM_Function::GetOwnerEntry()
129 {
130   TDF_Label aFather = _label.Father();
131   while(!aFather.IsRoot()) {
132     if(aFather.IsAttribute(GEOM_Object::GetObjectID())) return aFather;
133     aFather = aFather.Father();
134   }
135
136   return TDF_Label();
137 }
138
139 //=============================================================================
140 /*!
141  *  GetType
142  */
143 //=============================================================================
144 int GEOM_Function::GetType()
145 {
146   _isDone = false;
147   Handle(TDataStd_Integer) aType;
148   if(!_label.FindAttribute(TDataStd_Integer::GetID(), aType)) return 0;
149   _isDone = true;
150   return aType->Get();
151 }
152
153 //=============================================================================
154 /*!
155  *  GetValue
156  */
157 //=============================================================================
158 TopoDS_Shape GEOM_Function::GetValue()
159 {
160   _isDone = false;
161
162   TopoDS_Shape aShape;
163   TDF_Label aLabel = GetOwnerEntry();
164   if(aLabel.IsRoot()) return aShape;
165   Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
166   if(anObject.IsNull()) return aShape;
167   if(!anObject->IsMainShape()) {
168     try {
169 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
170      OCC_CATCH_SIGNALS;
171 #endif
172      GEOM_Solver aSolver(GEOM_Engine::GetEngine());
173       if (!aSolver.ComputeFunction(this)) {
174         MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape");
175         return aShape;
176       }
177     }
178     catch (Standard_Failure) {
179       Handle(Standard_Failure) aFail = Standard_Failure::Caught();
180       MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString());
181       return aShape;
182     }
183   }
184
185   TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
186   Handle(TNaming_NamedShape) aNS;
187   if(!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
188
189   aShape = aNS->Get();
190
191   _isDone = true;
192   return aShape;
193 }
194
195 //=============================================================================
196 /*!
197  *  GetValue
198  */
199 //=============================================================================
200 void GEOM_Function::SetValue(TopoDS_Shape& theShape)
201 {
202   _isDone = false;
203   TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
204   TNaming_Builder aBuilder(aResultLabel);
205
206   aBuilder.Generated(theShape);
207
208   _isDone = true;
209 }
210
211 //=============================================================================
212 /*!
213  *  GetDriverGUID
214  */
215 //=============================================================================
216 Standard_GUID GEOM_Function::GetDriverGUID()
217 {
218   Handle(TFunction_Function) aFunction;
219   if(!_label.FindAttribute(TFunction_Function::GetID(), aFunction)) {
220     return TDF::LowestID();
221   }
222
223   return aFunction->GetDriverGUID();
224 }
225
226 //=============================================================================
227 /*!
228  *  GetDescription
229  */
230 //=============================================================================
231 TCollection_AsciiString GEOM_Function::GetDescription()
232 {
233   Handle(TDataStd_Comment) aComment;
234   TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
235   if(!aChild.FindAttribute(TDataStd_Comment::GetID(), aComment)) return TCollection_AsciiString();
236   TCollection_AsciiString aDescr(aComment->Get());
237   return aDescr;
238 }
239
240 //=============================================================================
241 /*!
242  *  SetDescription
243  */
244 //=============================================================================
245 void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription)
246 {
247   TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
248   Handle(TDataStd_Comment) aComment =
249     TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription));
250 }
251
252 //=============================================================================
253 /*!
254  *  SetReal
255  */
256 //=============================================================================
257 void GEOM_Function::SetReal(int thePosition, double theValue)
258 {
259   _isDone = false;
260   if(thePosition <= 0) return;
261   TDF_Label anArgLabel = ARGUMENT(thePosition);
262   TDataStd_Real::Set(anArgLabel, theValue);
263   _isDone = true;
264 }
265
266 //=============================================================================
267 /*!
268  *  SetRealArray
269  */
270 //=============================================================================
271 void GEOM_Function::SetRealArray (int thePosition,
272                                   const Handle(TColStd_HArray1OfReal)& theArray)
273 {
274   _isDone = false;
275   if(thePosition <= 0) return;
276   TDF_Label anArgLabel = ARGUMENT(thePosition);
277   Handle(TDataStd_RealArray) anAttr =
278     TDataStd_RealArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
279   anAttr->ChangeArray(theArray);
280   _isDone = true;
281 }
282
283 //=============================================================================
284 /*!
285  *  GetReal
286  */
287 //=============================================================================
288 double GEOM_Function::GetReal(int thePosition)
289 {
290   _isDone = false;
291   if(thePosition <= 0) return 0.0;
292   Handle(TDataStd_Real) aReal;
293   TDF_Label anArgLabel = ARGUMENT(thePosition);
294   if(!anArgLabel.FindAttribute(TDataStd_Real::GetID(), aReal)) return 0.0;
295
296   _isDone = true;
297   return aReal->Get();
298 }
299
300 //=============================================================================
301 /*!
302  *  GetRealArray
303  */
304 //=============================================================================
305 Handle(TColStd_HArray1OfReal) GEOM_Function::GetRealArray(int thePosition)
306 {
307   _isDone = false;
308   if(thePosition <= 0) return NULL;
309   Handle(TDataStd_RealArray) aRealArray;
310   TDF_Label anArgLabel = ARGUMENT(thePosition);
311   if(!anArgLabel.FindAttribute(TDataStd_RealArray::GetID(), aRealArray)) return NULL;
312
313   _isDone = true;
314   return aRealArray->Array();
315 }
316
317 //=============================================================================
318 /*!
319  *  SetInteger
320  */
321 //=============================================================================
322 void GEOM_Function::SetInteger(int thePosition, int theValue)
323 {
324   _isDone = false;
325   if(thePosition <= 0) return;
326   TDF_Label anArgLabel = ARGUMENT(thePosition);
327   TDataStd_Integer::Set(anArgLabel, theValue);
328   _isDone = true;
329 }
330
331 //=============================================================================
332 /*!
333  *  SetIntegerArray
334  */
335 //=============================================================================
336 void GEOM_Function::SetIntegerArray (int thePosition,
337                                      const Handle(TColStd_HArray1OfInteger)& theArray)
338 {
339   _isDone = false;
340   if(thePosition <= 0) return;
341   TDF_Label anArgLabel = ARGUMENT(thePosition);
342   Handle(TDataStd_IntegerArray) anAttr =
343     TDataStd_IntegerArray::Set(anArgLabel, theArray->Lower(), theArray->Upper());
344   anAttr->ChangeArray(theArray);
345   _isDone = true;
346 }
347
348 //=============================================================================
349 /*!
350  *  GetInteger
351  */
352 //=============================================================================
353 int GEOM_Function::GetInteger(int thePosition)
354 {
355   _isDone = false;
356   if(thePosition <= 0) return 0;
357   Handle(TDataStd_Integer) anInteger;
358   TDF_Label anArgLabel = ARGUMENT(thePosition);
359   if(!anArgLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) return 0;
360
361   _isDone = true;
362   return anInteger->Get();
363 }
364
365 //=============================================================================
366 /*!
367  *  GetIntegerArray
368  */
369 //=============================================================================
370 Handle(TColStd_HArray1OfInteger) GEOM_Function::GetIntegerArray(int thePosition)
371 {
372   _isDone = false;
373   if(thePosition <= 0) return 0;
374   Handle(TDataStd_IntegerArray) anIntegerArray;
375   TDF_Label anArgLabel = ARGUMENT(thePosition);
376   if(!anArgLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) return 0;
377
378   _isDone = true;
379   return anIntegerArray->Array();
380 }
381
382 //=============================================================================
383 /*!
384  *  SetString
385  */
386 //=============================================================================
387 void GEOM_Function::SetString(int thePosition, const TCollection_AsciiString& theValue)
388 {
389   _isDone = false;
390   if(thePosition <= 0) return;
391   TDF_Label anArgLabel = ARGUMENT(thePosition);
392   TDataStd_Comment::Set(anArgLabel, theValue);
393   _isDone = true;
394 }
395
396 //=============================================================================
397 /*!
398  *  GetString
399  */
400 //=============================================================================
401 TCollection_AsciiString GEOM_Function::GetString(int thePosition)
402 {
403   _isDone = false;
404   TCollection_AsciiString aRes;
405   if(thePosition <= 0) return aRes;
406   Handle(TDataStd_Comment) aString;
407   TDF_Label anArgLabel = ARGUMENT(thePosition);
408   if(!anArgLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) return aRes;
409
410   _isDone = true;
411   aRes = TCollection_AsciiString(aString->Get());
412   return aRes;
413 }
414
415 //=============================================================================
416 /*!
417  *  SetReference
418  */
419 //=============================================================================
420 void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference)
421 {
422   _isDone = false;
423   if(thePosition <= 0) return;
424   if(theReference.IsNull()) return;
425   TDF_Label anArgLabel = ARGUMENT(thePosition);
426   TDF_Reference::Set(anArgLabel, theReference->GetEntry());
427   TDataStd_UAttribute::Set(anArgLabel, GetDependencyID());
428   _isDone = true;
429   return;
430 }
431
432 //=============================================================================
433 /*!
434  *  GetReference
435  */
436 //=============================================================================
437 Handle(GEOM_Function) GEOM_Function::GetReference(int thePosition)
438 {
439   _isDone = false;
440   if(thePosition <= 0) return NULL;
441   TDF_Label anArgLabel = ARGUMENT(thePosition);
442   Handle(TDF_Reference) aRef;
443   if(!anArgLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL;
444
445   _isDone = true;
446   return GetFunction(aRef->Get());
447 }
448
449
450 //=============================================================================
451 /*!
452  *  SetStringArray
453  */
454 //=============================================================================
455 void GEOM_Function::SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray)
456 {
457   _isDone = false;
458   if(thePosition <= 0 || theArray.IsNull()) return;
459   TDF_Label anArgLabel = ARGUMENT(thePosition);
460
461   Handle(TDataStd_ExtStringArray) anArray = new TDataStd_ExtStringArray;
462   anArray->ChangeArray(theArray);
463   anArgLabel.AddAttribute(anArray);
464
465   _isDone = true;
466 }
467
468
469 //=============================================================================
470 /*!
471  *  GetStringArray
472  */
473 //=============================================================================
474 Handle(TColStd_HArray1OfExtendedString) GEOM_Function::GetStringArray(int thePosition)
475 {
476   _isDone = false;
477   if(thePosition <= 0) return NULL;
478   TDF_Label anArgLabel = ARGUMENT(thePosition);
479   Handle(TDataStd_ExtStringArray) anArray;
480   if(!anArgLabel.FindAttribute(TDataStd_ExtStringArray::GetID(), anArray)) return NULL;
481
482   _isDone = true;
483   return anArray->Array();
484 }
485
486 //=======================================================================
487 //function : GetReferencesTreeID
488 //purpose  :
489 //=======================================================================
490 const Standard_GUID& GEOM_Function::GetReferencesTreeID()
491 {
492   static Standard_GUID aReferencesTreeID("FF1BBB10-5D14-4df2-980B-3A668264EA16");
493   return aReferencesTreeID;
494 }
495
496 //=============================================================================
497 /*!
498  *  SetReferenceList
499  */
500 //=============================================================================
501 void GEOM_Function::SetReferenceList (int thePosition,
502                                       const Handle(TColStd_HSequenceOfTransient)& theRefList)
503 {
504   _isDone = false;
505   if(thePosition <= 0) return;
506
507   // parent label for the list of references
508   TDF_Label anArgLabel = ARGUMENT(thePosition);
509   anArgLabel.ForgetAllAttributes();
510
511   // set TreeNode on the parent label
512   Handle(TDataStd_TreeNode) aRoot, aNode;
513   aRoot = TDataStd_TreeNode::Set(anArgLabel, GetReferencesTreeID());
514
515   // store references on sub-labels of the parent label
516   Handle(GEOM_Function) aFunc;
517   Standard_Integer ind, len = theRefList->Length();
518   for (ind = 1; ind <= len; ind++) {
519     aFunc = Handle(GEOM_Function)::DownCast(theRefList->Value(ind));
520     if (aFunc.IsNull()) continue;
521     TDF_Label anArgLabel_i = SUB_ARGUMENT(thePosition, ind);
522     TDF_Reference::Set(anArgLabel_i, aFunc->GetEntry());
523     TDataStd_UAttribute::Set(anArgLabel_i, GetDependencyID());
524
525     // set TreeNode on the child label
526     aNode = TDataStd_TreeNode::Set(anArgLabel_i, GetReferencesTreeID());
527     aRoot->Append(aNode);
528   }
529
530   _isDone = true;
531   return;
532 }
533
534 //=============================================================================
535 /*!
536  *  GetReferenceList
537  */
538 //=============================================================================
539 Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosition)
540 {
541   Handle(TColStd_HSequenceOfTransient) aResult = new TColStd_HSequenceOfTransient;
542   _isDone = false;
543   if(thePosition <= 0) return aResult;
544
545   // parent label for the list of references
546   TDF_Label anArgLabel = ARGUMENT(thePosition);
547   Handle(TDF_Reference) aRef;
548
549   // get TreeNode on the parent label
550   Handle(TDataStd_TreeNode) aRoot, aNode;
551   if(!anArgLabel.FindAttribute(GetReferencesTreeID(), aRoot))
552     return aResult;
553
554   // get references, stored on sub-labels of the parent label
555   TDF_Label aLabel_i;
556   TDataStd_ChildNodeIterator anIter (aRoot);
557   for (; anIter.More(); anIter.Next()) {
558     aNode = anIter.Value();
559     aLabel_i = aNode->Label();
560     if (!aLabel_i.FindAttribute(TDF_Reference::GetID(), aRef)) continue;
561     Handle(GEOM_Function) aFunc_i = GetFunction(aRef->Get());
562     if (aFunc_i.IsNull()) continue;
563     aResult->Append(aFunc_i);
564   }
565
566   _isDone = true;
567   return aResult;
568 }
569
570 //=============================================================================
571 /*!
572  *  SetShape
573  */
574 //=============================================================================
575 //void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
576 //{
577 //  _isDone = false;
578 //  if(thePosition <= 0 || theShape.IsNull()) return;
579 //
580 //  TDF_Label anArgLabel = ARGUMENT(thePosition);
581 //  TNaming_Builder aBuilder(anArgLabel);
582 //  aBuilder.Generated(theShape);
583 //
584 //  _isDone = true;
585 //  return;
586 //}
587 //
588 //=============================================================================
589 /*!
590  *  GetShape
591  */
592 //=============================================================================
593 //TopoDS_Shape GEOM_Function::GetShape(int thePosition)
594 //{
595 //  _isDone = false;
596 //  TopoDS_Shape aShape;
597 //  if(thePosition <= 0) return aShape;
598 //
599 //  TDF_Label anArgLabel = ARGUMENT(thePosition);
600 //  Handle(TNaming_NamedShape) aNS;
601 //  if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
602 //
603 //  aShape = aNS->Get();
604 //  _isDone = true;
605 //  return aShape;
606 //}
607
608
609 //=============================================================================
610 /*!
611  *  GetDependency
612  */
613 //=============================================================================
614 void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
615 {
616   TDF_ChildIterator anIterator(ARGUMENTS, Standard_True);
617   for(; anIterator.More(); anIterator.Next()) {
618     if(anIterator.Value().IsAttribute(GetDependencyID())) theSeq.Append(anIterator.Value());
619   }
620 }
621
622 //=============================================================================
623 /*!
624  *  GetHistoryEntry
625  */
626 //=============================================================================
627 TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create)
628 {
629   return _label.FindChild(HISTORY_LABEL, create);
630 }
631
632 //=============================================================================
633 /*!
634  *  GetArgumentHistoryEntry
635  */
636 //=============================================================================
637 TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label&       theArgumentRefEntry,
638                                                   const Standard_Boolean create)
639 {
640   TColStd_ListOfInteger anArgumentRefTags;
641   TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags);
642   Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent();
643
644   TDF_Label aHistoryLabel = GetHistoryEntry(create);
645   if (aHistoryLabel.IsNull())
646     return aHistoryLabel;
647   Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1;
648
649   Standard_Integer itag;
650   TDF_Label aHistoryCurLabel = aHistoryLabel;
651   TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags);
652   for (itag = 1; itag <= aHistoryLabelPos; itag++) {
653     aListIter.Next();
654   }
655   for (; itag <= anArgumentRefLabelPos; itag++) {
656     aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create);
657     if (aHistoryCurLabel.IsNull())
658       return aHistoryCurLabel;
659     aListIter.Next();
660   }
661
662   return aHistoryCurLabel;
663 }
664
665 //=======================================================================
666 //function :  GEOM_Function_Type_
667 //purpose  :
668 //=======================================================================
669 Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
670 {
671
672   static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
673   if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
674   static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
675   if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
676
677
678   static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
679   static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
680                                                          sizeof(GEOM_Function),
681                                                          1,
682                                                          (Standard_Address)_Ancestors,
683                                                          (Standard_Address)NULL);
684
685   return _aType;
686 }
687
688 //=======================================================================
689 //function : DownCast
690 //purpose  :
691 //=======================================================================
692
693 const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standard_Transient)& AnObject)
694 {
695   Handle(GEOM_Function) _anOtherObject;
696
697   if (!AnObject.IsNull()) {
698      if (AnObject->IsKind(STANDARD_TYPE(GEOM_Function))) {
699        _anOtherObject = Handle(GEOM_Function)((Handle(GEOM_Function)&)AnObject);
700      }
701   }
702
703   return _anOtherObject ;
704 }