SHAPER  9.12.0
PrimitivesPlugin_Cylinder.h
1 // Copyright (C) 2014-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 #ifndef PRIMITIVESPLUGIN_CYLINDER_H_
21 #define PRIMITIVESPLUGIN_CYLINDER_H_
22 
23 #include <PrimitivesPlugin.h>
24 #include <ModelAPI_Feature.h>
25 #include <GeomAlgoAPI_Cylinder.h>
26 
27 class GeomAPI_Shape;
29 
38 {
39  public:
41  inline static const std::string& ID()
42  {
43  static const std::string MY_CYLINDER_ID("Cylinder");
44  return MY_CYLINDER_ID;
45  }
46 
48  inline static const std::string& CREATION_METHOD()
49  {
50  static const std::string MY_CREATION_METHOD_ID("CreationMethod");
51  return MY_CREATION_METHOD_ID;
52  }
53 
55  inline static const std::string& CREATION_METHOD_CYLINDER()
56  {
57  static const std::string MY_CREATION_METHOD_ID("Cylinder");
58  return MY_CREATION_METHOD_ID;
59  }
60 
62  inline static const std::string& CREATION_METHOD_CYLINDER_PORTION()
63  {
64  static const std::string MY_CREATION_METHOD_ID("CylinderPortion");
65  return MY_CREATION_METHOD_ID;
66  }
67 
69  inline static const std::string& BASE_POINT_ID()
70  {
71  static const std::string MY_BASE_POINT_ID("base_point");
72  return MY_BASE_POINT_ID;
73  }
74 
76  inline static const std::string& AXIS_ID()
77  {
78  static const std::string MY_AXIS_ID("axis");
79  return MY_AXIS_ID;
80  }
81 
83  inline static const std::string& RADIUS_ID()
84  {
85  static const std::string MY_RADIUS_ID("radius");
86  return MY_RADIUS_ID;
87  }
88 
90  inline static const std::string& HEIGHT_ID()
91  {
92  static const std::string MY_HEIGHT_ID("height");
93  return MY_HEIGHT_ID;
94  }
95 
97  inline static const std::string& ANGLE_ID()
98  {
99  static const std::string MY_ANGLE_ID("angle");
100  return MY_ANGLE_ID;
101  }
102 
104  PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
105  {
106  static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID();
107  return MY_KIND;
108  }
109 
111  PRIMITIVESPLUGIN_EXPORT virtual void execute();
112 
114  PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
115 
118 
119  private:
121  void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinder> theCylinderAlgo,
122  std::shared_ptr<ModelAPI_ResultBody> theResultCylinder);
123 
125  void createCylinder(bool withAngle);
126 
127 };
128 
129 #endif // PRIMITIVESPLUGIN_CYLINDER_H_
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
The body (shape) result of a feature.
Definition: ModelAPI_ResultBody.h:43
Feature for creation of a cylinder.
Definition: PrimitivesPlugin_Cylinder.h:38
static const std::string & CREATION_METHOD_CYLINDER()
Attribute name for creation method.
Definition: PrimitivesPlugin_Cylinder.h:55
virtual PRIMITIVESPLUGIN_EXPORT void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: PrimitivesPlugin_Cylinder.cpp:42
virtual PRIMITIVESPLUGIN_EXPORT void execute()
Creates a new part document if needed.
Definition: PrimitivesPlugin_Cylinder.cpp:83
PrimitivesPlugin_Cylinder()
Use plugin manager for features creation.
Definition: PrimitivesPlugin_Cylinder.cpp:37
static const std::string & CREATION_METHOD()
Attribute name for creation method.
Definition: PrimitivesPlugin_Cylinder.h:48
static const std::string & RADIUS_ID()
Attribute name of the radius.
Definition: PrimitivesPlugin_Cylinder.h:83
static const std::string & ANGLE_ID()
Attribute name of the angle.
Definition: PrimitivesPlugin_Cylinder.h:97
static const std::string & AXIS_ID()
Attribute name of the axis.
Definition: PrimitivesPlugin_Cylinder.h:76
static const std::string & CREATION_METHOD_CYLINDER_PORTION()
Attribute name for creation method.
Definition: PrimitivesPlugin_Cylinder.h:62
static const std::string & ID()
Cylinder kind.
Definition: PrimitivesPlugin_Cylinder.h:41
static const std::string & BASE_POINT_ID()
Attribute name of the base point.
Definition: PrimitivesPlugin_Cylinder.h:69
static const std::string & HEIGHT_ID()
Attribute name of the height.
Definition: PrimitivesPlugin_Cylinder.h:90
virtual PRIMITIVESPLUGIN_EXPORT const std::string & getKind()
Returns the kind of a feature.
Definition: PrimitivesPlugin_Cylinder.h:104