Salome HOME
Simplification and refactoring of unit tests for SketchPlugin
[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 the feature and the feature results can be displayed.
49   /// \return false
50   SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const
51   {
52     return false;
53   }
54
55   /// Creates a new part document if needed
56   SKETCHPLUGIN_EXPORT virtual void execute();
57
58   /// Moves the feature
59   /// \param theDeltaX the delta for X coordinate is moved
60   /// \param theDeltaY the delta for Y coordinate is moved
61   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
62
63   /// Called on change of any argument-attribute of this object: for external point
64   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
65
66   /// Use plugin manager for features creation
67   SketchPlugin_Projection();
68
69 protected:
70   /// \brief Initializes attributes of derived class.
71   virtual void initDerivedClassAttributes();
72
73 private:
74   /// \brief Find projection of a feature onto sketch plane
75   void computeProjection(const std::string& theID);
76
77   bool myIsComputing;
78 };
79
80 #endif