Version: 9.12.0
GEOM_Field.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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 #ifndef _GEOM_Field_HeaderFile
24 #define _GEOM_Field_HeaderFile
25 
26 #include "GEOM_Object.hxx"
27 
28 #include <list>
29 
30 
31 const int GEOM_FIELD_OBJTYPE = 52; // same value #defined in GEOMImpl_Types.hxx
32 const int GEOM_FIELD_STEP_OBJTYPE = 53;
33 
34 class GEOM_Field;
35 class GEOM_FieldStep;
38 
40 {
41  GEOM_Field(const TDF_Label& theLabel);
42  friend class GEOM_Engine;
43 
44  public:
45 
46  // Function types
47  enum { FUN_ADD_FIELD = 1,
50  //FUN_REMOVE_STEP,
52  FUN_CHANGE_VALUE
53  };
54 
55  // Creates a GEOM_Field on an empty Label
56  Standard_EXPORT GEOM_Field(const TDF_Label& theLabel, int );
57  Standard_EXPORT ~GEOM_Field();
58 
59  // Finds a GEOM_Field on theLabel
60  Standard_EXPORT static Handle(GEOM_Field) GetField(const TDF_Label& theLabel);
61 
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();
66 
67  // Sets the basic data that do not change (except compNames?)
68  Standard_EXPORT void Init(const Handle(GEOM_Object)& theShape,
69  const char* theName,
70  const int theDataType,
71  const int theDimension,
72  const Handle(TColStd_HArray1OfExtendedString)& theCompNames);
73 
74  // Returns a shape this GEOM_Field lies on
75  Standard_EXPORT Handle(GEOM_Object) GetShape();
76 
77  // Returns a data type of this GEOM_Field
78  // 0 - bool, 1 - int, 2 - double, 3 - string
79  Standard_EXPORT int GetDataType();
80 
81  // Returns one of "Bool","Int","Double","String"
82  Standard_EXPORT static TCollection_AsciiString GetDataTypeString(int type);
83 
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();
87 
88  // Sets names of components
89  Standard_EXPORT void SetComponents( const Handle(TColStd_HArray1OfExtendedString)& compNames );
90 
91  // Returns names of components
92  Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetComponents();
93 
94  // Returns names of components in a python syntax
95  Standard_EXPORT TCollection_AsciiString GetComponentsForPython();
96 
97  // Returns number of components
98  Standard_EXPORT int GetNbComponents();
99 
100  // Returns number of sub-shapes.
101  // Size of data arrays == GetNbSubShapes() * GetComponents()->Extent()
102  Standard_EXPORT int GetNbSubShapes();
103 
104  // Returns number of sub-shapes of given dimension
105  Standard_EXPORT static int GetNbSubShapes(const Handle(GEOM_Object)& shape,
106  const int dim);
107 
108  // Returns size of data array == GetNbSubShapes() * GetComponents()->Extent()
109  Standard_EXPORT int GetArrayLength();
110 
111  // Removes a component. Number counts from one.
112  //Standard_EXPORT void RemoveComponent(const int number);
113 
114  // Adds a step
115  Standard_EXPORT Handle(GEOM_FieldStep) AddStep(const int stepID, const int stamp);
116 
117  // Removes a step
118  Standard_EXPORT void RemoveStep(const int stepID);
119 
120  // Returns a step
121  Standard_EXPORT Handle(GEOM_FieldStep) GetStep(const int stepID);
122 
123  // Returns all steps
124  Standard_EXPORT std::list< Handle(GEOM_FieldStep)> GetSteps();
125 
126  DEFINE_STANDARD_RTTIEXT(GEOM_Field,GEOM_BaseObject)
127 
128 private:
129 
130  int nbSubShapes; // not to explode the shape each time nbSubShapes is needed
131 };
132 
133 
135 {
136  GEOM_FieldStep(const TDF_Label& theLabel);
137  friend class GEOM_Engine;
138 
139 public:
140  // Creates a GEOM_FieldStep on an empty Label
141  Standard_EXPORT GEOM_FieldStep(const TDF_Label& theLabel, int );
142  Standard_EXPORT ~GEOM_FieldStep();
143 
144  // Sets the basic data
145  Standard_EXPORT void Init(const Handle(GEOM_Field)& theField,
146  const int theID,
147  const int theStamp);
148 
149  // Finds a GEOM_FieldStep on the label theLabel
150  Standard_EXPORT static Handle(GEOM_FieldStep) GetFieldStep(const TDF_Label& theLabel);
151 
152  // Returns the Field this GEOM_FieldStep belongs to
153  Standard_EXPORT Handle(GEOM_Field) GetField();
154 
155  // Returns the stamp step id
156  Standard_EXPORT int GetID();
157 
158  // Removes a component. Number counts from one.
159  //Standard_EXPORT void RemoveComponent(const int number);
160 
161  // Sets the stamp of the step
162  Standard_EXPORT void SetStamp(const int stamp);
163 
164  // Returns the stamp of the step
165  Standard_EXPORT int GetStamp();
166 
167  // Sets int or bool values. Returns false if number of values is wrong
168  Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfInteger)& values );
169 
170  // Sets double values. Returns false if number of values is wrong
171  Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfReal)& values );
172 
173  // Sets string values. Returns false if number of values is wrong
174  Standard_EXPORT bool SetValues( const Handle(TColStd_HArray1OfExtendedString)& values );
175 
176  // Returns int or bool values
177  Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntValues();
178 
179  // Returns double values
180  Standard_EXPORT Handle(TColStd_HArray1OfReal) GetDoubleValues();
181 
182  // Returns string values
183  Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringValues();
184 
185  // Returns GUID of CAF data array
186  const Standard_GUID& GetDataID();
187 
188  DEFINE_STANDARD_RTTIEXT(GEOM_FieldStep,GEOM_BaseObject)
189 
190 private:
191 
192  Handle(GEOM_Function) getFunctionToSetValuesAndDump(const TCollection_AsciiString& valueStr);
193 
194 };
195 
196 
197 #endif
Handle(TColStd_HSequenceOfTransient) AdvancedEngine_IOperations
Create a T-shape object with specified caracteristics for the main and the incident pipes (radius,...
Definition: AdvancedEngine_IOperations.cxx:1907
const int GEOM_FIELD_STEP_OBJTYPE
Definition: GEOM_Field.hxx:32
DEFINE_STANDARD_HANDLE(GEOM_Field, GEOM_BaseObject) DEFINE_STANDARD_HANDLE(GEOM_FieldStep
const int GEOM_FIELD_OBJTYPE
Definition: GEOM_Field.hxx:31
Definition: GEOM_Engine.hxx:91
Definition: GEOM_Field.hxx:135
Standard_EXPORT void Init(const Handle(GEOM_Field)&theField, const int theID, const int theStamp)
Sets the basic data.
Definition: GEOM_Field.cxx:495
Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntValues()
Standard_EXPORT Handle(GEOM_Field) GetField()
const Standard_GUID & GetDataID()
Definition: GEOM_Field.cxx:741
Standard_EXPORT ~GEOM_FieldStep()
Definition: GEOM_Field.cxx:529
Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringValues()
Standard_EXPORT int GetStamp()
GEOM_FieldStep(const TDF_Label &theLabel)
Standard_EXPORT void SetStamp(const int stamp)
Definition: GEOM_Field.cxx:571
static Standard_EXPORT Handle(GEOM_FieldStep) GetFieldStep(const TDF_Label &theLabel)
Standard_EXPORT Handle(TColStd_HArray1OfReal) GetDoubleValues()
Standard_EXPORT int GetID()
Standard_EXPORT bool SetValues(const Handle(TColStd_HArray1OfInteger)&values)
Definition: GEOM_Field.cxx:634
Definition: GEOM_Field.hxx:40
Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetComponents()
Standard_EXPORT int GetDimension()
Standard_EXPORT int GetDataType()
Standard_EXPORT std::list< Handle(GEOM_FieldStep)> GetSteps()
@ FUN_ADD_STEP
Definition: GEOM_Field.hxx:48
@ FUN_CHANGE_STEP_STAMP
Definition: GEOM_Field.hxx:51
@ FUN_CHANGE_COMP_NAMES
Definition: GEOM_Field.hxx:49
static Standard_EXPORT int GetNbSubShapes(const Handle(GEOM_Object)&shape, const int dim)
Standard_EXPORT Handle(GEOM_FieldStep) GetStep(const int stepID)
Standard_EXPORT Handle(GEOM_FieldStep) AddStep(const int stepID
static Standard_EXPORT Handle(GEOM_Field) GetField(const TDF_Label &theLabel)
GEOM_Field(const TDF_Label &theLabel)
Standard_EXPORT GEOM_Field(const TDF_Label &theLabel, int)
Standard_EXPORT Handle(GEOM_Object) GetShape()