]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawlinerelangle.h
6908afad7402809b4a8c8319c93a2ca9f447578c
[architektonas] / src / actions / rs_actiondrawlinerelangle.h
1 #ifndef RS_ACTIONDRAWLINERELANGLE_H
2 #define RS_ACTIONDRAWLINERELANGLE_H
3
4 #include "rs_line.h"
5 #include "rs_previewactioninterface.h"
6 #include "vector.h"
7
8 class RS_Entity;
9
10 /**
11  * This action class can handle user events to draw lines with a given angle
12  * to a given entity.
13  *
14  * @author Andrew Mustun
15  */
16 class RS_ActionDrawLineRelAngle: public RS_PreviewActionInterface
17 {
18         private:
19                 enum Status {
20                         SetEntity,     /**< Choose entity. */
21                         SetPos,        /**< Choose position. */
22                         SetAngle,      /**< Set angle in console. */
23                         SetLength      /**< Set length in console. */
24                 };
25
26         public:
27                 RS_ActionDrawLineRelAngle(RS_EntityContainer & container, RS_GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false);
28                 ~RS_ActionDrawLineRelAngle();
29
30                 virtual RS2::ActionType rtti();
31                 virtual void trigger();
32                 virtual void mouseMoveEvent(QMouseEvent * e);
33                 virtual void mouseReleaseEvent(QMouseEvent * e);
34                 virtual void coordinateEvent(Vector * e);
35                 virtual void commandEvent(RS_CommandEvent * e);
36                 virtual QStringList getAvailableCommands();
37                 virtual void hideOptions();
38                 virtual void showOptions();
39                 virtual void updateMouseButtonHints();
40                 virtual void updateMouseCursor();
41                 virtual void updateToolBar();
42                 void setAngle(double a);
43                 double getAngle();
44                 void setLength(double l);
45                 double getLength();
46                 bool hasFixedAngle();
47
48         private:
49                 /** Chosen entity */
50                 RS_Entity * entity;
51                 /** Chosen position */
52                 Vector pos;
53                 /** Data of new line */
54                 RS_LineData data;
55                 /**
56                  * Line angle.
57                  */
58                 double angle;
59                 /**
60                  * Line length.
61                  */
62                 double length;
63                 /**
64                  * Is the angle fixed?
65                  */
66                 bool fixedAngle;
67 };
68
69 #endif