SHAPER  9.12.0
PrimitivesPlugin_Sphere.h
1 // Copyright (C) 2017-2023 CEA, EDF
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 
39 {
40  public:
42  inline static const std::string& ID()
43  {
44  static const std::string MY_SPHERE_ID("Sphere");
45  return MY_SPHERE_ID;
46  }
47 
49  inline static const std::string& CREATION_METHOD()
50  {
51  static const std::string MY_CREATION_METHOD_ID("CreationMethod");
52  return MY_CREATION_METHOD_ID;
53  }
54 
56  inline static const std::string& CREATION_METHOD_BY_PT_RADIUS()
57  {
58  static const std::string MY_CREATION_METHOD_ID("SphereByPointRadius");
59  return MY_CREATION_METHOD_ID;
60  }
61 
63  inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
64  {
65  static const std::string MY_CREATION_METHOD_ID("SphereByDimensions");
66  return MY_CREATION_METHOD_ID;
67  }
68 
70  inline static const std::string& CENTER_POINT_ID()
71  {
72  static const std::string MY_CENTER_POINT_ID("center_point");
73  return MY_CENTER_POINT_ID;
74  }
75 
77  inline static const std::string& RADIUS_ID()
78  {
79  static const std::string MY_RADIUS_ID("radius");
80  return MY_RADIUS_ID;
81  }
82 
84  inline static const std::string& RMIN_ID()
85  {
86  static const std::string MY_RMIN_ID("rmin");
87  return MY_RMIN_ID;
88  }
89 
91  inline static const std::string& RMAX_ID()
92  {
93  static const std::string MY_RMAX_ID("rmax");
94  return MY_RMAX_ID;
95  }
96 
98  inline static const std::string& PHIMIN_ID()
99  {
100  static const std::string MY_PHIMIN_ID("phimin");
101  return MY_PHIMIN_ID;
102  }
103 
105  inline static const std::string& PHIMAX_ID()
106  {
107  static const std::string MY_PHIMAX_ID("phimax");
108  return MY_PHIMAX_ID;
109  }
110 
112  inline static const std::string& THETAMIN_ID()
113  {
114  static const std::string MY_THETAMIN_ID("thetamin");
115  return MY_THETAMIN_ID;
116  }
117 
119  inline static const std::string& THETAMAX_ID()
120  {
121  static const std::string MY_THETAMAX_ID("thetamax");
122  return MY_THETAMAX_ID;
123  }
124 
126  PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
127  {
128  static std::string MY_KIND = PrimitivesPlugin_Sphere::ID();
129  return MY_KIND;
130  }
131 
133  PRIMITIVESPLUGIN_EXPORT virtual void execute();
134 
136  PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
137 
140 
141  private:
143  void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> theSphereAlgo,
144  std::shared_ptr<ModelAPI_ResultBody> theResultSphere);
145 
147  void createSphereByPtRadius();
148 
151  void createShereByDimensions();
152 
153 };
154 
155 #endif // PRIMITIVESPLUGIN_SPHERE_H_
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Feature for creation of a sphere primitive using various methods.
Definition: PrimitivesPlugin_Sphere.h:39
virtual PRIMITIVESPLUGIN_EXPORT void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: PrimitivesPlugin_Sphere.cpp:45
virtual PRIMITIVESPLUGIN_EXPORT void execute()
Creates a new part document if needed.
Definition: PrimitivesPlugin_Sphere.cpp:109
static const std::string & THETAMAX_ID()
attribute name of the higher theta limit
Definition: PrimitivesPlugin_Sphere.h:119
static const std::string & CREATION_METHOD_BY_DIMENSIONS()
Attribute name for creation method.
Definition: PrimitivesPlugin_Sphere.h:63
static const std::string & RADIUS_ID()
Attribute name of the radius.
Definition: PrimitivesPlugin_Sphere.h:77
static const std::string & ID()
Sphere kind.
Definition: PrimitivesPlugin_Sphere.h:42
static const std::string & RMIN_ID()
attribute name of the inner radius
Definition: PrimitivesPlugin_Sphere.h:84
static const std::string & THETAMIN_ID()
attribute name of the lower theta limit
Definition: PrimitivesPlugin_Sphere.h:112
static const std::string & PHIMIN_ID()
attribute name of the lower phi limit
Definition: PrimitivesPlugin_Sphere.h:98
static const std::string & RMAX_ID()
attribute name of the outer radius
Definition: PrimitivesPlugin_Sphere.h:91
virtual PRIMITIVESPLUGIN_EXPORT const std::string & getKind()
Returns the kind of a feature.
Definition: PrimitivesPlugin_Sphere.h:126
static const std::string & CENTER_POINT_ID()
Attribute name of the base point.
Definition: PrimitivesPlugin_Sphere.h:70
PrimitivesPlugin_Sphere()
Use plugin manager for features creation.
Definition: PrimitivesPlugin_Sphere.cpp:40
static const std::string & PHIMAX_ID()
attribute name of the higher phi limit
Definition: PrimitivesPlugin_Sphere.h:105
static const std::string & CREATION_METHOD_BY_PT_RADIUS()
Attribute name for creation method.
Definition: PrimitivesPlugin_Sphere.h:56
static const std::string & CREATION_METHOD()
Attribute name for creation method.
Definition: PrimitivesPlugin_Sphere.h:49