1 // Copyright (C) 2007-2022 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, or (at your option) any later version.
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 #ifndef _GEOM_Field_HeaderFile
24 #define _GEOM_Field_HeaderFile
26 #include "GEOM_Object.hxx"
31 const int GEOM_FIELD_OBJTYPE = 52; // same value #defined in GEOMImpl_Types.hxx
32 const int GEOM_FIELD_STEP_OBJTYPE = 53;
36 DEFINE_STANDARD_HANDLE( GEOM_Field, GEOM_BaseObject )
37 DEFINE_STANDARD_HANDLE( GEOM_FieldStep, GEOM_BaseObject )
39 class GEOM_Field : public GEOM_BaseObject
41 GEOM_Field(const TDF_Label& theLabel);
42 friend class GEOM_Engine;
47 enum { FUN_ADD_FIELD = 1,
49 FUN_CHANGE_COMP_NAMES,
51 FUN_CHANGE_STEP_STAMP,
55 // Creates a GEOM_Field on an empty Label
56 Standard_EXPORT GEOM_Field(const TDF_Label& theLabel, int );
57 Standard_EXPORT ~GEOM_Field();
59 // Finds a GEOM_Field on theLabel
60 Standard_EXPORT static Handle(GEOM_Field) GetField(const TDF_Label& theLabel);
62 // Returns a GUID associated with a field object (GEOM_Field or GEOM_FieldStep)
63 // This GUID corresponds to GEOMImpl_FieldDriver::GetID() and
64 // it also marks TDataStd_TreeNode on a label of GEOM_FieldStep
65 Standard_EXPORT static const Standard_GUID& GetFieldID();
67 // Sets the basic data that do not change (except compNames?)
68 Standard_EXPORT void Init(const Handle(GEOM_Object)& theShape,
70 const int theDataType,
71 const int theDimension,
72 const Handle(TColStd_HArray1OfExtendedString)& theCompNames);
74 // Returns a shape this GEOM_Field lies on
75 Standard_EXPORT Handle(GEOM_Object) GetShape();
77 // Returns a data type of this GEOM_Field
78 // 0 - bool, 1 - int, 2 - double, 3 - string
79 Standard_EXPORT int GetDataType();
81 // Returns one of "Bool","Int","Double","String"
82 Standard_EXPORT static TCollection_AsciiString GetDataTypeString(int type);
84 // Returns dimension of the shape the field lies on:
85 // 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
86 Standard_EXPORT int GetDimension();
88 // Sets names of components
89 Standard_EXPORT void SetComponents( const Handle(TColStd_HArray1OfExtendedString)& compNames );
91 // Returns names of components
92 Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetComponents();
94 // Returns names of components in a python syntax
95 Standard_EXPORT TCollection_AsciiString GetComponentsForPython();
97 // Returns number of components
98 Standard_EXPORT int GetNbComponents();
100 // Returns number of sub-shapes.
101 // Size of data arrays == GetNbSubShapes() * GetComponents()->Extent()
102 Standard_EXPORT int GetNbSubShapes();
104 // Returns number of sub-shapes of given dimension
105 Standard_EXPORT static int GetNbSubShapes(const Handle(GEOM_Object)& shape,
108 // Returns size of data array == GetNbSubShapes() * GetComponents()->Extent()
109 Standard_EXPORT int GetArrayLength();
111 // Removes a component. Number counts from one.
112 //Standard_EXPORT void RemoveComponent(const int number);
115 Standard_EXPORT Handle(GEOM_FieldStep) AddStep(const int stepID, const int stamp);
118 Standard_EXPORT void RemoveStep(const int stepID);
121 Standard_EXPORT Handle(GEOM_FieldStep) GetStep(const int stepID);
124 Standard_EXPORT std::list< Handle(GEOM_FieldStep)> GetSteps();
126 DEFINE_STANDARD_RTTIEXT(GEOM_Field,GEOM_BaseObject)
130 int nbSubShapes; // not to explode the shape each time nbSubShapes is needed
134 class GEOM_FieldStep : public GEOM_BaseObject
136 GEOM_FieldStep(const TDF_Label& theLabel);
137 friend class GEOM_Engine;
140 // Creates a GEOM_FieldStep on an empty Label
141 Standard_EXPORT GEOM_FieldStep(const TDF_Label& theLabel, int );
142 Standard_EXPORT ~GEOM_FieldStep();
144 // Sets the basic data
145 Standard_EXPORT void Init(const Handle(GEOM_Field)& theField,
149 // Finds a GEOM_FieldStep on the label theLabel
150 Standard_EXPORT static Handle(GEOM_FieldStep) GetFieldStep(const TDF_Label& theLabel);
152 // Returns the Field this GEOM_FieldStep belongs to
153 Standard_EXPORT Handle(GEOM_Field) GetField();
155 // Returns the stamp step id
156 Standard_EXPORT int GetID();
158 // Removes a component. Number counts from one.
159 //Standard_EXPORT void RemoveComponent(const int number);
161 // Sets the stamp of the step
162 Standard_EXPORT void SetStamp(const int stamp);
164 // Returns the stamp of the step
165 Standard_EXPORT int GetStamp();
167 // Sets int or bool values. Returns false if number of values is wrong
168 Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfInteger)& values );
170 // Sets double values. Returns false if number of values is wrong
171 Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfReal)& values );
173 // Sets string values. Returns false if number of values is wrong
174 Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfExtendedString)& values );
176 // Returns int or bool values
177 Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntValues();
179 // Returns double values
180 Standard_EXPORT Handle(TColStd_HArray1OfReal) GetDoubleValues();
182 // Returns string values
183 Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringValues();
185 // Returns GUID of CAF data array
186 const Standard_GUID& GetDataID();
188 DEFINE_STANDARD_RTTIEXT(GEOM_FieldStep,GEOM_BaseObject)
192 Handle(GEOM_Function) getFunctionToSetValuesAndDump(const TCollection_AsciiString& valueStr);