Salome HOME
dc74b7ae1ce99274e6b241cca5375182e19de878
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.cpp
1 // Name   : ModelHighAPI_Tools.cpp
2 // Purpose: 
3 //
4 // History:
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
6
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"
35
36 //--------------------------------------------------------------------------------------
37 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
38                    const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
39 {
40   theAttribute->setValue(theValue);
41 }
42
43 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
44                    double theX, double theY)
45 {
46   theAttribute->setValue(theX, theY);
47 }
48
49 //--------------------------------------------------------------------------------------
50 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
51                    const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
52 {
53   theAttribute->setValue(theValue);
54 }
55
56 //--------------------------------------------------------------------------------------
57 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
58                    const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
59 {
60   theAttribute->setValue(theValue);
61 }
62
63 //--------------------------------------------------------------------------------------
64 void fillAttribute(bool theValue,
65                    const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
66 {
67   theAttribute->setValue(theValue);
68 }
69
70 //--------------------------------------------------------------------------------------
71 void fillAttribute(const ModelHighAPI_Double & theValue,
72                    const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
73 {
74   theValue.fillAttribute(theAttribute);
75 }
76
77 //--------------------------------------------------------------------------------------
78 void fillAttribute(const ModelHighAPI_Integer & theValue,
79                    const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
80 {
81   theValue.fillAttribute(theAttribute);
82 }
83
84 //--------------------------------------------------------------------------------------
85 void fillAttribute(const ModelHighAPI_RefAttr & theValue,
86                    const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
87 {
88   theValue.fillAttribute(theAttribute);
89 }
90
91 //--------------------------------------------------------------------------------------
92 void fillAttribute(const ModelHighAPI_Selection & theValue,
93                    const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
94 {
95   theValue.fillAttribute(theAttribute);
96 }
97
98 //--------------------------------------------------------------------------------------
99 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
100                    const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
101 {
102   theAttribute->clear();
103   for (auto it = theValue.begin(); it != theValue.end(); ++it)
104     it->appendToList(theAttribute);
105 }
106
107 //--------------------------------------------------------------------------------------
108 void fillAttribute(const std::string & theValue,
109                    const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
110 {
111   theAttribute->setValue(theValue);
112 }
113 //--------------------------------------------------------------------------------------