]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Projection.h
Salome HOME
b9ae2611f049a1269254581afb075e1c52ef105b
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Projection.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_Projection.h
4 // Created: 20 April 2016
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchPlugin_Projection_H_
8 #define SketchPlugin_Projection_H_
9
10 #include "SketchPlugin_SketchEntity.h"
11
12 /** \class SketchPlugin_Projection
13  *  \ingroup Plugins
14  *  \brief Feature for creation of external feature as a projection onto the sketch plane.
15  */
16 class SketchPlugin_Projection : public SketchPlugin_SketchEntity
17 {
18 public:
19   /// Projection feature kind
20   inline static const std::string& ID()
21   {
22     static const std::string MY_PROJECTION_ID("SketchProjection");
23     return MY_PROJECTION_ID;
24   }
25   /// Returns the kind of a feature
26   virtual const std::string& getKind()
27   {
28     static std::string MY_KIND = SketchPlugin_Projection::ID();
29     return MY_KIND;
30   }
31
32   static const std::string& EXTERNAL_FEATURE_ID()
33   {
34     static std::string MY_EXT_FEATURE_ID("ExternalFeature");
35     return MY_EXT_FEATURE_ID;
36   }
37
38   static const std::string& PROJECTED_FEATURE_ID()
39   {
40     static std::string MY_PROJ_FEATURE_ID("ProjectedFeature");
41     return MY_PROJ_FEATURE_ID;
42   }
43
44   /// Returns true because projected feature is always external
45   virtual bool isFixed()
46   { return true; }
47
48   /// Returns true if object must be displayed in the viewer
49   virtual bool isDisplayed()
50   { return false; }
51
52   /// Creates a new part document if needed
53   SKETCHPLUGIN_EXPORT virtual void execute();
54
55   /// Moves the feature
56   /// \param theDeltaX the delta for X coordinate is moved
57   /// \param theDeltaY the delta for Y coordinate is moved
58   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
59
60   /// Called on change of any argument-attribute of this object: for external point
61   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
62
63   /// Use plugin manager for features creation
64   SketchPlugin_Projection();
65
66 protected:
67   /// \brief Initializes attributes of derived class.
68   virtual void initDerivedClassAttributes();
69
70 private:
71   /// \brief Find projection of a feature onto sketch plane
72   void computeProjection(const std::string& theID);
73
74   bool myIsComputing;
75 };
76
77 #endif