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_Selection.h"
35 //--------------------------------------------------------------------------------------
36 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
37 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
39 theAttribute->setValue(theValue);
42 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
43 double theX, double theY)
45 theAttribute->setValue(theX, theY);
48 //--------------------------------------------------------------------------------------
49 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
50 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
52 theAttribute->setValue(theValue);
55 //--------------------------------------------------------------------------------------
56 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
57 const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
59 theAttribute->setValue(theValue);
62 //--------------------------------------------------------------------------------------
63 void fillAttribute(bool theValue,
64 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
66 theAttribute->setValue(theValue);
69 //--------------------------------------------------------------------------------------
70 void fillAttribute(const ModelHighAPI_Double & theValue,
71 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
73 theValue.fillAttribute(theAttribute);
76 //--------------------------------------------------------------------------------------
77 void fillAttribute(const ModelHighAPI_Integer & theValue,
78 const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
80 theValue.fillAttribute(theAttribute);
83 //--------------------------------------------------------------------------------------
84 void fillAttribute(const ModelHighAPI_Selection & theValue,
85 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
87 theValue.fillAttribute(theAttribute);
90 //--------------------------------------------------------------------------------------
91 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
92 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
94 theAttribute->clear();
95 for (auto it = theValue.begin(); it != theValue.end(); ++it)
96 it->appendToList(theAttribute);
99 //--------------------------------------------------------------------------------------
100 void fillAttribute(const std::string & theValue,
101 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
103 theAttribute->setValue(theValue);
105 //--------------------------------------------------------------------------------------