]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawlinebisector.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / actions / rs_actiondrawlinebisector.h
1 #ifndef RS_ACTIONDRAWLINEBISECTOR_H
2 #define RS_ACTIONDRAWLINEBISECTOR_H
3
4 #include "rs_line.h"
5 #include "rs_previewactioninterface.h"
6 #include "vector.h"
7
8 class RS_Line;
9
10 /**
11  * This action class can handle user events to draw bisectors.
12  *
13  * @author Andrew Mustun
14  */
15 class RS_ActionDrawLineBisector: public RS_PreviewActionInterface
16 {
17         private:
18                 enum Status {
19                         SetLine1,     /**< Choose the 1st line. */
20                         SetLine2,     /**< Choose the 2nd line. */
21                         SetLength,    /**< Set length in command line. */
22                         SetNumber     /**< Set number in command line. */
23                 };
24
25         public:
26                 RS_ActionDrawLineBisector(RS_EntityContainer & container, GraphicView & graphicView);
27                 ~RS_ActionDrawLineBisector();
28
29                 virtual RS2::ActionType rtti();
30                 virtual void trigger();
31                 virtual void mouseMoveEvent(QMouseEvent * e);
32                 virtual void mouseReleaseEvent(QMouseEvent * e);
33                 virtual void commandEvent(RS_CommandEvent * e);
34                 virtual QStringList getAvailableCommands();
35                 virtual void hideOptions();
36                 virtual void showOptions();
37                 virtual void updateMouseButtonHints();
38                 virtual void updateMouseCursor();
39                 virtual void updateToolBar();
40                 void setLength(double l);
41                 double getLength();
42                 void setNumber(int n);
43                 int getNumber();
44
45         private:
46                 /** Closest bisector. */
47                 RS_Line * bisector;
48                 /** First chosen entity */
49                 RS_Line * line1;
50                 /** Second chosen entity */
51                 RS_Line * line2;
52                 /** Data of new bisector */
53                 RS_LineData data;
54                 /** Length of the bisector. */
55                 double length;
56                 /** Number of bisectors to create. */
57                 int number;
58                 /** Mouse pos when choosing the 1st line */
59                 Vector coord1;
60                 /** Mouse pos when choosing the 2nd line */
61                 Vector coord2;
62                 /** Last status before entering length or number. */
63                 Status lastStatus;
64 };
65
66 #endif