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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
22 #define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
24 //--------------------------------------------------------------------------------------
25 #include "ModelHighAPI.h"
26 #include <ModelAPI_AttributeTables.h>
28 #include <GeomAPI_Shape.h>
33 //--------------------------------------------------------------------------------------
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 //--------------------------------------------------------------------------------------
63 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
64 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
67 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
68 double theX, double theY);
71 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
72 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
75 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
76 const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
78 //--------------------------------------------------------------------------------------
80 void fillAttribute(bool theValue,
81 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
84 void fillAttribute(const ModelHighAPI_Double & theValue,
85 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
88 void fillAttribute(double theValue,
89 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
92 void fillAttribute(const ModelHighAPI_Integer & theValue,
93 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
96 void fillAttribute(int theValue,
97 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
100 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
101 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
104 void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
105 const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
108 void fillAttribute(const ModelHighAPI_Reference & theValue,
109 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
112 void fillAttribute(const std::list<ModelHighAPI_Reference> & theValue,
113 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
116 void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
117 const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
120 void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
121 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
124 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
125 const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
128 void fillAttribute(const ModelHighAPI_Selection & theValue,
129 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
132 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
133 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
136 void fillAttribute(const std::string & theValue,
137 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
139 void fillAttribute(const char * theValue,
140 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
143 void fillAttribute(const std::list<std::string> & theValue,
144 const std::shared_ptr<ModelAPI_AttributeStringArray> & theAttribute);
147 void fillAttribute(const std::list<ModelHighAPI_Integer> & theValue,
148 const std::shared_ptr<ModelAPI_AttributeIntArray> & theAttribute);
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);
157 GeomAPI_Shape::ShapeType shapeTypeByStr(std::string theShapeTypeStr);
160 std::string strByShapeType(GeomAPI_Shape::ShapeType theShapeType);
163 GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
166 ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
169 std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
171 /// Enumeration to manage the check python dump modes.
173 CHECK_NAMING = 1, ///< check topological naming only
174 CHECK_GEOMETRICAL = 2, ///< check geometrical naming only
175 CHECK_NAMING_AND_GEOMETRICAL = 3, ///< default option, check topological and geometrical dumps
176 CHECK_WEAK = 4, ///< check weak naming only
179 /// Performs the high level API dump, then closes all and executes the script:
180 /// model must be recreated fully, with all attributes
181 /// \returns true if check is well done
183 bool checkPythonDump(const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
185 //--------------------------------------------------------------------------------------
186 //--------------------------------------------------------------------------------------
187 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */