]> SALOME platform Git repositories - modules/shaper.git/blob - src/GDMLAPI/GDMLAPI_ConeSegment.cpp
Salome HOME
Add the GDML primitive "Cone Segment".
[modules/shaper.git] / src / GDMLAPI / GDMLAPI_ConeSegment.cpp
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D -->
2
3 // File:        GDMLAPI_ConeSegment.cpp
4 // Created:     29 Nov. 2016
5 // Author:      Clarisse Genrault
6
7 #include "GDMLAPI_ConeSegment.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 GDMLAPI_ConeSegment::GDMLAPI_ConeSegment(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 GDMLAPI_ConeSegment::GDMLAPI_ConeSegment(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                          const ModelHighAPI_Double& theRMin1,
21                                          const ModelHighAPI_Double& theRMax1,
22                                          const ModelHighAPI_Double& theRMin2,
23                                          const ModelHighAPI_Double& theRMax2,
24                                          const ModelHighAPI_Double& theZ,
25                                          const ModelHighAPI_Double& theStartPhi,
26                                          const ModelHighAPI_Double& theDeltaPhi)
27 : ModelHighAPI_Interface(theFeature)
28 {
29   if (initialize())
30     setAttributes(theRMin1, theRMax1, theRMin2, theRMax2, theZ, theStartPhi, theDeltaPhi);
31 }
32
33 //==================================================================================================
34 GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment()
35 {
36
37 }
38
39 //==================================================================================================
40 void GDMLAPI_ConeSegment::setAttributes(const ModelHighAPI_Double& theRMin1,
41                                         const ModelHighAPI_Double& theRMax1,
42                                         const ModelHighAPI_Double& theRMin2,
43                                         const ModelHighAPI_Double& theRMax2,
44                                         const ModelHighAPI_Double& theZ,
45                                         const ModelHighAPI_Double& theStartPhi,
46                                         const ModelHighAPI_Double& theDeltaPhi)
47 {
48   fillAttribute(theRMin1, rmin1());
49   fillAttribute(theRMax1, rmax1());
50   fillAttribute(theRMin2, rmin2());
51   fillAttribute(theRMax2, rmax2());
52   fillAttribute(theZ, z());
53   fillAttribute(theStartPhi, startphi());
54   fillAttribute(theDeltaPhi, deltaphi());
55
56   execute();
57 }
58
59 //==================================================================================================
60 ConeSegmentPtr addConeSegment(const std::shared_ptr<ModelAPI_Document>& thePart,
61                               const ModelHighAPI_Double& theRMin1,
62                               const ModelHighAPI_Double& theRMax1,
63                               const ModelHighAPI_Double& theRMin2,
64                               const ModelHighAPI_Double& theRMax2,
65                               const ModelHighAPI_Double& theZ,
66                               const ModelHighAPI_Double& theStartPhi,
67                               const ModelHighAPI_Double& theDeltaPhi)
68 {
69   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(GDMLAPI_ConeSegment::ID());
70   return ConeSegmentPtr(new GDMLAPI_ConeSegment(aFeature, theRMin1, theRMax1, theRMin2, theRMax2,
71                                                 theZ, theStartPhi, theDeltaPhi));
72 }