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