Salome HOME
Copyright update 2020
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Cone.h
1 // Copyright (C) 2017-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:        PrimitivesPlugin_Cone.h
21 // Created:     17 Mar 2017
22 // Author:      Clarisse Genrault (CEA)
23
24 #ifndef PRIMITIVESPLUGIN_CONE_H_
25 #define PRIMITIVESPLUGIN_CONE_H_
26
27 #include <PrimitivesPlugin.h>
28 #include <ModelAPI_Feature.h>
29 #include <GeomAlgoAPI_Cone.h>
30
31 /**\class PrimitivesPlugin_Cone
32  * \ingroup Plugins
33  * \brief Feature for creation of a cone.
34  *
35  * Creates a cone from a 
36  */
37 class PrimitivesPlugin_Cone : public ModelAPI_Feature
38 {
39  public:
40   /// Cone kind
41   inline static const std::string& ID()
42   {
43     static const std::string MY_CONE_ID("Cone");
44     return MY_CONE_ID;
45   }
46
47   /// Attribute name of the base point
48   inline static const std::string& BASE_POINT_ID()
49   {
50     static const std::string MY_BASE_POINT_ID("base_point");
51     return MY_BASE_POINT_ID;
52   }
53
54   /// Attribute name of the axis
55   inline static const std::string& AXIS_ID()
56   {
57     static const std::string MY_AXIS_ID("axis");
58     return MY_AXIS_ID;
59   }
60
61   /// Attribute name of the base radius
62   inline static const std::string& BASE_RADIUS_ID()
63   {
64     static const std::string MY_BASE_RADIUS_ID("base_radius");
65     return MY_BASE_RADIUS_ID;
66   }
67
68   /// Attribute name of the radius
69   inline static const std::string& TOP_RADIUS_ID()
70   {
71     static const std::string MY_TOP_RADIUS_ID("top_radius");
72     return MY_TOP_RADIUS_ID;
73   }
74
75   /// Attribute name of the radius
76   inline static const std::string& HEIGHT_ID()
77   {
78     static const std::string MY_HEIGHT_ID("height");
79     return MY_HEIGHT_ID;
80   }
81
82   /// Returns the kind of a feature
83   PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
84   {
85     static std::string MY_KIND = PrimitivesPlugin_Cone::ID();
86     return MY_KIND;
87   }
88
89   /// Creates a new part document if needed
90   PRIMITIVESPLUGIN_EXPORT virtual void execute();
91
92   /// Request for initialization of data model of the feature: adding all attributes
93   PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
94
95   /// Use plugin manager for features creation
96   PrimitivesPlugin_Cone();
97
98  private:
99   /// Load Naming data structure of the feature to the document
100   void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cone> theConeAlgo,
101                     std::shared_ptr<ModelAPI_ResultBody> theResultCone);
102
103 };
104
105 #endif // PRIMITIVESPLUGIN_CONE_H_