]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI_Tools.h
Salome HOME
Merge remote-tracking branch 'origin/Custom_Fitter' into CEA_2019
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.h
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
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;
39 class GeomDataAPI_Point2D;
40 //--------------------------------------------------------------------------------------
41 class ModelAPI_AttributeBoolean;
42 class ModelAPI_AttributeDouble;
43 class ModelAPI_AttributeIntArray;
44 class ModelAPI_AttributeInteger;
45 class ModelAPI_AttributeRefAttr;
46 class ModelAPI_AttributeRefAttrList;
47 class ModelAPI_AttributeReference;
48 class ModelAPI_AttributeRefList;
49 class ModelAPI_AttributeSelection;
50 class ModelAPI_AttributeSelectionList;
51 class ModelAPI_AttributeString;
52 class ModelAPI_AttributeStringArray;
53 class ModelAPI_Object;
54 //--------------------------------------------------------------------------------------
55 class ModelHighAPI_Double;
56 class ModelHighAPI_Integer;
57 class ModelHighAPI_RefAttr;
58 class ModelHighAPI_Reference;
59 class ModelHighAPI_Selection;
60 //--------------------------------------------------------------------------------------
61 MODELHIGHAPI_EXPORT
62 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
63                    const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
64
65 MODELHIGHAPI_EXPORT
66 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
67                    double theX, double theY);
68
69 MODELHIGHAPI_EXPORT
70 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
71                    const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
72
73 MODELHIGHAPI_EXPORT
74 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
75                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
76
77 //--------------------------------------------------------------------------------------
78 MODELHIGHAPI_EXPORT
79 void fillAttribute(bool theValue,
80                    const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
81
82 MODELHIGHAPI_EXPORT
83 void fillAttribute(const ModelHighAPI_Double & theValue,
84                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
85
86 MODELHIGHAPI_EXPORT
87 void fillAttribute(double theValue,
88                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
89
90 MODELHIGHAPI_EXPORT
91 void fillAttribute(const ModelHighAPI_Integer & theValue,
92                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
93
94 MODELHIGHAPI_EXPORT
95 void fillAttribute(int theValue,
96                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
97
98 MODELHIGHAPI_EXPORT
99 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
100                    const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
101
102 MODELHIGHAPI_EXPORT
103 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
104                    const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
105
106 MODELHIGHAPI_EXPORT
107 void fillAttribute(const ModelHighAPI_Reference & theValue,
108                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
109
110 MODELHIGHAPI_EXPORT
111 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
112                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
113
114 MODELHIGHAPI_EXPORT
115 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
116                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
117
118 MODELHIGHAPI_EXPORT
119 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
120                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
121
122 MODELHIGHAPI_EXPORT
123 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
124                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
125
126 MODELHIGHAPI_EXPORT
127 void fillAttribute(const ModelHighAPI_Selection & theValue,
128                    const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
129
130 MODELHIGHAPI_EXPORT
131 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
132                    const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
133
134 MODELHIGHAPI_EXPORT
135 void fillAttribute(const std::string & theValue,
136                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
137 MODELHIGHAPI_EXPORT
138 void fillAttribute(const char * theValue,
139                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
140
141 MODELHIGHAPI_EXPORT
142 void fillAttribute(const std::list<std::string> & theValue,
143                    const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
144
145 MODELHIGHAPI_EXPORT
146 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
147                    const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
148
149 MODELHIGHAPI_EXPORT
150 void fillAttribute(const ModelHighAPI_Double & theX,
151                    const ModelHighAPI_Double & theY,
152                    const ModelHighAPI_Double & theZ,
153                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
154
155 MODELHIGHAPI_EXPORT
156 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
157
158 MODELHIGHAPI_EXPORT
159 std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType);
160
161 MODELHIGHAPI_EXPORT
162 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
163
164 MODELHIGHAPI_EXPORT
165 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
166
167 MODELHIGHAPI_EXPORT
168 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
169
170 /// Enumeration to manage the check python dump modes.
171 enum checkDumpType {
172   CHECK_NAMING = 1, ///< check topological naming only
173   CHECK_GEOMETRICAL = 2, ///< check geometrical naming only
174   CHECK_NAMING_AND_GEOMETRICAL = 3, ///< default option, check topological and geometrical dumps
175   CHECK_WEAK = 4, ///< check weak naming only
176 };
177
178 /// Performs the high level API dump, then closes all and executes the script:
179 /// model must be recreated fully, with all attributes
180 /// \returns true if check is well done
181 MODELHIGHAPI_EXPORT
182 bool checkPythonDump(const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
183
184 //--------------------------------------------------------------------------------------
185 //--------------------------------------------------------------------------------------
186 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */