1 // File: PartSet_OperationConstraint.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationConstraint_H
6 #define PartSet_OperationConstraint_H
10 #include <PartSet_OperationSketchBase.h>
12 #include <SketchPlugin_ConstraintLength.h>
17 \class PartSet_OperationConstraint
18 * \brief The operation for the sketch constraint feature creation
20 class PARTSET_EXPORT PartSet_OperationConstraint : public PartSet_OperationSketchBase
25 /// Returns the operation type key
26 static std::string Type() { return SKETCH_CONSTRAINT_LENGTH_KIND; }
30 /// \param theId the feature identifier
31 /// \param theParent the operation parent
32 /// \param theFeature the parent feature
33 PartSet_OperationConstraint(const QString& theId, QObject* theParent,
34 FeaturePtr theSketchFeature);
36 virtual ~PartSet_OperationConstraint();
38 /// Returns that this operator can be started above already running one.
39 /// The runned operation should be the sketch feature modified operation
40 /// \param theOperation the previous running operation
41 virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
43 /// Initializes some fields accorging to the feature
44 /// \param theSelected the list of selected presentations
45 /// \param theHighlighted the list of highlighted presentations
46 virtual void init(FeaturePtr theFeature,
47 const std::list<XGUI_ViewerPrs>& theSelected,
48 const std::list<XGUI_ViewerPrs>& theHighlighted);
50 /// Returns the operation sketch feature
51 /// \returns the sketch instance
52 virtual FeaturePtr sketch() const;
54 /// Gives the current selected objects to be processed by the operation
55 /// \param theEvent the mouse event
56 /// \param theView a viewer to have the viewer the eye position
57 /// \param theSelected the list of selected presentations
58 /// \param theHighlighted the list of highlighted presentations
59 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
60 const std::list<XGUI_ViewerPrs>& theSelected,
61 const std::list<XGUI_ViewerPrs>& theHighlighted);
62 /// Gives the current mouse point in the viewer
63 /// \param thePoint a point clicked in the viewer
64 /// \param theEvent the mouse event
65 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
68 /// \brief Virtual method called when operation is started
69 /// Virtual method called when operation started (see start() method for more description)
70 /// After the parent operation body perform, set sketch feature to the created line feature
71 virtual void startOperation();
73 /// Virtual method called when operation aborted (see abort() method for more description)
74 /// Before the feature is aborted, it should be hidden from the viewer
75 virtual void abortOperation();
77 /// Virtual method called when operation stopped - committed or aborted.
78 /// Restore the multi selection state
79 virtual void stopOperation();
81 /// Virtual method called after operation committed (see commit() method for more description)
82 virtual void afterCommitOperation();
84 /// Creates an operation new feature
85 /// In addition to the default realization it appends the created line feature to
86 /// the sketch feature
87 /// \param theFlushMessage the flag whether the create message should be flushed
88 /// \returns the created feature
89 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
91 /// Set the feature for the constraint
92 /// \param theFeature the line feature
93 void setFeature(FeaturePtr theFeature);
95 /// Set the value for the constraint
96 /// \param theValue the constraint value
97 void setValue(const double theValue);
100 FeaturePtr mySketch; ///< the sketch feature