]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawlineangle.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / actions / rs_actiondrawlineangle.h
1 #ifndef RS_ACTIONDRAWLINEANGLE_H
2 #define RS_ACTIONDRAWLINEANGLE_H
3
4 #include "rs_line.h"
5 #include "rs_previewactioninterface.h"
6 #include "vector.h"
7
8 /**
9  * This action class can handle user events to draw
10  * simple lines at a gien angle.
11  *
12  * @author Andrew Mustun
13  */
14 class RS_ActionDrawLineAngle: public RS_PreviewActionInterface
15 {
16         public:
17                 /**
18                  * Action States.
19                  */
20                 enum Status {
21                         SetPos,       /**< Setting the position.  */
22                         SetAngle,     /**< Setting angle in the command line. */
23                         SetLength     /**< Setting length in the command line. */
24                 };
25
26                 RS_ActionDrawLineAngle(RS_EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false);
27                 ~RS_ActionDrawLineAngle();
28
29                 virtual RS2::ActionType rtti();
30                 void reset();
31                 virtual void init(int status = 0);
32                 virtual void trigger();
33                 virtual void mouseMoveEvent(QMouseEvent * e);
34                 virtual void mouseReleaseEvent(QMouseEvent * e);
35                 void preparePreview();
36                 virtual void coordinateEvent(Vector * e);
37                 virtual void commandEvent(RS_CommandEvent * e);
38                 virtual QStringList getAvailableCommands();
39                 virtual void hideOptions();
40                 virtual void showOptions();
41                 virtual void updateMouseButtonHints();
42                 virtual void updateMouseCursor();
43                 virtual void updateToolBar();
44                 void setSnapPoint(int sp);
45                 int getSnapPoint();
46                 void setAngle(double a);
47                 double getAngle();
48                 void setLength(double l);
49                 double getLength();
50                 bool hasFixedAngle();
51
52         protected:
53                 /**
54                  * Line data defined so far.
55                  */
56                 RS_LineData data;
57                 /**
58                  * Position.
59                  */
60                 Vector pos;
61                 /**
62                  * Line angle.
63                  */
64                 double angle;
65                 /**
66                  * Line length.
67                  */
68                 double length;
69                 /**
70                  * Is the angle fixed?
71                  */
72                 bool fixedAngle;
73                 /**
74                  * Snap point (start, middle, end).
75                  */
76                 int snpPoint;
77 };
78
79 #endif
80