]> SALOME platform Git repositories - modules/shaper.git/blob - src/PrimitivesPlugin/PrimitivesPlugin_Box.h
Salome HOME
7672d2fb8413fc3c9e2c0055055a419316cad58d
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Box.h
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 // File:        PrimitivesPlugin_Box.h
4 // Created:     10 Mar 2016
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef PrimitivesPlugin_Box_H_
8 #define PrimitivesPlugin_Box_H_
9
10 #include <PrimitivesPlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <GeomAlgoAPI_Box.h>
13 #include <GeomAlgoAPI_BoxPoints.h>
14
15 class GeomAPI_Shape;
16 class ModelAPI_ResultBody;
17
18 /**\class PrimitivesPlugin_Box
19  * \ingroup Plugins
20  * \brief Feature for creation of a box primitive using various methods.
21  *
22  * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via two
23  * methods : using two points that define a diagonal, or using 3 lengths that define the 
24  * rectangular dimensions.
25  */
26 class PrimitivesPlugin_Box : public ModelAPI_Feature
27 {
28  public:
29   /// Box kind
30   inline static const std::string& ID()
31   {
32     static const std::string MY_BOX_ID("Box");
33     return MY_BOX_ID;
34   }
35
36   /// attribute name for creation method
37   inline static const std::string& METHOD()
38   {
39     static const std::string METHOD_ATTR("CreationMethod");
40     return METHOD_ATTR;
41   }
42
43   /// attribute name of first point
44   inline static const std::string& POINT_FIRST()
45   {
46     static const std::string MY_POINT_FIRST("FirstPoint");
47     return MY_POINT_FIRST;
48   }
49
50   /// attribute name of second point
51   inline static const std::string& POINT_SECOND()
52   {
53     static const std::string MY_POINT_SECOND("SecondPoint");
54     return MY_POINT_SECOND;
55   }
56
57   /// attribute first coordinate
58   inline static const std::string& DX()
59   {
60     static const std::string MY_DX("dx");
61     return MY_DX;
62   }
63
64   /// attribute second coordinate
65   inline static const std::string& DY()
66   {
67     static const std::string MY_DY("dy");
68     return MY_DY;
69   }
70
71   /// attribute third coordinate
72   inline static const std::string& DZ()
73   {
74     static const std::string MY_DZ("dz");
75     return MY_DZ;
76   }
77
78   /// Returns the kind of a feature
79   PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
80   {
81     static std::string MY_KIND = PrimitivesPlugin_Box::ID();
82     return MY_KIND;
83   }
84
85   /// Creates a new part document if needed
86   PRIMITIVESPLUGIN_EXPORT virtual void execute();
87
88   /// Request for initialization of data model of the feature: adding all attributes
89   PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
90   
91   /// Use plugin manager for features creation
92   PrimitivesPlugin_Box();
93
94  private:
95   /// Load Naming data structure of the feature to the document
96   void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
97                     std::shared_ptr<ModelAPI_ResultBody> theResultBox);
98
99   ///Perform the creation of the box using two points defining a diagonal
100   void createBoxByTwoPoints();
101   
102   ///Perform the creation of the box using three cordinates
103   void createBoxByDimensions();
104
105 };
106
107
108 #endif