]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesAPI/FeaturesAPI_Pipe.cpp
Salome HOME
Added CPP High API for FeaturesPlugin_Pipe
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Pipe.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_Pipe.cpp
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_Pipe.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                    const std::list<ModelHighAPI_Selection>& theBaseObjects,
21                                    const ModelHighAPI_Selection& thePath)
22 : ModelHighAPI_Interface(theFeature)
23 {
24   if(initialize()) {
25     fillAttribute(theBaseObjects, mybaseObjects);
26     setPath(thePath);
27   }
28 }
29
30 //==================================================================================================
31 FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
32                                    const std::list<ModelHighAPI_Selection>& theBaseObjects,
33                                    const ModelHighAPI_Selection& thePath,
34                                    const ModelHighAPI_Selection& theBiNoramal)
35 : ModelHighAPI_Interface(theFeature)
36 {
37   if(initialize()) {
38     setByBasePathBiNormal(theBaseObjects, thePath, theBiNoramal);
39   }
40 }
41
42 //==================================================================================================
43 FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
44                                    const std::list<ModelHighAPI_Selection>& theBaseObjects,
45                                    const ModelHighAPI_Selection& thePath,
46                                    const std::list<ModelHighAPI_Selection>& theLocations)
47 : ModelHighAPI_Interface(theFeature)
48 {
49   if(initialize()) {
50     setByBasePathLocations(theBaseObjects, thePath, theLocations);
51   }
52 }
53
54 //==================================================================================================
55 FeaturesAPI_Pipe::~FeaturesAPI_Pipe()
56 {
57
58 }
59
60 //==================================================================================================
61 void FeaturesAPI_Pipe::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
62 {
63   fillAttribute(theBaseObjects, mybaseObjects);
64
65   execute();
66 }
67
68 //==================================================================================================
69 void FeaturesAPI_Pipe::setPath(const ModelHighAPI_Selection& thePath)
70 {
71   fillAttribute(thePath, mypath);
72
73   execute();
74 }
75
76 //==================================================================================================
77 void FeaturesAPI_Pipe::setByBasePath(const std::list<ModelHighAPI_Selection>& theBaseObjects,
78                                      const ModelHighAPI_Selection& thePath)
79 {
80   fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE(), mycreationMethod);
81   fillAttribute(theBaseObjects, mybaseObjects);
82   fillAttribute(thePath, mypath);
83
84   execute();
85 }
86
87 //==================================================================================================
88 void FeaturesAPI_Pipe::setByBasePathBiNormal(const std::list<ModelHighAPI_Selection>& theBaseObjects,
89                                              const ModelHighAPI_Selection& thePath,
90                                              const ModelHighAPI_Selection& theBiNoramal)
91 {
92   fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL(), mycreationMethod);
93   fillAttribute(theBaseObjects, mybaseObjects);
94   fillAttribute(thePath, mypath);
95   fillAttribute(theBiNoramal, mybiNormal);
96
97   execute();
98 }
99
100 //==================================================================================================
101 void FeaturesAPI_Pipe::setByBasePathLocations(const std::list<ModelHighAPI_Selection>& theBaseObjects,
102                                               const ModelHighAPI_Selection& thePath,
103                                               const std::list<ModelHighAPI_Selection>& theLocations)
104 {
105   fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS(), mycreationMethod);
106   fillAttribute(theBaseObjects, mybaseObjects);
107   fillAttribute(thePath, mypath);
108   fillAttribute(theLocations, mylocations);
109
110   execute();
111 }
112
113 // TODO(spo): make add* as static functions of the class
114 //==================================================================================================
115 PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
116                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
117                 const ModelHighAPI_Selection& thePath)
118 {
119   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
120   return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath));
121 }
122
123 //==================================================================================================
124 PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
125                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
126                 const ModelHighAPI_Selection& thePath,
127                 const ModelHighAPI_Selection& theBiNoramal)
128 {
129   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
130   return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theBiNoramal));
131 }
132
133 //==================================================================================================
134 PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
135                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
136                 const ModelHighAPI_Selection& thePath,
137                 const std::list<ModelHighAPI_Selection>& theLocations)
138 {
139   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
140   return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theLocations));
141 }