Salome HOME
Merge branch 'Dev_2.8.0'
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Sphere.h
1 // Copyright (C) 2014-201x CEA/DEN, EDF R&D
2
3 // File:        PrimitivesPlugin_Sphere.h
4 // Created:     15 Mar 2017
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef PRIMITIVESPLUGIN_SPHERE_H_
8 #define PRIMITIVESPLUGIN_SPHERE_H_
9
10 #include <PrimitivesPlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <GeomAlgoAPI_Sphere.h>
13
14 /**\class PrimitivesPlugin_Sphere
15  * \ingroup Plugins
16  * \brief Feature for creation of a sphere.
17  *
18  * Creates a sphere from a radius and a center point defaulting to the origin
19  */
20 class PrimitivesPlugin_Sphere : public ModelAPI_Feature
21 {
22  public:
23   /// Sphere kind
24   inline static const std::string& ID()
25   {
26     static const std::string MY_SPHERE_ID("Sphere");
27     return MY_SPHERE_ID;
28   }
29
30   /// Attribute name of the base point
31   inline static const std::string& CENTER_POINT_ID()
32   {
33     static const std::string MY_CENTER_POINT_ID("center_point");
34     return MY_CENTER_POINT_ID;
35   }
36
37   /// Attribute name of the radius
38   inline static const std::string& RADIUS_ID()
39   {
40     static const std::string MY_RADIUS_ID("radius");
41     return MY_RADIUS_ID;
42   }
43
44   /// Returns the kind of a feature
45   PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
46   {
47     static std::string MY_KIND = PrimitivesPlugin_Sphere::ID();
48     return MY_KIND;
49   }
50
51   /// Creates a new part document if needed
52   PRIMITIVESPLUGIN_EXPORT virtual void execute();
53
54   /// Request for initialization of data model of the feature: adding all attributes
55   PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
56
57   /// Use plugin manager for features creation
58   PrimitivesPlugin_Sphere();
59
60  private:
61   /// Load Naming data structure of the feature to the document
62   void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> theSphereAlgo,
63                     std::shared_ptr<ModelAPI_ResultBody> theResultSphere);
64
65 };
66
67 #endif // PRIMITIVESPLUGIN_SPHERE_H_