Resolved issue #209. New tool point from circle and tangent.
--HG-- branch : develop
This commit is contained in:
parent
9041ebc2cf
commit
a327bc4985
|
@ -53,6 +53,7 @@
|
|||
#include "tools/dialogcurveintersectaxis.h"
|
||||
#include "tools/dialogpointofintersectionarcs.h"
|
||||
#include "tools/dialogpointofintersectioncircles.h"
|
||||
#include "tools/dialogpointfromcircleandtangent.h"
|
||||
|
||||
#include "app/dialoghistory.h"
|
||||
#include "app/dialogincrements.h"
|
||||
|
|
|
@ -46,7 +46,8 @@ HEADERS += \
|
|||
$$PWD/app/dialoglayoutprogress.h \
|
||||
$$PWD/app/dialogsavelayout.h \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.h \
|
||||
$$PWD/tools/dialogpointofintersectioncircles.h
|
||||
$$PWD/tools/dialogpointofintersectioncircles.h \
|
||||
$$PWD/tools/dialogpointfromcircleandtangent.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/tools/dialogtriangle.cpp \
|
||||
|
@ -91,7 +92,8 @@ SOURCES += \
|
|||
$$PWD/app/dialoglayoutprogress.cpp \
|
||||
$$PWD/app/dialogsavelayout.cpp \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.cpp \
|
||||
$$PWD/tools/dialogpointofintersectioncircles.cpp
|
||||
$$PWD/tools/dialogpointofintersectioncircles.cpp \
|
||||
$$PWD/tools/dialogpointfromcircleandtangent.cpp
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tools/dialogtriangle.ui \
|
||||
|
@ -130,4 +132,5 @@ FORMS += \
|
|||
$$PWD/app/dialoglayoutprogress.ui \
|
||||
$$PWD/app/dialogsavelayout.ui \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.ui \
|
||||
$$PWD/tools/dialogpointofintersectioncircles.ui
|
||||
$$PWD/tools/dialogpointofintersectioncircles.ui \
|
||||
$$PWD/tools/dialogpointfromcircleandtangent.ui
|
||||
|
|
317
src/app/dialogs/tools/dialogpointfromcircleandtangent.cpp
Normal file
317
src/app/dialogs/tools/dialogpointfromcircleandtangent.cpp
Normal file
|
@ -0,0 +1,317 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpointfromcircleandtangent.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 3 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "dialogpointfromcircleandtangent.h"
|
||||
#include "ui_dialogpointfromcircleandtangent.h"
|
||||
|
||||
#include "../../libs/vgeometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../visualization/vistoolpointfromcircleandtangent.h"
|
||||
#include "../../widgets/vmaingraphicsscene.h"
|
||||
#include "dialogeditwrongformula.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContainer *data, const quint32 &toolId,
|
||||
QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointFromCircleAndTangent), flagCircleRadius(false),
|
||||
timerCircleRadius(nullptr), circleRadius(), formulaBaseHeightCircleRadius(0), angleCircleRadius(INT_MIN)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
plainTextEditFormula = ui->plainTextEditRadius;
|
||||
this->formulaBaseHeightCircleRadius = ui->plainTextEditRadius->height();
|
||||
|
||||
ui->plainTextEditRadius->installEventFilter(this);
|
||||
|
||||
timerCircleRadius = new QTimer(this);
|
||||
connect(timerCircleRadius, &QTimer::timeout, this, &DialogPointFromCircleAndTangent::EvalCircleRadius);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
CheckState();
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxCircleCenter);
|
||||
FillComboBoxPoints(ui->comboBoxTangentPoint);
|
||||
FillComboBoxCrossCirclesPoints(ui->comboBoxResult);
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointFromCircleAndTangent::NamePointChanged);
|
||||
connect(ui->comboBoxCircleCenter,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPointFromCircleAndTangent::PointChanged);
|
||||
|
||||
connect(ui->toolButtonExprRadius, &QPushButton::clicked, this,
|
||||
&DialogPointFromCircleAndTangent::FXCircleRadius);
|
||||
|
||||
connect(ui->plainTextEditRadius, &QPlainTextEdit::textChanged, this,
|
||||
&DialogPointFromCircleAndTangent::CircleRadiusChanged);
|
||||
|
||||
connect(ui->pushButtonGrowRadius, &QPushButton::clicked, this,
|
||||
&DialogPointFromCircleAndTangent::DeployCircleRadiusTextEdit);
|
||||
|
||||
vis = new VisToolPointFromCircleAndTangent(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointFromCircleAndTangent::~DialogPointFromCircleAndTangent()
|
||||
{
|
||||
DeleteVisualization<VisToolPointFromCircleAndTangent>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointFromCircleAndTangent::GetCircleCenterId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxCircleCenter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxCircleCenter, value);
|
||||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPointFromCircleAndTangent::GetCircleRadius() const
|
||||
{
|
||||
return qApp->FormulaFromUser(ui->plainTextEditRadius->toPlainText());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SetCircleRadius(const QString &value)
|
||||
{
|
||||
const QString formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployCircleRadiusTextEdit();
|
||||
}
|
||||
ui->plainTextEditRadius->setPlainText(formula);
|
||||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setCRadius(formula);
|
||||
|
||||
MoveCursorToEnd(ui->plainTextEditRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointFromCircleAndTangent::GetTangentPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxTangentPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SetTangentPointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxTangentPoint, value);
|
||||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossCirclesPoint DialogPointFromCircleAndTangent::GetCrossCirclesPoint() const
|
||||
{
|
||||
return getCurrentCrossPoint(ui->comboBoxResult);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &p)
|
||||
{
|
||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxResult->setCurrentIndex(index);
|
||||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setCrossPoint(p);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false)// After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
switch (number)
|
||||
{
|
||||
case 0:
|
||||
if (SetObject(id, ui->comboBoxTangentPoint, tr("Select a circle center")))
|
||||
{
|
||||
number++;
|
||||
point->VisualMode(id);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxTangentPoint) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxCircleCenter, ""))
|
||||
{
|
||||
number = 0;
|
||||
point->setPoint2Id(id);
|
||||
point->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::PointChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
if (getCurrentObjectId(ui->comboBoxCircleCenter) == getCurrentObjectId(ui->comboBoxTangentPoint))
|
||||
{
|
||||
flagError = false;
|
||||
color = errorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagError = true;
|
||||
color = okColor;
|
||||
}
|
||||
ChangeColor(ui->labelCircleCenter, color);
|
||||
ChangeColor(ui->labelTangentPoint, color);
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::DeployCircleRadiusTextEdit()
|
||||
{
|
||||
DeployFormula(ui->plainTextEditRadius, ui->pushButtonGrowRadius, formulaBaseHeightCircleRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::CircleRadiusChanged()
|
||||
{
|
||||
labelEditFormula = ui->labelEditRadius;
|
||||
labelResultCalculation = ui->labelResultCircleRadius;
|
||||
ValFormulaChanged(flagCircleRadius, ui->plainTextEditRadius, timerCircleRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::FXCircleRadius()
|
||||
{
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
dialog->setWindowTitle(tr("Edit radius"));
|
||||
dialog->SetFormula(GetCircleRadius());
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
SetCircleRadius(dialog->GetFormula());
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::EvalCircleRadius()
|
||||
{
|
||||
labelEditFormula = ui->labelEditRadius;
|
||||
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
|
||||
const qreal radius = Eval(ui->plainTextEditRadius->toPlainText(), flagCircleRadius,
|
||||
ui->labelResultCircleRadius, postfix);
|
||||
|
||||
if (radius < 0)
|
||||
{
|
||||
flagCircleRadius = false;
|
||||
ChangeColor(labelEditFormula, Qt::red);
|
||||
ui->labelResultCircleRadius->setText(tr("Error"));
|
||||
ui->labelResultCircleRadius->setToolTip(tr("Radius can't be negative"));
|
||||
|
||||
DialogPointFromCircleAndTangent::CheckState();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::ShowVisualization()
|
||||
{
|
||||
AddVisualization<VisToolPointFromCircleAndTangent>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
|
||||
QString radius = ui->plainTextEditRadius->toPlainText();
|
||||
radius.replace("\n", " ");
|
||||
|
||||
VisToolPointFromCircleAndTangent *point = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
point->setPoint1Id(GetTangentPointId());
|
||||
point->setPoint2Id(GetCircleCenterId());
|
||||
point->setCRadius(radius);
|
||||
point->setCrossPoint(GetCrossCirclesPoint());
|
||||
point->RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
ui->plainTextEditRadius->blockSignals(true);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointFromCircleAndTangent::CheckState()
|
||||
{
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagFormula && flagName && flagError && flagCircleRadius);
|
||||
// In case dialog hasn't apply button
|
||||
if ( bApply != nullptr)
|
||||
{
|
||||
bApply->setEnabled(bOk->isEnabled());
|
||||
}
|
||||
}
|
91
src/app/dialogs/tools/dialogpointfromcircleandtangent.h
Normal file
91
src/app/dialogs/tools/dialogpointfromcircleandtangent.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpointfromcircleandtangent.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 3 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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 DIALOGPOINTFROMCIRCLEANDTANGENT_H
|
||||
#define DIALOGPOINTFROMCIRCLEANDTANGENT_H
|
||||
|
||||
#include "dialogtool.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPointFromCircleAndTangent;
|
||||
}
|
||||
|
||||
class DialogPointFromCircleAndTangent : public DialogTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DialogPointFromCircleAndTangent(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
||||
~DialogPointFromCircleAndTangent();
|
||||
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
quint32 GetCircleCenterId() const;
|
||||
void SetCircleCenterId(const quint32 &value);
|
||||
|
||||
QString GetCircleRadius() const;
|
||||
void SetCircleRadius(const QString &value);
|
||||
|
||||
quint32 GetTangentPointId() const;
|
||||
void SetTangentPointId(const quint32 &value);
|
||||
|
||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||
void SetCrossCirclesPoint(CrossCirclesPoint &p);
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
void PointChanged();
|
||||
|
||||
void DeployCircleRadiusTextEdit();
|
||||
void CircleRadiusChanged();
|
||||
void FXCircleRadius();
|
||||
void EvalCircleRadius();
|
||||
|
||||
protected:
|
||||
virtual void ShowVisualization();
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData();
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void CheckState();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointFromCircleAndTangent)
|
||||
|
||||
Ui::DialogPointFromCircleAndTangent *ui;
|
||||
|
||||
bool flagCircleRadius;
|
||||
QTimer *timerCircleRadius;
|
||||
QString circleRadius;
|
||||
int formulaBaseHeightCircleRadius;
|
||||
qreal angleCircleRadius;
|
||||
};
|
||||
|
||||
#endif // DIALOGPOINTFROMCIRCLEANDTANGENT_H
|
347
src/app/dialogs/tools/dialogpointfromcircleandtangent.ui
Normal file
347
src/app/dialogs/tools/dialogpointfromcircleandtangent.ui
Normal file
|
@ -0,0 +1,347 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogPointFromCircleAndTangent</class>
|
||||
<widget class="QDialog" name="DialogPointFromCircleAndTangent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>430</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>430</width>
|
||||
<height>251</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>430</width>
|
||||
<height>251</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEditRadius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>159</red>
|
||||
<green>158</green>
|
||||
<blue>158</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonExprRadius">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../share/resources/icon.qrc">
|
||||
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelResultCircleRadius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>87</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Value of first angle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">_</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditRadius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowRadius">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEditNamePoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Point label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCircleCenter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center of the circle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxCircleCenter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>145</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select point of center of arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelTangentPoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tangent point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxTangentPoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>143</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Take</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxResult"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../share/resources/icon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogPointFromCircleAndTangent</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogPointFromCircleAndTangent</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -715,6 +715,16 @@ void MainWindow::ToolPointOfIntersectionCircles(bool checked)
|
|||
&MainWindow::ApplyDialog<VToolPointOfIntersectionCircles>);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToolPointFromCircleAndTangent(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogPointFromCircleAndTangent>(checked, Tool::PointFromCircleAndTangent,
|
||||
"://cursor/point_from_circle_and_tangent_cursor.png",
|
||||
tr("Select point on tangent "),
|
||||
&MainWindow::ClosedDialogWithApply<VToolPointFromCircleAndTangent>,
|
||||
&MainWindow::ApplyDialog<VToolPointFromCircleAndTangent>);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief About show widows about.
|
||||
|
@ -1014,6 +1024,8 @@ void MainWindow::InitToolButtons()
|
|||
&MainWindow::ToolPointOfIntersectionArcs);
|
||||
connect(ui->toolButtonPointOfIntersectionCircles, &QToolButton::clicked, this,
|
||||
&MainWindow::ToolPointOfIntersectionCircles);
|
||||
connect(ui->toolButtonPointFromCircleAndTangent, &QToolButton::clicked, this,
|
||||
&MainWindow::ToolPointFromCircleAndTangent);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2160,6 +2172,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
ui->toolButtonArcIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools);
|
||||
ui->toolButtonPointOfIntersectionCircles->setEnabled(drawTools);
|
||||
ui->toolButtonPointFromCircleAndTangent->setEnabled(drawTools);
|
||||
|
||||
ui->actionLast_tool->setEnabled(drawTools);
|
||||
|
||||
|
@ -2526,6 +2539,10 @@ void MainWindow::LastUsedTool()
|
|||
ui->toolButtonPointOfIntersectionCircles->setChecked(true);
|
||||
ToolPointOfIntersectionCircles(true);
|
||||
break;
|
||||
case Tool::PointFromCircleAndTangent:
|
||||
ui->toolButtonPointFromCircleAndTangent->setChecked(true);
|
||||
ToolPointFromCircleAndTangent(true);
|
||||
break;
|
||||
case Tool::NodePoint:
|
||||
case Tool::NodeArc:
|
||||
case Tool::NodeSpline:
|
||||
|
|
|
@ -117,6 +117,7 @@ public slots:
|
|||
void ToolCurveIntersectAxis(bool checked);
|
||||
void ToolPointOfIntersectionArcs(bool checked);
|
||||
void ToolPointOfIntersectionCircles(bool checked);
|
||||
void ToolPointFromCircleAndTangent(bool checked);
|
||||
|
||||
void ClosedDialogDetail(int result);
|
||||
void ClosedDialogUnionDetails(int result);
|
||||
|
|
|
@ -650,7 +650,7 @@
|
|||
<string>Point intersect arc and axis</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
|
@ -676,7 +676,7 @@
|
|||
<string>Point of intersection arcs</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
|
@ -702,7 +702,7 @@
|
|||
<string>Point of intersection circles</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
|
@ -719,6 +719,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QToolButton" name="toolButtonPointFromCircleAndTangent">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Point from circle and tangent</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/point_from_circle_and_tangent.png</normaloff>:/icon/32x32/point_from_circle_and_tangent.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_5">
|
||||
|
|
|
@ -90,12 +90,13 @@ enum class Tool : unsigned char
|
|||
PointOfIntersectionCircles,
|
||||
CurveIntersectAxis,
|
||||
PointOfIntersection,
|
||||
UnionDetails // 32
|
||||
PointFromCircleAndTangent,
|
||||
UnionDetails // 33
|
||||
};
|
||||
|
||||
enum class Vis : unsigned char
|
||||
{
|
||||
ControlPointSpline = 33, // increase this value if need more positions in Tool enum
|
||||
ControlPointSpline = 34, // increase this value if need more positions in Tool enum
|
||||
GraphicsSimpleTextItem,
|
||||
SimpleSplinePath,
|
||||
Line,
|
||||
|
@ -113,6 +114,7 @@ enum class Vis : unsigned char
|
|||
ToolPointOfIntersection,
|
||||
ToolPointOfIntersectionArcs,
|
||||
ToolPointOfIntersectionCircles,
|
||||
ToolPointFromCircleAndTangent,
|
||||
ToolShoulderPoint,
|
||||
ToolSpline,
|
||||
ToolTriangle,
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
<file>cursor/curve_intersect_axis_cursor.png</file>
|
||||
<file>cursor/point_of_intersection_arcs.png</file>
|
||||
<file>cursor/point_of_intersection_circles.png</file>
|
||||
<file>cursor/point_from_circle_and_tangent_cursor.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -63,5 +63,6 @@
|
|||
<file>icon/32x32/export_to_picture_document.png</file>
|
||||
<file>icon/32x32/point_of_intersection_arcs.png</file>
|
||||
<file>icon/32x32/point_of_intersection_circles.png</file>
|
||||
<file>icon/32x32/point_from_circle_and_tangent.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="32"
|
||||
height="32"
|
||||
id="svg5205"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="point_from_arc_and_tangent.svg">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1619"
|
||||
inkscape:window-height="981"
|
||||
id="namedview10"
|
||||
showgrid="false"
|
||||
inkscape:zoom="7.9121198"
|
||||
inkscape:cx="10.243063"
|
||||
inkscape:cy="2.8989892"
|
||||
inkscape:window-x="75"
|
||||
inkscape:window-y="34"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg5205" />
|
||||
<defs
|
||||
id="defs5207" />
|
||||
<metadata
|
||||
id="metadata5210">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#ff0034;stroke-width:1.41504109;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:2.8300822, 1.41504109;stroke-dashoffset:3.53760291;marker-start:none"
|
||||
id="path3013"
|
||||
d="M 32.277829,17.763196 0.48150803,0.746658" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#00b400;stroke-width:0.94695449;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:5.68172693, 1.89390898;stroke-dashoffset:0"
|
||||
id="path2991"
|
||||
sodipodi:cx="11.864407"
|
||||
sodipodi:cy="10.542373"
|
||||
sodipodi:rx="10.033898"
|
||||
sodipodi:ry="9.525424"
|
||||
d="m 8.1328754,19.384593 a 10.033898,9.525424 0 1 1 0.032661,0.01236"
|
||||
sodipodi:start="1.9518432"
|
||||
sodipodi:end="8.2315244"
|
||||
sodipodi:open="true"
|
||||
transform="matrix(0.8949542,0,0,0.97829113,-1.0587788,5.9576767)" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#ff0034;stroke-width:1.33645833;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:2.6729165, 1.33645825;stroke-dashoffset:3.341146;marker-start:none"
|
||||
id="path3013-6"
|
||||
d="M 32.331736,16.652038 0.61764148,30.601976" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:0.93950177;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-1"
|
||||
d="m 31.332144,17.046554 a 1.6940329,1.7299054 0 0 1 -3.388065,0 1.6940329,1.7299054 0 1 1 3.388065,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:0.93950177;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-1-4"
|
||||
d="m 11.185558,16.407961 a 1.6940329,1.7299054 0 0 1 -3.3880651,0 1.6940329,1.7299054 0 1 1 3.3880651,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#f73208;fill-opacity:1;stroke:#f73208;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-1-5"
|
||||
d="m 14.361574,7.225183 a 1.6940329,1.7299054 0 0 1 -3.388065,0 1.6940329,1.7299054 0 1 1 3.388065,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#f73208;fill-opacity:1;stroke:#f73208;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-1-5-9"
|
||||
d="m 14.575388,25.289317 a 1.6940329,1.7299054 0 0 1 -3.388065,0 1.6940329,1.7299054 0 1 1 3.388065,0 z" />
|
||||
</svg>
|
After Width: | Height: | Size: 4.2 KiB |
|
@ -51,5 +51,6 @@
|
|||
#include "vtoolcutarc.h"
|
||||
#include "vtoollineintersectaxis.h"
|
||||
#include "vtoolcurveintersectaxis.h"
|
||||
#include "vtoolpointfromcircleandtangent.h"
|
||||
|
||||
#endif // DRAWTOOLS_H
|
||||
|
|
305
src/app/tools/drawTools/vtoolpointfromcircleandtangent.cpp
Normal file
305
src/app/tools/drawTools/vtoolpointfromcircleandtangent.cpp
Normal file
|
@ -0,0 +1,305 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtoolpointfromcircleandtangent.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 3 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vtoolpointfromcircleandtangent.h"
|
||||
#include "../../dialogs/tools/dialogpointfromcircleandtangent.h"
|
||||
#include "../../libs/vgeometry/vpointf.h"
|
||||
#include "../../libs/vgeometry/varc.h"
|
||||
#include "../../visualization/vistoolpointfromcircleandtangent.h"
|
||||
#include "../container/vformula.h"
|
||||
|
||||
const QString VToolPointFromCircleAndTangent::ToolType = QStringLiteral("pointFromCircleAndTangent");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointFromCircleAndTangent::VToolPointFromCircleAndTangent(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
quint32 circleCenterId, const QString &circleRadius,
|
||||
quint32 tangentPointId, CrossCirclesPoint crossPoint,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), circleCenterId(circleCenterId), tangentPointId(tangentPointId),
|
||||
circleRadius(circleRadius), crossPoint(crossPoint)
|
||||
{
|
||||
ToolCreation(typeCreation);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::setDialog()
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetCircleCenterId(circleCenterId);
|
||||
dialogTool->SetCircleRadius(circleRadius);
|
||||
dialogTool->SetCrossCirclesPoint(crossPoint);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 circleCenterId = dialogTool->GetCircleCenterId();
|
||||
QString circleRadius = dialogTool->GetCircleRadius();
|
||||
const quint32 tangentPointId = dialogTool->GetTangentPointId();
|
||||
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolPointFromCircleAndTangent *point = nullptr;
|
||||
point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const quint32 _id, const QString &pointName,
|
||||
quint32 circleCenterId, QString &circleRadius,
|
||||
quint32 tangentPointId,
|
||||
CrossCirclesPoint crossPoint, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data,
|
||||
const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const qreal radius = qApp->toPixel(CheckFormula(_id, circleRadius, data));
|
||||
const VPointF cPoint = *data->GeometricObject<VPointF>(circleCenterId);
|
||||
const VPointF tPoint = *data->GeometricObject<VPointF>(tangentPointId);
|
||||
|
||||
const QPointF point = VToolPointFromCircleAndTangent::FindPoint(tPoint.toQPointF(), cPoint.toQPointF(), radius,
|
||||
crossPoint);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(new VPointF(point, pointName, mx, my));
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
}
|
||||
VDrawTool::AddRecord(id, Tool::PointOfIntersectionCircles, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolPointFromCircleAndTangent *point = new VToolPointFromCircleAndTangent(doc, data, id, circleCenterId,
|
||||
circleRadius, tangentPointId,
|
||||
crossPoint, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPointFromCircleAndTangent::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointFromCircleAndTangent::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointFromCircleAndTangent::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointFromCircleAndTangent::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(circleCenterId);
|
||||
doc->IncrementReferens(tangentPointId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VToolPointFromCircleAndTangent::FindPoint(const QPointF &p, const QPointF ¢er, qreal radius,
|
||||
const CrossCirclesPoint crossPoint)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const int res = VGObject::ContactPoints (p, center, radius, p1, p2);
|
||||
|
||||
switch(res)
|
||||
{
|
||||
case 2:
|
||||
if (crossPoint == CrossCirclesPoint::FirstPoint)
|
||||
{
|
||||
return p1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return p2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
return p1;
|
||||
break;
|
||||
case 3:
|
||||
case 0:
|
||||
default:
|
||||
return QPointF(0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointFromCircleAndTangent::GetTangentPointId() const
|
||||
{
|
||||
return tangentPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SetTangentPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
tangentPointId = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointFromCircleAndTangent::GetCircleCenterId() const
|
||||
{
|
||||
return circleCenterId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
circleCenterId = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolPointFromCircleAndTangent::GetCircleRadius() const
|
||||
{
|
||||
VFormula radius(circleRadius, getData());
|
||||
radius.setCheckZero(true);
|
||||
radius.setToolId(id);
|
||||
radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
|
||||
return radius;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SetCircleRadius(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
if (value.getDoubleValue() > 0)// Formula don't check this, but radius can't be 0 or negative
|
||||
{
|
||||
circleRadius = value.GetFormula(FormulaType::FromUser);
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossCirclesPoint VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const
|
||||
{
|
||||
return crossPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SetCrossCirclesPoint(CrossCirclesPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::ShowVisualization(bool show)
|
||||
{
|
||||
ShowToolVisualization<VisToolPointFromCircleAndTangent>(show);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(circleCenterId);
|
||||
doc->DecrementReferens(tangentPointId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
ContextMenu<DialogPointFromCircleAndTangent>(this, event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrCCenter, QString().setNum(dialogTool->GetCircleCenterId()));
|
||||
doc->SetAttribute(domElement, AttrTangent, QString().setNum(dialogTool->GetTangentPointId()));
|
||||
doc->SetAttribute(domElement, AttrCRadius, dialogTool->GetCircleRadius());
|
||||
doc->SetAttribute(domElement, AttrCrossPoint,
|
||||
QString().setNum(static_cast<int>(dialogTool->GetCrossCirclesPoint())));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||
{
|
||||
VToolPoint::SaveOptions(tag, obj);
|
||||
|
||||
doc->SetAttribute(tag, AttrType, ToolType);
|
||||
doc->SetAttribute(tag, AttrCCenter, circleCenterId);
|
||||
doc->SetAttribute(tag, AttrTangent, tangentPointId);
|
||||
doc->SetAttribute(tag, AttrCRadius, circleRadius);
|
||||
doc->SetAttribute(tag, AttrCrossPoint, static_cast<int>(crossPoint));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
circleCenterId = doc->GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR);
|
||||
tangentPointId = doc->GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
|
||||
circleRadius = doc->GetParametrString(domElement, AttrCRadius);
|
||||
crossPoint = static_cast<CrossCirclesPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, "1"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointFromCircleAndTangent::SetVisualization()
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolPointFromCircleAndTangent *visual = qobject_cast<VisToolPointFromCircleAndTangent *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setPoint1Id(tangentPointId);
|
||||
visual->setPoint2Id(circleCenterId);
|
||||
visual->setCRadius(circleRadius);
|
||||
visual->setCrossPoint(crossPoint);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
86
src/app/tools/drawTools/vtoolpointfromcircleandtangent.h
Normal file
86
src/app/tools/drawTools/vtoolpointfromcircleandtangent.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtoolpointfromcircleandtangent.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 3 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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
|
||||
|
||||
#include "vtoolpoint.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
class VFormula;
|
||||
|
||||
class VToolPointFromCircleAndTangent : public VToolPoint
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolPointFromCircleAndTangent(VPattern *doc, VContainer *data, const quint32 &id, quint32 circleCenterId,
|
||||
const QString &circleRadius, quint32 tangentPointId, CrossCirclesPoint crossPoint,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolPointFromCircleAndTangent *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data);
|
||||
static VToolPointFromCircleAndTangent *Create(const quint32 _id, const QString &pointName,
|
||||
quint32 circleCenterId, QString &circleRadius, quint32 tangentPointId,
|
||||
CrossCirclesPoint crossPoint, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static QPointF FindPoint(const QPointF &p, const QPointF ¢er, qreal radius, const CrossCirclesPoint crossPoint);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::PointFromCircleAndTangent) };
|
||||
|
||||
quint32 GetTangentPointId() const;
|
||||
void SetTangentPointId(const quint32 &value);
|
||||
|
||||
quint32 GetCircleCenterId() const;
|
||||
void SetCircleCenterId(const quint32 &value);
|
||||
|
||||
VFormula GetCircleRadius() const;
|
||||
void SetCircleRadius(const VFormula &value);
|
||||
|
||||
CrossCirclesPoint GetCrossCirclesPoint() const;
|
||||
void SetCrossCirclesPoint(CrossCirclesPoint &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
protected:
|
||||
virtual void RemoveReferens();
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
virtual void SetVisualization();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolPointFromCircleAndTangent)
|
||||
|
||||
quint32 circleCenterId;
|
||||
quint32 tangentPointId;
|
||||
QString circleRadius;
|
||||
CrossCirclesPoint crossPoint;
|
||||
};
|
||||
|
||||
#endif // VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
|
@ -40,7 +40,8 @@ HEADERS += \
|
|||
$$PWD/drawTools/vtoollineintersectaxis.h \
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.h \
|
||||
$$PWD/drawTools/vtoolpointofintersectionarcs.h \
|
||||
$$PWD/drawTools/vtoolpointofintersectioncircles.h
|
||||
$$PWD/drawTools/vtoolpointofintersectioncircles.h \
|
||||
$$PWD/drawTools/vtoolpointfromcircleandtangent.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vtooldetail.cpp \
|
||||
|
@ -78,4 +79,5 @@ SOURCES += \
|
|||
$$PWD/drawTools/vtoollineintersectaxis.cpp \
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.cpp \
|
||||
$$PWD/drawTools/vtoolpointofintersectionarcs.cpp \
|
||||
$$PWD/drawTools/vtoolpointofintersectioncircles.cpp
|
||||
$$PWD/drawTools/vtoolpointofintersectioncircles.cpp \
|
||||
$$PWD/drawTools/vtoolpointfromcircleandtangent.cpp
|
||||
|
|
|
@ -83,6 +83,9 @@ const QString VAbstractTool::AttrC1Center = QStringLiteral("c1Center");
|
|||
const QString VAbstractTool::AttrC2Center = QStringLiteral("c2Center");
|
||||
const QString VAbstractTool::AttrC1Radius = QStringLiteral("c1Radius");
|
||||
const QString VAbstractTool::AttrC2Radius = QStringLiteral("c2Radius");
|
||||
const QString VAbstractTool::AttrCCenter = QStringLiteral("cCenter");
|
||||
const QString VAbstractTool::AttrTangent = QStringLiteral("tangent");
|
||||
const QString VAbstractTool::AttrCRadius = QStringLiteral("cRadius");
|
||||
|
||||
const QString VAbstractTool::TypeLineNone = QStringLiteral("none");
|
||||
const QString VAbstractTool::TypeLineLine = QStringLiteral("hair");
|
||||
|
|
|
@ -98,6 +98,9 @@ public:
|
|||
static const QString AttrC2Center;
|
||||
static const QString AttrC1Radius;
|
||||
static const QString AttrC2Radius;
|
||||
static const QString AttrCCenter;
|
||||
static const QString AttrTangent;
|
||||
static const QString AttrCRadius;
|
||||
|
||||
static const QString TypeLineNone;
|
||||
static const QString TypeLineLine;
|
||||
|
|
|
@ -128,3 +128,15 @@ void VisLine::AddOnScene()
|
|||
{
|
||||
AddItem(this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisLine::DrawRay(QGraphicsLineItem *lineItem, const QPointF &p, const QPointF &pTangent, const QColor &color,
|
||||
Qt::PenStyle style)
|
||||
{
|
||||
SCASSERT (lineItem != nullptr);
|
||||
|
||||
const qreal angle = QLineF(p, pTangent).angle();
|
||||
const QPointF endRay = Ray(p, angle);
|
||||
const QLineF tangent = VGObject::BuildLine(p, QLineF(p, endRay).length(), angle);
|
||||
DrawLine(lineItem, tangent, color, style);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ protected:
|
|||
QLineF Axis(const QPointF &p1, const QPointF &p2) const;
|
||||
virtual void InitPen();
|
||||
virtual void AddOnScene();
|
||||
|
||||
void DrawRay(QGraphicsLineItem *lineItem, const QPointF &p, const QPointF &pTangent,
|
||||
const QColor &color, Qt::PenStyle style);
|
||||
private:
|
||||
Q_DISABLE_COPY(VisLine)
|
||||
};
|
||||
|
|
117
src/app/visualization/vistoolpointfromcircleandtangent.cpp
Normal file
117
src/app/visualization/vistoolpointfromcircleandtangent.cpp
Normal file
|
@ -0,0 +1,117 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointfromcircleandtangent.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 5 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vistoolpointfromcircleandtangent.h"
|
||||
#include "../container/vcontainer.h"
|
||||
#include "../tools/drawTools/vtoolpointfromcircleandtangent.h"
|
||||
#include "../libs/vgeometry/vpointf.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointFromCircleAndTangent::VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), point2Id(NULL_ID), cRadius(0), crossPoint(CrossCirclesPoint::FirstPoint),
|
||||
point(nullptr), tangent(nullptr), cCenter(nullptr), cPath(nullptr), tangent2(nullptr)
|
||||
{
|
||||
cPath = InitItem<QGraphicsEllipseItem>(Qt::darkGreen, this);
|
||||
point = InitPoint(mainColor, this);
|
||||
tangent = InitPoint(supportColor, this);
|
||||
cCenter = InitPoint(supportColor, this);
|
||||
tangent2 = InitItem<QGraphicsLineItem>(supportColor, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointFromCircleAndTangent::~VisToolPointFromCircleAndTangent()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::RefreshGeometry()
|
||||
{
|
||||
if (point1Id > NULL_ID)// tangent point
|
||||
{
|
||||
const QSharedPointer<VPointF> tan = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(tangent, tan->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id > NULL_ID)// circle center
|
||||
{
|
||||
const QSharedPointer<VPointF> center = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(cCenter, center->toQPointF(), supportColor);
|
||||
|
||||
if (cRadius > 0)
|
||||
{
|
||||
cPath->setRect(PointRect(cRadius));
|
||||
DrawPoint(cPath, center->toQPointF(), Qt::darkGreen, Qt::DashLine);
|
||||
|
||||
FindRays(tan->toQPointF(), center->toQPointF(), cRadius);
|
||||
|
||||
const QPointF fPoint = VToolPointFromCircleAndTangent::FindPoint(tan->toQPointF(), center->toQPointF(),
|
||||
cRadius, crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::setPoint2Id(const quint32 &value)
|
||||
{
|
||||
point2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::setCRadius(const QString &value)
|
||||
{
|
||||
cRadius = FindLength(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::setCrossPoint(const CrossCirclesPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointFromCircleAndTangent::FindRays(const QPointF &p, const QPointF ¢er, qreal radius)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const int res = VGObject::ContactPoints (p, center, radius, p1, p2);
|
||||
|
||||
switch(res)
|
||||
{
|
||||
case 2:
|
||||
DrawRay(this, p, p1, supportColor, Qt::DashLine);
|
||||
DrawRay(tangent2, p, p2, supportColor, Qt::DashLine);
|
||||
break;
|
||||
case 1:
|
||||
DrawRay(this, p, p1, supportColor, Qt::DashLine);
|
||||
tangent2->setVisible(false);
|
||||
break;
|
||||
default:
|
||||
this->setVisible(false);
|
||||
tangent2->setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
64
src/app/visualization/vistoolpointfromcircleandtangent.h
Normal file
64
src/app/visualization/vistoolpointfromcircleandtangent.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointfromcircleandtangent.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 5 6, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** 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 VISTOOLPOINTFROMCIRCLEANDTANGENT_H
|
||||
#define VISTOOLPOINTFROMCIRCLEANDTANGENT_H
|
||||
|
||||
#include "visline.h"
|
||||
#include "../xml/vpattern.h"
|
||||
|
||||
class VisToolPointFromCircleAndTangent : public VisLine
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VisToolPointFromCircleAndTangent(const VContainer *data, QGraphicsItem *parent = 0);
|
||||
virtual ~VisToolPointFromCircleAndTangent();
|
||||
|
||||
virtual void RefreshGeometry();
|
||||
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void setCRadius(const QString &value);
|
||||
void setCrossPoint(const CrossCirclesPoint &value);
|
||||
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointFromCircleAndTangent)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPointFromCircleAndTangent)
|
||||
quint32 point2Id;
|
||||
qreal cRadius;
|
||||
CrossCirclesPoint crossPoint;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsEllipseItem *tangent;
|
||||
QGraphicsEllipseItem *cCenter;
|
||||
QGraphicsEllipseItem *cPath;
|
||||
QGraphicsLineItem *tangent2;
|
||||
|
||||
void FindRays(const QPointF &p, const QPointF ¢er, qreal radius);
|
||||
};
|
||||
|
||||
#endif // VISTOOLPOINTFROMCIRCLEANDTANGENT_H
|
|
@ -28,7 +28,8 @@ HEADERS += \
|
|||
$$PWD/vistoollineintersectaxis.h \
|
||||
$$PWD/vistoolcurveintersectaxis.h \
|
||||
$$PWD/vistoolpointofintersectionarcs.h \
|
||||
visualization/vistoolpointofintersectioncircles.h
|
||||
$$PWD/vistoolpointofintersectioncircles.h \
|
||||
$$PWD/vistoolpointfromcircleandtangent.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vgraphicssimpletextitem.cpp \
|
||||
|
@ -57,4 +58,5 @@ SOURCES += \
|
|||
$$PWD/vistoollineintersectaxis.cpp \
|
||||
$$PWD/vistoolcurveintersectaxis.cpp \
|
||||
$$PWD/vistoolpointofintersectionarcs.cpp \
|
||||
visualization/vistoolpointofintersectioncircles.cpp
|
||||
$$PWD/vistoolpointofintersectioncircles.cpp \
|
||||
$$PWD/vistoolpointfromcircleandtangent.cpp
|
||||
|
|
|
@ -152,6 +152,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
|||
case VToolCurveIntersectAxis::Type:
|
||||
ShowOptionsToolCurveIntersectAxis(item);
|
||||
break;
|
||||
case VToolPointFromCircleAndTangent::Type:
|
||||
ShowOptionsToolPointFromCircleAndTangent(item);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -239,6 +242,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
case VToolCurveIntersectAxis::Type:
|
||||
UpdateOptionsToolCurveIntersectAxis();
|
||||
break;
|
||||
case VToolPointFromCircleAndTangent::Type:
|
||||
UpdateOptionsToolPointFromCircleAndTangent();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -341,6 +347,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
|||
case VToolCurveIntersectAxis::Type:
|
||||
ChangeDataToolCurveIntersectAxis(prop);
|
||||
break;
|
||||
case VToolPointFromCircleAndTangent::Type:
|
||||
ChangeDataToolPointFromCircleAndTangent(prop);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -897,8 +906,6 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPropert
|
|||
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
|
||||
const QString id = propertyToId[property];
|
||||
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
SCASSERT(i != nullptr);
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // VAbstractTool::AttrName
|
||||
|
@ -949,6 +956,36 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProp
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VProperty *property)
|
||||
{
|
||||
SCASSERT(property != nullptr)
|
||||
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
|
||||
const QString id = propertyToId[property];
|
||||
|
||||
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
|
||||
SCASSERT(i != nullptr);
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // VAbstractTool::AttrName
|
||||
SetPointName<VToolPointFromCircleAndTangent>(value.toString());
|
||||
break;
|
||||
case 31: // VAbstractTool::AttrCRadius
|
||||
i->SetCircleRadius(value.value<VFormula>());
|
||||
break;
|
||||
case 28: // VAbstractTool::AttrCrossPoint
|
||||
{
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole);
|
||||
SetCrossCirclesPoint<VToolPointFromCircleAndTangent>(value);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qWarning()<<"Unknown property type. id = "<<id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *property)
|
||||
{
|
||||
|
@ -1317,6 +1354,18 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionCircles(QGra
|
|||
AddPropertyCrossPoint(i, tr("Take"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item)
|
||||
{
|
||||
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool to make point from circle and tangent"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
AddPropertyFormula(tr("Circle radius"), i->GetCircleRadius(), VAbstractTool::AttrCRadius);
|
||||
AddPropertyCrossPoint(i, tr("Take"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *item)
|
||||
{
|
||||
|
@ -1657,6 +1706,19 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles()
|
|||
idToProperty[VAbstractTool::AttrC2Radius]->setValue(c2Radius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent()
|
||||
{
|
||||
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
|
||||
|
||||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
idToProperty[VAbstractTool::AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
|
||||
QVariant cRadius;
|
||||
cRadius.setValue(i->GetCircleRadius());
|
||||
idToProperty[VAbstractTool::AttrCRadius]->setValue(cRadius);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
|
||||
{
|
||||
|
@ -1786,6 +1848,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
|||
<< VAbstractTool::AttrColor /* 27 */
|
||||
<< VAbstractTool::AttrCrossPoint /* 28 */
|
||||
<< VAbstractTool::AttrC1Radius /* 29 */
|
||||
<< VAbstractTool::AttrC2Radius; /* 30 */
|
||||
<< VAbstractTool::AttrC2Radius /* 30 */
|
||||
<< VAbstractTool::AttrCRadius; /* 31 */
|
||||
return attr;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ private:
|
|||
void ChangeDataToolPointOfIntersection(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property);
|
||||
void ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property);
|
||||
void ChangeDataToolShoulderPoint(VPE::VProperty *property);
|
||||
void ChangeDataToolSpline(VPE::VProperty *property);
|
||||
void ChangeDataToolSplinePath(VPE::VProperty *property);
|
||||
|
@ -127,6 +128,7 @@ private:
|
|||
void ShowOptionsToolPointOfIntersection(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionCircles(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointFromCircleAndTangent(QGraphicsItem *item);
|
||||
void ShowOptionsToolShoulderPoint(QGraphicsItem *item);
|
||||
void ShowOptionsToolSpline(QGraphicsItem *item);
|
||||
void ShowOptionsToolSplinePath(QGraphicsItem *item);
|
||||
|
@ -150,6 +152,7 @@ private:
|
|||
void UpdateOptionsToolPointOfIntersection();
|
||||
void UpdateOptionsToolPointOfIntersectionArcs();
|
||||
void UpdateOptionsToolPointOfIntersectionCircles();
|
||||
void UpdateOptionsToolPointFromCircleAndTangent();
|
||||
void UpdateOptionsToolShoulderPoint();
|
||||
void UpdateOptionsToolSpline();
|
||||
void UpdateOptionsToolSplinePath();
|
||||
|
|
|
@ -1144,7 +1144,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
<< VToolCutSplinePath::ToolType << VToolCutArc::ToolType
|
||||
<< VToolLineIntersectAxis::ToolType << VToolCurveIntersectAxis::ToolType
|
||||
<< VToolPointOfIntersectionArcs::ToolType
|
||||
<< VToolPointOfIntersectionCircles::ToolType;
|
||||
<< VToolPointOfIntersectionCircles::ToolType
|
||||
<< VToolPointFromCircleAndTangent::ToolType;
|
||||
switch (points.indexOf(type))
|
||||
{
|
||||
case 0: //VToolSinglePoint::ToolType
|
||||
|
@ -1686,6 +1687,34 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
throw excep;
|
||||
}
|
||||
break;
|
||||
case 19: //VToolPointFromCircleAndTangent::ToolType
|
||||
try
|
||||
{
|
||||
PointsCommonAttributes(domElement, id, name, mx, my);
|
||||
const quint32 cCenterId = GetParametrUInt(domElement, VAbstractTool::AttrCCenter, NULL_ID_STR);
|
||||
const quint32 tangentId = GetParametrUInt(domElement, VAbstractTool::AttrTangent, NULL_ID_STR);
|
||||
const QString cRadius = GetParametrString(domElement, VAbstractTool::AttrCRadius);
|
||||
QString cR = cRadius;
|
||||
const CrossCirclesPoint crossPoint = static_cast<CrossCirclesPoint>(GetParametrUInt(domElement,
|
||||
VAbstractTool::AttrCrossPoint,
|
||||
"1"));
|
||||
|
||||
VToolPointFromCircleAndTangent::Create(id, name, cCenterId, cR, tangentId, crossPoint, mx, my,
|
||||
scene, this, data, parse, Source::FromFile);
|
||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||
if (cR != cRadius)
|
||||
{
|
||||
SetAttribute(domElement, VAbstractTool::AttrCCenter, cR);
|
||||
haveLiteChange();
|
||||
}
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
VExceptionObjectError excep(tr("Error creating or updating point from circle and tangent"), domElement);
|
||||
excep.AddMoreInformation(e.ErrorMessage());
|
||||
throw excep;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Illegal point type in VDomDocument::ParsePointElement().";
|
||||
break;
|
||||
|
|
|
@ -130,6 +130,9 @@
|
|||
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||
|
|
|
@ -225,6 +225,27 @@ QLineF VGObject::BuildAxis(const QPointF &p1, const QPointF &p2, const QRectF &s
|
|||
return BuildAxis(p1, line.angle(), scRect);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VGObject::ContactPoints(const QPointF &p, const QPointF ¢er, qreal radius, QPointF &p1, QPointF &p2)
|
||||
{
|
||||
const int flag = PointInCircle(p, center, radius);
|
||||
|
||||
if (flag == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flag == 1)
|
||||
{
|
||||
p1 = p;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const double d = QLineF (p, center).length();
|
||||
const double k = sqrt (d * d - radius * radius);
|
||||
return IntersectionCircles(p, k, center, radius, p1, p2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief LineIntersectRect find point intersection line and rect.
|
||||
|
@ -455,6 +476,21 @@ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2)
|
|||
return epsilon;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VGObject::PointInCircle(const QPointF &p, const QPointF ¢er, qreal radius)
|
||||
{
|
||||
const double d = QLineF (p, center).length();
|
||||
if (qFuzzyCompare(radius, d))
|
||||
{
|
||||
return 1; // on circle
|
||||
}
|
||||
if (radius > d)
|
||||
{
|
||||
return 0; // outside circle
|
||||
}
|
||||
return 2; // inside circle
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetReversePoint return revers container of points.
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
static QLineF BuildAxis(const QPointF &p, const qreal &angle, const QRectF &scRect);
|
||||
static QLineF BuildAxis(const QPointF &p1, const QPointF &p2, const QRectF &scRect);
|
||||
|
||||
static int ContactPoints (const QPointF &p, const QPointF ¢er, qreal radius, QPointF &p1, QPointF &p2);
|
||||
static QPointF LineIntersectRect(const QRectF &rec, const QLineF &line);
|
||||
static int IntersectionCircles(const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1,
|
||||
QPointF &p2);
|
||||
|
@ -90,6 +91,8 @@ private:
|
|||
static bool IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||
static double PerpDotProduct(const QPointF &t, const QPointF &p1, const QPointF &p2);
|
||||
static double GetEpsilon(const QPointF &p1, const QPointF &p2);
|
||||
|
||||
static int PointInCircle (const QPointF &p, const QPointF ¢er, qreal radius);
|
||||
};
|
||||
|
||||
#endif // VGOBJECT_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user