Salome HOME
7f4aced7d0466f86cf9cdf1f0e0ba1106c56d865
[modules/geom.git] / src / GEOM / GEOM_Field.cxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "GEOM_Field.hxx"
24
25 #include "GEOM_IField.hxx"
26 #include "GEOM_Engine.hxx"
27 #include "GEOM_PythonDump.hxx"
28
29 #include <Standard_MultiplyDefined.hxx>
30 #include <TDataStd_ChildNodeIterator.hxx>
31 #include <TDataStd_ExtStringArray.hxx>
32 #include <TDataStd_Integer.hxx>
33 #include <TDataStd_IntegerArray.hxx>
34 #include <TDataStd_Real.hxx>
35 #include <TDataStd_RealArray.hxx>
36 #include <TopExp.hxx>
37 #include <TopTools_IndexedMapOfShape.hxx>
38
39 #include "utilities.h"
40
41 #include <limits>
42
43 using namespace GEOM;
44
45 namespace
46 {
47   //================================================================================
48   /*!
49    * \brief Returns a function with a given type OR the 1st function
50    */
51   //================================================================================
52
53   Handle(GEOM_Function) getFunction(int theFunType, GEOM_BaseObject* obj )
54   {
55     Handle(GEOM_Function) fun;
56     int nbFuns = obj->GetNbFunctions();
57     while ( nbFuns >= 1 )
58     {
59       fun = obj->GetFunction( nbFuns-- );
60       const int funType = fun->GetType();
61       if ( funType == theFunType )
62         return fun;
63     }
64     return fun; // function 1
65   }
66 }
67
68 //=============================================================================
69 /*!
70  *  Constructor: private
71  */
72 //=============================================================================
73
74 GEOM_Field::GEOM_Field(const TDF_Label& theEntry)
75   : GEOM_BaseObject(theEntry), nbSubShapes(-1)
76 {
77 }
78
79 //=============================================================================
80 /*!
81  *  Constructor: public
82  */
83 //=============================================================================
84
85 GEOM_Field::GEOM_Field(const TDF_Label&    theEntry, int /*typ*/)
86   : GEOM_BaseObject( theEntry, GEOM_FIELD_OBJTYPE ), nbSubShapes(-1)
87 {
88 }
89
90 //================================================================================
91 /*!
92  * \brief Sets the basic data that do not change (except compNames?)
93  */
94 //================================================================================
95
96 void GEOM_Field::Init(const Handle(GEOM_Object)&                     theShape,
97                       const char*                                    theName,
98                       const int                                      theDataType,
99                       const int                                      theDimension,
100                       const Handle(TColStd_HArray1OfExtendedString)& theCompNames)
101 {
102   Handle(GEOM_Function) fun = GetFunction(1);
103   if ( !fun.IsNull() )
104     Standard_MultiplyDefined::Raise( "Reinitialization of GEOM_Field is forbidden" );
105   fun = AddFunction( GetFieldID(), FUN_ADD_FIELD );
106
107   GEOM_IField data( fun );
108   data.SetShape     ( theShape->GetLastFunction() );
109   data.SetDataType  ( theDataType );
110   data.SetDimension ( theDimension );
111   data.SetComponents( theCompNames );
112
113   TPythonDump py( fun ); // prevent dump of SetName
114   SetName( theName );
115   // PythonDump to be done by the operation creating this field
116 }
117
118 //=============================================================================
119 /*!
120  *  GetField
121  */
122 //=============================================================================
123
124 Handle(GEOM_Field) GEOM_Field::GetField(const TDF_Label& theLabel)
125 {
126   Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetObject(theLabel);
127   return Handle(GEOM_Field)::DownCast( base );
128 }
129
130 //=======================================================================
131 //function : GetFieldID
132 //purpose  :
133 //=======================================================================
134
135 const Standard_GUID& GEOM_Field::GetFieldID()
136 {
137   static Standard_GUID anID("FF1BBB01-5252-4df2-980B-3A668264EA16");
138   return anID;
139 }
140
141 //=============================================================================
142 /*!
143  *  Destructor
144  */
145 //=============================================================================
146
147 GEOM_Field::~GEOM_Field()
148 {
149 }
150
151 //=============================================================================
152 /*!
153  *  Returns a shape this GEOM_Field lies on
154  */
155 //=============================================================================
156
157 Handle(GEOM_Object) GEOM_Field::GetShape()
158 {
159   Handle(GEOM_Object) shapeObject;
160
161   Handle(GEOM_Function) fun = GetFunction(1);
162   if ( !fun.IsNull() )
163   {
164     GEOM_IField data( fun );
165     Handle(GEOM_Function) shapeFun = data.GetShape();
166     if ( !shapeFun.IsNull() )
167     {
168       TDF_Label shapeLabel = shapeFun->GetOwnerEntry();
169       shapeObject = GEOM_Object::GetObject( shapeLabel );
170     }
171   }
172
173   return shapeObject;
174 }
175
176 //=======================================================================
177 //function : GetNbSubShapes
178 //purpose  : Returns number of sub-shapes.
179 //           Size of data arrays == GetNbSubShapes() * GetComponents()->Extent()
180 //=======================================================================
181
182 int GEOM_Field::GetNbSubShapes()
183 {
184   if ( nbSubShapes < 0 )
185     nbSubShapes = GetNbSubShapes( GetShape(), GetDimension() );
186
187   return nbSubShapes;
188 }
189
190 //=======================================================================
191 //function : GetNbSubShapes
192 //purpose  : Returns number of sub-shapes of given dimension
193 //=======================================================================
194
195 int GEOM_Field::GetNbSubShapes(const Handle(GEOM_Object)& shObj,
196                                const int                  dim)
197 {
198   int nbSubShapes = 0;
199   if ( shObj.IsNull() ) return nbSubShapes;
200
201   TopoDS_Shape shape = shObj->GetValue();
202   if (shape.IsNull() ) return nbSubShapes;
203
204   if ( dim == -1 )
205   {
206     nbSubShapes = 1;
207   }
208   else
209   {
210     TopAbs_ShapeEnum type;
211     switch( dim ) {
212     case 0: type = TopAbs_VERTEX; break;
213     case 1: type = TopAbs_EDGE; break;
214     case 2: type = TopAbs_FACE; break;
215     case 3: type = TopAbs_SOLID; break;
216     default: return nbSubShapes;
217     }
218     TopTools_IndexedMapOfShape map;
219     TopExp::MapShapes( shape, type, map );
220     nbSubShapes = map.Extent();
221   }
222   return nbSubShapes;
223 }
224
225 //=======================================================================
226 //function : GetNbComponents
227 //purpose  : Returns number of components
228 //=======================================================================
229
230 int GEOM_Field::GetNbComponents()
231 {
232   Handle(TColStd_HArray1OfExtendedString) comps = GetComponents();
233   return comps.IsNull() ? 0 : comps->Length();
234 }
235
236 //=======================================================================
237 //function : GetArrayLength
238 //purpose  : Returns size of data array == GetNbSubShapes() * GetComponents()->Extent()
239 //=======================================================================
240
241 int GEOM_Field::GetArrayLength()
242 {
243   return GetNbComponents() * GetNbSubShapes();
244 }
245
246 //=======================================================================
247 //function : GetDataType
248 //purpose  : Returns a data type of this GEOM_Field
249 //=======================================================================
250
251 int GEOM_Field::GetDataType()
252 {
253   Handle(GEOM_Function) fun = GetFunction(1);
254   if ( !fun.IsNull() )
255     return GEOM_IField( fun ).GetDataType();
256   return -1;
257 }
258
259 //=======================================================================
260 //function : GetDataTypeString
261 //purpose  : Returns one of "Bool","Int","Double","String"
262 //=======================================================================
263
264 TCollection_AsciiString GEOM_Field::GetDataTypeString(int type)
265 {
266   const char* typeNames[] = { "Bool","Int","Double","String" };
267   if ( type < 0 || type > 3 )
268     return type;
269   return typeNames[ type ];
270 }
271
272 //=======================================================================
273 //function : GetDimension
274 //purpose  : Returns dimension of the shape the field lies on:
275 //           0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
276 //=======================================================================
277
278 int GEOM_Field::GetDimension()
279 {
280   Handle(GEOM_Function) fun = GetFunction(1);
281   if ( !fun.IsNull() )
282     return GEOM_IField( fun ).GetDimension();
283   return -1;
284 }
285
286 //=======================================================================
287 //function : SetComponents
288 //purpose  : Sets names of components
289 //=======================================================================
290
291 void GEOM_Field::SetComponents( const Handle(TColStd_HArray1OfExtendedString)& compNames )
292 {
293   // By spec. modification of components is not required, but just in case...
294   Handle(GEOM_Function) fun = GetLastFunction();
295   if ( fun->GetType() != FUN_ADD_FIELD )
296   {
297     fun = AddFunction( GetFieldID(), FUN_CHANGE_COMP_NAMES );
298     //TPythonDump( fun ) << this << ".setComponents( "
299   }
300   GEOM_IField data( fun );
301   data.SetComponents( compNames );
302 }
303
304 //=======================================================================
305 //function : GetComponents
306 //purpose  : Returns names of components
307 //=======================================================================
308
309 Handle(TColStd_HArray1OfExtendedString) GEOM_Field::GetComponents()
310 {
311   Handle(GEOM_Function) fun = getFunction( FUN_CHANGE_COMP_NAMES, this );
312   if ( !fun.IsNull() )
313     return GEOM_IField( fun ).GetComponents();
314   return NULL;
315 }
316
317 //=======================================================================
318 //function : getFunctionToSetValues
319 //purpose  : dump any HArray into a string
320 //=======================================================================
321 template< class HandleArray1 >
322 TCollection_AsciiString arrayToSting( const HandleArray1& ar,
323                                       const char*            quote="")
324 {
325   TCollection_AsciiString s;
326   char prefix[] = "[ ";
327   if ( !ar.IsNull() )
328     for ( int i = ar->Lower(), nb = ar->Upper(); i <= nb; ++i )
329     {
330       s += prefix;
331       s += quote;
332       s += TCollection_AsciiString( ar->Value( i ));
333       s += quote;
334       prefix[0] = ',';
335     }
336   if ( !s.IsEmpty() )
337     s += " ]";
338
339   return s;
340 }
341
342 //=======================================================================
343 //function : GetComponentsForPython
344 //purpose  : Returns names of components in a python syntax
345 //=======================================================================
346
347 TCollection_AsciiString GEOM_Field::GetComponentsForPython()
348 {
349   return arrayToSting( GetComponents(), "'" );
350 }
351
352 //=======================================================================
353 //function : AddStep
354 //purpose  : Adds a step
355 //=======================================================================
356
357 Handle(GEOM_FieldStep) GEOM_Field::AddStep(const int stepID, const int stamp)
358 {
359   Handle(GEOM_FieldStep) step = GetStep( stepID );
360   if ( !step.IsNull() )
361     return NULL;
362
363   GEOM_Engine* anEngine = GEOM_Engine::GetEngine();
364   if(anEngine == NULL) return NULL;
365
366   step = Handle(GEOM_FieldStep)::DownCast
367     ( anEngine->AddBaseObject( GEOM_FIELD_STEP_OBJTYPE ));
368   if ( step.IsNull())
369     return step;
370
371   // set all step data
372   Handle(GEOM_Field) field = GEOM_Field::GetField( GetEntry() );
373   step->Init( field, stepID, stamp );
374
375   Handle(TDataStd_TreeNode) aRoot, aNode;
376   aRoot = TDataStd_TreeNode::Set( GetEntry(),       GetFieldID() );
377   aNode = TDataStd_TreeNode::Set( step->GetEntry(), GetFieldID() );
378   aRoot->Append(aNode);
379
380   // Dump just in case if step.SetValues() would fail which normally
381   // replaces this dump.
382   // field.addStep(step, stamp, values)
383   TCollection_AsciiString defaultVal( GetDataType() == 3 ? "''" : "0" );
384   TPythonDump( step->GetFunction(1) )
385     << step << " = "
386     << this << ".addStep( "
387     << stepID << ", "
388     << stamp << ", "
389     << "[" << defaultVal << "]*" << GetArrayLength() << " )";
390
391   return step;
392 }
393
394 //=======================================================================
395 //function : RemoveStep
396 //purpose  : Removes a step
397 //=======================================================================
398
399 void GEOM_Field::RemoveStep(const int stepID)
400 {
401   Handle(GEOM_FieldStep) step = GetStep( stepID );
402   if ( step.IsNull() )
403     return;
404
405   Handle(TDataStd_TreeNode) aNode =
406     TDataStd_TreeNode::Set( step->GetEntry(), GetFieldID() );
407   aNode->Remove(); // Removes this tree node attribute from its father
408
409   // Dump of removed objects is not produced anayway
410   //Handle(GEOM_Function) fun = AddFunction( GetFieldID(), FUN_REMOVE_STEP );
411   //TPythonDump( fun ) << this << ".removeStep( " << stepID << " )";
412
413   GEOM_Engine* anEngine = GEOM_Engine::GetEngine();
414   if ( anEngine )
415     anEngine->RemoveObject( step );
416 }
417
418 //=======================================================================
419 //function : GetStep
420 //purpose  : Returns a step
421 //=======================================================================
422
423 Handle(GEOM_FieldStep) GEOM_Field::GetStep(const int stepID)
424 {
425   Handle(GEOM_FieldStep) step;
426
427   Handle(TDataStd_TreeNode) aRoot, aNode;
428   if ( !GetEntry().FindAttribute( GetFieldID(), aRoot ))
429     return step;
430
431   TDataStd_ChildNodeIterator anIter (aRoot);
432   for (; anIter.More(); anIter.Next())
433   {
434     aNode = anIter.Value();
435     step = GEOM_FieldStep::GetFieldStep( aNode->Label() );
436     if ( !step.IsNull() && step->GetID() == stepID )
437       return step;
438   }
439   return NULL;
440 }
441
442 //=======================================================================
443 //function : GetSteps
444 //purpose  : Returns all steps
445 //=======================================================================
446
447 std::list< Handle(GEOM_FieldStep)> GEOM_Field::GetSteps()
448 {
449   std::list< Handle(GEOM_FieldStep) > stepList;
450
451   Handle(TDataStd_TreeNode) aRoot, aNode;
452   if ( !GetEntry().FindAttribute( GetFieldID(), aRoot ))
453     return stepList;
454
455   Handle(GEOM_FieldStep) step;
456   TDataStd_ChildNodeIterator anIter (aRoot);
457   for (; anIter.More(); anIter.Next())
458   {
459     aNode = anIter.Value();
460     step = GEOM_FieldStep::GetFieldStep( aNode->Label() );
461     if ( !step.IsNull() )
462       stepList.push_back( step );
463   }
464   return stepList;
465 }
466
467 //=============================================================================
468 /*!
469  *  Constructor: private
470  */
471 //=============================================================================
472
473 GEOM_FieldStep::GEOM_FieldStep(const TDF_Label& theEntry)
474   : GEOM_BaseObject(theEntry)
475 {
476 }
477
478 //=============================================================================
479 /*!
480  *  Constructor: public
481  */
482 //=============================================================================
483
484 GEOM_FieldStep::GEOM_FieldStep(const TDF_Label& theLabel, int /*type*/ )
485   : GEOM_BaseObject( theLabel, GEOM_FIELD_STEP_OBJTYPE )
486 {
487 }
488
489 //================================================================================
490 /*!
491  * \brief Sets the basic data
492  */
493 //================================================================================
494
495 void GEOM_FieldStep::Init(const Handle(GEOM_Field)& theField,
496                           const int                 theID,
497                           const int                 theStamp)
498 {
499   Handle(GEOM_Function) fun = GetFunction(1);
500   if ( !fun.IsNull() )
501     Standard_MultiplyDefined::Raise( "Reinitialization of GEOM_FieldStep is forbidden" );
502   fun = AddFunction( GEOM_Field::GetFieldID(), GEOM_Field::FUN_ADD_STEP );
503
504   GEOM_IField data( fun );
505   data.SetField    ( theField->GetFunction(1) );
506   data.SetStepID   ( theID );
507   data.SetStepStamp( theStamp );
508   // PythonDump to be done by the operation creating this field step
509 }
510
511 //=============================================================================
512 /*!
513  *  GetField
514  */
515 //=============================================================================
516
517 Handle(GEOM_FieldStep) GEOM_FieldStep::GetFieldStep(const TDF_Label& theLabel)
518 {
519   Handle(GEOM_BaseObject) base = GEOM_BaseObject::GetObject(theLabel);
520   return Handle(GEOM_FieldStep)::DownCast( base );
521 }
522
523 //=============================================================================
524 /*!
525  *  Destructor
526  */
527 //=============================================================================
528
529 GEOM_FieldStep::~GEOM_FieldStep()
530 {
531 }
532
533 //=======================================================================
534 //function : GetField
535 //purpose  : Returns the Field this GEOM_FieldStep belongs to
536 //=======================================================================
537
538 Handle(GEOM_Field) GEOM_FieldStep::GetField()
539 {
540   Handle(GEOM_Field) field;
541
542   Handle(GEOM_Function) fun= GetFunction(1);
543   if ( !fun.IsNull() )
544   {
545     GEOM_IField data( fun );
546     Handle(GEOM_Function) fldFun = data.GetField();
547     if ( !fldFun.IsNull() )
548       field = GEOM_Field::GetField( fldFun->GetOwnerEntry() );
549   }
550   return field;
551 }
552
553 //=======================================================================
554 //function : GetID
555 //purpose  : Returns the stamp step id
556 //=======================================================================
557
558 int GEOM_FieldStep::GetID()
559 {
560   Handle(GEOM_Function) fun= GetFunction(1);
561   if ( !fun.IsNull() )
562     return GEOM_IField( fun ).GetStepID();
563   return std::numeric_limits<int>::max();
564 }
565
566 //=======================================================================
567 //function : SetStamp
568 //purpose  : Sets the stamp of the step
569 //=======================================================================
570
571 void GEOM_FieldStep::SetStamp(const int stamp)
572 {
573   if ( GetStamp() != stamp )
574   {
575     // it's stamp modification: field.setStamp(step, stamp)
576     Handle(GEOM_Function) fun =
577       AddFunction( GEOM_Field::GetFieldID(), GEOM_Field::FUN_CHANGE_STEP_STAMP );
578
579     GEOM_IField data( fun );
580     data.SetStepStamp( stamp );
581
582     TPythonDump( fun ) <<
583       GetField() << ".setStamp( " << GetID() << ", " << stamp << " )";
584   }
585 }
586
587 //=======================================================================
588 //function : GetStamp
589 //purpose  : Returns the stamp of the step
590 //=======================================================================
591
592 int GEOM_FieldStep::GetStamp()
593 {
594   // find the last function changing the stamp
595   Handle(GEOM_Function) fun = getFunction( GEOM_Field::FUN_CHANGE_STEP_STAMP, this );
596   if ( !fun.IsNull() )
597     return GEOM_IField( fun ).GetStepStamp();
598   return std::numeric_limits<int>::max();
599 }
600
601 //=======================================================================
602 //function : getFunctionToSetValues
603 //purpose  : Finds a function to store new values and dumps to Python
604 //=======================================================================
605
606 Handle(GEOM_Function)
607 GEOM_FieldStep::getFunctionToSetValuesAndDump( const TCollection_AsciiString& valueStr )
608 {
609   Handle(GEOM_Function) fun = GetLastFunction();
610   if ( fun->GetType() == GEOM_Field::FUN_ADD_STEP &&
611        !fun->HasData( GEOM_IField::STEP_VALUES, GetDataID() ))
612   {
613     // it's creation of the step: field.addStep(step, stamp, values)
614     GEOM_IField data( fun );
615     TPythonDump( fun ) << this << " = " << GetField() << ".addStep( " <<
616       data.GetStepID() << ", " << data.GetStepStamp() << ", " << valueStr << " )";
617   }
618   else
619   {
620     // it's value modification: field.setValues(step, values)
621     fun = AddFunction( GEOM_Field::GetFieldID(), GEOM_Field::FUN_CHANGE_VALUE );
622     GEOM_IField data( GetFunction(1) );
623     TPythonDump( fun ) << GetField() << ".setValues( " <<
624       data.GetStepID() << ", " << valueStr << " )";
625   }
626   return fun;
627 }
628
629 //=======================================================================
630 //function : SetValues
631 //purpose  : Set int or bool values
632 //=======================================================================
633
634 bool GEOM_FieldStep::SetValues( const Handle(TColStd_HArray1OfInteger)& values )
635 {
636   Handle(GEOM_Field) field = GetField();
637   if ( field.IsNull() ||
638        values.IsNull() ||
639        field->GetArrayLength() != values->Length() )
640     return false;
641
642   // fix bool values to be 0 or 1 only
643   if ( field->GetDataType() == 0 )
644     for ( int i = values->Lower(), nb = values->Upper(); i <= nb; ++i )
645       values->SetValue( i , bool( values->Value( i )));
646
647   Handle(GEOM_Function) fun =
648     getFunctionToSetValuesAndDump( arrayToSting( values ));
649
650   GEOM_IField data( fun );
651   data.SetValues( values );
652   return true;
653 }
654
655 //=======================================================================
656 //function : SetValues
657 //purpose  : Sets double values
658 //=======================================================================
659
660 bool GEOM_FieldStep::SetValues( const Handle(TColStd_HArray1OfReal)& values )
661 {
662   Handle(GEOM_Field) field = GetField();
663   if ( field.IsNull() ||
664        values.IsNull() ||
665        field->GetArrayLength() != values->Length() )
666     return false;
667
668   Handle(GEOM_Function) fun =
669     getFunctionToSetValuesAndDump( arrayToSting( values ));
670
671   GEOM_IField data( fun );
672   data.SetValues( values );
673   return true;
674 }
675
676 //=======================================================================
677 //function : SetValues
678 //purpose  : Sets string values
679 //=======================================================================
680
681 bool GEOM_FieldStep::SetValues( const Handle(TColStd_HArray1OfExtendedString)& values )
682 {
683   Handle(GEOM_Field) field = GetField();
684   if ( field.IsNull() ||
685        values.IsNull() ||
686        field->GetArrayLength() != values->Length() )
687     return false;
688
689   Handle(GEOM_Function) fun =
690     getFunctionToSetValuesAndDump( arrayToSting( values, "'" ));
691
692   GEOM_IField data( fun );
693   data.SetValues( values );
694   return true;
695 }
696
697 //=======================================================================
698 //function : GetIntValues
699 //purpose  : Returns int or bool values
700 //=======================================================================
701
702 Handle(TColStd_HArray1OfInteger) GEOM_FieldStep::GetIntValues()
703 {
704   Handle(GEOM_Function) fun = getFunction( GEOM_Field::FUN_CHANGE_VALUE, this );
705   if ( !fun.IsNull() )
706     return GEOM_IField( fun ).GetIntValues();
707   return NULL;
708 }
709
710 //=======================================================================
711 //function : GetDoubleValues
712 //purpose  : Returns double values
713 //=======================================================================
714
715 Handle(TColStd_HArray1OfReal) GEOM_FieldStep::GetDoubleValues()
716 {
717   Handle(GEOM_Function) fun = getFunction( GEOM_Field::FUN_CHANGE_VALUE, this );
718   if ( !fun.IsNull() )
719     return GEOM_IField( fun ).GetDoubleValues();
720   return NULL;
721 }
722
723 //=======================================================================
724 //function : GetStringValues
725 //purpose  : Returns string values
726 //=======================================================================
727
728 Handle(TColStd_HArray1OfExtendedString) GEOM_FieldStep::GetStringValues()
729 {
730   Handle(GEOM_Function) fun = getFunction( GEOM_Field::FUN_CHANGE_VALUE, this );
731   if ( !fun.IsNull() )
732     return GEOM_IField( fun ).GetStringValues();
733   return NULL;
734 }
735
736 //=======================================================================
737 //function : GetDataID
738 //purpose  : Returns GUID of CAF data array
739 //=======================================================================
740
741 const Standard_GUID& GEOM_FieldStep::GetDataID()
742 {
743   int dataType = 2;
744   Handle(GEOM_Field) f = GetField();
745   if ( !f.IsNull() )
746     dataType = f->GetDataType();
747
748   switch ( dataType ) {
749   case 0: // bool
750   case 1: // int
751     return TDataStd_IntegerArray::GetID();
752   case 2: // double
753     return TDataStd_RealArray::GetID();
754   default:; // string
755   }
756   return TDataStd_ExtStringArray::GetID();
757 }
758
759 IMPLEMENT_STANDARD_RTTIEXT(GEOM_Field, GEOM_BaseObject )
760 IMPLEMENT_STANDARD_RTTIEXT(GEOM_FieldStep, GEOM_BaseObject )