Salome HOME
Bug #1748: Naming incorrect for edges after translation
[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 #include <GeomAlgoAPI_Transform.h>
14
15 class ModelAPI_ResultBody;
16 class GeomAPI_Shape;
17
18 /**\class FeaturesPlugin_Placement
19  * \ingroup Plugins
20  * \brief Feature for applying of placement operation: relative movement of Solid.
21  *
22  * Locates the selected placement_attractable_object (face, edge, vertex) of the solid into 
23  * the selected placement_base_object. Faces must be planar, edges must be linear.
24  * Orientation of the placed solid depends on the underlied planes of both faces.
25  */
26 class FeaturesPlugin_Placement : public ModelAPI_Feature
27 {
28  public:
29   /// Placement kind
30   inline static const std::string& ID()
31   {
32     static const std::string MY_PLACEMENT_ID("Placement");
33     return MY_PLACEMENT_ID;
34   }
35
36   /// attribute name of references sketch entities list, it should contain a sketch result or
37   /// a pair a sketch result to sketch face
38   inline static const std::string& OBJECTS_LIST_ID()
39   {
40     static const std::string MY_OBJECTS_LIST_ID("placement_objects_list");
41     return MY_OBJECTS_LIST_ID;
42   }
43
44   /// attribute name of referenced object
45   inline static const std::string& START_SHAPE_ID()
46   {
47     static const std::string MY_START_SHAPE_ID("placement_start_shape");
48     return MY_START_SHAPE_ID;
49   }
50   /// attribute name of attractable face
51   inline static const std::string& END_SHAPE_ID()
52   {
53     static const std::string MY_END_SHAPE_ID("placement_end_shape");
54     return MY_END_SHAPE_ID;
55   }
56   /// attribute name of flag of reverse direction
57   inline static const std::string& REVERSE_ID()
58   {
59     static const std::string MY_REVERSE_ID("placement_reverse_direction");
60     return MY_REVERSE_ID;
61   }
62   /// attribute name of flag of centering position
63   inline static const std::string& CENTERING_ID()
64   {
65     static const std::string MY_CENTERING_ID("placement_centering");
66     return MY_CENTERING_ID;
67   }
68
69   /// Returns the kind of a feature
70   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
71   {
72     static std::string MY_KIND = FeaturesPlugin_Placement::ID();
73     return MY_KIND;
74   }
75
76   /// Creates a new part document if needed
77   FEATURESPLUGIN_EXPORT virtual void execute();
78
79   /// Request for initialization of data model of the feature: adding all attributes
80   FEATURESPLUGIN_EXPORT virtual void initAttributes();
81
82   /// Use plugin manager for features creation
83   FeaturesPlugin_Placement();
84 private:
85   /// Load Naming data structure of the feature to the document
86   void loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
87                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
88                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
89 };
90
91 #endif