1 
2 /****************************************************************************
3 **
4  * This action class can handle user events to draw tangents normal to lines
5 
6 Copyright (C) 2011 Dongxu Li (dongxuli2011@gmail.com)
7 Copyright (C) 2011 R. van Twisk (librecad@rvt.dds.nl)
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 **********************************************************************/
23 
24 #ifndef RS_ACTIONDRAWLINEORTHTAN_H
25 #define RS_ACTIONDRAWLINEORTHTAN_H
26 
27 #include "rs_previewactioninterface.h"
28 
29 class RS_Line;
30 
31 /**
32  * This action class can handle user events to draw tangents normal to lines
33  *
34  * @author Dongxu Li
35  */
36 class RS_ActionDrawLineOrthTan : public RS_PreviewActionInterface {
37         Q_OBJECT
38 private:
39     enum Status {
40         SetLine,     /**< Choose the line orthogonal to the tangent line */
41 		SetCircle    /**< Choose the arc/circle/ellipse to create its tangent line*/
42     };
43 
44 public:
45     RS_ActionDrawLineOrthTan(RS_EntityContainer& container,
46                              RS_GraphicView& graphicView);
47 
48 	void trigger() override;
49 	void finish(bool updateTB = true) override;
50 
51 	void mouseMoveEvent(QMouseEvent* e) override;
52 	void mouseReleaseEvent(QMouseEvent* e) override;
53 
54 	void updateMouseButtonHints() override;
55 	void updateMouseCursor() override;
56 
57 private:
58 	void clearLines();
59     /** normal to tangent. */
60     RS_Line* normal; // the select normal line
61     /** tangent. */
62     RS_Line* tangent; //holds the tangent line for preview
63     /** arc/circle/ellipse to generate tangent */
64     RS_Entity* circle;
65 };
66 
67 #endif
68