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