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