Salome HOME
Added CPP High API for BuildPlugin_Wire
[modules/shaper.git] / src / BuildAPI / BuildAPI_Wire.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        BuildAPI_Wire.cpp
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "BuildAPI_Wire.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                              const std::list<ModelHighAPI_Selection>& theBaseObjects)
21 : ModelHighAPI_Interface(theFeature)
22 {
23   if(initialize()) {
24     setBase(theBaseObjects);
25   }
26 }
27
28 //==================================================================================================
29 BuildAPI_Wire::~BuildAPI_Wire()
30 {
31
32 }
33
34 //==================================================================================================
35 void BuildAPI_Wire::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
36 {
37   fillAttribute(theBaseObjects, mybaseObjects);
38
39   execute();
40 }
41
42 //==================================================================================================
43 void BuildAPI_Wire::addContour()
44 {
45   feature()->customAction(BuildPlugin_Wire::ADD_CONTOUR_ACTION_ID());
46 }
47
48 // TODO(spo): make add* as static functions of the class
49 //==================================================================================================
50 WirePtr addWire(const std::shared_ptr<ModelAPI_Document>& thePart,
51                 const std::list<ModelHighAPI_Selection>& theBaseObjects)
52 {
53   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Wire::ID());
54   return WirePtr(new BuildAPI_Wire(aFeature, theBaseObjects));
55 }