Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Axis.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ConstructionPlugin_Axis.h
4 // Created:     12 Dec 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ConstructionPlugin_Axis_H
8 #define ConstructionPlugin_Axis_H
9
10 #include "ConstructionPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13 #include <GeomAPI_ICustomPrs.h>
14
15 /**\class ConstructionPlugin_Axis
16  * \ingroup Plugins
17  * \brief Feature for creation of the new axis in PartSet.
18  */
19 class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs
20 {
21  public:
22   /// Returns the kind of a feature
23   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
24   {
25     static std::string MY_KIND = ConstructionPlugin_Axis::ID();
26     return MY_KIND;
27   }
28
29   /// Axis kind
30   inline static const std::string& ID()
31   {
32     static const std::string CONSTRUCTION_AXIS_KIND("Axis");
33     return CONSTRUCTION_AXIS_KIND;
34   }
35
36   /// attribute name for first point
37   inline static const std::string& METHOD()
38   {
39     static const std::string METHOD_ATTR("CreationMethod");
40     return METHOD_ATTR;
41   }
42   /// attribute name for first point
43   inline static const std::string& POINT_FIRST()
44   {
45     static const std::string POINT_ATTR_FIRST("FirstPoint");
46     return POINT_ATTR_FIRST;
47   }
48   /// attribute name for second point
49   inline static const std::string& POINT_SECOND()
50   {
51     static const std::string POINT_ATTR_SECOND("SecondPoint");
52     return POINT_ATTR_SECOND;
53   }
54   /// attribute name for second point
55   inline static const std::string& CYLINDRICAL_FACE()
56   {
57     static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
58     return CYLINDRICAL_FACE_ATTR;
59   }
60
61   inline static const double MINIMAL_LENGTH() { return 1.e-5; }
62
63   /// Creates a new part document if needed
64   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
65
66   /// Request for initialization of data model of the feature: adding all attributes
67   CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
68
69   /// Construction result is allways recomuted on the fly
70   CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
71
72   /// Use plugin manager for features creation
73   ConstructionPlugin_Axis();
74
75   /// Customize presentation of the feature
76   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
77                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
78
79  protected:
80   void createAxisByTwoPoints();
81 };
82
83
84 #endif