SHAPER  9.12.0
ModelHighAPI_Tools.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
21 #define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
22 
23 //--------------------------------------------------------------------------------------
24 #include "ModelHighAPI.h"
25 #include <ModelAPI_AttributeTables.h>
26 
27 #include <GeomAPI_Shape.h>
28 
29 #include <list>
30 #include <memory>
31 #include <string>
32 //--------------------------------------------------------------------------------------
33 class GeomAPI_Dir;
34 class GeomAPI_Pnt;
35 class GeomAPI_Pnt2d;
36 //--------------------------------------------------------------------------------------
37 class GeomDataAPI_Dir;
38 class GeomDataAPI_Point;
41 //--------------------------------------------------------------------------------------
55 class ModelAPI_Object;
56 //--------------------------------------------------------------------------------------
62 //--------------------------------------------------------------------------------------
63 MODELHIGHAPI_EXPORT
64 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
65  const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
66 
67 MODELHIGHAPI_EXPORT
68 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
69  double theX, double theY);
70 
71 MODELHIGHAPI_EXPORT
72 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
73  const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
74 
75 MODELHIGHAPI_EXPORT
76 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
77  const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
78 
79 //--------------------------------------------------------------------------------------
80 MODELHIGHAPI_EXPORT
81 void fillAttribute(bool theValue,
82  const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
83 
84 MODELHIGHAPI_EXPORT
85 void fillAttribute(const ModelHighAPI_Double & theValue,
86  const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
87 
88 MODELHIGHAPI_EXPORT
89 void fillAttribute(double theValue,
90  const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
91 
92 MODELHIGHAPI_EXPORT
93 void fillAttribute(const ModelHighAPI_Integer & theValue,
94  const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
95 
96 MODELHIGHAPI_EXPORT
97 void fillAttribute(int theValue,
98  const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
99 
100 MODELHIGHAPI_EXPORT
101 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
102  const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
103 
104 MODELHIGHAPI_EXPORT
105 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
106  const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
107 
108 MODELHIGHAPI_EXPORT
109 void fillAttribute(const ModelHighAPI_Reference & theValue,
110  const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
111 
112 MODELHIGHAPI_EXPORT
113 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
114  const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
115 
116 MODELHIGHAPI_EXPORT
117 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
118  const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
119 
120 MODELHIGHAPI_EXPORT
121 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
122  const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
123 
124 MODELHIGHAPI_EXPORT
125 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
126  const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
127 
128 MODELHIGHAPI_EXPORT
129 void fillAttribute(const ModelHighAPI_Selection & theValue,
130  const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
131 
132 MODELHIGHAPI_EXPORT
133 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
134  const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
135 
136 MODELHIGHAPI_EXPORT
137 void fillAttribute(const std::string & theValue,
138  const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
139 
140 MODELHIGHAPI_EXPORT
141 void fillAttribute(const std::wstring & theValue,
142  const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
143 
144 MODELHIGHAPI_EXPORT
145 void fillAttribute(const char * theValue,
146  const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
147 
148 MODELHIGHAPI_EXPORT
149 void fillAttribute(const std::list<std::string> & theValue,
150  const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
151 
152 MODELHIGHAPI_EXPORT
153 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
154  const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
155 
156 MODELHIGHAPI_EXPORT
157 void fillAttribute(const std::list<ModelHighAPI_Double> & theValue,
158  const std::shared_ptr<ModelAPI_AttributeDoubleArray> & theAttribute);
159 
160 MODELHIGHAPI_EXPORT
161 void fillAttribute(const std::list<std::shared_ptr<GeomAPI_Pnt2d> > & theValue,
162  const std::shared_ptr<GeomDataAPI_Point2DArray> & theAttribute);
163 
164 MODELHIGHAPI_EXPORT
165 void fillAttribute(const ModelHighAPI_Double & theX,
166  const ModelHighAPI_Double & theY,
167  const ModelHighAPI_Double & theZ,
168  const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
169 
170 MODELHIGHAPI_EXPORT
171 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
172 
173 MODELHIGHAPI_EXPORT
174 std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType);
175 
176 MODELHIGHAPI_EXPORT
177 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
178 
179 MODELHIGHAPI_EXPORT
180 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
181 
182 MODELHIGHAPI_EXPORT
183 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
184 
186 enum checkDumpType {
187  CHECK_NAMING = 1,
188  CHECK_GEOMETRICAL = 2,
189  CHECK_NAMING_AND_GEOMETRICAL = 3,
190  CHECK_WEAK = 4,
191 };
192 
196 MODELHIGHAPI_EXPORT
197 bool checkPyDump(const std::string& theFilenameNaming,
198  const std::string& theFilenameGeo,
199  const std::string& theFilenameWeak,
200  const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
201 
202 //--------------------------------------------------------------------------------------
203 //--------------------------------------------------------------------------------------
204 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */
3D direction defined by three normalized coordinates
Definition: GeomAPI_Dir.h:34
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
ShapeType
Shape type enum.
Definition: GeomAPI_Shape.h:46
Attribute that contains 3D direction coordinates.
Definition: GeomDataAPI_Dir.h:35
Attribute that contains array of 2D point coordinates.
Definition: GeomDataAPI_Point2DArray.h:34
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Attribute that contains 3D point coordinates.
Definition: GeomDataAPI_Point.h:36
Attribute that contains boolean value.
Definition: ModelAPI_AttributeBoolean.h:31
API for the attribute that contains several double in the array inside.
Definition: ModelAPI_AttributeDoubleArray.h:32
Attribute that contains real value with double precision.
Definition: ModelAPI_AttributeDouble.h:34
API for the attribute that contains several integers in the array inside.
Definition: ModelAPI_AttributeIntArray.h:36
API for the attribute that contains integer (int).
Definition: ModelAPI_AttributeInteger.h:34
Attribute that contains list of references to features (located in the same document) or references t...
Definition: ModelAPI_AttributeRefAttrList.h:34
Attribute that contains reference to an attribute of a feature or reference to a feature (switchable)
Definition: ModelAPI_AttributeRefAttr.h:33
Attribute that contains list of references to features (located in the same document).
Definition: ModelAPI_AttributeRefList.h:33
Attribute that contains reference to feature (located in the same document).
Definition: ModelAPI_AttributeReference.h:32
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: ModelAPI_AttributeSelectionList.h:37
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: ModelAPI_AttributeSelection.h:35
API for the attribute that contains several strings in the array inside.
Definition: ModelAPI_AttributeStringArray.h:32
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
ValueType
Type of the value in the table.
Definition: ModelAPI_AttributeTables.h:42
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
Class for filling ModelAPI_AttributeDouble.
Definition: ModelHighAPI_Double.h:37
Class for filling ModelAPI_AttributeInteger.
Definition: ModelHighAPI_Integer.h:36
Class for filling ModelAPI_AttributeRefAttr.
Definition: ModelHighAPI_RefAttr.h:41
Class for filling ModelAPI_AttributeReference.
Definition: ModelHighAPI_Reference.h:41
Class for filling ModelAPI_AttributeSelection.
Definition: ModelHighAPI_Selection.h:49
virtual void fillAttribute(const std::shared_ptr< ModelAPI_AttributeSelection > &theAttribute) const
Fill attribute values.
Definition: ModelHighAPI_Selection.cpp:87