]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationConstraint.h
Salome HOME
It replaces using of direct value "SketchLine" to SKETCH_LINE_KIND, which is defined...
[modules/shaper.git] / src / PartSet / PartSet_OperationConstraint.h
1 // File:        PartSet_OperationConstraint.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_OperationConstraint_H
6 #define PartSet_OperationConstraint_H
7
8 #include "PartSet.h"
9
10 #include <PartSet_OperationSketchBase.h>
11 #include <QObject>
12
13 /*!
14  \class PartSet_OperationConstraint
15  * \brief The operation for the sketch constraint feature creation
16 */
17 class PARTSET_EXPORT PartSet_OperationConstraint : public PartSet_OperationSketchBase
18 {
19   Q_OBJECT
20
21 public:
22   /// Returns the operation type key
23   static std::string Type() { return "SketchConstraintLength"; }
24
25 public:
26   /// Constructor
27   /// \param theId the feature identifier
28   /// \param theParent the operation parent
29   /// \param theFeature the parent feature
30   PartSet_OperationConstraint(const QString& theId, QObject* theParent,
31                               boost::shared_ptr<ModelAPI_Feature> theSketchFeature);
32   /// Destructor
33   virtual ~PartSet_OperationConstraint();
34
35   /// Returns that this operator can be started above already running one.
36    /// The runned operation should be the sketch feature modified operation
37   /// \param theOperation the previous running operation
38   virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
39
40   /// Initializes some fields accorging to the feature
41   /// \param theSelected the list of selected presentations
42   /// \param theHighlighted the list of highlighted presentations
43   virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
44                     const std::list<XGUI_ViewerPrs>& theSelected,
45                     const std::list<XGUI_ViewerPrs>& theHighlighted);
46
47   /// Returns the operation sketch feature
48   /// \returns the sketch instance
49   virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
50
51   /// Gives the current selected objects to be processed by the operation
52   /// \param theEvent the mouse event
53   /// \param theView a viewer to have the viewer the eye position
54   /// \param theSelected the list of selected presentations
55   /// \param theHighlighted the list of highlighted presentations
56  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
57                             const std::list<XGUI_ViewerPrs>& theSelected,
58                             const std::list<XGUI_ViewerPrs>& theHighlighted);
59   /// Gives the current mouse point in the viewer
60   /// \param thePoint a point clicked in the viewer
61   /// \param theEvent the mouse event
62   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
63
64 protected:
65   /// \brief Virtual method called when operation is started
66   /// Virtual method called when operation started (see start() method for more description)
67   /// After the parent operation body perform, set sketch feature to the created line feature
68   virtual void startOperation();
69
70   /// Virtual method called when operation aborted (see abort() method for more description)
71   /// Before the feature is aborted, it should be hidden from the viewer
72   virtual void abortOperation();
73
74   /// Virtual method called when operation stopped - committed or aborted.
75   /// Restore the multi selection state
76   virtual void stopOperation();
77
78   /// Virtual method called after operation committed (see commit() method for more description)
79   virtual void afterCommitOperation();
80
81   /// Creates an operation new feature
82   /// In addition to the default realization it appends the created line feature to
83   /// the sketch feature
84   /// \param theFlushMessage the flag whether the create message should be flushed
85   /// \returns the created feature
86   virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
87
88   /// Set the feature for the constraint
89   /// \param theFeature the line feature
90   void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
91
92   /// Set the value for the constraint
93   /// \param theValue the constraint value
94   void setValue(const double theValue);
95
96 private:
97   boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
98 };
99
100 #endif