1 // Copyright (C) 2014-2019 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
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 void fillAttribute(const ModelHighAPI_Double & theX,
151 const ModelHighAPI_Double & theY,
152 const ModelHighAPI_Double & theZ,
153 const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
156 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
159 std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType);
162 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
165 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
168 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
170 /// Enumeration to manage the check python dump modes.
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
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
182 bool checkPythonDump(const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
184 //--------------------------------------------------------------------------------------
185 //--------------------------------------------------------------------------------------
186 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */