1
/****************************************************************************
3
* Draw a common tangent circle of 3 existing circles
4
* Problem of Appollonius
6
Copyright (C) 2012 Dongxu Li (dongxuli2011@gmail.com)
7
Copyright (C) 2011 R. van Twisk (librecad@rvt.dds.nl)
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.
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.
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
**********************************************************************/
24
#ifndef RS_ACTIONDRAWCIRCLETAN3_H
25
#define RS_ACTIONDRAWCIRCLETAN3_H
28
#include "rs_circle.h"
29
#include "rs_previewactioninterface.h"
32
* Draw ellipse by foci and a point on ellipse
36
class RS_ActionDrawCircleTan3 : public RS_PreviewActionInterface {
43
SetCircle1, // Setting the First Circle. */
44
SetCircle2, // Setting the Second Circle. */
45
SetCircle3, // Setting the Third Circle. */
46
SetCenter // select the closest tangential Circle. */
50
RS_ActionDrawCircleTan3(RS_EntityContainer& container,
51
RS_GraphicView& graphicView);
52
~RS_ActionDrawCircleTan3();
54
static QAction* createGUIAction(RS2::ActionType type, QObject* /*parent*/);
56
virtual RS2::ActionType rtti() {
57
return RS2::ActionDrawCircleTan3;
59
virtual void init(int status=0);
61
virtual void trigger();
62
virtual bool getData();
63
virtual bool preparePreview();
65
virtual void mouseMoveEvent(QMouseEvent* e);
66
virtual void mouseReleaseEvent(QMouseEvent* e);
68
// virtual void coordinateEvent(RS_CoordinateEvent* e);
69
// virtual void commandEvent(RS_CommandEvent* e);
70
virtual QStringList getAvailableCommands();
71
virtual void finish(bool updateTB=true);
72
virtual void updateMouseButtonHints();
73
virtual void updateMouseCursor();
74
// virtual void updateToolBar();
76
// virtual void showOptions();
77
// virtual void hideOptions();
83
QVector<double> verifyCenter(const RS_Vector& center) const;
84
QVector<double> getRadii(RS_AtomicEntity* entity, const RS_Vector& center) const;
85
RS_Entity* catchCircle(QMouseEvent* e);
86
QVector<RS_AtomicEntity*> circles;
88
QVector<RS_CircleData> m_vCandidates;
91
QVector<RS2::EntityType> enTypeList;
92
//keep a list of centers found
93
QList<RS_Circle> candidates;
94
RS_VectorSolutions centers;