1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
21 #define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
23 //--------------------------------------------------------------------------------------
24 #include "ModelHighAPI.h"
25 #include <ModelAPI_AttributeTables.h>
27 #include <GeomAPI_Shape.h>
32 //--------------------------------------------------------------------------------------
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 //--------------------------------------------------------------------------------------
62 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
63 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
66 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
67 double theX, double theY);
70 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
71 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
74 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
75 const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
77 //--------------------------------------------------------------------------------------
79 void fillAttribute(bool theValue,
80 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
83 void fillAttribute(const ModelHighAPI_Double & theValue,
84 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
87 void fillAttribute(double theValue,
88 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
91 void fillAttribute(const ModelHighAPI_Integer & theValue,
92 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
95 void fillAttribute(int theValue,
96 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
99 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
100 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
103 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
104 const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
107 void fillAttribute(const ModelHighAPI_Reference & theValue,
108 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
111 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
112 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
115 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
116 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
119 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
120 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
123 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
124 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
127 void fillAttribute(const ModelHighAPI_Selection & theValue,
128 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
131 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
132 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
135 void fillAttribute(const std::string & theValue,
136 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
138 void fillAttribute(const char * theValue,
139 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
142 void fillAttribute(const std::list<std::string> & theValue,
143 const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
146 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
147 const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
150 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
153 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
156 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
159 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
161 /// Performs the high level API dump, then closes all and executes the script:
162 /// model must be recreated fully, with all attributes
163 /// \returns true if check is well done
165 bool checkPythonDump();
167 //--------------------------------------------------------------------------------------
168 //--------------------------------------------------------------------------------------
169 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */