Salome HOME
Remove some TODOs
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Placement.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_Placement.cpp
4 // Created:     07 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_Placement.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                              const std::list<ModelHighAPI_Selection>& theObjects,
21                                              const ModelHighAPI_Selection& theStartShape,
22                                              const ModelHighAPI_Selection& theEndShape,
23                                              const bool theReverseDirection,
24                                              const bool theCentering)
25 : ModelHighAPI_Interface(theFeature)
26 {
27   if(initialize()) {
28     fillAttribute(theObjects, myobjects);
29     fillAttribute(theStartShape, mystartShape);
30     fillAttribute(theEndShape, myendShape);
31     fillAttribute(theReverseDirection, myreverseDirection);
32     setCentering(theCentering);
33   }
34 }
35
36 //==================================================================================================
37 FeaturesAPI_Placement::~FeaturesAPI_Placement()
38 {
39
40 }
41
42 //==================================================================================================
43 void FeaturesAPI_Placement::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
44 {
45   fillAttribute(theObjects, myobjects);
46
47   execute();
48 }
49
50 //==================================================================================================
51 void FeaturesAPI_Placement::setStartShape(const ModelHighAPI_Selection& theStartShape)
52 {
53   fillAttribute(theStartShape, mystartShape);
54
55   execute();
56 }
57
58 //==================================================================================================
59 void FeaturesAPI_Placement::setEndShape(const ModelHighAPI_Selection& theEndShape)
60 {
61   fillAttribute(theEndShape, myendShape);
62
63   execute();
64 }
65
66 //==================================================================================================
67 void FeaturesAPI_Placement::setReverseDirection(const bool theReverseDirection)
68 {
69   fillAttribute(theReverseDirection, myreverseDirection);
70
71   execute();
72 }
73
74 //==================================================================================================
75 void FeaturesAPI_Placement::setCentering(const bool theCentering)
76 {
77   fillAttribute(theCentering, mycentering);
78
79   execute();
80 }
81
82 //==================================================================================================
83 PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
84                           const std::list<ModelHighAPI_Selection>& theObjects,
85                           const ModelHighAPI_Selection& theStartShape,
86                           const ModelHighAPI_Selection& theEndShape,
87                           const bool theReverseDirection,
88                           const bool theCentering)
89 {
90   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Placement::ID());
91   return PlacementPtr(new FeaturesAPI_Placement(aFeature,
92                                                 theObjects,
93                                                 theStartShape,
94                                                 theEndShape,
95                                                 theReverseDirection,
96                                                 theCentering));
97 }