Salome HOME
Merge remote-tracking branch 'origin/PortingSalome760' into Dev_1.3.0
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Placement.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Placement.h
4 // Created:     2 Dec 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef FeaturesPlugin_Placement_H_
8 #define FeaturesPlugin_Placement_H_
9
10 #include "FeaturesPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <GeomAlgoAPI_Placement.h>
13
14 class ModelAPI_ResultBody;
15 class GeomAPI_Shape;
16
17 /**\class FeaturesPlugin_Placement
18  * \ingroup Plugins
19  * \brief Feature for applying of placement operation: relative movement of Solid.
20  *
21  * Locates the selected placement_attractable_object (face, edge, vertex) of the solid into 
22  * the selected placement_base_object. Faces must be planar, edges must be linear.
23  * Orientation of the placed solid depends on the underlied planes of both faces.
24  */
25 class FeaturesPlugin_Placement : public ModelAPI_Feature
26 {
27  public:
28   /// Placement kind
29   inline static const std::string& ID()
30   {
31     static const std::string MY_PLACEMENT_ID("Placement");
32     return MY_PLACEMENT_ID;
33   }
34   /// attribute name of references sketch entities list, it should contain a sketch result or
35   /// a pair a sketch result to sketch face
36   /*Modification for specification of 1.3.0
37   inline static const std::string& LIST_ID()
38   {
39     static const std::string MY_GROUP_LIST_ID("base");
40     return MY_GROUP_LIST_ID;
41   }*/
42   /// attribute name of referenced object
43   inline static const std::string& BASE_OBJECT_ID()
44   {
45     static const std::string MY_BASE_OBJECT_ID("placement_base_object");
46     return MY_BASE_OBJECT_ID;
47   }
48   /// attribute name of attractable face
49   inline static const std::string& ATTRACT_OBJECT_ID()
50   {
51     static const std::string MY_ATTRACT_OBJECT_ID("placement_attractable_object");
52     return MY_ATTRACT_OBJECT_ID;
53   }
54   /// attribute name of flag of reverse direction
55   inline static const std::string& REVERSE_ID()
56   {
57     static const std::string MY_REVERSE_ID("placement_reverse_direction");
58     return MY_REVERSE_ID;
59   }
60   /// attribute name of flag of centering position
61   inline static const std::string& CENTERING_ID()
62   {
63     static const std::string MY_CENTERING_ID("placement_centering");
64     return MY_CENTERING_ID;
65   }
66
67   /// Returns the kind of a feature
68   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
69   {
70     static std::string MY_KIND = FeaturesPlugin_Placement::ID();
71     return MY_KIND;
72   }
73
74   /// Creates a new part document if needed
75   FEATURESPLUGIN_EXPORT virtual void execute();
76
77   /// Request for initialization of data model of the feature: adding all attributes
78   FEATURESPLUGIN_EXPORT virtual void initAttributes();
79
80   /// Use plugin manager for features creation
81   FeaturesPlugin_Placement();
82 private:
83   /// Load Naming data structure of the feature to the document
84   void LoadNamingDS(GeomAlgoAPI_Placement& theFeature,
85                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
86                     std::shared_ptr<GeomAPI_Shape> theSlaveObject);
87 };
88
89 #endif