]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationEditLine.h
Salome HOME
Merge remote-tracking branch 'remotes/origin/SolveSpace'
[modules/shaper.git] / src / PartSet / PartSet_OperationEditLine.h
1 // File:        PartSet_OperationEditLine.h
2 // Created:     05 May 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_OperationEditLine_H
6 #define PartSet_OperationEditLine_H
7
8 #include "PartSet.h"
9
10 #include <PartSet_OperationSketchBase.h>
11 #include <QObject>
12
13 class QMouseEvent;
14
15 /*!
16  \class PartSet_OperationEditLine
17  * \brief The operation for the sketch feature creation
18 */
19 class PARTSET_EXPORT PartSet_OperationEditLine : public PartSet_OperationSketchBase
20 {
21   Q_OBJECT
22 public:
23   /// Returns the operation type key
24   static std::string Type() { return "EditLine"; }
25
26 public:
27   /// Constructor
28   /// \param theId the feature identifier
29   /// \param theParent the operation parent
30   /// \param theFeature the parent feature
31   PartSet_OperationEditLine(const QString& theId, QObject* theParent,
32                             boost::shared_ptr<ModelAPI_Feature> theFeature);
33   /// Destructor
34   virtual ~PartSet_OperationEditLine();
35
36    /// Returns that this operator can be started above already running one.
37    /// The runned operation should be the sketch feature modified operation
38   virtual bool isGranted() const;
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(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
44
45   /// Initializes some fields accorging to the feature
46   /// \param theFeature the feature
47   virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature);
48
49   /// Processes the mouse pressed in the point
50   /// \param thePoint a point clicked in the viewer
51   /// \param theEvent the mouse event
52   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView);
53   /// Gives the current mouse point in the viewer
54   /// \param thePoint a point clicked in the viewer
55   /// \param theEvent the mouse event
56   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
57   /// Gives the current selected objects to be processed by the operation
58   /// \param thePoint a point clicked in the viewer
59   /// \param theEvent the mouse event
60   /// \param theSelected the list of selected presentations
61  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
62                              const std::list<XGUI_ViewerPrs>& theSelected);
63 protected:
64   /// \brief Virtual method called when operation is started
65   /// Virtual method called when operation started (see start() method for more description)
66   /// Switch off the multi selection state
67   virtual void startOperation();
68
69   /// Virtual method called when operation stopped - committed or aborted.
70   /// Restore the multi selection state
71   virtual void stopOperation();
72
73   /// Creates an operation new feature
74   /// Returns NULL feature. This is an operation of edition, not creation.
75   /// \returns the created feature
76   virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
77
78 protected:
79   /// \brief Save the point to the line.
80   /// \param theDeltaX the delta for X coordinate is moved
81   /// \param theDeltaY the delta for Y coordinate is moved
82   /// \param theAttribute the start or end attribute of the line
83   void  moveLinePoint(double theDeltaX, double theDeltaY,
84                       const std::string& theAttribute);
85
86 private:
87   boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
88   gp_Pnt myCurPressed; ///< the current 3D point clicked or moved
89 };
90
91 #endif