1 // File: PartSet_OperationEditLine.h
2 // Created: 05 May 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationEditLine_H
6 #define PartSet_OperationEditLine_H
10 #include <PartSet_OperationSketchBase.h>
16 \class PartSet_OperationEditLine
17 * \brief The operation for the sketch feature creation
19 class PARTSET_EXPORT PartSet_OperationEditLine : public PartSet_OperationSketchBase
23 /// Returns the operation type key
24 static std::string Type() { return "EditLine"; }
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);
34 virtual ~PartSet_OperationEditLine();
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;
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;
45 /// Initializes some fields accorging to the feature
46 /// \param theFeature the feature
47 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature);
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(const gp_Pnt& thePoint, QMouseEvent* theEvent);
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(const gp_Pnt& thePoint, QMouseEvent* theEvent);
58 /// Gives the current selected objects to be processed by the operation
59 /// \param theFeature the selected feature
60 /// \param theShape the selected shape
61 virtual void setSelected(boost::shared_ptr<ModelAPI_Feature> theFeature,
62 const TopoDS_Shape& theShape);
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();
70 /// Creates an operation new feature
71 /// Returns NULL feature. This is an operation of edition, not creation.
72 /// \returns the created feature
73 virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
76 /// \brief Save the point to the line.
77 /// \param theDeltaX the delta for X coordinate is moved
78 /// \param theDeltaY the delta for Y coordinate is moved
79 /// \param theAttribute the start or end attribute of the line
80 void moveLinePoint(double theDeltaX, double theDeltaY,
81 const std::string& theAttribute);
84 boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
85 gp_Pnt myCurPressed; ///< the current 3D point clicked or moved