]> SALOME platform Git repositories - modules/shaper.git/blob - src/ParametersAPI/ParametersAPI_Parameter.cpp
Salome HOME
Add ParametersAPI
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.cpp
1 // Name   : ParametersAPI_Parameter.cpp
2 // Purpose: 
3 //
4 // History:
5 // 16/06/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ParametersAPI_Parameter.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ParametersAPI_Parameter::ParametersAPI_Parameter(
13     const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16   initialize();
17 }
18
19 ParametersAPI_Parameter::ParametersAPI_Parameter(
20     const std::shared_ptr<ModelAPI_Feature> & theFeature,
21     const std::string & theName,
22     const ModelHighAPI_Double & theExpression)
23 : ModelHighAPI_Interface(theFeature)
24 {
25   if (initialize()) {
26     fillAttribute(theName, name());
27     fillAttribute(theExpression, expression());
28
29     execute();
30   }
31 }
32
33 ParametersAPI_Parameter::~ParametersAPI_Parameter()
34 {
35 }
36
37 //--------------------------------------------------------------------------------------
38 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & theParameter,
39                           const std::string & theName,
40                           const ModelHighAPI_Double & theExpression)
41 {
42   // TODO(spo): check that theParameter is not empty
43   std::shared_ptr<ModelAPI_Feature> aFeature = theParameter->addFeature(ParametersAPI_Parameter::ID());
44   return ParameterPtr(new ParametersAPI_Parameter(aFeature));
45 }