]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationSketch.h
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
[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 SKETCH_KIND; }
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(FeaturePtr theFeature) const;
41
42   /// Initializes some fields accorging to the feature
43   /// \param theSelected the list of selected presentations
44   /// \param theHighlighted the list of highlighted presentations
45   virtual void init(FeaturePtr theFeature,
46                     const std::list<XGUI_ViewerPrs>& theSelected,
47                     const std::list<XGUI_ViewerPrs>& theHighlighted);
48
49   /// Returns the operation sketch feature
50   /// \returns the sketch instance
51   virtual FeaturePtr sketch() const;
52
53   /// Processes the mouse pressed in the point
54   /// \param theEvent the mouse event
55   /// \param theView a viewer to have the viewer the eye position
56   /// \param theSelected the list of selected presentations
57   /// \param theHighlighted the list of highlighted presentations
58   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
59                             const std::list<XGUI_ViewerPrs>& theSelected,
60                             const std::list<XGUI_ViewerPrs>& theHighlighted);
61   /// Processes the mouse release in the point
62   /// \param theEvent the mouse event
63   /// \param theView a viewer to have the viewer the eye position
64   /// \param theSelected the list of selected presentations
65   /// \param theHighlighted the list of highlighted presentations
66   virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
67                              const std::list<XGUI_ViewerPrs>& theSelected,
68                              const std::list<XGUI_ViewerPrs>& theHighlighted);
69
70   /// Gives the current mouse point in the viewer
71   /// \param thePoint a point clicked in the viewer
72   /// \param theEvent the mouse event
73   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
74
75   /// Processes the mouse double click in the point
76   /// \param theEvent the mouse event
77   /// \param theView a viewer to have the viewer the eye position
78   /// \param theSelected the list of selected presentations
79   /// \param theHighlighted the list of highlighted presentations
80   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
81                                 const std::list<XGUI_ViewerPrs>& theSelected,
82                                 const std::list<XGUI_ViewerPrs>& theHighlighted);
83
84   /// Returns the map of the operation previews including the nested feature previews
85   /// \return the map of feature to the feature preview
86   virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
87                                                                            subPreview() const;
88
89   /// Virtual method called when operation stopped - committed or aborted.
90   /// Emits a signal to hide the preview of the operation
91   virtual void stopOperation();
92
93   /// Returns whether the nested operations are enabled.
94   /// The state can depend on the operation current state.
95   /// It returns true after the sketch plane is choosen.
96   /// \return enabled state
97   virtual bool isNestedOperationsEnabled() const;
98
99 signals:
100   /// signal about the sketch plane is selected
101   /// \param theX the value in the X direction of the plane
102   /// \param theX the value in the Y direction value of the plane
103   /// \param theX the value in the Z direction of the plane
104   void planeSelected(double theX, double theY, double theZ);
105   // signal about the viewer fit all perform
106   void fitAllView();
107
108 protected:
109   /// Virtual method called when operation started (see start() method for more description)
110   /// Default impl calls corresponding slot and commits immediately.
111   virtual void startOperation();
112
113   /// Returns whether the sketch plane is set
114   /// \return the boolean value whether the sketch is set
115   bool hasSketchPlane() const;
116
117   /// Set the plane to the current sketch
118   /// \param theShape the shape
119   void setSketchPlane(const TopoDS_Shape& theShape);
120
121 private:
122   std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
123 };
124
125 #endif