1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name : ModelHighAPI_Tools.h
6 // 07/06/16 - Sergey POKHODENKO - Creation of the file
8 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
9 #define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
11 //--------------------------------------------------------------------------------------
12 #include "ModelHighAPI.h"
13 #include <ModelAPI_AttributeTables.h>
15 #include <GeomAPI_Shape.h>
20 //--------------------------------------------------------------------------------------
24 //--------------------------------------------------------------------------------------
25 class GeomDataAPI_Dir;
26 class GeomDataAPI_Point;
27 class GeomDataAPI_Point2D;
28 //--------------------------------------------------------------------------------------
29 class ModelAPI_AttributeBoolean;
30 class ModelAPI_AttributeDouble;
31 class ModelAPI_AttributeIntArray;
32 class ModelAPI_AttributeInteger;
33 class ModelAPI_AttributeRefAttr;
34 class ModelAPI_AttributeRefAttrList;
35 class ModelAPI_AttributeReference;
36 class ModelAPI_AttributeRefList;
37 class ModelAPI_AttributeSelection;
38 class ModelAPI_AttributeSelectionList;
39 class ModelAPI_AttributeString;
40 class ModelAPI_AttributeStringArray;
41 class ModelAPI_Object;
42 //--------------------------------------------------------------------------------------
43 class ModelHighAPI_Double;
44 class ModelHighAPI_Integer;
45 class ModelHighAPI_RefAttr;
46 class ModelHighAPI_Reference;
47 class ModelHighAPI_Selection;
48 //--------------------------------------------------------------------------------------
50 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
51 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
54 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
55 double theX, double theY);
58 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
59 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
62 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
63 const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
65 //--------------------------------------------------------------------------------------
67 void fillAttribute(bool theValue,
68 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
71 void fillAttribute(const ModelHighAPI_Double & theValue,
72 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
75 void fillAttribute(double theValue,
76 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
79 void fillAttribute(const ModelHighAPI_Integer & theValue,
80 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
83 void fillAttribute(int theValue,
84 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
87 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
88 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
91 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
92 const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
95 void fillAttribute(const ModelHighAPI_Reference & theValue,
96 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
99 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
100 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
103 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
104 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
107 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
108 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
111 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
112 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
115 void fillAttribute(const ModelHighAPI_Selection & theValue,
116 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
119 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
120 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
123 void fillAttribute(const std::string & theValue,
124 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
126 void fillAttribute(const char * theValue,
127 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
130 void fillAttribute(const std::list<std::string> & theValue,
131 const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
134 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
135 const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
138 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
141 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
144 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
147 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
149 /// Performs the high level API dump, then closes all and executes the script:
150 /// model must be recreated fully, with all attributes
151 /// \returns true if check is well done
153 bool checkPythonDump();
155 //--------------------------------------------------------------------------------------
156 //--------------------------------------------------------------------------------------
157 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */