1 /****************************************************************************
2 **
3  * Draw ellipse by foci and a point on ellipse
4 
5 Copyright (C) 2011-2015 Dongxu Li (dongxuli2011@gmail.com)
6 Copyright (C) 2011 R. van Twisk (librecad@rvt.dds.nl)
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 **********************************************************************/
22 
23 #ifndef RS_ACTIONDRAWELLIPSECENTER3POINTS_H
24 #define RS_ACTIONDRAWELLIPSECENTER3POINTS_H
25 
26 #include "rs_previewactioninterface.h"
27 
28 /**
29  * Draw ellipse by center and 3 points on ellipse
30  *
31  * @author Dongxu Li
32  */
33 class RS_ActionDrawEllipseCenter3Points : public RS_PreviewActionInterface {
34         Q_OBJECT
35 public:
36     /**
37      * Action States.
38      */
39     enum Status {
40         SetCenter=0,   //  Setting the Center.  */
41         SetPoint1=1,   //  Setting the First Point.  */
42         SetPoint2=2,   //  Setting the Second Point.  */
43         SetPoint3=3   //  Setting the Third Point.  */
44     };
45 
46 public:
47     RS_ActionDrawEllipseCenter3Points(RS_EntityContainer& container,
48                                       RS_GraphicView& graphicView);
49 	~RS_ActionDrawEllipseCenter3Points() override;
50 
51 	void init(int status=0) override;
52 
53 	void trigger() override;
54 	bool preparePreview();
55 
56 	void mouseMoveEvent(QMouseEvent* e) override;
57 	void mouseReleaseEvent(QMouseEvent* e) override;
58 
59 		void coordinateEvent(RS_CoordinateEvent* e) override;
60 //    void commandEvent(RS_CommandEvent* e) override;
61 		QStringList getAvailableCommands() override;
62 
63 	void updateMouseButtonHints() override;
64 	void updateMouseCursor() override;
65 
66 private:
67 	struct Points;
68 	std::unique_ptr<Points> pPoints;
69 };
70 
71 #endif
72