Salome HOME
Restore old planes selection definition
[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() { return SketchPlugin_Sketch::ID(); }
28
29 public:
30   /// Constructor
31   /// \param theId the feature identifier
32   /// \param theParent the operation parent
33   PartSet_OperationSketch(const QString& theId, QObject* theParent);
34   /// Destructor
35   virtual ~PartSet_OperationSketch();
36
37   /// Returns the operation local selection mode
38   /// \param theFeature the feature object to get the selection mode
39   /// \return the selection mode
40   virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
41
42   /// Initializes the operation with previously created feature. It is used in sequental operations
43   virtual void initFeature(FeaturePtr theFeature);
44
45   /// Returns the operation sketch feature
46   /// \returns the sketch instance
47   virtual FeaturePtr sketch() const;
48
49   /// Processes the mouse pressed in the point
50   /// \param theEvent the mouse event
51   /// \param theView a viewer to have the viewer the eye position
52   /// \param theSelected the list of selected presentations
53   /// \param theHighlighted the list of highlighted presentations
54   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
55                             const std::list<ModuleBase_ViewerPrs>& theSelected,
56                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
57   /// Processes the mouse release in the point
58   /// \param theEvent the mouse event
59   /// \param theView a viewer to have the viewer the eye position
60   /// \param theSelected the list of selected presentations
61   /// \param theHighlighted the list of highlighted presentations
62   virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
63                              const std::list<ModuleBase_ViewerPrs>& theSelected,
64                              const std::list<ModuleBase_ViewerPrs>& theHighlighted);
65
66   /// Gives the current mouse point in the viewer
67   /// \param thePoint a point clicked in the viewer
68   /// \param theEvent the mouse event
69   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
70
71   /// Returns the list of the nested features
72   /// \return the list of subfeatures
73   virtual std::list<FeaturePtr> subFeatures() const;
74
75   /// Virtual method called when operation stopped - committed or aborted.
76   /// Emits a signal to hide the preview of the operation
77   virtual void stopOperation();
78
79   /// Returns whether the nested operations are enabled.
80   /// The state can depend on the operation current state.
81   /// It returns true after the sketch plane is choosen.
82   /// \return enabled state
83   virtual bool isNestedOperationsEnabled() const;
84
85   /// Returns whether the sketch plane is set
86   /// \return the boolean value whether the sketch is set
87   bool hasSketchPlane() const;
88
89   /// Set the plane to the current sketch
90   /// \param theShape the shape
91   void setSketchPlane(const TopoDS_Shape& theShape);
92
93 signals:
94   /// signal about the sketch plane is selected
95   /// \param theX the value in the X direction of the plane
96   /// \param theX the value in the Y direction value of the plane
97   /// \param theX the value in the Z direction of the plane
98   void planeSelected(double theX, double theY, double theZ);
99   // signal about the viewer fit all perform
100   void fitAllView();
101
102 protected:
103   /// Virtual method called when operation started (see start() method for more description)
104   /// Default impl calls corresponding slot and commits immediately.
105   virtual void startOperation();
106
107 private:
108   std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
109 };
110
111 #endif