]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationSketch.h
Salome HOME
Sources formated according to the codeing standards
[modules/shaper.git] / src / PartSet / PartSet_OperationSketch.h
1 // File:        PartSet_OperationSketch.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_OperationSketch_H
6 #define PartSet_OperationSketch_H
7
8 #include "PartSet.h"
9
10 #include <PartSet_OperationSketchBase.h>
11
12 #include <SketchPlugin_Sketch.h>
13
14 #include <QObject>
15
16 class Handle_AIS_InteractiveObject;
17
18 /*!
19  \class PartSet_OperationSketch
20  * \brief The operation for the sketch feature creation
21  */
22 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
23 {
24 Q_OBJECT
25  public:
26   /// Returns the operation type key
27   static std::string Type()
28   {
29     return SketchPlugin_Sketch::ID();
30   }
31
32  public:
33   /// Constructor
34   /// \param theId the feature identifier
35   /// \param theParent the operation parent
36   PartSet_OperationSketch(const QString& theId, QObject* theParent);
37   /// Destructor
38   virtual ~PartSet_OperationSketch();
39
40   /// Returns the operation local selection mode
41   /// \param theFeature the feature object to get the selection mode
42   /// \return the selection mode
43   virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
44
45   /// Initializes the operation with previously created feature. It is used in sequental operations
46   virtual void initFeature(FeaturePtr theFeature);
47
48   /// Returns the operation sketch feature
49   /// \returns the sketch instance
50   virtual FeaturePtr sketch() const;
51
52   /// Processes the mouse pressed in the point
53   /// \param theEvent the mouse event
54   /// \param theView a viewer to have the viewer the eye position
55   /// \param theSelected the list of selected presentations
56   /// \param theHighlighted the list of highlighted presentations
57   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
58                             const std::list<ModuleBase_ViewerPrs>& theSelected,
59                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
60   /// Processes the mouse release in the point
61   /// \param theEvent the mouse event
62   /// \param theView a viewer to have the viewer the eye position
63   /// \param theSelected the list of selected presentations
64   /// \param theHighlighted the list of highlighted presentations
65   virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
66                              const std::list<ModuleBase_ViewerPrs>& theSelected,
67                              const std::list<ModuleBase_ViewerPrs>& theHighlighted);
68
69   /// Gives the current mouse point in the viewer
70   /// \param thePoint a point clicked in the viewer
71   /// \param theEvent the mouse event
72   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
73
74   /// Returns the list of the nested features
75   /// \return the list of subfeatures
76   virtual std::list<FeaturePtr> subFeatures() const;
77
78   /// Virtual method called when operation stopped - committed or aborted.
79   /// Emits a signal to hide the preview of the operation
80   virtual void stopOperation();
81
82   /// Returns whether the nested operations are enabled.
83   /// The state can depend on the operation current state.
84   /// It returns true after the sketch plane is choosen.
85   /// \return enabled state
86   virtual bool isNestedOperationsEnabled() const;
87
88   /// Returns whether the sketch plane is set
89   /// \return the boolean value whether the sketch is set
90   bool hasSketchPlane() const;
91
92   /// Set the plane to the current sketch
93   /// \param theShape the shape
94   void setSketchPlane(const TopoDS_Shape& theShape);
95
96 signals:
97   /// signal about the sketch plane is selected
98   /// \param theX the value in the X direction of the plane
99   /// \param theX the value in the Y direction value of the plane
100   /// \param theX the value in the Z direction of the plane
101   void planeSelected(double theX, double theY, double theZ);
102   // signal about the viewer fit all perform
103   void fitAllView();
104
105  protected:
106   /// Virtual method called when operation started (see start() method for more description)
107   /// Default impl calls corresponding slot and commits immediately.
108   virtual void startOperation();
109
110  private:
111   std::list<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
112 };
113
114 #endif