2015-06-05 15:43:41 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vtoolpointfromcircleandtangent.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 3 6, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-06-05 15:43:41 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-06-05 15:43:41 +02:00
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
|
|
|
#define VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QDomElement>
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QString>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
#include "../ifc/xml/vabstractpattern.h"
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../vmisc/def.h"
|
2015-06-20 08:23:04 +02:00
|
|
|
#include "vtoolsinglepoint.h"
|
2015-06-05 15:43:41 +02:00
|
|
|
|
|
|
|
class VFormula;
|
2016-08-08 13:44:49 +02:00
|
|
|
template <class T> class QSharedPointer;
|
2015-06-05 15:43:41 +02:00
|
|
|
|
2017-09-21 09:05:58 +02:00
|
|
|
struct VToolPointFromCircleAndTangentInitData : VToolSinglePointInitData
|
2017-09-18 10:37:23 +02:00
|
|
|
{
|
|
|
|
VToolPointFromCircleAndTangentInitData()
|
|
|
|
: VToolSinglePointInitData(),
|
|
|
|
circleCenterId(NULL_ID),
|
2018-04-12 12:13:19 +02:00
|
|
|
circleRadius('0'),
|
2017-09-18 10:37:23 +02:00
|
|
|
tangentPointId(NULL_ID),
|
|
|
|
crossPoint(CrossCirclesPoint::FirstPoint)
|
|
|
|
{}
|
|
|
|
|
|
|
|
quint32 circleCenterId;
|
|
|
|
QString circleRadius;
|
|
|
|
quint32 tangentPointId;
|
|
|
|
CrossCirclesPoint crossPoint;
|
|
|
|
};
|
|
|
|
|
2015-06-20 08:23:04 +02:00
|
|
|
class VToolPointFromCircleAndTangent : public VToolSinglePoint
|
2015-06-05 15:43:41 +02:00
|
|
|
{
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_OBJECT // NOLINT
|
2015-06-05 15:43:41 +02:00
|
|
|
public:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void setDialog() override;
|
2018-07-24 13:57:41 +02:00
|
|
|
static VToolPointFromCircleAndTangent *Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene,
|
2017-04-15 16:39:59 +02:00
|
|
|
VAbstractPattern *doc, VContainer *data);
|
2017-09-18 10:37:23 +02:00
|
|
|
static VToolPointFromCircleAndTangent *Create(VToolPointFromCircleAndTangentInitData &initData);
|
2018-06-07 13:37:43 +02:00
|
|
|
static bool FindPoint(const QPointF &p, const QPointF ¢er, qreal radius, const CrossCirclesPoint crossPoint,
|
|
|
|
QPointF *intersectionPoint);
|
2015-06-05 15:43:41 +02:00
|
|
|
static const QString ToolType;
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual int type() const override {return Type;}
|
2015-06-05 15:43:41 +02:00
|
|
|
enum { Type = UserType + static_cast<int>(Tool::PointFromCircleAndTangent) };
|
|
|
|
|
2017-03-19 16:13:02 +01:00
|
|
|
QString TangentPointName() const;
|
|
|
|
QString CircleCenterPointName() const;
|
|
|
|
|
2015-06-05 15:43:41 +02:00
|
|
|
VFormula GetCircleRadius() const;
|
|
|
|
void SetCircleRadius(const VFormula &value);
|
|
|
|
|
|
|
|
CrossCirclesPoint GetCrossCirclesPoint() const;
|
2015-10-28 15:22:36 +01:00
|
|
|
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
|
2015-06-05 15:43:41 +02:00
|
|
|
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void ShowVisualization(bool show) override;
|
2017-09-15 16:32:23 +02:00
|
|
|
protected slots:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) override;
|
2015-06-05 15:43:41 +02:00
|
|
|
protected:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void RemoveReferens() override;
|
2017-10-17 18:35:39 +02:00
|
|
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
2018-06-26 14:53:48 +02:00
|
|
|
QList<quint32> &newDependencies) override;
|
|
|
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
|
|
|
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
|
|
|
virtual void SetVisualization() override;
|
2015-06-05 15:43:41 +02:00
|
|
|
private:
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(VToolPointFromCircleAndTangent) // NOLINT
|
2015-06-05 15:43:41 +02:00
|
|
|
|
|
|
|
quint32 circleCenterId;
|
|
|
|
quint32 tangentPointId;
|
|
|
|
QString circleRadius;
|
|
|
|
CrossCirclesPoint crossPoint;
|
2016-05-14 21:54:57 +02:00
|
|
|
|
2017-09-18 10:37:23 +02:00
|
|
|
VToolPointFromCircleAndTangent(const VToolPointFromCircleAndTangentInitData &initData,
|
|
|
|
QGraphicsItem *parent = nullptr);
|
2015-06-05 15:43:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTOOLPOINTFROMCIRCLEANDTANGENT_H
|