Salome HOME
Remove some TODOs
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Translation.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_Translation.cpp
4 // Created:     07 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_Translation.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                                  const std::list<ModelHighAPI_Selection>& theMainObjects,
21                                                  const ModelHighAPI_Selection& theAxisObject,
22                                                  const ModelHighAPI_Double& theDistance)
23 : ModelHighAPI_Interface(theFeature)
24 {
25   if(initialize()) {
26     fillAttribute(theMainObjects, mymainObjects);
27     fillAttribute(theAxisObject, myaxisObject);
28     setDistance(theDistance);
29   }
30 }
31
32 //==================================================================================================
33 FeaturesAPI_Translation::~FeaturesAPI_Translation()
34 {
35
36 }
37
38 //==================================================================================================
39 void FeaturesAPI_Translation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
40 {
41   fillAttribute(theMainObjects, mymainObjects);
42
43   execute();
44 }
45
46 //==================================================================================================
47 void FeaturesAPI_Translation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
48 {
49   fillAttribute(theAxisObject, myaxisObject);
50
51   execute();
52 }
53
54 //==================================================================================================
55 void FeaturesAPI_Translation::setDistance(const ModelHighAPI_Double& theDistance)
56 {
57   fillAttribute(theDistance, mydistance);
58
59   execute();
60 }
61
62 //==================================================================================================
63 TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
64                               const std::list<ModelHighAPI_Selection>& theMainObjects,
65                               const ModelHighAPI_Selection& theAxisObject,
66                               const ModelHighAPI_Double& theDistance)
67 {
68   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
69   return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theAxisObject, theDistance));
70 }