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_Selection.h"
34 //--------------------------------------------------------------------------------------
35 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
36 const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
38 theAttribute->setValue(theValue);
41 void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
42 double theX, double theY)
44 theAttribute->setValue(theX, theY);
47 //--------------------------------------------------------------------------------------
48 void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
49 const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
51 theAttribute->setValue(theValue);
54 //--------------------------------------------------------------------------------------
55 void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
56 const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
58 theAttribute->setValue(theValue);
61 //--------------------------------------------------------------------------------------
62 void fillAttribute(bool theValue,
63 const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
65 theAttribute->setValue(theValue);
68 //--------------------------------------------------------------------------------------
69 void fillAttribute(const ModelHighAPI_Double & theValue,
70 const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
72 theValue.fillAttribute(theAttribute);
75 //--------------------------------------------------------------------------------------
76 void fillAttribute(const ModelHighAPI_Selection & theValue,
77 const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
79 theValue.fillAttribute(theAttribute);
82 //--------------------------------------------------------------------------------------
83 void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
84 const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
86 theAttribute->clear();
87 for (auto it = theValue.begin(); it != theValue.end(); ++it)
88 it->appendToList(theAttribute);
91 //--------------------------------------------------------------------------------------
92 void fillAttribute(const std::string & theValue,
93 const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
95 theAttribute->setValue(theValue);
97 //--------------------------------------------------------------------------------------