Salome HOME
Fix the point by XYZ coordinates python export/dump
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.h
1 // Copyright (C) 2014-2017  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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
22 #define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
23
24 //--------------------------------------------------------------------------------------
25 #include "ModelHighAPI.h"
26 #include <ModelAPI_AttributeTables.h>
27
28 #include <GeomAPI_Shape.h>
29
30 #include <list>
31 #include <memory>
32 #include <string>
33 //--------------------------------------------------------------------------------------
34 class GeomAPI_Dir;
35 class GeomAPI_Pnt;
36 class GeomAPI_Pnt2d;
37 //--------------------------------------------------------------------------------------
38 class GeomDataAPI_Dir;
39 class GeomDataAPI_Point;
40 class GeomDataAPI_Point2D;
41 //--------------------------------------------------------------------------------------
42 class ModelAPI_AttributeBoolean;
43 class ModelAPI_AttributeDouble;
44 class ModelAPI_AttributeIntArray;
45 class ModelAPI_AttributeInteger;
46 class ModelAPI_AttributeRefAttr;
47 class ModelAPI_AttributeRefAttrList;
48 class ModelAPI_AttributeReference;
49 class ModelAPI_AttributeRefList;
50 class ModelAPI_AttributeSelection;
51 class ModelAPI_AttributeSelectionList;
52 class ModelAPI_AttributeString;
53 class ModelAPI_AttributeStringArray;
54 class ModelAPI_Object;
55 //--------------------------------------------------------------------------------------
56 class ModelHighAPI_Double;
57 class ModelHighAPI_Integer;
58 class ModelHighAPI_RefAttr;
59 class ModelHighAPI_Reference;
60 class ModelHighAPI_Selection;
61 //--------------------------------------------------------------------------------------
62 MODELHIGHAPI_EXPORT
63 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
64                    const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
65
66 MODELHIGHAPI_EXPORT
67 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
68                    double theX, double theY);
69
70 MODELHIGHAPI_EXPORT
71 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
72                    const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
73
74 MODELHIGHAPI_EXPORT
75 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
76                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
77
78 //--------------------------------------------------------------------------------------
79 MODELHIGHAPI_EXPORT
80 void fillAttribute(bool theValue,
81                    const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
82
83 MODELHIGHAPI_EXPORT
84 void fillAttribute(const ModelHighAPI_Double & theValue,
85                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
86
87 MODELHIGHAPI_EXPORT
88 void fillAttribute(double theValue,
89                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
90
91 MODELHIGHAPI_EXPORT
92 void fillAttribute(const ModelHighAPI_Integer & theValue,
93                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
94
95 MODELHIGHAPI_EXPORT
96 void fillAttribute(int theValue,
97                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
98
99 MODELHIGHAPI_EXPORT
100 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
101                    const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
102
103 MODELHIGHAPI_EXPORT
104 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
105                    const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
106
107 MODELHIGHAPI_EXPORT
108 void fillAttribute(const ModelHighAPI_Reference & theValue,
109                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
110
111 MODELHIGHAPI_EXPORT
112 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
113                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
114
115 MODELHIGHAPI_EXPORT
116 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
117                    const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
118
119 MODELHIGHAPI_EXPORT
120 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
121                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
122
123 MODELHIGHAPI_EXPORT
124 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
125                    const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
126
127 MODELHIGHAPI_EXPORT
128 void fillAttribute(const ModelHighAPI_Selection & theValue,
129                    const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
130
131 MODELHIGHAPI_EXPORT
132 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
133                    const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
134
135 MODELHIGHAPI_EXPORT
136 void fillAttribute(const std::string & theValue,
137                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
138 MODELHIGHAPI_EXPORT
139 void fillAttribute(const char * theValue,
140                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
141
142 MODELHIGHAPI_EXPORT
143 void fillAttribute(const std::list<std::string> & theValue,
144                    const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
145
146 MODELHIGHAPI_EXPORT
147 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
148                    const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
149
150 MODELHIGHAPI_EXPORT
151 void fillAttribute(const ModelHighAPI_Double & theX,
152                    const ModelHighAPI_Double & theY,
153                    const ModelHighAPI_Double & theZ,
154                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
155
156 MODELHIGHAPI_EXPORT
157 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
158
159 MODELHIGHAPI_EXPORT
160 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
161
162 MODELHIGHAPI_EXPORT
163 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
164
165 MODELHIGHAPI_EXPORT
166 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
167
168 /// Performs the high level API dump, then closes all and executes the script:
169 /// model must be recreated fully, with all attributes
170 /// \returns true if check is well done
171 MODELHIGHAPI_EXPORT
172 bool checkPythonDump();
173
174 //--------------------------------------------------------------------------------------
175 //--------------------------------------------------------------------------------------
176 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */