1 // Name : ModelHighAPI_Tools.cpp
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Tools.h"
9 //--------------------------------------------------------------------------------------
10 #include <GeomAPI_Dir.h>
11 #include <GeomAPI_Pnt.h>
12 #include <GeomAPI_Pnt2d.h>
13 //--------------------------------------------------------------------------------------
14 #include <GeomDataAPI_Dir.h>
15 #include <GeomDataAPI_Point.h>
16 #include <GeomDataAPI_Point2D.h>
17 //--------------------------------------------------------------------------------------
18 #include <ModelAPI_AttributeBoolean.h>
19 #include <ModelAPI_AttributeDocRef.h>
20 #include <ModelAPI_AttributeDouble.h>
21 #include <ModelAPI_AttributeIntArray.h>
22 #include <ModelAPI_AttributeInteger.h>
23 #include <ModelAPI_AttributeRefAttr.h>
24 #include <ModelAPI_AttributeRefAttrList.h>
25 #include <ModelAPI_AttributeReference.h>
26 #include <ModelAPI_AttributeRefList.h>
27 #include <ModelAPI_AttributeSelection.h>
28 #include <ModelAPI_AttributeSelectionList.h>
29 #include <ModelAPI_AttributeString.h>
30 //--------------------------------------------------------------------------------------
31 #include "ModelHighAPI_Double.h"
32 #include "ModelHighAPI_Integer.h"
33 #include "ModelHighAPI_RefAttr.h"
34 #include "ModelHighAPI_Selection.h"
36 //--------------------------------------------------------------------------------------
37 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
38 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
40 theAttribute->setValue(theValue);
43 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
44 double theX, double theY)
46 theAttribute->setValue(theX, theY);
49 //--------------------------------------------------------------------------------------
50 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
51 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
53 theAttribute->setValue(theValue);
56 //--------------------------------------------------------------------------------------
57 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
58 const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
60 theAttribute->setValue(theValue);
63 //--------------------------------------------------------------------------------------
64 void fillAttribute(bool theValue,
65 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
67 theAttribute->setValue(theValue);
70 //--------------------------------------------------------------------------------------
71 void fillAttribute(const ModelHighAPI_Double & theValue,
72 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
74 theValue.fillAttribute(theAttribute);
76 void fillAttribute(double theValue,
77 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
79 theAttribute->setValue(theValue);
82 //--------------------------------------------------------------------------------------
83 void fillAttribute(const ModelHighAPI_Integer & theValue,
84 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
86 theValue.fillAttribute(theAttribute);
89 //--------------------------------------------------------------------------------------
90 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
91 const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
93 theValue.fillAttribute(theAttribute);
96 //--------------------------------------------------------------------------------------
97 void fillAttribute(const ModelHighAPI_Selection & theValue,
98 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
100 theValue.fillAttribute(theAttribute);
103 //--------------------------------------------------------------------------------------
104 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
105 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
107 theAttribute->clear();
108 for (auto it = theValue.begin(); it != theValue.end(); ++it)
109 it->appendToList(theAttribute);
112 //--------------------------------------------------------------------------------------
113 void fillAttribute(const std::string & theValue,
114 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
116 theAttribute->setValue(theValue);
118 void fillAttribute(const char * theValue,
119 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
121 theAttribute->setValue(theValue);
124 //--------------------------------------------------------------------------------------