1 // Copyright (C) 2017-2022 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: PrimitivesPlugin_Sphere.h
21 // Created: 15 Mar 2017
22 // Author: Clarisse Genrault (CEA)
24 #ifndef PRIMITIVESPLUGIN_SPHERE_H_
25 #define PRIMITIVESPLUGIN_SPHERE_H_
27 #include <PrimitivesPlugin.h>
28 #include <ModelAPI_Feature.h>
29 #include <GeomAlgoAPI_Sphere.h>
31 /**\class PrimitivesPlugin_Sphere
33 * \brief Feature for creation of a sphere primitive using various methods.
35 * It can be built via two methods : using a radius and a center point defaulting to the origin,
36 * or radii (inner and outer) and angle limits (theta and phi).
38 class PrimitivesPlugin_Sphere : public ModelAPI_Feature
42 inline static const std::string& ID()
44 static const std::string MY_SPHERE_ID("Sphere");
48 /// Attribute name for creation method
49 inline static const std::string& CREATION_METHOD()
51 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
52 return MY_CREATION_METHOD_ID;
55 /// Attribute name for creation method
56 inline static const std::string& CREATION_METHOD_BY_PT_RADIUS()
58 static const std::string MY_CREATION_METHOD_ID("SphereByPointRadius");
59 return MY_CREATION_METHOD_ID;
62 /// Attribute name for creation method
63 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
65 static const std::string MY_CREATION_METHOD_ID("SphereByDimensions");
66 return MY_CREATION_METHOD_ID;
69 /// Attribute name of the base point
70 inline static const std::string& CENTER_POINT_ID()
72 static const std::string MY_CENTER_POINT_ID("center_point");
73 return MY_CENTER_POINT_ID;
76 /// Attribute name of the radius
77 inline static const std::string& RADIUS_ID()
79 static const std::string MY_RADIUS_ID("radius");
83 /// attribute name of the inner radius
84 inline static const std::string& RMIN_ID()
86 static const std::string MY_RMIN_ID("rmin");
90 /// attribute name of the outer radius
91 inline static const std::string& RMAX_ID()
93 static const std::string MY_RMAX_ID("rmax");
97 /// attribute name of the lower phi limit
98 inline static const std::string& PHIMIN_ID()
100 static const std::string MY_PHIMIN_ID("phimin");
104 /// attribute name of the higher phi limit
105 inline static const std::string& PHIMAX_ID()
107 static const std::string MY_PHIMAX_ID("phimax");
111 /// attribute name of the lower theta limit
112 inline static const std::string& THETAMIN_ID()
114 static const std::string MY_THETAMIN_ID("thetamin");
115 return MY_THETAMIN_ID;
118 /// attribute name of the higher theta limit
119 inline static const std::string& THETAMAX_ID()
121 static const std::string MY_THETAMAX_ID("thetamax");
122 return MY_THETAMAX_ID;
125 /// Returns the kind of a feature
126 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
128 static std::string MY_KIND = PrimitivesPlugin_Sphere::ID();
132 /// Creates a new part document if needed
133 PRIMITIVESPLUGIN_EXPORT virtual void execute();
135 /// Request for initialization of data model of the feature: adding all attributes
136 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
138 /// Use plugin manager for features creation
139 PrimitivesPlugin_Sphere();
142 /// Load Naming data structure of the feature to the document
143 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> theSphereAlgo,
144 std::shared_ptr<ModelAPI_ResultBody> theResultSphere);
146 /// Perform the creation of the sphere using a point and a radius
147 void createSphereByPtRadius();
149 /// Perform the creation of the sphere using radii (inner and outer) and angle limits
151 void createShereByDimensions();
155 #endif // PRIMITIVESPLUGIN_SPHERE_H_