1 /**************************************************************************** 2 ** 3 * Draw ellipse by foci and a point on ellipse 4 5 Copyright (C) 2011 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_ACTIONDRAWELLIPSE4POINTS_H 24 #define RS_ACTIONDRAWELLIPSE4POINTS_H 25 26 #include "rs_previewactioninterface.h" 27 28 struct RS_CircleData; 29 struct RS_EllipseData; 30 31 /** 32 * Draw ellipse in XY direction by 4 points on ellipse 33 * 34 * @author Dongxu Li 35 */ 36 class RS_ActionDrawEllipse4Points : public RS_PreviewActionInterface { 37 Q_OBJECT 38 public: 39 /** 40 * Action States. 41 */ 42 enum Status { 43 SetPoint1, // Setting the First Point. */ 44 SetPoint2, // Setting the Second Point. */ 45 SetPoint3, // Setting the Third Point. */ 46 SetPoint4 // Setting the Last Point. */ 47 }; 48 49 public: 50 RS_ActionDrawEllipse4Points(RS_EntityContainer& container, 51 RS_GraphicView& graphicView); 52 ~RS_ActionDrawEllipse4Points() override; 53 54 void init(int status=0) override; 55 56 void trigger() override; 57 bool preparePreview(); 58 59 void mouseMoveEvent(QMouseEvent* e) override; 60 void mouseReleaseEvent(QMouseEvent* e) override; 61 62 void coordinateEvent(RS_CoordinateEvent* e) override; 63 // void commandEvent(RS_CommandEvent* e) override; 64 QStringList getAvailableCommands() override; 65 66 void updateMouseButtonHints() override; 67 void updateMouseCursor() override; 68 69 protected: 70 // 4 points on ellipse 71 struct Points; 72 std::unique_ptr<Points> pPoints; 73 }; 74 75 #endif 76