Salome HOME
Merge branch 'csgroup_IS2'
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Sphere.h
1 // Copyright (C) 2017-2021  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_Sphere.h
21 // Created:     15 Mar 2017
22 // Author:      Clarisse Genrault (CEA)
23
24 #ifndef PRIMITIVESPLUGIN_SPHERE_H_
25 #define PRIMITIVESPLUGIN_SPHERE_H_
26
27 #include <PrimitivesPlugin.h>
28 #include <ModelAPI_Feature.h>
29 #include <GeomAlgoAPI_Sphere.h>
30
31 /**\class PrimitivesPlugin_Sphere
32  * \ingroup Plugins
33  * \brief Feature for creation of a sphere.
34  *
35  * Creates a sphere from a radius and a center point defaulting to the origin
36  */
37 class PrimitivesPlugin_Sphere : public ModelAPI_Feature
38 {
39  public:
40   /// Sphere kind
41   inline static const std::string& ID()
42   {
43     static const std::string MY_SPHERE_ID("Sphere");
44     return MY_SPHERE_ID;
45   }
46
47   /// Attribute name of the base point
48   inline static const std::string& CENTER_POINT_ID()
49   {
50     static const std::string MY_CENTER_POINT_ID("center_point");
51     return MY_CENTER_POINT_ID;
52   }
53
54   /// Attribute name of the radius
55   inline static const std::string& RADIUS_ID()
56   {
57     static const std::string MY_RADIUS_ID("radius");
58     return MY_RADIUS_ID;
59   }
60
61   /// Returns the kind of a feature
62   PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
63   {
64     static std::string MY_KIND = PrimitivesPlugin_Sphere::ID();
65     return MY_KIND;
66   }
67
68   /// Creates a new part document if needed
69   PRIMITIVESPLUGIN_EXPORT virtual void execute();
70
71   /// Request for initialization of data model of the feature: adding all attributes
72   PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
73
74   /// Use plugin manager for features creation
75   PrimitivesPlugin_Sphere();
76
77  private:
78   /// Load Naming data structure of the feature to the document
79   void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> theSphereAlgo,
80                     std::shared_ptr<ModelAPI_ResultBody> theResultSphere);
81
82 };
83
84 #endif // PRIMITIVESPLUGIN_SPHERE_H_