mirror of
https://gitlab.com/smart-pattern/valentina.git
synced 2024-09-19 23:34:04 +02:00
Compare commits
12 commits
03a1b53276
...
57f8a56830
Author | SHA1 | Date | |
---|---|---|---|
57f8a56830 | |||
e2829cd043 | |||
bf4942e316 | |||
9178456a9f | |||
6565cc6355 | |||
41d2ad7afa | |||
e9e439e9cb | |||
4691de62fd | |||
ae9e374629 | |||
c84d1153ab | |||
7f6231f480 | |||
6ddefa9d99 |
|
@ -52,6 +52,8 @@
|
||||||
- Tape app. Show variables in order they were added.
|
- Tape app. Show variables in order they were added.
|
||||||
- Shortcuts manager.
|
- Shortcuts manager.
|
||||||
- Support for custom known measurements.
|
- Support for custom known measurements.
|
||||||
|
- Allow negative values.
|
||||||
|
- Tape app. New feature: Always keep on top.
|
||||||
|
|
||||||
# Valentina 0.7.52 September 12, 2022
|
# Valentina 0.7.52 September 12, 2022
|
||||||
- Fix crash when default locale is ru.
|
- Fix crash when default locale is ru.
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -108,7 +108,8 @@ auto DialogMDataBase::ImgTag(const VPatternImage &image) -> QString
|
||||||
return QStringLiteral("<img src=\"wrong.png\" align=\"center\"/>"); // In case of error
|
return QStringLiteral("<img src=\"wrong.png\" align=\"center\"/>"); // In case of error
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString("<img src=\"data:%1;base64,%2\" align=\"center\"/>").arg(image.ContentType(), image.ContentData());
|
return QStringLiteral("<img src=\"data:%1;base64,%2\" align=\"center\"/>")
|
||||||
|
.arg(image.ContentType(), QString(image.ContentData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1007,7 +1007,8 @@ auto MApplication::StartWithMeasurementFiles(QCommandLineParser &parser) -> bool
|
||||||
ParseUnitsOption(parser, unit, flagUnits);
|
ParseUnitsOption(parser, unit, flagUnits);
|
||||||
|
|
||||||
return std::all_of(args.begin(), args.end(),
|
return std::all_of(args.begin(), args.end(),
|
||||||
[&](const auto &arg)
|
[this, flagDimensionA, flagDimensionB, flagDimensionC, flagUnits, dimensionAValue,
|
||||||
|
dimensionBValue, dimensionCValue, unit](const auto &arg)
|
||||||
{
|
{
|
||||||
NewMainTapeWindow();
|
NewMainTapeWindow();
|
||||||
if (not MainTapeWindow()->LoadFile(arg))
|
if (not MainTapeWindow()->LoadFile(arg))
|
||||||
|
@ -1046,7 +1047,7 @@ auto MApplication::StartWithKnownMeasurementFiles(QCommandLineParser &parser) ->
|
||||||
const QStringList args = parser.positionalArguments();
|
const QStringList args = parser.positionalArguments();
|
||||||
|
|
||||||
return std::all_of(args.begin(), args.end(),
|
return std::all_of(args.begin(), args.end(),
|
||||||
[&](const auto &arg)
|
[this, args](const auto &arg)
|
||||||
{
|
{
|
||||||
NewMainKMWindow();
|
NewMainKMWindow();
|
||||||
if (not MainKMWindow()->LoadFile(arg))
|
if (not MainKMWindow()->LoadFile(arg))
|
||||||
|
|
|
@ -2129,6 +2129,10 @@ void TKMMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
QAction *action = menu->addAction(tr("&New Window"));
|
QAction *action = menu->addAction(tr("&New Window"));
|
||||||
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainKMWindow()->activateWindow(); });
|
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainKMWindow()->activateWindow(); });
|
||||||
action->setMenuRole(QAction::NoRole);
|
action->setMenuRole(QAction::NoRole);
|
||||||
|
|
||||||
|
menu->addAction(ui->actionAlwaysOnTop);
|
||||||
|
connect(ui->actionAlwaysOnTop, &QAction::triggered, this, &TKMMainWindow::AlwaysOnTop);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
const QList<TKMMainWindow *> windows = MApplication::VApp()->MainKMWindows();
|
const QList<TKMMainWindow *> windows = MApplication::VApp()->MainKMWindows();
|
||||||
|
|
|
@ -1203,6 +1203,20 @@
|
||||||
<enum>QAction::NoRole</enum>
|
<enum>QAction::NoRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionAlwaysOnTop">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Always on top</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Keep window always on top</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -4227,6 +4227,10 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
QAction *action = menu->addAction(tr("&New Window"));
|
QAction *action = menu->addAction(tr("&New Window"));
|
||||||
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainTapeWindow()->activateWindow(); });
|
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainTapeWindow()->activateWindow(); });
|
||||||
action->setMenuRole(QAction::NoRole);
|
action->setMenuRole(QAction::NoRole);
|
||||||
|
|
||||||
|
menu->addAction(ui->actionAlwaysOnTop);
|
||||||
|
connect(ui->actionAlwaysOnTop, &QAction::triggered, this, &TMainWindow::AlwaysOnTop);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
const QList<TMainWindow *> windows = MApplication::VApp()->MainTapeWindows();
|
const QList<TMainWindow *> windows = MApplication::VApp()->MainTapeWindows();
|
||||||
|
|
|
@ -1726,6 +1726,20 @@
|
||||||
<string>Edit current Known Measurements</string>
|
<string>Edit current Known Measurements</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionAlwaysOnTop">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Always on top</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Keep window always on top</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -3114,28 +3114,24 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
||||||
AddPropertyObjectName(i, tr("Name:"), true);
|
AddPropertyObjectName(i, tr("Name:"), true);
|
||||||
|
|
||||||
VFormula angle1(spl.GetStartAngleFormula(), i->getData());
|
VFormula angle1(spl.GetStartAngleFormula(), i->getData());
|
||||||
angle1.setCheckZero(false);
|
|
||||||
angle1.setToolId(i->getId());
|
angle1.setToolId(i->getId());
|
||||||
angle1.setPostfix(degreeSymbol);
|
angle1.setPostfix(degreeSymbol);
|
||||||
angle1.Eval();
|
angle1.Eval();
|
||||||
AddPropertyFormula(tr("C1: angle:"), angle1, AttrAngle1);
|
AddPropertyFormula(tr("C1: angle:"), angle1, AttrAngle1);
|
||||||
|
|
||||||
VFormula length1(spl.GetC1LengthFormula(), i->getData());
|
VFormula length1(spl.GetC1LengthFormula(), i->getData());
|
||||||
length1.setCheckZero(false);
|
|
||||||
length1.setToolId(i->getId());
|
length1.setToolId(i->getId());
|
||||||
length1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
length1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length1.Eval();
|
length1.Eval();
|
||||||
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
|
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
|
||||||
|
|
||||||
VFormula angle2(spl.GetEndAngleFormula(), i->getData());
|
VFormula angle2(spl.GetEndAngleFormula(), i->getData());
|
||||||
angle2.setCheckZero(false);
|
|
||||||
angle2.setToolId(i->getId());
|
angle2.setToolId(i->getId());
|
||||||
angle2.setPostfix(degreeSymbol);
|
angle2.setPostfix(degreeSymbol);
|
||||||
angle2.Eval();
|
angle2.Eval();
|
||||||
AddPropertyFormula(tr("C2: angle:"), angle2, AttrAngle2);
|
AddPropertyFormula(tr("C2: angle:"), angle2, AttrAngle2);
|
||||||
|
|
||||||
VFormula length2(spl.GetC2LengthFormula(), i->getData());
|
VFormula length2(spl.GetC2LengthFormula(), i->getData());
|
||||||
length2.setCheckZero(false);
|
|
||||||
length2.setToolId(i->getId());
|
length2.setToolId(i->getId());
|
||||||
length2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
length2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length2.Eval();
|
length2.Eval();
|
||||||
|
@ -3992,7 +3988,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
m_idToProperty[AttrName]->setValue(i->name());
|
m_idToProperty[AttrName]->setValue(i->name());
|
||||||
|
|
||||||
VFormula angle1F(spl.GetStartAngleFormula(), i->getData());
|
VFormula angle1F(spl.GetStartAngleFormula(), i->getData());
|
||||||
angle1F.setCheckZero(false);
|
|
||||||
angle1F.setToolId(i->getId());
|
angle1F.setToolId(i->getId());
|
||||||
angle1F.setPostfix(degreeSymbol);
|
angle1F.setPostfix(degreeSymbol);
|
||||||
angle1F.Eval();
|
angle1F.Eval();
|
||||||
|
@ -4001,7 +3996,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
m_idToProperty[AttrAngle1]->setValue(angle1);
|
m_idToProperty[AttrAngle1]->setValue(angle1);
|
||||||
|
|
||||||
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
|
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
|
||||||
length1F.setCheckZero(false);
|
|
||||||
length1F.setToolId(i->getId());
|
length1F.setToolId(i->getId());
|
||||||
length1F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
length1F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length1F.Eval();
|
length1F.Eval();
|
||||||
|
@ -4010,7 +4004,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
m_idToProperty[AttrLength1]->setValue(length1);
|
m_idToProperty[AttrLength1]->setValue(length1);
|
||||||
|
|
||||||
VFormula angle2F(spl.GetEndAngleFormula(), i->getData());
|
VFormula angle2F(spl.GetEndAngleFormula(), i->getData());
|
||||||
angle2F.setCheckZero(false);
|
|
||||||
angle2F.setToolId(i->getId());
|
angle2F.setToolId(i->getId());
|
||||||
angle2F.setPostfix(degreeSymbol);
|
angle2F.setPostfix(degreeSymbol);
|
||||||
angle2F.Eval();
|
angle2F.Eval();
|
||||||
|
@ -4019,7 +4012,6 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
m_idToProperty[AttrAngle2]->setValue(angle2);
|
m_idToProperty[AttrAngle2]->setValue(angle2);
|
||||||
|
|
||||||
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
|
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
|
||||||
length2F.setCheckZero(false);
|
|
||||||
length2F.setToolId(i->getId());
|
length2F.setToolId(i->getId());
|
||||||
length2F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
length2F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length2F.Eval();
|
length2F.Eval();
|
||||||
|
|
|
@ -636,7 +636,7 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
|
||||||
QList<QGraphicsScene *> scenes = CreateScenes(papers, shadows, details);
|
QList<QGraphicsScene *> scenes = CreateScenes(papers, shadows, details);
|
||||||
|
|
||||||
const bool ignorePrinterFields = false;
|
const bool ignorePrinterFields = false;
|
||||||
const qreal margin = ToPixel(1, Unit::Cm);
|
Q_RELAXED_CONSTEXPR qreal margin = ToPixel(1, Unit::Cm);
|
||||||
ExportFlatLayout(scenes, papers, shadows, details, ignorePrinterFields, QMarginsF(margin, margin, margin, margin));
|
ExportFlatLayout(scenes, papers, shadows, details, ignorePrinterFields, QMarginsF(margin, margin, margin, margin));
|
||||||
|
|
||||||
qDeleteAll(scenes); // Scene will clear all other items
|
qDeleteAll(scenes); // Scene will clear all other items
|
||||||
|
|
|
@ -214,7 +214,7 @@ auto VAbstractArc::AngleArc() const -> qreal
|
||||||
const qreal angleDiff = qAbs(GetStartAngle() - GetEndAngle());
|
const qreal angleDiff = qAbs(GetStartAngle() - GetEndAngle());
|
||||||
if (VFuzzyComparePossibleNulls(angleDiff, 0) || VFuzzyComparePossibleNulls(angleDiff, 360))
|
if (VFuzzyComparePossibleNulls(angleDiff, 0) || VFuzzyComparePossibleNulls(angleDiff, 360))
|
||||||
{
|
{
|
||||||
return 360;
|
return !d->isAllowEmpty ? 360 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QLineF l1(0, 0, 100, 0);
|
QLineF l1(0, 0, 100, 0);
|
||||||
|
@ -232,12 +232,39 @@ auto VAbstractArc::AngleArc() const -> qreal
|
||||||
return ang;
|
return ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractArc::GetPath() const -> QPainterPath
|
||||||
|
{
|
||||||
|
QPainterPath path;
|
||||||
|
|
||||||
|
const QVector<QPointF> points = GetPoints();
|
||||||
|
if (points.count() >= 2)
|
||||||
|
{
|
||||||
|
path.addPolygon(QPolygonF(points));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QPointF center = GetCenter().toQPointF();
|
||||||
|
QRectF rec = QRectF(center.x(), center.y(), accuracyPointOnLine * 2, accuracyPointOnLine * 2);
|
||||||
|
rec.translate(-rec.center().x(), -rec.center().y());
|
||||||
|
path.addEllipse(rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractArc::SetFlipped(bool value)
|
void VAbstractArc::SetFlipped(bool value)
|
||||||
{
|
{
|
||||||
d->isFlipped = value;
|
d->isFlipped = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractArc::SetAllowEmpty(bool value)
|
||||||
|
{
|
||||||
|
d->isAllowEmpty = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractArc::SetFormulaLength(const QString &formula)
|
void VAbstractArc::SetFormulaLength(const QString &formula)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,8 +83,11 @@ public:
|
||||||
auto IsFlipped() const -> bool;
|
auto IsFlipped() const -> bool;
|
||||||
auto AngleArc() const -> qreal;
|
auto AngleArc() const -> qreal;
|
||||||
|
|
||||||
|
auto GetPath() const -> QPainterPath override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetFlipped(bool value);
|
void SetFlipped(bool value);
|
||||||
|
void SetAllowEmpty(bool value);
|
||||||
virtual void FindF2(qreal length) = 0;
|
virtual void FindF2(qreal length) = 0;
|
||||||
void SetFormulaLength(const QString &formula);
|
void SetFormulaLength(const QString &formula);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
|
|
||||||
QString formulaLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString formulaLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
|
bool isAllowEmpty{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_ASSIGN_MOVE(VAbstractArcData) // NOLINT
|
Q_DISABLE_ASSIGN_MOVE(VAbstractArcData) // NOLINT
|
||||||
};
|
};
|
||||||
|
|
|
@ -245,12 +245,33 @@ auto VAbstractCurve::ClosestPoint(QPointF scenePoint) const -> QPointF
|
||||||
return points.constFirst();
|
return points.constFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VFuzzyComparePoints(points.constLast(), scenePoint))
|
||||||
|
{
|
||||||
|
return points.constLast();
|
||||||
|
}
|
||||||
|
|
||||||
QPointF candidatePoint;
|
QPointF candidatePoint;
|
||||||
qreal bestDistance = INT_MAX;
|
qreal bestDistance = INT_MAX;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (qint32 i = 0; i < points.count() - 1; ++i)
|
for (qint32 i = 0; i < points.count() - 1; ++i)
|
||||||
{
|
{
|
||||||
|
qreal length = QLineF(points.at(i), scenePoint).length();
|
||||||
|
if (length < bestDistance)
|
||||||
|
{
|
||||||
|
candidatePoint = points.at(i);
|
||||||
|
bestDistance = length;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = QLineF(points.at(i + 1), scenePoint).length();
|
||||||
|
if (length < bestDistance)
|
||||||
|
{
|
||||||
|
candidatePoint = points.at(i + 1);
|
||||||
|
bestDistance = length;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
const QPointF cPoint = VGObject::ClosestPoint(QLineF(points.at(i), points.at(i + 1)), scenePoint);
|
const QPointF cPoint = VGObject::ClosestPoint(QLineF(points.at(i), points.at(i + 1)), scenePoint);
|
||||||
|
|
||||||
if (IsPointOnLineSegment(cPoint, points.at(i), points.at(i + 1)))
|
if (IsPointOnLineSegment(cPoint, points.at(i), points.at(i + 1)))
|
||||||
|
|
|
@ -66,6 +66,7 @@ VArc::VArc(const VPointF ¢er, qreal radius, const QString &formulaRadius, qr
|
||||||
d(new VArcData(radius, formulaRadius))
|
d(new VArcData(radius, formulaRadius))
|
||||||
{
|
{
|
||||||
CreateName();
|
CreateName();
|
||||||
|
SetFlipped(radius < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -74,6 +75,7 @@ VArc::VArc(const VPointF ¢er, qreal radius, qreal f1, qreal f2)
|
||||||
d(new VArcData(radius))
|
d(new VArcData(radius))
|
||||||
{
|
{
|
||||||
CreateName();
|
CreateName();
|
||||||
|
SetFlipped(radius < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -143,7 +145,7 @@ auto VArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &pref
|
||||||
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
||||||
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
||||||
|
|
||||||
VArc arc(center, GetRadius(), f1, f2);
|
VArc arc(center, d->radius, f1, f2);
|
||||||
arc.setName(name() + prefix);
|
arc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -169,7 +171,7 @@ auto VArc::Flip(const QLineF &axis, const QString &prefix) const -> VArc
|
||||||
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
||||||
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
||||||
|
|
||||||
VArc arc(center, GetRadius(), f1, f2);
|
VArc arc(center, d->radius, f1, f2);
|
||||||
arc.setName(name() + prefix);
|
arc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -195,7 +197,7 @@ auto VArc::Move(qreal length, qreal angle, const QString &prefix) const -> VArc
|
||||||
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
const qreal f1 = QLineF(static_cast<QPointF>(center), p1).angle();
|
||||||
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle();
|
||||||
|
|
||||||
VArc arc(center, GetRadius(), f1, f2);
|
VArc arc(center, d->radius, f1, f2);
|
||||||
arc.setName(name() + prefix);
|
arc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -220,7 +222,7 @@ VArc::~VArc() = default;
|
||||||
*/
|
*/
|
||||||
auto VArc::GetLength() const -> qreal
|
auto VArc::GetLength() const -> qreal
|
||||||
{
|
{
|
||||||
qreal length = d->radius * qDegreesToRadians(AngleArc());
|
qreal length = qAbs(d->radius) * qDegreesToRadians(AngleArc());
|
||||||
if (IsFlipped())
|
if (IsFlipped())
|
||||||
{
|
{
|
||||||
length *= -1;
|
length *= -1;
|
||||||
|
@ -236,7 +238,7 @@ auto VArc::GetLength() const -> qreal
|
||||||
*/
|
*/
|
||||||
auto VArc::GetP1() const -> QPointF
|
auto VArc::GetP1() const -> QPointF
|
||||||
{
|
{
|
||||||
QPointF p1(GetCenter().x() + d->radius, GetCenter().y());
|
QPointF p1(GetCenter().x() + qAbs(d->radius), GetCenter().y());
|
||||||
QLineF centerP1(static_cast<QPointF>(GetCenter()), p1);
|
QLineF centerP1(static_cast<QPointF>(GetCenter()), p1);
|
||||||
centerP1.setAngle(GetStartAngle());
|
centerP1.setAngle(GetStartAngle());
|
||||||
return centerP1.p2();
|
return centerP1.p2();
|
||||||
|
@ -249,7 +251,7 @@ auto VArc::GetP1() const -> QPointF
|
||||||
*/
|
*/
|
||||||
auto VArc::GetP2() const -> QPointF
|
auto VArc::GetP2() const -> QPointF
|
||||||
{
|
{
|
||||||
QPointF p2(GetCenter().x() + d->radius, GetCenter().y());
|
QPointF p2(GetCenter().x() + qAbs(d->radius), GetCenter().y());
|
||||||
QLineF centerP2(static_cast<QPointF>(GetCenter()), p2);
|
QLineF centerP2(static_cast<QPointF>(GetCenter()), p2);
|
||||||
centerP2.setAngle(GetEndAngle());
|
centerP2.setAngle(GetEndAngle());
|
||||||
return centerP2.p2();
|
return centerP2.p2();
|
||||||
|
@ -262,7 +264,7 @@ auto VArc::GetP2() const -> QPointF
|
||||||
*/
|
*/
|
||||||
auto VArc::GetPoints() const -> QVector<QPointF>
|
auto VArc::GetPoints() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
if (qFuzzyIsNull(GetRadius()))
|
if (qFuzzyIsNull(d->radius))
|
||||||
{
|
{
|
||||||
return {GetCenter().toQPointF()};
|
return {GetCenter().toQPointF()};
|
||||||
}
|
}
|
||||||
|
@ -305,7 +307,7 @@ auto VArc::GetPoints() const -> QVector<QPointF>
|
||||||
|
|
||||||
for (int i = 0; i < sectionAngle.size(); ++i)
|
for (int i = 0; i < sectionAngle.size(); ++i)
|
||||||
{
|
{
|
||||||
const qreal lDistance = GetRadius() * 4.0 / 3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25);
|
const qreal lDistance = qAbs(d->radius) * 4.0 / 3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25);
|
||||||
|
|
||||||
const QPointF center = static_cast<QPointF>(GetCenter());
|
const QPointF center = static_cast<QPointF>(GetCenter());
|
||||||
|
|
||||||
|
@ -315,7 +317,7 @@ auto VArc::GetPoints() const -> QVector<QPointF>
|
||||||
|
|
||||||
QLineF lineP4P3(center, pStart);
|
QLineF lineP4P3(center, pStart);
|
||||||
lineP4P3.setAngle(lineP4P3.angle() + sectionAngle.at(i));
|
lineP4P3.setAngle(lineP4P3.angle() + sectionAngle.at(i));
|
||||||
lineP4P3.setLength(GetRadius()); // in case of computing error
|
lineP4P3.setLength(qAbs(d->radius)); // in case of computing error
|
||||||
lineP4P3 = QLineF(lineP4P3.p2(), center);
|
lineP4P3 = QLineF(lineP4P3.p2(), center);
|
||||||
lineP4P3.setAngle(lineP4P3.angle() + 90.0);
|
lineP4P3.setAngle(lineP4P3.angle() + 90.0);
|
||||||
lineP4P3.setLength(lDistance);
|
lineP4P3.setLength(lDistance);
|
||||||
|
@ -345,20 +347,39 @@ auto VArc::GetPoints() const -> QVector<QPointF>
|
||||||
*/
|
*/
|
||||||
auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName) const -> QPointF
|
auto VArc::CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName) const -> QPointF
|
||||||
{
|
{
|
||||||
// Always need return two arcs, so we must correct wrong length.
|
|
||||||
const qreal fullLength = GetLength();
|
const qreal fullLength = GetLength();
|
||||||
|
|
||||||
if (qAbs(fullLength) < ToPixel(2, Unit::Mm))
|
if (qFuzzyIsNull(fullLength) || qFuzzyIsNull(d->radius))
|
||||||
{
|
{
|
||||||
arc1 = VArc();
|
arc1 = *this;
|
||||||
arc2 = VArc();
|
arc2 = *this;
|
||||||
|
return GetCenter().toQPointF();
|
||||||
|
}
|
||||||
|
|
||||||
const QString errorMsg = tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
|
if (qFuzzyIsNull(length) || qFuzzyIsNull(length + fullLength))
|
||||||
VAbstractApplication::VApp()->IsPedantic()
|
{
|
||||||
? throw VException(errorMsg)
|
arc1 = VArc(GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), GetStartAngle(),
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
GetFormulaF1(), getIdObject(), getMode());
|
||||||
|
arc1.SetApproximationScale(GetApproximationScale());
|
||||||
|
arc1.SetFlipped(IsFlipped());
|
||||||
|
arc1.SetAllowEmpty(true);
|
||||||
|
|
||||||
return {};
|
arc2 = *this;
|
||||||
|
|
||||||
|
return GetP1();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFuzzyComparePossibleNulls(length, fullLength))
|
||||||
|
{
|
||||||
|
arc1 = *this;
|
||||||
|
|
||||||
|
arc2 = VArc(GetCenter(), d->radius, d->formulaRadius, GetEndAngle(), GetFormulaF2(), GetEndAngle(),
|
||||||
|
GetFormulaF2(), getIdObject(), getMode());
|
||||||
|
arc2.SetApproximationScale(GetApproximationScale());
|
||||||
|
arc2.SetFlipped(IsFlipped());
|
||||||
|
arc2.SetAllowEmpty(true);
|
||||||
|
|
||||||
|
return GetP2();
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF line =
|
QLineF line =
|
||||||
|
@ -381,7 +402,7 @@ auto VArc::CutArc(qreal length, const QString &pointName) const -> QPointF
|
||||||
{
|
{
|
||||||
VArc arc1;
|
VArc arc1;
|
||||||
VArc arc2;
|
VArc arc2;
|
||||||
return this->CutArc(length, arc1, arc2, pointName);
|
return CutArc(length, arc1, arc2, pointName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -423,14 +444,14 @@ void VArc::CreateAlias()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VArc::FindF2(qreal length)
|
void VArc::FindF2(qreal length)
|
||||||
{
|
{
|
||||||
SetFlipped(length < 0);
|
SetFlipped(length < 0 || d->radius < 0);
|
||||||
|
|
||||||
if (length >= MaxLength())
|
if (qAbs(length) >= qAbs(MaxLength()))
|
||||||
{
|
{
|
||||||
length = MaxLength();
|
length = MaxLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal arcAngle = qAbs(qRadiansToDegrees(length / d->radius));
|
qreal arcAngle = qAbs(qRadiansToDegrees(qAbs(length) / qAbs(d->radius)));
|
||||||
|
|
||||||
if (IsFlipped())
|
if (IsFlipped())
|
||||||
{
|
{
|
||||||
|
@ -438,7 +459,7 @@ void VArc::FindF2(qreal length)
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF startAngle(0, 0, 100, 0);
|
QLineF startAngle(0, 0, 100, 0);
|
||||||
startAngle.setAngle(GetStartAngle() + arcAngle); // We use QLineF just because it is easy way correct angle value
|
startAngle.setAngle(GetStartAngle() + arcAngle); // We use QLineF just because it is easy way to correct angle value
|
||||||
|
|
||||||
SetFormulaF2(QString::number(startAngle.angle()), startAngle.angle());
|
SetFormulaF2(QString::number(startAngle.angle()), startAngle.angle());
|
||||||
}
|
}
|
||||||
|
@ -457,9 +478,7 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
|
||||||
length = fullLength + length;
|
length = fullLength + length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal maxLength = fullLength - minLength;
|
if (length < 0)
|
||||||
|
|
||||||
if (length < minLength)
|
|
||||||
{
|
{
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
if (not pointName.isEmpty())
|
if (not pointName.isEmpty())
|
||||||
|
@ -476,7 +495,7 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
|
||||||
? throw VException(errorMsg)
|
? throw VException(errorMsg)
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
else if (length > maxLength)
|
else if (length > fullLength)
|
||||||
{
|
{
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
if (not pointName.isEmpty())
|
if (not pointName.isEmpty())
|
||||||
|
@ -486,7 +505,6 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.").arg(name());
|
errorMsg = tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.").arg(name());
|
||||||
}
|
}
|
||||||
VAbstractApplication::VApp()->IsPedantic()
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
@ -494,7 +512,12 @@ auto VArc::CutPoint(qreal length, qreal fullLength, const QString &pointName) co
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = qBound(minLength, length, maxLength);
|
if (qFuzzyIsNull(d->radius))
|
||||||
|
{
|
||||||
|
return {static_cast<QPointF>(GetCenter()), static_cast<QPointF>(GetCenter())};
|
||||||
|
}
|
||||||
|
|
||||||
|
length = qBound(0.0, length, fullLength);
|
||||||
|
|
||||||
QLineF line(static_cast<QPointF>(GetCenter()), GetP1());
|
QLineF line(static_cast<QPointF>(GetCenter()), GetP1());
|
||||||
line.setAngle(line.angle() + qRadiansToDegrees(length / d->radius));
|
line.setAngle(line.angle() + qRadiansToDegrees(length / d->radius));
|
||||||
|
@ -509,10 +532,7 @@ auto VArc::CutPointFlipped(qreal length, qreal fullLength, const QString &pointN
|
||||||
length = fullLength + length;
|
length = fullLength + length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal minLengthFlipped = fullLength + minLength;
|
if (length < fullLength)
|
||||||
const qreal maxLengthFlipped = -minLength;
|
|
||||||
|
|
||||||
if (length < minLengthFlipped)
|
|
||||||
{
|
{
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
if (not pointName.isEmpty())
|
if (not pointName.isEmpty())
|
||||||
|
@ -529,7 +549,7 @@ auto VArc::CutPointFlipped(qreal length, qreal fullLength, const QString &pointN
|
||||||
? throw VException(errorMsg)
|
? throw VException(errorMsg)
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
else if (length > maxLengthFlipped)
|
else if (length > 0)
|
||||||
{
|
{
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
if (not pointName.isEmpty())
|
if (not pointName.isEmpty())
|
||||||
|
@ -546,7 +566,12 @@ auto VArc::CutPointFlipped(qreal length, qreal fullLength, const QString &pointN
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = qBound(minLengthFlipped, length, maxLengthFlipped);
|
if (qFuzzyIsNull(d->radius))
|
||||||
|
{
|
||||||
|
return {static_cast<QPointF>(GetCenter()), static_cast<QPointF>(GetCenter())};
|
||||||
|
}
|
||||||
|
|
||||||
|
length = qBound(fullLength, length, 0.0);
|
||||||
|
|
||||||
QLineF line(static_cast<QPointF>(GetCenter()), GetP1());
|
QLineF line(static_cast<QPointF>(GetCenter()), GetP1());
|
||||||
line.setAngle(line.angle() - qRadiansToDegrees(qAbs(length) / d->radius));
|
line.setAngle(line.angle() - qRadiansToDegrees(qAbs(length) / d->radius));
|
||||||
|
|
|
@ -226,6 +226,15 @@ auto JoinVectors(const QVector<QPointF> &v1, const QVector<QPointF> &v2) -> QVec
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto IsBoundedIntersection(QLineF::IntersectType type, QPointF p, const QLineF &segment1, const QLineF &segment2)
|
||||||
|
-> bool
|
||||||
|
{
|
||||||
|
return type == QLineF::BoundedIntersection ||
|
||||||
|
(type == QLineF::UnboundedIntersection && VGObject::IsPointOnLineSegment(p, segment1.p1(), segment2.p1()) &&
|
||||||
|
VGObject::IsPointOnLineSegment(p, segment2.p1(), segment2.p2()));
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -255,6 +264,7 @@ VEllipticalArc::VEllipticalArc(const VPointF ¢er, qreal radius1, qreal radiu
|
||||||
d(new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
|
d(new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
|
||||||
{
|
{
|
||||||
CreateName();
|
CreateName();
|
||||||
|
SetFlipped(radius1 < 0 || radius2 < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -264,6 +274,7 @@ VEllipticalArc::VEllipticalArc(const VPointF ¢er, qreal radius1, qreal radiu
|
||||||
d(new VEllipticalArcData(radius1, radius2, rotationAngle))
|
d(new VEllipticalArcData(radius1, radius2, rotationAngle))
|
||||||
{
|
{
|
||||||
CreateName();
|
CreateName();
|
||||||
|
SetFlipped(radius1 < 0 || radius2 < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -333,11 +344,11 @@ auto VEllipticalArc::Rotate(QPointF originPoint, qreal degrees, const QString &p
|
||||||
|
|
||||||
QTransform t = d->m_transform;
|
QTransform t = d->m_transform;
|
||||||
t.translate(originPoint.x(), originPoint.y());
|
t.translate(originPoint.x(), originPoint.y());
|
||||||
t.rotate(IsFlipped() ? degrees : -degrees);
|
t.rotate(-degrees);
|
||||||
t.translate(-originPoint.x(), -originPoint.y());
|
t.translate(-originPoint.x(), -originPoint.y());
|
||||||
|
|
||||||
VEllipticalArc elArc(VAbstractArc::GetCenter(), GetRadius1(), GetRadius2(), VAbstractArc::GetStartAngle(),
|
VEllipticalArc elArc(VAbstractArc::GetCenter(), d->radius1, d->radius2, VAbstractArc::GetStartAngle(),
|
||||||
VAbstractArc::GetEndAngle(), GetRotationAngle());
|
VAbstractArc::GetEndAngle(), d->rotationAngle);
|
||||||
elArc.setName(name() + prefix);
|
elArc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -356,8 +367,8 @@ auto VEllipticalArc::Rotate(QPointF originPoint, qreal degrees, const QString &p
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::Flip(const QLineF &axis, const QString &prefix) const -> VEllipticalArc
|
auto VEllipticalArc::Flip(const QLineF &axis, const QString &prefix) const -> VEllipticalArc
|
||||||
{
|
{
|
||||||
VEllipticalArc elArc(VAbstractArc::GetCenter(), GetRadius1(), GetRadius2(), VAbstractArc::GetStartAngle(),
|
VEllipticalArc elArc(VAbstractArc::GetCenter(), d->radius1, d->radius2, VAbstractArc::GetStartAngle(),
|
||||||
VAbstractArc::GetEndAngle(), GetRotationAngle());
|
VAbstractArc::GetEndAngle(), d->rotationAngle);
|
||||||
elArc.setName(name() + prefix);
|
elArc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -385,8 +396,8 @@ auto VEllipticalArc::Move(qreal length, qreal angle, const QString &prefix) cons
|
||||||
QTransform t = d->m_transform;
|
QTransform t = d->m_transform;
|
||||||
t.translate(position.x(), position.y());
|
t.translate(position.x(), position.y());
|
||||||
|
|
||||||
VEllipticalArc elArc(oldCenter, GetRadius1(), GetRadius2(), VAbstractArc::GetStartAngle(),
|
VEllipticalArc elArc(oldCenter, d->radius1, d->radius2, VAbstractArc::GetStartAngle(), VAbstractArc::GetEndAngle(),
|
||||||
VAbstractArc::GetEndAngle(), GetRotationAngle());
|
d->rotationAngle);
|
||||||
elArc.setName(name() + prefix);
|
elArc.setName(name() + prefix);
|
||||||
|
|
||||||
if (not GetAliasSuffix().isEmpty())
|
if (not GetAliasSuffix().isEmpty())
|
||||||
|
@ -416,7 +427,7 @@ auto VEllipticalArc::GetLength() const -> qreal
|
||||||
|
|
||||||
if (IsFlipped())
|
if (IsFlipped())
|
||||||
{
|
{
|
||||||
length = length * -1;
|
length *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
|
@ -473,11 +484,16 @@ auto VEllipticalArc::GetPoints() const -> QVector<QPointF>
|
||||||
{
|
{
|
||||||
const QPointF center = VAbstractArc::GetCenter().toQPointF();
|
const QPointF center = VAbstractArc::GetCenter().toQPointF();
|
||||||
|
|
||||||
|
if (qFuzzyIsNull(d->radius1) && qFuzzyIsNull(d->radius2))
|
||||||
|
{
|
||||||
|
return {center};
|
||||||
|
}
|
||||||
|
|
||||||
// Don't work with 0 radius. Always make it bigger than 0.
|
// Don't work with 0 radius. Always make it bigger than 0.
|
||||||
Q_RELAXED_CONSTEXPR qreal threshold = ToPixel(0.001, Unit::Mm);
|
Q_RELAXED_CONSTEXPR qreal threshold = ToPixel(0.001, Unit::Mm);
|
||||||
qreal radius1 = qMax(d->radius1, threshold);
|
qreal radius1 = qMax(qAbs(d->radius1), threshold);
|
||||||
qreal radius2 = qMax(d->radius2, threshold);
|
qreal radius2 = qMax(qAbs(d->radius2), threshold);
|
||||||
qreal max = qMax(d->radius1, d->radius2);
|
qreal max = qMax(qAbs(d->radius1), qAbs(d->radius2));
|
||||||
qreal scale = 1;
|
qreal scale = 1;
|
||||||
|
|
||||||
if (max > maxRadius)
|
if (max > maxRadius)
|
||||||
|
@ -499,24 +515,24 @@ auto VEllipticalArc::GetPoints() const -> QVector<QPointF>
|
||||||
// To avoid this we calculate an arc for scaled radiuses and then scale up to original size.
|
// To avoid this we calculate an arc for scaled radiuses and then scale up to original size.
|
||||||
t.scale(scale, scale);
|
t.scale(scale, scale);
|
||||||
}
|
}
|
||||||
t.rotate(-GetRotationAngle());
|
t.rotate(-d->rotationAngle);
|
||||||
t.translate(-center.x(), -center.y());
|
t.translate(-center.x(), -center.y());
|
||||||
|
|
||||||
std::transform(points.begin(), points.end(), points.begin(), [t](const QPointF &point) { return t.map(point); });
|
std::transform(points.begin(), points.end(), points.begin(), [t](const QPointF &point) { return t.map(point); });
|
||||||
|
|
||||||
return points;
|
return IsFlipped() ? Reverse(points) : points;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::GetStartAngle() const -> qreal
|
auto VEllipticalArc::GetStartAngle() const -> qreal
|
||||||
{
|
{
|
||||||
return QLineF(GetCenter().toQPointF(), GetP1()).angle() - GetRotationAngle();
|
return QLineF(GetCenter().toQPointF(), GetP1()).angle() - d->rotationAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::GetEndAngle() const -> qreal
|
auto VEllipticalArc::GetEndAngle() const -> qreal
|
||||||
{
|
{
|
||||||
return QLineF(GetCenter().toQPointF(), GetP2()).angle() - GetRotationAngle();
|
return QLineF(GetCenter().toQPointF(), GetP2()).angle() - d->rotationAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -527,96 +543,78 @@ auto VEllipticalArc::GetEndAngle() const -> qreal
|
||||||
* @param arc2 second arc.
|
* @param arc2 second arc.
|
||||||
* @return point cutting
|
* @return point cutting
|
||||||
*/
|
*/
|
||||||
auto VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2,
|
auto VEllipticalArc::CutArc(qreal length, VEllipticalArc &arc1, VEllipticalArc &arc2, const QString &pointName) const
|
||||||
const QString &pointName) const -> QPointF
|
-> QPointF
|
||||||
{
|
{
|
||||||
// Always need return two arcs, so we must correct wrong length.
|
|
||||||
qreal len = 0;
|
|
||||||
const qreal fullLength = GetLength();
|
const qreal fullLength = GetLength();
|
||||||
|
|
||||||
if (fullLength <= minLength)
|
if (qFuzzyIsNull(fullLength) || (qFuzzyIsNull(d->radius1) && qFuzzyIsNull(d->radius2)))
|
||||||
{
|
{
|
||||||
arc1 = VEllipticalArc();
|
arc1 = *this;
|
||||||
arc2 = VEllipticalArc();
|
arc2 = *this;
|
||||||
|
return GetCenter().toQPointF();
|
||||||
const QString errorMsg = QObject::tr("Unable to cut curve '%1'. The curve is too short.").arg(name());
|
|
||||||
VAbstractApplication::VApp()->IsPedantic()
|
|
||||||
? throw VException(errorMsg)
|
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal maxLength = fullLength - minLength;
|
if (qFuzzyIsNull(length) || qFuzzyIsNull(length + fullLength))
|
||||||
|
{
|
||||||
|
arc1 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2,
|
||||||
|
GetStartAngle(), GetFormulaF1(), GetStartAngle(), GetFormulaF1(), d->rotationAngle,
|
||||||
|
GetFormulaRotationAngle(), getIdObject(), getMode());
|
||||||
|
arc1.SetApproximationScale(GetApproximationScale());
|
||||||
|
arc1.SetFlipped(IsFlipped());
|
||||||
|
arc1.SetAllowEmpty(true);
|
||||||
|
|
||||||
if (length < minLength)
|
arc2 = *this;
|
||||||
{
|
|
||||||
len = minLength;
|
|
||||||
|
|
||||||
QString errorMsg;
|
return GetP1();
|
||||||
if (not pointName.isEmpty())
|
|
||||||
{
|
|
||||||
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too small. Optimize it to minimal "
|
|
||||||
"value.")
|
|
||||||
.arg(name(), pointName);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.")
|
|
||||||
.arg(name());
|
|
||||||
}
|
|
||||||
VAbstractApplication::VApp()->IsPedantic()
|
|
||||||
? throw VException(errorMsg)
|
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
|
||||||
}
|
|
||||||
else if (length > maxLength)
|
|
||||||
{
|
|
||||||
len = maxLength;
|
|
||||||
|
|
||||||
QString errorMsg;
|
if (VFuzzyComparePossibleNulls(length, fullLength))
|
||||||
if (not pointName.isEmpty())
|
|
||||||
{
|
{
|
||||||
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too big. Optimize it to maximal value.")
|
arc1 = *this;
|
||||||
.arg(name(), pointName);
|
|
||||||
}
|
arc2 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, GetEndAngle(),
|
||||||
else
|
GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
|
||||||
{
|
GetFormulaRotationAngle(), getIdObject(), getMode());
|
||||||
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.")
|
arc2.SetApproximationScale(GetApproximationScale());
|
||||||
.arg(name());
|
arc2.SetFlipped(IsFlipped());
|
||||||
}
|
arc2.SetAllowEmpty(true);
|
||||||
VAbstractApplication::VApp()->IsPedantic()
|
|
||||||
? throw VException(errorMsg)
|
return GetP2();
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal len = CorrectCutLength(length, fullLength, pointName);
|
||||||
|
|
||||||
// the first arc has given length and startAngle just like in the origin arc
|
// the first arc has given length and startAngle just like in the origin arc
|
||||||
arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1,
|
arc1 = VEllipticalArc(len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1,
|
||||||
d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
|
d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
|
||||||
GetFormulaRotationAngle(), getIdObject(), getMode());
|
GetFormulaRotationAngle(), getIdObject(), getMode());
|
||||||
|
arc1.SetApproximationScale(GetApproximationScale());
|
||||||
|
arc1.SetFlipped(IsFlipped());
|
||||||
|
|
||||||
// the second arc has startAngle just like endAngle of the first arc
|
// the second arc has startAngle just like endAngle of the first arc
|
||||||
// and it has endAngle just like endAngle of the origin arc
|
// and it has endAngle just like endAngle of the origin arc
|
||||||
arc2 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(),
|
arc2 = VEllipticalArc(GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(),
|
||||||
arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
|
arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
|
||||||
GetFormulaRotationAngle(), getIdObject(), getMode());
|
GetFormulaRotationAngle(), getIdObject(), getMode());
|
||||||
return arc1.GetP1();
|
arc2.SetApproximationScale(GetApproximationScale());
|
||||||
|
arc2.SetFlipped(IsFlipped());
|
||||||
|
|
||||||
|
return arc1.GetP2();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::CutArc(const qreal &length, const QString &pointName) const -> QPointF
|
auto VEllipticalArc::CutArc(qreal length, const QString &pointName) const -> QPointF
|
||||||
{
|
{
|
||||||
VEllipticalArc arc1;
|
VEllipticalArc arc1;
|
||||||
VEllipticalArc arc2;
|
VEllipticalArc arc2;
|
||||||
return this->CutArc(length, arc1, arc2, pointName);
|
return CutArc(length, arc1, arc2, pointName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VEllipticalArc::CreateName()
|
void VEllipticalArc::CreateName()
|
||||||
{
|
{
|
||||||
QString name = ELARC_ + QStringLiteral("%1").arg(this->GetCenter().name());
|
QString name = ELARC_ + this->GetCenter().name();
|
||||||
const QString nameStr = QStringLiteral("_%1");
|
const QString nameStr = QStringLiteral("_%1");
|
||||||
|
|
||||||
if (getMode() == Draw::Modeling && getIdObject() != NULL_ID)
|
if (getMode() == Draw::Modeling && getIdObject() != NULL_ID)
|
||||||
|
@ -653,12 +651,12 @@ void VEllipticalArc::CreateAlias()
|
||||||
void VEllipticalArc::FindF2(qreal length)
|
void VEllipticalArc::FindF2(qreal length)
|
||||||
{
|
{
|
||||||
qreal gap = 180;
|
qreal gap = 180;
|
||||||
if (length < 0)
|
if (length < 0 || d->radius1 < 0 || d->radius2 < 0)
|
||||||
{
|
{
|
||||||
SetFlipped(true);
|
SetFlipped(true);
|
||||||
gap = -gap;
|
gap = -gap;
|
||||||
}
|
}
|
||||||
while (length > MaxLength())
|
else if (qAbs(length) > qAbs(MaxLength()))
|
||||||
{
|
{
|
||||||
length = MaxLength();
|
length = MaxLength();
|
||||||
}
|
}
|
||||||
|
@ -666,7 +664,8 @@ void VEllipticalArc::FindF2(qreal length)
|
||||||
// We need to calculate the second angle
|
// We need to calculate the second angle
|
||||||
// first approximation of angle between start and end angles
|
// first approximation of angle between start and end angles
|
||||||
|
|
||||||
QLineF radius1(GetCenter().x(), GetCenter().y(), GetCenter().x() + d->radius1, GetCenter().y());
|
VPointF center = GetCenter();
|
||||||
|
QLineF radius1(center.x(), center.y(), center.x() + qAbs(d->radius1), center.y());
|
||||||
radius1.setAngle(GetStartAngle());
|
radius1.setAngle(GetStartAngle());
|
||||||
radius1.setAngle(radius1.angle() + gap);
|
radius1.setAngle(radius1.angle() + gap);
|
||||||
qreal endAngle = radius1.angle();
|
qreal endAngle = radius1.angle();
|
||||||
|
@ -676,16 +675,17 @@ void VEllipticalArc::FindF2(qreal length)
|
||||||
|
|
||||||
qreal lenBez = GetLength(); // first approximation of length
|
qreal lenBez = GetLength(); // first approximation of length
|
||||||
|
|
||||||
const qreal eps = ToPixel(0.001, Unit::Mm);
|
Q_RELAXED_CONSTEXPR qreal eps = ToPixel(0.001, Unit::Mm);
|
||||||
|
|
||||||
while (qAbs(lenBez - length) > eps)
|
while (qAbs(lenBez - length) > eps)
|
||||||
{
|
{
|
||||||
gap = gap / 2;
|
gap = gap / 2;
|
||||||
if (gap < 0.0001)
|
if (qAbs(gap) < 0.0001)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lenBez > length)
|
|
||||||
|
if (qAbs(lenBez) > qAbs(length))
|
||||||
{ // we selected too big end angle
|
{ // we selected too big end angle
|
||||||
radius1.setAngle(endAngle - qAbs(gap));
|
radius1.setAngle(endAngle - qAbs(gap));
|
||||||
}
|
}
|
||||||
|
@ -703,15 +703,21 @@ void VEllipticalArc::FindF2(qreal length)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::MaxLength() const -> qreal
|
auto VEllipticalArc::MaxLength() const -> qreal
|
||||||
{
|
{
|
||||||
const qreal h = qPow(d->radius1 - d->radius2, 2) / qPow(d->radius1 + d->radius2, 2);
|
const qreal h = qPow(qAbs(d->radius1) - qAbs(d->radius2), 2) / qPow(qAbs(d->radius1) + qAbs(d->radius2), 2);
|
||||||
const qreal ellipseLength = M_PI * (d->radius1 + d->radius2) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h)));
|
qreal ellipseLength = M_PI * (qAbs(d->radius1) + qAbs(d->radius2)) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h)));
|
||||||
|
|
||||||
|
if (d->radius1 < 0 || d->radius2 < 0)
|
||||||
|
{
|
||||||
|
ellipseLength *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ellipseLength;
|
return ellipseLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VEllipticalArc::GetP(qreal angle) const -> QPointF
|
auto VEllipticalArc::GetP(qreal angle) const -> QPointF
|
||||||
{
|
{
|
||||||
if (qFuzzyIsNull(GetRadius1()) && qFuzzyIsNull(GetRadius2()))
|
if (qFuzzyIsNull(d->radius1) && qFuzzyIsNull(d->radius2))
|
||||||
{
|
{
|
||||||
return GetCenter().toQPointF();
|
return GetCenter().toQPointF();
|
||||||
}
|
}
|
||||||
|
@ -719,8 +725,8 @@ auto VEllipticalArc::GetP(qreal angle) const -> QPointF
|
||||||
QLineF line(0, 0, 100, 0);
|
QLineF line(0, 0, 100, 0);
|
||||||
line.setAngle(angle);
|
line.setAngle(angle);
|
||||||
|
|
||||||
const qreal a = not qFuzzyIsNull(GetRadius1()) ? line.p2().x() / GetRadius1() : 0;
|
const qreal a = not qFuzzyIsNull(d->radius1) ? line.p2().x() / qAbs(d->radius1) : 0;
|
||||||
const qreal b = not qFuzzyIsNull(GetRadius2()) ? line.p2().y() / GetRadius2() : 0;
|
const qreal b = not qFuzzyIsNull(d->radius2) ? line.p2().y() / qAbs(d->radius2) : 0;
|
||||||
const qreal k = qSqrt(a * a + b * b);
|
const qreal k = qSqrt(a * a + b * b);
|
||||||
|
|
||||||
if (qFuzzyIsNull(k))
|
if (qFuzzyIsNull(k))
|
||||||
|
@ -733,7 +739,7 @@ auto VEllipticalArc::GetP(qreal angle) const -> QPointF
|
||||||
QLineF line2(QPointF(), p);
|
QLineF line2(QPointF(), p);
|
||||||
SCASSERT(VFuzzyComparePossibleNulls(line2.angle(), line.angle()))
|
SCASSERT(VFuzzyComparePossibleNulls(line2.angle(), line.angle()))
|
||||||
|
|
||||||
line2.setAngle(line2.angle() + GetRotationAngle());
|
line2.setAngle(line2.angle() + d->rotationAngle);
|
||||||
return line2.p2() + VAbstractArc::GetCenter().toQPointF();
|
return line2.p2() + VAbstractArc::GetCenter().toQPointF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +752,7 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF center = VAbstractArc::GetCenter().toQPointF();
|
QPointF center = VAbstractArc::GetCenter().toQPointF();
|
||||||
qreal radius = qMax(d->radius1, d->radius2) * 2;
|
qreal radius = qMax(qAbs(d->radius1), qAbs(d->radius2)) * 2;
|
||||||
|
|
||||||
QLineF start(center.x(), center.y(), center.x() + radius, center.y());
|
QLineF start(center.x(), center.y(), center.x() + radius, center.y());
|
||||||
start.setAngle(VAbstractArc::GetStartAngle());
|
start.setAngle(VAbstractArc::GetStartAngle());
|
||||||
|
@ -754,15 +760,6 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
|
||||||
QLineF end(center.x(), center.y(), center.x() + radius, center.y());
|
QLineF end(center.x(), center.y(), center.x() + radius, center.y());
|
||||||
end.setAngle(VAbstractArc::GetEndAngle());
|
end.setAngle(VAbstractArc::GetEndAngle());
|
||||||
|
|
||||||
auto IsBoundedIntersection =
|
|
||||||
[](QLineF::IntersectType type, QPointF p, const QLineF &segment1, const QLineF &segment2)
|
|
||||||
{
|
|
||||||
return type == QLineF::BoundedIntersection ||
|
|
||||||
(type == QLineF::UnboundedIntersection &&
|
|
||||||
VGObject::IsPointOnLineSegment(p, segment1.p1(), segment2.p1()) &&
|
|
||||||
VGObject::IsPointOnLineSegment(p, segment2.p1(), segment2.p2()));
|
|
||||||
};
|
|
||||||
|
|
||||||
bool begin = true;
|
bool begin = true;
|
||||||
|
|
||||||
if (start.angle() >= end.angle())
|
if (start.angle() >= end.angle())
|
||||||
|
@ -839,6 +836,78 @@ auto VEllipticalArc::ArcPoints(QVector<QPointF> points) const -> QVector<QPointF
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VEllipticalArc::CorrectCutLength(qreal length, qreal fullLength, const QString &pointName) const -> qreal
|
||||||
|
{
|
||||||
|
qreal len = length;
|
||||||
|
|
||||||
|
auto TooSmallWarning = [this, pointName]()
|
||||||
|
{
|
||||||
|
QString errorMsg;
|
||||||
|
if (not pointName.isEmpty())
|
||||||
|
{
|
||||||
|
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too small. Optimize it to minimal "
|
||||||
|
"value.")
|
||||||
|
.arg(name(), pointName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too small. Optimize it to minimal value.")
|
||||||
|
.arg(name());
|
||||||
|
}
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto TooBigWarning = [this, pointName]()
|
||||||
|
{
|
||||||
|
QString errorMsg;
|
||||||
|
if (not pointName.isEmpty())
|
||||||
|
{
|
||||||
|
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment (%2) is too big. Optimize it to maximal value.")
|
||||||
|
.arg(name(), pointName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorMsg = QObject::tr("Curve '%1'. Length of a cut segment is too big. Optimize it to maximal value.")
|
||||||
|
.arg(name());
|
||||||
|
}
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractApplication::warningMessageSignature + errorMsg;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!IsFlipped())
|
||||||
|
{
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
len = 0;
|
||||||
|
TooSmallWarning();
|
||||||
|
}
|
||||||
|
else if (length > fullLength)
|
||||||
|
{
|
||||||
|
len = fullLength;
|
||||||
|
TooBigWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (length < fullLength)
|
||||||
|
{
|
||||||
|
len = fullLength;
|
||||||
|
TooSmallWarning();
|
||||||
|
}
|
||||||
|
else if (length > 0)
|
||||||
|
{
|
||||||
|
len = 0;
|
||||||
|
TooBigWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief GetFormulaRadius1 return formula for major radius.
|
* @brief GetFormulaRadius1 return formula for major radius.
|
||||||
|
|
|
@ -101,9 +101,8 @@ public:
|
||||||
auto GetStartAngle() const -> qreal override;
|
auto GetStartAngle() const -> qreal override;
|
||||||
auto GetEndAngle() const -> qreal override;
|
auto GetEndAngle() const -> qreal override;
|
||||||
|
|
||||||
auto CutArc(const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2, const QString &pointName) const
|
auto CutArc(qreal length, VEllipticalArc &arc1, VEllipticalArc &arc2, const QString &pointName) const -> QPointF;
|
||||||
-> QPointF;
|
auto CutArc(qreal length, const QString &pointName) const -> QPointF;
|
||||||
auto CutArc(const qreal &length, const QString &pointName) const -> QPointF;
|
|
||||||
|
|
||||||
static auto OptimizeAngle(qreal angle) -> qreal;
|
static auto OptimizeAngle(qreal angle) -> qreal;
|
||||||
|
|
||||||
|
@ -118,6 +117,8 @@ private:
|
||||||
auto MaxLength() const -> qreal;
|
auto MaxLength() const -> qreal;
|
||||||
auto GetP(qreal angle) const -> QPointF;
|
auto GetP(qreal angle) const -> QPointF;
|
||||||
auto ArcPoints(QVector<QPointF> points) const -> QVector<QPointF>;
|
auto ArcPoints(QVector<QPointF> points) const -> QVector<QPointF>;
|
||||||
|
|
||||||
|
auto CorrectCutLength(qreal length, qreal fullLength, const QString &pointName) const -> qreal;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(VEllipticalArc) // NOLINT
|
Q_DECLARE_METATYPE(VEllipticalArc) // NOLINT
|
||||||
|
|
|
@ -304,7 +304,9 @@ auto VPointF::FlipPF(const QLineF &axis, const QPointF &point) -> QPointF
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPointF::MovePF(const QPointF &originPoint, qreal length, qreal angle) -> QPointF
|
auto VPointF::MovePF(const QPointF &originPoint, qreal length, qreal angle) -> QPointF
|
||||||
{
|
{
|
||||||
QLineF line(originPoint.x(), originPoint.y(), originPoint.x() + length, originPoint.y());
|
QLineF line;
|
||||||
line.setAngle(angle);
|
line.setP1(originPoint);
|
||||||
|
line.setAngle(angle); // First set angle then length. Length can have negative value.
|
||||||
|
line.setLength(length);
|
||||||
return line.p2();
|
return line.p2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,15 +758,14 @@ Q_DECL_RELAXED_CONSTEXPR static inline auto VFuzzyComparePossibleNulls(double p1
|
||||||
{
|
{
|
||||||
return qFuzzyIsNull(p2);
|
return qFuzzyIsNull(p2);
|
||||||
}
|
}
|
||||||
else if (qFuzzyIsNull(p2))
|
|
||||||
|
if (qFuzzyIsNull(p2))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return qFuzzyCompare(p1, p2);
|
return qFuzzyCompare(p1, p2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The CustomSA struct contains record about custom seam allowanse (SA).
|
* @brief The CustomSA struct contains record about custom seam allowanse (SA).
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
QString formula{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString formula{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString strValue{tr("Error")}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString strValue{tr("Error")}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
bool checkZero{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool checkZero{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
bool checkLessThanZero{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool checkLessThanZero{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
const VContainer *data{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
const VContainer *data{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
quint32 toolId{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
quint32 toolId{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
|
@ -142,7 +142,6 @@ auto VPieceNode::GetSABefore(const VContainer *data) const -> qreal
|
||||||
}
|
}
|
||||||
|
|
||||||
VFormula formula(d->m_formulaWidthBefore, data);
|
VFormula formula(d->m_formulaWidthBefore, data);
|
||||||
formula.setCheckZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -175,7 +174,6 @@ auto VPieceNode::GetSABefore(const VContainer *data, Unit unit) const -> qreal
|
||||||
}
|
}
|
||||||
|
|
||||||
VFormula formula(d->m_formulaWidthBefore, data);
|
VFormula formula(d->m_formulaWidthBefore, data);
|
||||||
formula.setCheckZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -229,7 +227,6 @@ auto VPieceNode::GetSAAfter(const VContainer *data) const -> qreal
|
||||||
}
|
}
|
||||||
|
|
||||||
VFormula formula(d->m_formulaWidthAfter, data);
|
VFormula formula(d->m_formulaWidthAfter, data);
|
||||||
formula.setCheckZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -263,7 +260,6 @@ auto VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const -> qreal
|
||||||
}
|
}
|
||||||
|
|
||||||
VFormula formula(d->m_formulaWidthAfter, data);
|
VFormula formula(d->m_formulaWidthAfter, data);
|
||||||
formula.setCheckZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -395,7 +391,6 @@ auto VPieceNode::GetPassmarkWidth(const VContainer *data, Unit unit) const -> qr
|
||||||
{
|
{
|
||||||
VFormula formula(d->m_formulaPassmarkWidth, data);
|
VFormula formula(d->m_formulaPassmarkWidth, data);
|
||||||
formula.setCheckZero(true);
|
formula.setCheckZero(true);
|
||||||
formula.setCheckLessThanZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -428,8 +423,6 @@ auto VPieceNode::GetPassmarkAngle(const VContainer *data) const -> qreal
|
||||||
if (d->m_manualPassmarkAngle)
|
if (d->m_manualPassmarkAngle)
|
||||||
{
|
{
|
||||||
VFormula formula(d->m_formulaPassmarkAngle, data);
|
VFormula formula(d->m_formulaPassmarkAngle, data);
|
||||||
formula.setCheckZero(false);
|
|
||||||
formula.setCheckLessThanZero(false);
|
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
|
|
@ -299,7 +299,7 @@ void AbstractTest::ComparePathsDistance(const QVector<QPointF> &ekv, const QVect
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void AbstractTest::ComparePointsDistance(const QPointF &result, const QPointF &expected, qreal testAccuracy) const
|
void AbstractTest::ComparePointsDistance(const QPointF &result, const QPointF &expected, qreal testAccuracy) const
|
||||||
{
|
{
|
||||||
const QString msg = QStringLiteral("Actual '%2;%3', Expected '%4;%5'. Distance between points %6 mm.")
|
const QString msg = QStringLiteral("Actual '%1;%2', Expected '%3;%4'. Distance between points %5 mm.")
|
||||||
.arg(result.x())
|
.arg(result.x())
|
||||||
.arg(result.y())
|
.arg(result.y())
|
||||||
.arg(expected.x())
|
.arg(expected.x())
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct FormulaData
|
||||||
QLabel *labelEditFormula{nullptr};
|
QLabel *labelEditFormula{nullptr};
|
||||||
QLabel *labelResult{nullptr};
|
QLabel *labelResult{nullptr};
|
||||||
QString postfix;
|
QString postfix;
|
||||||
bool checkZero{true};
|
bool checkZero{false};
|
||||||
bool checkLessThanZero{false};
|
bool checkLessThanZero{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@
|
||||||
|
|
||||||
#include "../../visualization/line/vistoolalongline.h"
|
#include "../../visualization/line/vistoolalongline.h"
|
||||||
#include "../../visualization/visualization.h"
|
#include "../../visualization/visualization.h"
|
||||||
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../support/dialogeditwrongformula.h"
|
#include "../support/dialogeditwrongformula.h"
|
||||||
#include "../vgeometry/../ifc/ifcdef.h"
|
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vmisc/theme/vtheme.h"
|
#include "../vmisc/theme/vtheme.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
|
@ -57,6 +57,12 @@
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
#include "ui_dialogalongline.h"
|
#include "ui_dialogalongline.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
#include "../vmisc/compatibility.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief DialogAlongLine create dialog
|
* @brief DialogAlongLine create dialog
|
||||||
|
@ -157,7 +163,6 @@ void DialogAlongLine::EvalFormula()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormula);
|
Eval(formulaData, m_flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +302,7 @@ void DialogAlongLine::ChosenSecondPoint(quint32 id, const QString &toolTip)
|
||||||
line->SetPoint2Id(id);
|
line->SetPoint2Id(id);
|
||||||
if (m_buildMidpoint)
|
if (m_buildMidpoint)
|
||||||
{
|
{
|
||||||
SetFormula(currentLength + QStringLiteral("/2"));
|
SetFormula(currentLength + "/2"_L1);
|
||||||
line->SetMode(Mode::Show);
|
line->SetMode(Mode::Show);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -525,17 +525,7 @@ void DialogArc::EvalRadius()
|
||||||
formulaData.labelResult = ui->labelResultRadius;
|
formulaData.labelResult = ui->labelResultRadius;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
const qreal radius = Eval(formulaData, m_flagRadius);
|
Eval(formulaData, m_flagRadius);
|
||||||
|
|
||||||
if (radius < 0)
|
|
||||||
{
|
|
||||||
m_flagRadius = false;
|
|
||||||
ChangeColor(ui->labelEditRadius, errorColor);
|
|
||||||
ui->labelResultRadius->setText(tr("Error"));
|
|
||||||
ui->labelResultRadius->setToolTip(tr("Radius can't be negative"));
|
|
||||||
|
|
||||||
DialogArc::CheckState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -550,7 +540,6 @@ void DialogArc::EvalF()
|
||||||
formulaData.labelEditFormula = ui->labelEditF1;
|
formulaData.labelEditFormula = ui->labelEditF1;
|
||||||
formulaData.labelResult = ui->labelResultF1;
|
formulaData.labelResult = ui->labelResultF1;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
m_angleF1 = Eval(formulaData, m_flagF1);
|
m_angleF1 = Eval(formulaData, m_flagF1);
|
||||||
|
|
||||||
|
|
|
@ -550,7 +550,6 @@ void DialogArcWithLength::EvalF()
|
||||||
formulaData.labelEditFormula = ui->labelEditF1;
|
formulaData.labelEditFormula = ui->labelEditF1;
|
||||||
formulaData.labelResult = ui->labelResultF1;
|
formulaData.labelResult = ui->labelResultF1;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagF1);
|
Eval(formulaData, m_flagF1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,6 @@ void DialogBisector::EvalFormula()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormula);
|
Eval(formulaData, m_flagFormula);
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void DialogCurveIntersectAxis::SetAngle(const QString &value)
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
||||||
|
|
||||||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->SetAngle(formulaAngle);
|
line->SetAngle(formulaAngle);
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void DialogCurveIntersectAxis::SetBasePointId(quint32 value)
|
||||||
{
|
{
|
||||||
setCurrentPointId(ui->comboBoxAxisPoint, value);
|
setCurrentPointId(ui->comboBoxAxisPoint, value);
|
||||||
|
|
||||||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->setAxisPointId(value);
|
line->setAxisPointId(value);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ void DialogCurveIntersectAxis::setCurveId(quint32 value)
|
||||||
{
|
{
|
||||||
setCurrentCurveId(ui->comboBoxCurve, value);
|
setCurrentCurveId(ui->comboBoxCurve, value);
|
||||||
|
|
||||||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
line->SetCurveId(value);
|
line->SetCurveId(value);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
number++;
|
number++;
|
||||||
line->VisualMode(id);
|
line->VisualMode(id);
|
||||||
VAbstractMainWindow *window =
|
auto *window =
|
||||||
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
@ -309,7 +309,6 @@ void DialogCurveIntersectAxis::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -323,7 +322,7 @@ void DialogCurveIntersectAxis::DeployAngleTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogCurveIntersectAxis::FXAngle()
|
void DialogCurveIntersectAxis::FXAngle()
|
||||||
{
|
{
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit angle"));
|
dialog->setWindowTitle(tr("Edit angle"));
|
||||||
dialog->SetFormula(GetAngle());
|
dialog->SetFormula(GetAngle());
|
||||||
dialog->setPostfix(degreeSymbol);
|
dialog->setPostfix(degreeSymbol);
|
||||||
|
@ -346,7 +345,7 @@ void DialogCurveIntersectAxis::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
formulaAngle = ui->plainTextEditFormula->toPlainText();
|
formulaAngle = ui->plainTextEditFormula->toPlainText();
|
||||||
|
|
||||||
VisToolCurveIntersectAxis *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
auto *line = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
|
|
||||||
line->SetCurveId(getCurveId());
|
line->SetCurveId(getCurveId());
|
||||||
|
|
|
@ -125,7 +125,6 @@ void DialogCutArc::EvalFormula()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormula);
|
Eval(formulaData, m_flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -427,11 +426,10 @@ void DialogCutArc::ShowDialog(bool click)
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(getArcId());
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(getArcId());
|
||||||
QPointF p = arc->ClosestPoint(scene->getScenePos());
|
QPointF p = arc->ClosestPoint(scene->getScenePos());
|
||||||
qreal len = arc->GetLengthByPoint(p);
|
qreal len = arc->GetLengthByPoint(p);
|
||||||
if (len > 0)
|
|
||||||
{
|
len = !arc->IsFlipped() ? qBound(0.0, len, arc->GetLength()) : qBound(arc->GetLength(), -len, 0.0);
|
||||||
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
|
SetFormula(QString::number(FromPixel(len, *data->GetPatternUnit())));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FinishCreating();
|
FinishCreating();
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,6 @@ void DialogCutSpline::EvalFormula()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormula);
|
Eval(formulaData, m_flagFormula);
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,6 @@ void DialogCutSplinePath::EvalFormula()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormula);
|
Eval(formulaData, m_flagFormula);
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,6 @@ void DialogEllipticalArc::EvalRadiuses()
|
||||||
formulaData.labelEditFormula = ui->labelEditRadius1;
|
formulaData.labelEditFormula = ui->labelEditRadius1;
|
||||||
formulaData.labelResult = ui->labelResultRadius1;
|
formulaData.labelResult = ui->labelResultRadius1;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkLessThanZero = true;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagRadius1);
|
Eval(formulaData, m_flagRadius1);
|
||||||
|
|
||||||
|
@ -420,7 +419,6 @@ void DialogEllipticalArc::EvalAngles()
|
||||||
formulaData.labelEditFormula = ui->labelEditF1;
|
formulaData.labelEditFormula = ui->labelEditF1;
|
||||||
formulaData.labelResult = ui->labelResultF1;
|
formulaData.labelResult = ui->labelResultF1;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
m_angleF1 = Eval(formulaData, m_flagF1);
|
m_angleF1 = Eval(formulaData, m_flagF1);
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,6 @@ void DialogEndLine::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle;
|
formulaData.labelEditFormula = ui->labelEditAngle;
|
||||||
formulaData.labelResult = ui->labelResultCalculationAngle;
|
formulaData.labelResult = ui->labelResultCalculationAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagError);
|
Eval(formulaData, flagError);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +154,6 @@ void DialogEndLine::EvalLength()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkLessThanZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +173,7 @@ void DialogEndLine::DeployAngleTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEndLine::FXAngle()
|
void DialogEndLine::FXAngle()
|
||||||
{
|
{
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit angle"));
|
dialog->setWindowTitle(tr("Edit angle"));
|
||||||
dialog->SetFormula(GetAngle());
|
dialog->SetFormula(GetAngle());
|
||||||
dialog->setPostfix(degreeSymbol);
|
dialog->setPostfix(degreeSymbol);
|
||||||
|
@ -189,7 +187,7 @@ void DialogEndLine::FXAngle()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEndLine::FXLength()
|
void DialogEndLine::FXLength()
|
||||||
{
|
{
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
|
@ -381,7 +379,7 @@ void DialogEndLine::SaveData()
|
||||||
formulaLength = ui->plainTextEditFormula->toPlainText();
|
formulaLength = ui->plainTextEditFormula->toPlainText();
|
||||||
formulaAngle = ui->plainTextEditAngle->toPlainText();
|
formulaAngle = ui->plainTextEditAngle->toPlainText();
|
||||||
|
|
||||||
VisToolEndLine *line = qobject_cast<VisToolEndLine *>(vis);
|
auto *line = qobject_cast<VisToolEndLine *>(vis);
|
||||||
SCASSERT(line != nullptr)
|
SCASSERT(line != nullptr)
|
||||||
|
|
||||||
line->SetBasePointId(GetBasePointId());
|
line->SetBasePointId(GetBasePointId());
|
||||||
|
|
|
@ -349,7 +349,6 @@ void DialogLineIntersectAxis::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -388,7 +387,7 @@ void DialogLineIntersectAxis::PointNameChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLineIntersectAxis::FXAngle()
|
void DialogLineIntersectAxis::FXAngle()
|
||||||
{
|
{
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit angle"));
|
dialog->setWindowTitle(tr("Edit angle"));
|
||||||
dialog->SetFormula(GetAngle());
|
dialog->SetFormula(GetAngle());
|
||||||
dialog->setPostfix(degreeSymbol);
|
dialog->setPostfix(degreeSymbol);
|
||||||
|
|
|
@ -791,7 +791,6 @@ void DialogMove::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle;
|
formulaData.labelEditFormula = ui->labelEditAngle;
|
||||||
formulaData.labelResult = ui->labelResultAngle;
|
formulaData.labelResult = ui->labelResultAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle);
|
Eval(formulaData, flagAngle);
|
||||||
|
|
||||||
|
@ -810,7 +809,6 @@ void DialogMove::EvalRotationAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditRotationAngle;
|
formulaData.labelEditFormula = ui->labelEditRotationAngle;
|
||||||
formulaData.labelResult = ui->labelResultRotationAngle;
|
formulaData.labelResult = ui->labelResultRotationAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagRotationAngle);
|
Eval(formulaData, flagRotationAngle);
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,6 @@ void DialogRotation::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle;
|
formulaData.labelEditFormula = ui->labelEditAngle;
|
||||||
formulaData.labelResult = ui->labelResultAngle;
|
formulaData.labelResult = ui->labelResultAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle);
|
Eval(formulaData, flagAngle);
|
||||||
|
|
||||||
|
|
|
@ -389,7 +389,6 @@ void DialogSpline::EvalAngle1()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle1;
|
formulaData.labelEditFormula = ui->labelEditAngle1;
|
||||||
formulaData.labelResult = ui->labelResultAngle1;
|
formulaData.labelResult = ui->labelResultAngle1;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle1);
|
Eval(formulaData, flagAngle1);
|
||||||
}
|
}
|
||||||
|
@ -403,7 +402,6 @@ void DialogSpline::EvalAngle2()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle2;
|
formulaData.labelEditFormula = ui->labelEditAngle2;
|
||||||
formulaData.labelResult = ui->labelResultAngle2;
|
formulaData.labelResult = ui->labelResultAngle2;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle2);
|
Eval(formulaData, flagAngle2);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +415,6 @@ void DialogSpline::EvalLength1()
|
||||||
formulaData.labelEditFormula = ui->labelEditLength1;
|
formulaData.labelEditFormula = ui->labelEditLength1;
|
||||||
formulaData.labelResult = ui->labelResultLength1;
|
formulaData.labelResult = ui->labelResultLength1;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagLength1);
|
Eval(formulaData, flagLength1);
|
||||||
|
@ -432,7 +429,6 @@ void DialogSpline::EvalLength2()
|
||||||
formulaData.labelEditFormula = ui->labelEditLength2;
|
formulaData.labelEditFormula = ui->labelEditLength2;
|
||||||
formulaData.labelResult = ui->labelResultLength2;
|
formulaData.labelResult = ui->labelResultLength2;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagLength2);
|
Eval(formulaData, flagLength2);
|
||||||
|
|
|
@ -574,7 +574,6 @@ void DialogSplinePath::EvalAngle1()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle1;
|
formulaData.labelEditFormula = ui->labelEditAngle1;
|
||||||
formulaData.labelResult = ui->labelResultAngle1;
|
formulaData.labelResult = ui->labelResultAngle1;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle1[row]);
|
Eval(formulaData, flagAngle1[row]);
|
||||||
|
|
||||||
|
@ -600,7 +599,6 @@ void DialogSplinePath::EvalAngle2()
|
||||||
formulaData.labelEditFormula = ui->labelEditAngle2;
|
formulaData.labelEditFormula = ui->labelEditAngle2;
|
||||||
formulaData.labelResult = ui->labelResultAngle2;
|
formulaData.labelResult = ui->labelResultAngle2;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagAngle2[row]);
|
Eval(formulaData, flagAngle2[row]);
|
||||||
|
|
||||||
|
@ -626,7 +624,6 @@ void DialogSplinePath::EvalLength1()
|
||||||
formulaData.labelEditFormula = ui->labelEditLength1;
|
formulaData.labelEditFormula = ui->labelEditLength1;
|
||||||
formulaData.labelResult = ui->labelResultLength1;
|
formulaData.labelResult = ui->labelResultLength1;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagLength1[row]);
|
Eval(formulaData, flagLength1[row]);
|
||||||
|
@ -653,7 +650,6 @@ void DialogSplinePath::EvalLength2()
|
||||||
formulaData.labelEditFormula = ui->labelEditLength2;
|
formulaData.labelEditFormula = ui->labelEditLength2;
|
||||||
formulaData.labelResult = ui->labelResultLength2;
|
formulaData.labelResult = ui->labelResultLength2;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagLength2[row]);
|
Eval(formulaData, flagLength2[row]);
|
||||||
|
|
|
@ -820,7 +820,6 @@ void DialogPiecePath::EvalWidth()
|
||||||
formulaData.labelEditFormula = ui->labelEditWidth;
|
formulaData.labelEditFormula = ui->labelEditWidth;
|
||||||
formulaData.labelResult = ui->labelResultWidth;
|
formulaData.labelResult = ui->labelResultWidth;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
m_saWidth = Eval(formulaData, m_flagFormula);
|
m_saWidth = Eval(formulaData, m_flagFormula);
|
||||||
|
@ -851,7 +850,6 @@ void DialogPiecePath::EvalWidthBefore()
|
||||||
formulaData.labelEditFormula = ui->labelEditBefore;
|
formulaData.labelEditFormula = ui->labelEditBefore;
|
||||||
formulaData.labelResult = ui->labelResultBefore;
|
formulaData.labelResult = ui->labelResultBefore;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
const QString formula = GetFormulaSAWidthBefore();
|
const QString formula = GetFormulaSAWidthBefore();
|
||||||
|
@ -886,7 +884,6 @@ void DialogPiecePath::EvalWidthAfter()
|
||||||
formulaData.labelEditFormula = ui->labelEditAfter;
|
formulaData.labelEditFormula = ui->labelEditAfter;
|
||||||
formulaData.labelResult = ui->labelResultAfter;
|
formulaData.labelResult = ui->labelResultAfter;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
const QString formula = GetFormulaSAWidthAfter();
|
const QString formula = GetFormulaSAWidthAfter();
|
||||||
|
@ -919,7 +916,6 @@ void DialogPiecePath::EvalVisible()
|
||||||
formulaData.labelEditFormula = ui->labelEditVisible;
|
formulaData.labelEditFormula = ui->labelEditVisible;
|
||||||
formulaData.labelResult = ui->labelResultVisible;
|
formulaData.labelResult = ui->labelResultVisible;
|
||||||
formulaData.postfix = QString();
|
formulaData.postfix = QString();
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormulaVisible);
|
Eval(formulaData, m_flagFormulaVisible);
|
||||||
|
@ -970,7 +966,6 @@ void DialogPiecePath::EvalPassmarkWidth()
|
||||||
formulaData.labelResult = ui->labelResultPassmarkWidth;
|
formulaData.labelResult = ui->labelResultPassmarkWidth;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = true;
|
formulaData.checkZero = true;
|
||||||
formulaData.checkLessThanZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormulaPassmarkWidth);
|
Eval(formulaData, m_flagFormulaPassmarkWidth);
|
||||||
|
|
||||||
|
@ -1000,8 +995,6 @@ void DialogPiecePath::EvalPassmarkAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditPassmarkAngle;
|
formulaData.labelEditFormula = ui->labelEditPassmarkAngle;
|
||||||
formulaData.labelResult = ui->labelResultPassmarkAngle;
|
formulaData.labelResult = ui->labelResultPassmarkAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormulaPassmarkAngle);
|
Eval(formulaData, m_flagFormulaPassmarkAngle);
|
||||||
|
|
||||||
|
@ -1078,6 +1071,8 @@ void DialogPiecePath::FXPassmarkLength()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit passmark length"));
|
dialog->setWindowTitle(tr("Edit passmark length"));
|
||||||
dialog->SetFormula(GetFormulaPassmarkLength());
|
dialog->SetFormula(GetFormulaPassmarkLength());
|
||||||
|
dialog->setCheckZero(true);
|
||||||
|
dialog->setCheckLessThanZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
@ -1091,6 +1086,7 @@ void DialogPiecePath::FXPassmarkWidth()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit passmark width"));
|
dialog->setWindowTitle(tr("Edit passmark width"));
|
||||||
dialog->SetFormula(GetFormulaPassmarkWidth());
|
dialog->SetFormula(GetFormulaPassmarkWidth());
|
||||||
|
dialog->setCheckZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -370,7 +370,6 @@ void DialogPlaceLabel::EvalAngle()
|
||||||
formulaData.labelEditFormula = ui->labelEditFormulaAngle;
|
formulaData.labelEditFormula = ui->labelEditFormulaAngle;
|
||||||
formulaData.labelResult = ui->labelResultCalculationAngle;
|
formulaData.labelResult = ui->labelResultCalculationAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, m_flagAngle);
|
Eval(formulaData, m_flagAngle);
|
||||||
}
|
}
|
||||||
|
@ -384,7 +383,6 @@ void DialogPlaceLabel::EvalVisible()
|
||||||
formulaData.labelEditFormula = ui->labelEditVisible;
|
formulaData.labelEditFormula = ui->labelEditVisible;
|
||||||
formulaData.labelResult = ui->labelResultVisible;
|
formulaData.labelResult = ui->labelResultVisible;
|
||||||
formulaData.postfix = QString();
|
formulaData.postfix = QString();
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormulaVisible);
|
Eval(formulaData, m_flagFormulaVisible);
|
||||||
|
@ -396,6 +394,7 @@ void DialogPlaceLabel::FXWidth()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit rectangle width"));
|
dialog->setWindowTitle(tr("Edit rectangle width"));
|
||||||
dialog->SetFormula(GetWidth());
|
dialog->SetFormula(GetWidth());
|
||||||
|
dialog->setCheckLessThanZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
@ -409,6 +408,7 @@ void DialogPlaceLabel::FXHeight()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit rectangle width"));
|
dialog->setWindowTitle(tr("Edit rectangle width"));
|
||||||
dialog->SetFormula(GetHeight());
|
dialog->SetFormula(GetHeight());
|
||||||
|
dialog->setCheckLessThanZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2340,7 +2340,6 @@ void DialogSeamAllowance::EvalWidth()
|
||||||
formulaData.labelEditFormula = uiTabPaths->labelEditWidth;
|
formulaData.labelEditFormula = uiTabPaths->labelEditWidth;
|
||||||
formulaData.labelResult = uiTabPaths->labelResultWidth;
|
formulaData.labelResult = uiTabPaths->labelResultWidth;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
m_saWidth = Eval(formulaData, flagFormula);
|
m_saWidth = Eval(formulaData, flagFormula);
|
||||||
|
@ -2373,7 +2372,6 @@ void DialogSeamAllowance::EvalWidthBefore()
|
||||||
formulaData.labelEditFormula = uiTabPaths->labelEditBefore;
|
formulaData.labelEditFormula = uiTabPaths->labelEditBefore;
|
||||||
formulaData.labelResult = uiTabPaths->labelResultBefore;
|
formulaData.labelResult = uiTabPaths->labelResultBefore;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagFormulaBefore);
|
Eval(formulaData, flagFormulaBefore);
|
||||||
|
@ -2404,7 +2402,6 @@ void DialogSeamAllowance::EvalWidthAfter()
|
||||||
formulaData.labelEditFormula = uiTabPaths->labelEditAfter;
|
formulaData.labelEditFormula = uiTabPaths->labelEditAfter;
|
||||||
formulaData.labelResult = uiTabPaths->labelResultAfter;
|
formulaData.labelResult = uiTabPaths->labelResultAfter;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagFormulaAfter);
|
Eval(formulaData, flagFormulaAfter);
|
||||||
|
@ -2465,7 +2462,6 @@ void DialogSeamAllowance::EvalPassmarkWidth()
|
||||||
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkWidth;
|
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkWidth;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = true;
|
formulaData.checkZero = true;
|
||||||
formulaData.checkLessThanZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagFormulaPassmarkWidth);
|
Eval(formulaData, flagFormulaPassmarkWidth);
|
||||||
|
|
||||||
|
@ -2493,8 +2489,6 @@ void DialogSeamAllowance::EvalPassmarkAngle()
|
||||||
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkAngle;
|
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkAngle;
|
||||||
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkAngle;
|
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkAngle;
|
||||||
formulaData.postfix = degreeSymbol;
|
formulaData.postfix = degreeSymbol;
|
||||||
formulaData.checkZero = false;
|
|
||||||
formulaData.checkLessThanZero = false;
|
|
||||||
|
|
||||||
Eval(formulaData, flagFormulaPassmarkAngle);
|
Eval(formulaData, flagFormulaPassmarkAngle);
|
||||||
|
|
||||||
|
@ -2557,6 +2551,8 @@ void DialogSeamAllowance::FXPassmarkLength()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit passmark length"));
|
dialog->setWindowTitle(tr("Edit passmark length"));
|
||||||
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength));
|
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength));
|
||||||
|
dialog->setCheckLessThanZero(true);
|
||||||
|
dialog->setCheckZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
@ -2570,6 +2566,7 @@ void DialogSeamAllowance::FXPassmarkWidth()
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
dialog->setWindowTitle(tr("Edit passmark width"));
|
dialog->setWindowTitle(tr("Edit passmark width"));
|
||||||
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkWidth));
|
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkWidth));
|
||||||
|
dialog->setCheckZero(true);
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -935,6 +935,7 @@ auto VAbstractOperation::ComplexPointToolTip(quint32 itemId) const -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral("<table>"
|
return QStringLiteral("<table>"
|
||||||
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||||
|
"<tr> <td colspan=\"100%\"><hr/></td> </tr>"
|
||||||
"%3"
|
"%3"
|
||||||
"</table>")
|
"</table>")
|
||||||
.arg(tr("Label"), VAbstractTool::data.GetGObject(itemId)->name(), MakeToolTip());
|
.arg(tr("Label"), VAbstractTool::data.GetGObject(itemId)->name(), MakeToolTip());
|
||||||
|
@ -948,6 +949,7 @@ auto VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const -> QString
|
||||||
const QString toolTip = u"<table>"
|
const QString toolTip = u"<table>"
|
||||||
u"<tr> <td><b>%1:</b> %2</td> </tr>"
|
u"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||||
u"<tr> <td><b>%3:</b> %4 %5</td> </tr>"
|
u"<tr> <td><b>%3:</b> %4 %5</td> </tr>"
|
||||||
|
u"<tr> <td colspan=\"100%\"><hr/></td> </tr>"
|
||||||
u"%6"
|
u"%6"
|
||||||
u"</table>"_s.arg(tr("Label"), curve->ObjectName(), tr("Length"))
|
u"</table>"_s.arg(tr("Label"), curve->ObjectName(), tr("Length"))
|
||||||
.arg(VAbstractValApplication::VApp()->fromPixel(curve->GetLength()))
|
.arg(VAbstractValApplication::VApp()->fromPixel(curve->GetLength()))
|
||||||
|
|
|
@ -77,7 +77,7 @@ auto GetOriginPoint(const QVector<SourceItem> &objects, const VContainer *data,
|
||||||
{
|
{
|
||||||
QPolygonF originObjects;
|
QPolygonF originObjects;
|
||||||
|
|
||||||
for (auto object : objects)
|
for (const auto &object : objects)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VGObject> obj = data->GetGObject(object.id);
|
const QSharedPointer<VGObject> obj = data->GetGObject(object.id);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
|
||||||
|
|
||||||
initData.id = initData.data->getNextId(); // Just reserve id for tool
|
initData.id = initData.data->getNextId(); // Just reserve id for tool
|
||||||
|
|
||||||
for (auto object : qAsConst(initData.source))
|
for (const auto &object : qAsConst(initData.source))
|
||||||
{
|
{
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(object.id);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(object.id);
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
|
||||||
}
|
}
|
||||||
|
|
||||||
VAbstractTool::AddRecord(initData.id, Tool::Move, initData.doc);
|
VAbstractTool::AddRecord(initData.id, Tool::Move, initData.doc);
|
||||||
VToolMove *tool = new VToolMove(initData);
|
auto *tool = new VToolMove(initData);
|
||||||
initData.scene->addItem(tool);
|
initData.scene->addItem(tool);
|
||||||
InitOperationToolConnections(initData.scene, tool);
|
InitOperationToolConnections(initData.scene, tool);
|
||||||
VAbstractPattern::AddTool(initData.id, tool);
|
VAbstractPattern::AddTool(initData.id, tool);
|
||||||
|
@ -324,7 +324,7 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
|
||||||
initData.doc->IncrementReferens(originPoint->getIdTool());
|
initData.doc->IncrementReferens(originPoint->getIdTool());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto object : qAsConst(initData.source))
|
for (const auto &object : qAsConst(initData.source))
|
||||||
{
|
{
|
||||||
initData.doc->IncrementReferens(initData.data->GetGObject(object.id)->getIdTool());
|
initData.doc->IncrementReferens(initData.data->GetGObject(object.id)->getIdTool());
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,6 @@ auto VToolMove::Create(VToolMoveInitData &initData) -> VToolMove *
|
||||||
auto VToolMove::GetFormulaAngle() const -> VFormula
|
auto VToolMove::GetFormulaAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaAngle, getData());
|
VFormula fAngle(formulaAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
@ -354,7 +353,7 @@ auto VToolMove::GetFormulaAngle() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolMove::SetFormulaAngle(const VFormula &value)
|
void VToolMove::SetFormulaAngle(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
formulaAngle = value.GetFormula(FormulaType::FromUser);
|
formulaAngle = value.GetFormula(FormulaType::FromUser);
|
||||||
|
|
||||||
|
@ -367,7 +366,6 @@ void VToolMove::SetFormulaAngle(const VFormula &value)
|
||||||
auto VToolMove::GetFormulaRotationAngle() const -> VFormula
|
auto VToolMove::GetFormulaRotationAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaRotationAngle, getData());
|
VFormula fAngle(formulaRotationAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
@ -377,7 +375,7 @@ auto VToolMove::GetFormulaRotationAngle() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolMove::SetFormulaRotationAngle(const VFormula &value)
|
void VToolMove::SetFormulaRotationAngle(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
formulaRotationAngle = value.GetFormula(FormulaType::FromUser);
|
formulaRotationAngle = value.GetFormula(FormulaType::FromUser);
|
||||||
|
|
||||||
|
@ -390,7 +388,6 @@ void VToolMove::SetFormulaRotationAngle(const VFormula &value)
|
||||||
auto VToolMove::GetFormulaLength() const -> VFormula
|
auto VToolMove::GetFormulaLength() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fLength(formulaLength, getData());
|
VFormula fLength(formulaLength, getData());
|
||||||
fLength.setCheckZero(true);
|
|
||||||
fLength.setToolId(m_id);
|
fLength.setToolId(m_id);
|
||||||
fLength.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
fLength.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
fLength.Eval();
|
fLength.Eval();
|
||||||
|
@ -493,10 +490,10 @@ void VToolMove::ReadToolAttributes(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
VAbstractOperation::ReadToolAttributes(domElement);
|
VAbstractOperation::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
origPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
|
origPointId = VDomDocument::GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
|
||||||
formulaAngle = doc->GetParametrString(domElement, AttrAngle, QChar('0'));
|
formulaAngle = VDomDocument::GetParametrString(domElement, AttrAngle, QChar('0'));
|
||||||
formulaRotationAngle = doc->GetParametrString(domElement, AttrRotationAngle, QChar('0'));
|
formulaRotationAngle = VDomDocument::GetParametrString(domElement, AttrRotationAngle, QChar('0'));
|
||||||
formulaLength = doc->GetParametrString(domElement, AttrLength, QChar('0'));
|
formulaLength = VDomDocument::GetParametrString(domElement, AttrLength, QChar('0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -527,8 +524,8 @@ auto VToolMove::MakeToolTip() const -> QString
|
||||||
tr("Rotation angle")) // 6
|
tr("Rotation angle")) // 6
|
||||||
.arg(GetFormulaRotationAngle().getDoubleValue()) // 7
|
.arg(GetFormulaRotationAngle().getDoubleValue()) // 7
|
||||||
.arg(tr("Rotation origin point"), // 8
|
.arg(tr("Rotation origin point"), // 8
|
||||||
OriginPointName()) // 9
|
OriginPointName(), // 9
|
||||||
.arg(VisibilityGroupToolTip()); // 10
|
VisibilityGroupToolTip()); // 10
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -286,7 +286,6 @@ auto VToolRotation::OriginPointName() const -> QString
|
||||||
auto VToolRotation::GetFormulaAngle() const -> VFormula
|
auto VToolRotation::GetFormulaAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaAngle, getData());
|
VFormula fAngle(formulaAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
|
|
@ -207,8 +207,6 @@ auto VToolArc::GetFormulaRadius() const -> VFormula
|
||||||
void VToolArc::SetFormulaRadius(const VFormula &value)
|
void VToolArc::SetFormulaRadius(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (!value.error())
|
if (!value.error())
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0) // Formula don't check this, but radius can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
||||||
|
@ -216,7 +214,6 @@ void VToolArc::SetFormulaRadius(const VFormula &value)
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolArc::GetFormulaF1() const -> VFormula
|
auto VToolArc::GetFormulaF1() const -> VFormula
|
||||||
|
@ -225,7 +222,6 @@ auto VToolArc::GetFormulaF1() const -> VFormula
|
||||||
SCASSERT(arc.isNull() == false)
|
SCASSERT(arc.isNull() == false)
|
||||||
|
|
||||||
VFormula f1(arc->GetFormulaF1(), getData());
|
VFormula f1(arc->GetFormulaF1(), getData());
|
||||||
f1.setCheckZero(false);
|
|
||||||
f1.setToolId(m_id);
|
f1.setToolId(m_id);
|
||||||
f1.setPostfix(degreeSymbol);
|
f1.setPostfix(degreeSymbol);
|
||||||
f1.Eval();
|
f1.Eval();
|
||||||
|
@ -252,7 +248,6 @@ auto VToolArc::GetFormulaF2() const -> VFormula
|
||||||
SCASSERT(arc.isNull() == false)
|
SCASSERT(arc.isNull() == false)
|
||||||
|
|
||||||
VFormula f2(arc->GetFormulaF2(), getData());
|
VFormula f2(arc->GetFormulaF2(), getData());
|
||||||
f2.setCheckZero(false);
|
|
||||||
f2.setToolId(m_id);
|
f2.setToolId(m_id);
|
||||||
f2.setPostfix(degreeSymbol);
|
f2.setPostfix(degreeSymbol);
|
||||||
f2.Eval();
|
f2.Eval();
|
||||||
|
|
|
@ -178,7 +178,6 @@ auto VToolArcWithLength::GetFormulaRadius() const -> VFormula
|
||||||
SCASSERT(arc.isNull() == false)
|
SCASSERT(arc.isNull() == false)
|
||||||
|
|
||||||
VFormula radius(arc->GetFormulaRadius(), getData());
|
VFormula radius(arc->GetFormulaRadius(), getData());
|
||||||
radius.setCheckZero(true);
|
|
||||||
radius.setToolId(m_id);
|
radius.setToolId(m_id);
|
||||||
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius.Eval();
|
radius.Eval();
|
||||||
|
@ -189,8 +188,6 @@ auto VToolArcWithLength::GetFormulaRadius() const -> VFormula
|
||||||
void VToolArcWithLength::SetFormulaRadius(const VFormula &value)
|
void VToolArcWithLength::SetFormulaRadius(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (value.error() == false)
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0) // Formula don't check this, but radius can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
||||||
|
@ -198,7 +195,6 @@ void VToolArcWithLength::SetFormulaRadius(const VFormula &value)
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolArcWithLength::GetFormulaF1() const -> VFormula
|
auto VToolArcWithLength::GetFormulaF1() const -> VFormula
|
||||||
|
@ -207,7 +203,6 @@ auto VToolArcWithLength::GetFormulaF1() const -> VFormula
|
||||||
SCASSERT(arc.isNull() == false)
|
SCASSERT(arc.isNull() == false)
|
||||||
|
|
||||||
VFormula f1(arc->GetFormulaF1(), getData());
|
VFormula f1(arc->GetFormulaF1(), getData());
|
||||||
f1.setCheckZero(false);
|
|
||||||
f1.setToolId(m_id);
|
f1.setToolId(m_id);
|
||||||
f1.setPostfix(degreeSymbol);
|
f1.setPostfix(degreeSymbol);
|
||||||
f1.Eval();
|
f1.Eval();
|
||||||
|
|
|
@ -206,7 +206,6 @@ auto VToolEllipticalArc::GetFormulaRadius1() const -> VFormula
|
||||||
SCASSERT(elArc.isNull() == false)
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
|
||||||
VFormula radius1(elArc->GetFormulaRadius1(), getData());
|
VFormula radius1(elArc->GetFormulaRadius1(), getData());
|
||||||
radius1.setCheckZero(true);
|
|
||||||
radius1.setToolId(m_id);
|
radius1.setToolId(m_id);
|
||||||
radius1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius1.Eval();
|
radius1.Eval();
|
||||||
|
@ -216,9 +215,7 @@ auto VToolEllipticalArc::GetFormulaRadius1() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value)
|
void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0) // Formula don't check this, but radius1 can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
||||||
|
@ -226,7 +223,6 @@ void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value)
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolEllipticalArc::GetFormulaRadius2() const -> VFormula
|
auto VToolEllipticalArc::GetFormulaRadius2() const -> VFormula
|
||||||
|
@ -235,7 +231,6 @@ auto VToolEllipticalArc::GetFormulaRadius2() const -> VFormula
|
||||||
SCASSERT(elArc.isNull() == false)
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
|
||||||
VFormula radius2(elArc->GetFormulaRadius2(), getData());
|
VFormula radius2(elArc->GetFormulaRadius2(), getData());
|
||||||
radius2.setCheckZero(true);
|
|
||||||
radius2.setToolId(m_id);
|
radius2.setToolId(m_id);
|
||||||
radius2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius2.Eval();
|
radius2.Eval();
|
||||||
|
@ -245,9 +240,7 @@ auto VToolEllipticalArc::GetFormulaRadius2() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value)
|
void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0) // Formula don't check this, but radius2 can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
||||||
|
@ -255,7 +248,6 @@ void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value)
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolEllipticalArc::GetFormulaF1() const -> VFormula
|
auto VToolEllipticalArc::GetFormulaF1() const -> VFormula
|
||||||
|
@ -264,7 +256,6 @@ auto VToolEllipticalArc::GetFormulaF1() const -> VFormula
|
||||||
SCASSERT(elArc.isNull() == false)
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
|
||||||
VFormula f1(elArc->GetFormulaF1(), getData());
|
VFormula f1(elArc->GetFormulaF1(), getData());
|
||||||
f1.setCheckZero(false);
|
|
||||||
f1.setToolId(m_id);
|
f1.setToolId(m_id);
|
||||||
f1.setPostfix(degreeSymbol);
|
f1.setPostfix(degreeSymbol);
|
||||||
f1.Eval();
|
f1.Eval();
|
||||||
|
@ -274,7 +265,7 @@ auto VToolEllipticalArc::GetFormulaF1() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEllipticalArc::SetFormulaF1(const VFormula &value)
|
void VToolEllipticalArc::SetFormulaF1(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
||||||
|
@ -290,7 +281,6 @@ auto VToolEllipticalArc::GetFormulaF2() const -> VFormula
|
||||||
SCASSERT(elArc.isNull() == false)
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
|
||||||
VFormula f2(elArc->GetFormulaF2(), getData());
|
VFormula f2(elArc->GetFormulaF2(), getData());
|
||||||
f2.setCheckZero(false);
|
|
||||||
f2.setToolId(m_id);
|
f2.setToolId(m_id);
|
||||||
f2.setPostfix(degreeSymbol);
|
f2.setPostfix(degreeSymbol);
|
||||||
f2.Eval();
|
f2.Eval();
|
||||||
|
@ -300,7 +290,7 @@ auto VToolEllipticalArc::GetFormulaF2() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEllipticalArc::SetFormulaF2(const VFormula &value)
|
void VToolEllipticalArc::SetFormulaF2(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
||||||
|
@ -316,7 +306,6 @@ auto VToolEllipticalArc::GetFormulaRotationAngle() const -> VFormula
|
||||||
SCASSERT(elArc.isNull() == false)
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
|
||||||
VFormula rotationAngle(elArc->GetFormulaRotationAngle(), getData());
|
VFormula rotationAngle(elArc->GetFormulaRotationAngle(), getData());
|
||||||
rotationAngle.setCheckZero(false);
|
|
||||||
rotationAngle.setToolId(m_id);
|
rotationAngle.setToolId(m_id);
|
||||||
rotationAngle.setPostfix(degreeSymbol);
|
rotationAngle.setPostfix(degreeSymbol);
|
||||||
rotationAngle.Eval();
|
rotationAngle.Eval();
|
||||||
|
@ -326,7 +315,7 @@ auto VToolEllipticalArc::GetFormulaRotationAngle() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value)
|
void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
||||||
|
|
|
@ -215,7 +215,6 @@ auto VToolCurveIntersectAxis::FindPoint(const QPointF &point, qreal angle, const
|
||||||
auto VToolCurveIntersectAxis::GetFormulaAngle() const -> VFormula
|
auto VToolCurveIntersectAxis::GetFormulaAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaAngle, getData());
|
VFormula fAngle(formulaAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
|
|
@ -35,8 +35,10 @@
|
||||||
|
|
||||||
#include "../../../../../dialogs/tools/dialogendline.h"
|
#include "../../../../../dialogs/tools/dialogendline.h"
|
||||||
#include "../../../../../dialogs/tools/dialogtool.h"
|
#include "../../../../../dialogs/tools/dialogtool.h"
|
||||||
#include "../../../../../visualization/visualization.h"
|
|
||||||
#include "../../../../../visualization/line/vistoolendline.h"
|
#include "../../../../../visualization/line/vistoolendline.h"
|
||||||
|
#include "../../../../../visualization/visualization.h"
|
||||||
|
#include "../../../../vabstracttool.h"
|
||||||
|
#include "../../../vdrawtool.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
|
@ -45,8 +47,6 @@
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vpatterndb/vtranslatevars.h"
|
#include "../vpatterndb/vtranslatevars.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../../../../vabstracttool.h"
|
|
||||||
#include "../../../vdrawtool.h"
|
|
||||||
#include "vtoollinepoint.h"
|
#include "vtoollinepoint.h"
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
@ -136,8 +136,8 @@ auto VToolEndLine::Create(VToolEndLineInitData &initData) -> VToolEndLine *
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*basePoint), QPointF(basePoint->x() + 100, basePoint->y()));
|
QLineF line = QLineF(static_cast<QPointF>(*basePoint), QPointF(basePoint->x() + 100, basePoint->y()));
|
||||||
|
|
||||||
line.setAngle(CheckFormula(initData.id, initData.formulaAngle, initData.data)); // First set angle.
|
line.setAngle(CheckFormula(initData.id, initData.formulaAngle, initData.data)); // First set angle.
|
||||||
line.setLength(VAbstractValApplication::VApp()
|
line.setLength(
|
||||||
->toPixel(CheckFormula(initData.id, initData.formulaLength, initData.data)));
|
VAbstractValApplication::VApp()->toPixel(CheckFormula(initData.id, initData.formulaLength, initData.data)));
|
||||||
|
|
||||||
VPointF *p = new VPointF(line.p2(), initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(line.p2(), initData.name, initData.mx, initData.my);
|
||||||
p->SetShowLabel(initData.showLabel);
|
p->SetShowLabel(initData.showLabel);
|
||||||
|
@ -174,8 +174,7 @@ auto VToolEndLine::Create(VToolEndLineInitData &initData) -> VToolEndLine *
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolEndLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
void VToolEndLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
|
||||||
QList<quint32> &newDependencies)
|
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
const QPointer<DialogEndLine> dialogTool = qobject_cast<DialogEndLine *>(m_dialog);
|
const QPointer<DialogEndLine> dialogTool = qobject_cast<DialogEndLine *>(m_dialog);
|
||||||
|
@ -241,7 +240,6 @@ void VToolEndLine::SetVisualization()
|
||||||
auto VToolEndLine::GetFormulaAngle() const -> VFormula
|
auto VToolEndLine::GetFormulaAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaAngle, getData());
|
VFormula fAngle(formulaAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
|
|
@ -221,7 +221,6 @@ auto VToolLineIntersectAxis::SecondLinePoint() const -> QString
|
||||||
auto VToolLineIntersectAxis::GetFormulaAngle() const -> VFormula
|
auto VToolLineIntersectAxis::GetFormulaAngle() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fAngle(formulaAngle, getData());
|
VFormula fAngle(formulaAngle, getData());
|
||||||
fAngle.setCheckZero(false);
|
|
||||||
fAngle.setToolId(m_id);
|
fAngle.setToolId(m_id);
|
||||||
fAngle.setPostfix(degreeSymbol);
|
fAngle.setPostfix(degreeSymbol);
|
||||||
fAngle.Eval();
|
fAngle.Eval();
|
||||||
|
|
|
@ -226,7 +226,6 @@ void VToolLinePoint::SetLineColor(const QString &value)
|
||||||
auto VToolLinePoint::GetFormulaLength() const -> VFormula
|
auto VToolLinePoint::GetFormulaLength() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula fLength(formulaLength, this->getData());
|
VFormula fLength(formulaLength, this->getData());
|
||||||
fLength.setCheckZero(false);
|
|
||||||
fLength.setToolId(m_id);
|
fLength.setToolId(m_id);
|
||||||
fLength.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
fLength.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
fLength.Eval();
|
fLength.Eval();
|
||||||
|
@ -237,7 +236,7 @@ auto VToolLinePoint::GetFormulaLength() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLinePoint::SetFormulaLength(const VFormula &value)
|
void VToolLinePoint::SetFormulaLength(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
{
|
||||||
formulaLength = value.GetFormula(FormulaType::FromUser);
|
formulaLength = value.GetFormula(FormulaType::FromUser);
|
||||||
|
|
||||||
|
|
|
@ -33,20 +33,20 @@
|
||||||
|
|
||||||
#include "../../../../dialogs/tools/dialogpointfromcircleandtangent.h"
|
#include "../../../../dialogs/tools/dialogpointfromcircleandtangent.h"
|
||||||
#include "../../../../dialogs/tools/dialogtool.h"
|
#include "../../../../dialogs/tools/dialogtool.h"
|
||||||
#include "../../../../visualization/visualization.h"
|
|
||||||
#include "../../../../visualization/line/vistoolpointfromcircleandtangent.h"
|
#include "../../../../visualization/line/vistoolpointfromcircleandtangent.h"
|
||||||
|
#include "../../../../visualization/visualization.h"
|
||||||
|
#include "../../../vabstracttool.h"
|
||||||
|
#include "../../vdrawtool.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../vgeometry/vgobject.h"
|
#include "../vgeometry/vgobject.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vpatterndb/vformula.h"
|
#include "../vpatterndb/vformula.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../../../vabstracttool.h"
|
|
||||||
#include "../../vdrawtool.h"
|
|
||||||
#include "vtoolsinglepoint.h"
|
#include "vtoolsinglepoint.h"
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
@ -121,20 +121,22 @@ auto VToolPointFromCircleAndTangent::Create(VToolPointFromCircleAndTangentInitDa
|
||||||
const VPointF tPoint = *initData.data->GeometricObject<VPointF>(initData.tangentPointId);
|
const VPointF tPoint = *initData.data->GeometricObject<VPointF>(initData.tangentPointId);
|
||||||
|
|
||||||
QPointF point;
|
QPointF point;
|
||||||
const bool success = VToolPointFromCircleAndTangent::FindPoint(static_cast<QPointF>(tPoint),
|
const bool success = VToolPointFromCircleAndTangent::FindPoint(
|
||||||
static_cast<QPointF>(cPoint), radius,
|
static_cast<QPointF>(tPoint), static_cast<QPointF>(cPoint), radius, initData.crossPoint, &point);
|
||||||
initData.crossPoint, &point);
|
|
||||||
if (not success)
|
if (not success)
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Tangent to circle with center '%2' and radius '%3' "
|
const QString errorMsg = tr("Error calculating point '%1'. Tangent to circle with center '%2' and radius '%3' "
|
||||||
"from point '%4' cannot be found")
|
"from point '%4' cannot be found")
|
||||||
.arg(initData.name, cPoint.name()).arg(radius).arg(tPoint.name());
|
.arg(initData.name, cPoint.name())
|
||||||
|
.arg(radius)
|
||||||
|
.arg(tPoint.name());
|
||||||
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
? throw VExceptionObjectError(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
auto *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
p->SetShowLabel(initData.showLabel);
|
p->SetShowLabel(initData.showLabel);
|
||||||
|
|
||||||
if (initData.typeCreation == Source::FromGui)
|
if (initData.typeCreation == Source::FromGui)
|
||||||
|
@ -153,7 +155,7 @@ auto VToolPointFromCircleAndTangent::Create(VToolPointFromCircleAndTangentInitDa
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(initData.id, Tool::PointFromCircleAndTangent, initData.doc);
|
VAbstractTool::AddRecord(initData.id, Tool::PointFromCircleAndTangent, initData.doc);
|
||||||
VToolPointFromCircleAndTangent *point = new VToolPointFromCircleAndTangent(initData);
|
auto *point = new VToolPointFromCircleAndTangent(initData);
|
||||||
initData.scene->addItem(point);
|
initData.scene->addItem(point);
|
||||||
InitToolConnections(initData.scene, point);
|
InitToolConnections(initData.scene, point);
|
||||||
VAbstractPattern::AddTool(initData.id, point);
|
VAbstractPattern::AddTool(initData.id, point);
|
||||||
|
@ -171,7 +173,7 @@ auto VToolPointFromCircleAndTangent::FindPoint(const QPointF &p, const QPointF &
|
||||||
SCASSERT(intersectionPoint != nullptr)
|
SCASSERT(intersectionPoint != nullptr)
|
||||||
|
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
const int res = VGObject::ContactPoints (p, center, radius, p1, p2);
|
const int res = VGObject::ContactPoints(p, center, qAbs(radius), p1, p2);
|
||||||
|
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
|
@ -215,15 +217,12 @@ auto VToolPointFromCircleAndTangent::GetCircleRadius() const -> VFormula
|
||||||
void VToolPointFromCircleAndTangent::SetCircleRadius(const VFormula &value)
|
void VToolPointFromCircleAndTangent::SetCircleRadius(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
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);
|
circleRadius = value.GetFormula(FormulaType::FromUser);
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const -> CrossCirclesPoint
|
auto VToolPointFromCircleAndTangent::GetCrossCirclesPoint() const -> CrossCirclesPoint
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
#ifndef VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
||||||
#define VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
#define VTOOLPOINTFROMCIRCLEANDTANGENT_H
|
||||||
|
|
||||||
|
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
@ -53,7 +52,8 @@ struct VToolPointFromCircleAndTangentInitData : VToolSinglePointInitData
|
||||||
circleRadius('0'),
|
circleRadius('0'),
|
||||||
tangentPointId(NULL_ID),
|
tangentPointId(NULL_ID),
|
||||||
crossPoint(CrossCirclesPoint::FirstPoint)
|
crossPoint(CrossCirclesPoint::FirstPoint)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
quint32 circleCenterId;
|
quint32 circleCenterId;
|
||||||
QString circleRadius;
|
QString circleRadius;
|
||||||
|
@ -64,6 +64,7 @@ struct VToolPointFromCircleAndTangentInitData : VToolSinglePointInitData
|
||||||
class VToolPointFromCircleAndTangent : public VToolSinglePoint
|
class VToolPointFromCircleAndTangent : public VToolSinglePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetDialog() override;
|
virtual void SetDialog() override;
|
||||||
static auto Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
static auto Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
|
@ -73,7 +74,10 @@ public:
|
||||||
QPointF *intersectionPoint) -> bool;
|
QPointF *intersectionPoint) -> bool;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual auto type() const -> int override { return Type; }
|
virtual auto type() const -> int override { return Type; }
|
||||||
enum { Type = UserType + static_cast<int>(Tool::PointFromCircleAndTangent) };
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Tool::PointFromCircleAndTangent)
|
||||||
|
};
|
||||||
|
|
||||||
auto TangentPointName() const -> QString;
|
auto TangentPointName() const -> QString;
|
||||||
auto CircleCenterPointName() const -> QString;
|
auto CircleCenterPointName() const -> QString;
|
||||||
|
@ -87,6 +91,7 @@ public:
|
||||||
virtual void ShowVisualization(bool show) override;
|
virtual void ShowVisualization(bool show) override;
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id = NULL_ID) override;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id = NULL_ID) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() override;
|
virtual void RemoveReferens() override;
|
||||||
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
@ -94,6 +99,7 @@ protected:
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
||||||
virtual void SetVisualization() override;
|
virtual void SetVisualization() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VToolPointFromCircleAndTangent) // NOLINT
|
Q_DISABLE_COPY_MOVE(VToolPointFromCircleAndTangent) // NOLINT
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ auto VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q
|
||||||
SCASSERT(intersectionPoint != nullptr)
|
SCASSERT(intersectionPoint != nullptr)
|
||||||
|
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
qint32 res = VGObject::LineIntersectCircle(center, radius, QLineF(firstPoint, secondPoint), p1, p2);
|
qint32 res = VGObject::LineIntersectCircle(center, qAbs(radius), QLineF(firstPoint, secondPoint), p1, p2);
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -126,8 +126,7 @@ auto VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q
|
||||||
{
|
{
|
||||||
const bool flagP1 = VGObject::IsPointOnLineSegment(p1, firstPoint, secondPoint);
|
const bool flagP1 = VGObject::IsPointOnLineSegment(p1, firstPoint, secondPoint);
|
||||||
const bool flagP2 = VGObject::IsPointOnLineSegment(p2, firstPoint, secondPoint);
|
const bool flagP2 = VGObject::IsPointOnLineSegment(p2, firstPoint, secondPoint);
|
||||||
if ((flagP1 == true && flagP2 == true) ||
|
if ((flagP1 && flagP2) || (!flagP1 && !flagP2) /*In case we have something wrong*/)
|
||||||
(flagP1 == false && flagP2 == false) /*In case we have something wrong*/)
|
|
||||||
{
|
{
|
||||||
// We don't have options for choosing correct point. Use closest to segment first point.
|
// We don't have options for choosing correct point. Use closest to segment first point.
|
||||||
if (QLineF(firstPoint, p1).length() <= QLineF(firstPoint, p2).length())
|
if (QLineF(firstPoint, p1).length() <= QLineF(firstPoint, p2).length())
|
||||||
|
@ -139,8 +138,8 @@ auto VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q
|
||||||
*intersectionPoint = p2;
|
*intersectionPoint = p2;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{ // In this case we have one real and one theoretical intersection.
|
// In this case we have one real and one theoretical intersection.
|
||||||
if (flagP1)
|
if (flagP1)
|
||||||
{
|
{
|
||||||
*intersectionPoint = p1;
|
*intersectionPoint = p1;
|
||||||
|
@ -150,7 +149,6 @@ auto VToolPointOfContact::FindPoint(qreal radius, const QPointF ¢er, const Q
|
||||||
*intersectionPoint = p2;
|
*intersectionPoint = p2;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
qDebug() << "Unxpected value" << res;
|
qDebug() << "Unxpected value" << res;
|
||||||
break;
|
break;
|
||||||
|
@ -417,7 +415,6 @@ void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event,
|
||||||
auto VToolPointOfContact::getArcRadius() const -> VFormula
|
auto VToolPointOfContact::getArcRadius() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula radius(arcRadius, this->getData());
|
VFormula radius(arcRadius, this->getData());
|
||||||
radius.setCheckZero(true);
|
|
||||||
radius.setToolId(m_id);
|
radius.setToolId(m_id);
|
||||||
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius.Eval();
|
radius.Eval();
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VTOOLPOINTOFCONTACT_H
|
#ifndef VTOOLPOINTOFCONTACT_H
|
||||||
#define VTOOLPOINTOFCONTACT_H
|
#define VTOOLPOINTOFCONTACT_H
|
||||||
|
|
||||||
|
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
@ -53,7 +52,8 @@ struct VToolPointOfContactInitData : VToolSinglePointInitData
|
||||||
center(NULL_ID),
|
center(NULL_ID),
|
||||||
firstPointId(NULL_ID),
|
firstPointId(NULL_ID),
|
||||||
secondPointId(NULL_ID)
|
secondPointId(NULL_ID)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QString radius;
|
QString radius;
|
||||||
quint32 center;
|
quint32 center;
|
||||||
|
@ -67,6 +67,7 @@ struct VToolPointOfContactInitData : VToolSinglePointInitData
|
||||||
class VToolPointOfContact : public VToolSinglePoint
|
class VToolPointOfContact : public VToolSinglePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void SetDialog() override;
|
virtual void SetDialog() override;
|
||||||
static auto FindPoint(qreal radius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint,
|
static auto FindPoint(qreal radius, const QPointF ¢er, const QPointF &firstPoint, const QPointF &secondPoint,
|
||||||
|
@ -76,7 +77,10 @@ public:
|
||||||
static auto Create(VToolPointOfContactInitData &initData) -> VToolPointOfContact *;
|
static auto Create(VToolPointOfContactInitData &initData) -> VToolPointOfContact *;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual auto type() const -> int override { return Type; }
|
virtual auto type() const -> int override { return Type; }
|
||||||
enum { Type = UserType + static_cast<int>(Tool::PointOfContact) };
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Tool::PointOfContact)
|
||||||
|
};
|
||||||
|
|
||||||
auto ArcCenterPointName() const -> QString;
|
auto ArcCenterPointName() const -> QString;
|
||||||
auto FirstPointName() const -> QString;
|
auto FirstPointName() const -> QString;
|
||||||
|
@ -88,6 +92,7 @@ public:
|
||||||
virtual void ShowVisualization(bool show) override;
|
virtual void ShowVisualization(bool show) override;
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id = NULL_ID) override;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id = NULL_ID) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() override;
|
virtual void RemoveReferens() override;
|
||||||
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
|
|
@ -33,20 +33,20 @@
|
||||||
|
|
||||||
#include "../../../../dialogs/tools/dialogpointofintersectioncircles.h"
|
#include "../../../../dialogs/tools/dialogpointofintersectioncircles.h"
|
||||||
#include "../../../../dialogs/tools/dialogtool.h"
|
#include "../../../../dialogs/tools/dialogtool.h"
|
||||||
#include "../../../../visualization/visualization.h"
|
|
||||||
#include "../../../../visualization/line/vistoolpointofintersectioncircles.h"
|
#include "../../../../visualization/line/vistoolpointofintersectioncircles.h"
|
||||||
|
#include "../../../../visualization/visualization.h"
|
||||||
|
#include "../../../vabstracttool.h"
|
||||||
|
#include "../../vdrawtool.h"
|
||||||
#include "../ifc/exception/vexception.h"
|
#include "../ifc/exception/vexception.h"
|
||||||
#include "../ifc/exception/vexceptionobjecterror.h"
|
#include "../ifc/exception/vexceptionobjecterror.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../vgeometry/vgobject.h"
|
#include "../vgeometry/vgobject.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vpatterndb/vformula.h"
|
#include "../vpatterndb/vformula.h"
|
||||||
#include "../vwidgets/vmaingraphicsscene.h"
|
#include "../vwidgets/vmaingraphicsscene.h"
|
||||||
#include "../../../vabstracttool.h"
|
|
||||||
#include "../../vdrawtool.h"
|
|
||||||
#include "vtoolsinglepoint.h"
|
#include "vtoolsinglepoint.h"
|
||||||
|
|
||||||
template <class T> class QSharedPointer;
|
template <class T> class QSharedPointer;
|
||||||
|
@ -119,10 +119,10 @@ auto VToolPointOfIntersectionCircles::Create(const QPointer<DialogTool> &dialog,
|
||||||
auto VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData &initData)
|
auto VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData &initData)
|
||||||
-> VToolPointOfIntersectionCircles *
|
-> VToolPointOfIntersectionCircles *
|
||||||
{
|
{
|
||||||
const qreal calcC1Radius = VAbstractValApplication::VApp()
|
const qreal calcC1Radius =
|
||||||
->toPixel(CheckFormula(initData.id, initData.firstCircleRadius, initData.data));
|
VAbstractValApplication::VApp()->toPixel(CheckFormula(initData.id, initData.firstCircleRadius, initData.data));
|
||||||
const qreal calcC2Radius = VAbstractValApplication::VApp()
|
const qreal calcC2Radius =
|
||||||
->toPixel(CheckFormula(initData.id, initData.secondCircleRadius, initData.data));
|
VAbstractValApplication::VApp()->toPixel(CheckFormula(initData.id, initData.secondCircleRadius, initData.data));
|
||||||
|
|
||||||
const VPointF c1Point = *initData.data->GeometricObject<VPointF>(initData.firstCircleCenterId);
|
const VPointF c1Point = *initData.data->GeometricObject<VPointF>(initData.firstCircleCenterId);
|
||||||
const VPointF c2Point = *initData.data->GeometricObject<VPointF>(initData.secondCircleCenterId);
|
const VPointF c2Point = *initData.data->GeometricObject<VPointF>(initData.secondCircleCenterId);
|
||||||
|
@ -134,9 +134,11 @@ auto VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInit
|
||||||
if (not success)
|
if (not success)
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have "
|
const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have "
|
||||||
"no point of intersection").arg(initData.name, c1Point.name(), c2Point.name());
|
"no point of intersection")
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
.arg(initData.name, c1Point.name(), c2Point.name());
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VExceptionObjectError(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
@ -177,7 +179,7 @@ auto VToolPointOfIntersectionCircles::FindPoint(const QPointF &c1Point, const QP
|
||||||
SCASSERT(intersectionPoint != nullptr)
|
SCASSERT(intersectionPoint != nullptr)
|
||||||
|
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
const int res = VGObject::IntersectionCircles(c1Point, c1Radius, c2Point, c2Radius, p1, p2);
|
const int res = VGObject::IntersectionCircles(c1Point, qAbs(c1Radius), c2Point, qAbs(c2Radius), p1, p2);
|
||||||
|
|
||||||
switch (res)
|
switch (res)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +220,6 @@ auto VToolPointOfIntersectionCircles::SecondCircleCenterPointName() const -> QSt
|
||||||
auto VToolPointOfIntersectionCircles::GetFirstCircleRadius() const -> VFormula
|
auto VToolPointOfIntersectionCircles::GetFirstCircleRadius() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula radius(firstCircleRadius, getData());
|
VFormula radius(firstCircleRadius, getData());
|
||||||
radius.setCheckZero(true);
|
|
||||||
radius.setToolId(m_id);
|
radius.setToolId(m_id);
|
||||||
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius.Eval();
|
radius.Eval();
|
||||||
|
@ -228,22 +229,18 @@ auto VToolPointOfIntersectionCircles::GetFirstCircleRadius() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionCircles::SetFirstCircleRadius(const VFormula &value)
|
void VToolPointOfIntersectionCircles::SetFirstCircleRadius(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0)// Formula don't check this, but radius can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
firstCircleRadius = value.GetFormula(FormulaType::FromUser);
|
firstCircleRadius = value.GetFormula(FormulaType::FromUser);
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolPointOfIntersectionCircles::GetSecondCircleRadius() const -> VFormula
|
auto VToolPointOfIntersectionCircles::GetSecondCircleRadius() const -> VFormula
|
||||||
{
|
{
|
||||||
VFormula radius(secondCircleRadius, getData());
|
VFormula radius(secondCircleRadius, getData());
|
||||||
radius.setCheckZero(true);
|
|
||||||
radius.setToolId(m_id);
|
radius.setToolId(m_id);
|
||||||
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
radius.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
radius.Eval();
|
radius.Eval();
|
||||||
|
@ -253,16 +250,13 @@ auto VToolPointOfIntersectionCircles::GetSecondCircleRadius() const -> VFormula
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolPointOfIntersectionCircles::SetSecondCircleRadius(const VFormula &value)
|
void VToolPointOfIntersectionCircles::SetSecondCircleRadius(const VFormula &value)
|
||||||
{
|
{
|
||||||
if (value.error() == false)
|
if (!value.error())
|
||||||
{
|
|
||||||
if (value.getDoubleValue() > 0)// Formula don't check this, but radius can't be 0 or negative
|
|
||||||
{
|
{
|
||||||
secondCircleRadius = value.GetFormula(FormulaType::FromUser);
|
secondCircleRadius = value.GetFormula(FormulaType::FromUser);
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
||||||
SaveOption(obj);
|
SaveOption(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VToolPointOfIntersectionCircles::GetCrossCirclesPoint() const -> CrossCirclesPoint
|
auto VToolPointOfIntersectionCircles::GetCrossCirclesPoint() const -> CrossCirclesPoint
|
||||||
|
|
|
@ -88,7 +88,7 @@ void VisToolMove::RefreshGeometry()
|
||||||
qreal tempRoationAngle = 0;
|
qreal tempRoationAngle = 0;
|
||||||
|
|
||||||
QLineF line;
|
QLineF line;
|
||||||
if (qFuzzyIsNull(m_length))
|
if (qIsInf(m_length))
|
||||||
{
|
{
|
||||||
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
|
||||||
{
|
{
|
||||||
|
@ -157,10 +157,18 @@ void VisToolMove::RefreshGeometry()
|
||||||
DrawPath(m_angleArc, arc.GetPath(), Qt::SolidLine, Qt::RoundCap);
|
DrawPath(m_angleArc, arc.GetPath(), Qt::SolidLine, Qt::RoundCap);
|
||||||
}
|
}
|
||||||
DrawLine(this, line, Qt::DashLine);
|
DrawLine(this, line, Qt::DashLine);
|
||||||
|
|
||||||
|
if (qFuzzyIsNull(m_length))
|
||||||
|
{
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
DrawPoint(m_pointFinish, line.p2());
|
DrawPoint(m_pointFinish, line.p2());
|
||||||
|
|
||||||
|
if (GetMode() == Mode::Creation)
|
||||||
|
{
|
||||||
static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
static const QString prefix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
if (qFuzzyIsNull(m_length))
|
if (qIsInf(m_length))
|
||||||
{
|
{
|
||||||
SetToolTip(tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "
|
SetToolTip(tr("Length = %1%2, angle = %3°, <b>%4</b> - sticking angle, "
|
||||||
"<b>Mouse click</b> - finish selecting a position")
|
"<b>Mouse click</b> - finish selecting a position")
|
||||||
|
@ -173,6 +181,7 @@ void VisToolMove::RefreshGeometry()
|
||||||
.arg(LengthToUser(tempLength), prefix, AngleToUser(tempAngle), AngleToUser(tempRoationAngle),
|
.arg(LengthToUser(tempLength), prefix, AngleToUser(tempAngle), AngleToUser(tempRoationAngle),
|
||||||
VModifierKey::Shift(), VModifierKey::Control()));
|
VModifierKey::Shift(), VModifierKey::Control()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CreateMovedRotatedObjects(iPoint, iCurve, tempLength, tempAngle, tempRoationAngle, origin);
|
CreateMovedRotatedObjects(iPoint, iCurve, tempLength, tempAngle, tempRoationAngle, origin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#ifndef VISTOOLMOVE_H
|
#ifndef VISTOOLMOVE_H
|
||||||
#define VISTOOLMOVE_H
|
#define VISTOOLMOVE_H
|
||||||
|
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
@ -38,6 +37,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "visoperation.h"
|
#include "visoperation.h"
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
class VisToolMove : public VisOperation
|
class VisToolMove : public VisOperation
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VisToolMove(const VContainer *data, QGraphicsItem *parent = nullptr);
|
explicit VisToolMove(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
~VisToolMove() override = default;
|
~VisToolMove() override = default;
|
||||||
|
@ -64,13 +65,17 @@ public:
|
||||||
void SetRotationOriginPointId(quint32 value);
|
void SetRotationOriginPointId(quint32 value);
|
||||||
|
|
||||||
auto type() const -> int override { return Type; }
|
auto type() const -> int override { return Type; }
|
||||||
enum {Type = UserType + static_cast<int>(Vis::ToolMove)};
|
enum
|
||||||
|
{
|
||||||
|
Type = UserType + static_cast<int>(Vis::ToolMove)
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(VisToolMove) // NOLINT
|
Q_DISABLE_COPY_MOVE(VisToolMove) // NOLINT
|
||||||
qreal m_angle{0};
|
qreal m_angle{0};
|
||||||
qreal m_rotationAngle{INT_MIN};
|
qreal m_rotationAngle{INT_MIN};
|
||||||
qreal m_length{0};
|
qreal m_length{std::numeric_limits<qreal>::infinity()};
|
||||||
VScaledEllipse *m_pointOrigin{nullptr};
|
VScaledEllipse *m_pointOrigin{nullptr};
|
||||||
VScaledEllipse *m_pointRotationOrigin{nullptr};
|
VScaledEllipse *m_pointRotationOrigin{nullptr};
|
||||||
VScaledEllipse *m_pointFinish{nullptr};
|
VScaledEllipse *m_pointFinish{nullptr};
|
||||||
|
@ -79,8 +84,7 @@ private:
|
||||||
VScaledLine *m_xAxis{nullptr};
|
VScaledLine *m_xAxis{nullptr};
|
||||||
quint32 m_rotationOriginId{NULL_ID};
|
quint32 m_rotationOriginId{NULL_ID};
|
||||||
|
|
||||||
template <class Item>
|
template <class Item> auto AddOriginCurve(quint32 id, int &i) -> QGraphicsPathItem *;
|
||||||
auto AddOriginCurve(quint32 id, int &i) -> QGraphicsPathItem *;
|
|
||||||
|
|
||||||
template <class Item>
|
template <class Item>
|
||||||
auto AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
|
auto AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int i, qreal rotationAngle,
|
||||||
|
|
|
@ -82,6 +82,7 @@ void VisToolCutArc::RefreshGeometry()
|
||||||
{
|
{
|
||||||
QPointF p = arc->ClosestPoint(ScenePos());
|
QPointF p = arc->ClosestPoint(ScenePos());
|
||||||
qreal length = arc->GetLengthByPoint(p);
|
qreal length = arc->GetLengthByPoint(p);
|
||||||
|
length = !arc->IsFlipped() ? qBound(0.0, length, arc->GetLength()) : qBound(arc->GetLength(), -length, 0.0);
|
||||||
|
|
||||||
DrawPoint(m_point, p);
|
DrawPoint(m_point, p);
|
||||||
|
|
||||||
|
|
|
@ -288,14 +288,13 @@ auto Visualization::GetCurveItem(QVector<VCurvePathItem *> &curves, quint32 i, V
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto Visualization::LengthToUser(qreal value) -> QString
|
auto Visualization::LengthToUser(qreal value) -> QString
|
||||||
{
|
{
|
||||||
return VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
auto *app = VAbstractValApplication::VApp();
|
||||||
QString::number(VAbstractValApplication::VApp()->fromPixel(value)),
|
return app->TrVars()->FormulaToUser(QString::number(app->fromPixel(value)), app->Settings()->GetOsSeparator());
|
||||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto Visualization::AngleToUser(qreal value) -> QString
|
auto Visualization::AngleToUser(qreal value) -> QString
|
||||||
{
|
{
|
||||||
return VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
auto *app = VAbstractApplication::VApp();
|
||||||
QString::number(value), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
return app->TrVars()->FormulaToUser(QString::number(value), app->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,11 +183,10 @@ auto VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVers
|
||||||
VAbstractApplication::VApp()->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
|
VAbstractApplication::VApp()->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,21 +394,32 @@ void VAbstractMainWindow::ExportDataToCSV()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
|
||||||
|
|
||||||
DialogExportToCSV dialog(this);
|
DialogExportToCSV dialog(this);
|
||||||
dialog.SetWithHeader(VAbstractApplication::VApp()->Settings()->GetCSVWithHeader());
|
dialog.SetWithHeader(settings->GetCSVWithHeader());
|
||||||
dialog.SetSelectedMib(VAbstractApplication::VApp()->Settings()->GetCSVCodec());
|
dialog.SetSelectedMib(settings->GetCSVCodec());
|
||||||
dialog.SetSeparator(VAbstractApplication::VApp()->Settings()->GetCSVSeparator());
|
dialog.SetSeparator(settings->GetCSVSeparator());
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
ExportToCSVData(fileName, dialog.IsWithHeader(), dialog.GetSelectedMib(), dialog.GetSeparator());
|
ExportToCSVData(fileName, dialog.IsWithHeader(), dialog.GetSelectedMib(), dialog.GetSeparator());
|
||||||
|
|
||||||
VAbstractApplication::VApp()->Settings()->SetCSVSeparator(dialog.GetSeparator());
|
settings->SetCSVSeparator(dialog.GetSeparator());
|
||||||
VAbstractApplication::VApp()->Settings()->SetCSVCodec(dialog.GetSelectedMib());
|
settings->SetCSVCodec(dialog.GetSelectedMib());
|
||||||
VAbstractApplication::VApp()->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
|
settings->SetCSVWithHeader(dialog.IsWithHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractMainWindow::AlwaysOnTop(bool state)
|
||||||
|
{
|
||||||
|
setWindowFlag(Qt::WindowStaysOnTopHint, state);
|
||||||
|
destroy();
|
||||||
|
create();
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractMainWindow::UpdateVisibilityGroups()
|
void VAbstractMainWindow::UpdateVisibilityGroups()
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ public slots:
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void ExportDataToCSV();
|
void ExportDataToCSV();
|
||||||
|
void AlwaysOnTop(bool state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned m_curFileFormatVersion;
|
unsigned m_curFileFormatVersion;
|
||||||
|
|
|
@ -76,7 +76,7 @@ auto main(int argc, char **argv) -> int
|
||||||
int status = 0;
|
int status = 0;
|
||||||
auto ASSERT_TEST = [&status, argc, argv](QObject *obj)
|
auto ASSERT_TEST = [&status, argc, argv](QObject *obj)
|
||||||
{
|
{
|
||||||
status |= QTest::qExec(obj, argc, argv);
|
status |= QTest::qExec(obj, argc, argv); // NOLINT(hicpp-signed-bitwise)
|
||||||
delete obj;
|
delete obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,18 +93,39 @@ void TST_VArc::CompareTwoWays()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
void TST_VArc::ArcByLength_data()
|
||||||
void TST_VArc::NegativeArc()
|
|
||||||
{
|
{
|
||||||
const VPointF center;
|
QTest::addColumn<qreal>("radius");
|
||||||
const qreal radius = 100;
|
QTest::addColumn<qreal>("startAngle");
|
||||||
const qreal f1 = 1;
|
QTest::addColumn<qreal>("endAngle");
|
||||||
const qreal f2 = 316;
|
QTest::addColumn<qreal>("arcAngle");
|
||||||
const qreal length = M_PI * radius / 180 * 45;
|
QTest::addColumn<bool>("flipped");
|
||||||
VArc arc(-length, center, radius, f1);
|
QTest::addColumn<int>("direction");
|
||||||
|
|
||||||
QCOMPARE(arc.GetLength(), -length);
|
QTest::newRow("Positive radius, positive length") << 100. << 1. << 316. << 315. << false << 1;
|
||||||
QCOMPARE(arc.GetEndAngle(), f2);
|
QTest::newRow("Positive radius, negative length") << 100. << 1. << 316. << 45. << true << -1;
|
||||||
|
QTest::newRow("Negative radius, negative length") << -100. << 1. << 316. << 45. << true << -1;
|
||||||
|
QTest::newRow("Negative radius, positive length") << -100. << 1. << 316. << 45. << true << -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_VArc::ArcByLength()
|
||||||
|
{
|
||||||
|
QFETCH(qreal, radius);
|
||||||
|
QFETCH(qreal, startAngle);
|
||||||
|
QFETCH(qreal, endAngle);
|
||||||
|
QFETCH(qreal, arcAngle);
|
||||||
|
QFETCH(bool, flipped);
|
||||||
|
QFETCH(int, direction);
|
||||||
|
|
||||||
|
const qreal length = (M_PI * qAbs(radius) / 180 * arcAngle) * direction;
|
||||||
|
VArc arc(length, VPointF(), radius, startAngle);
|
||||||
|
|
||||||
|
QCOMPARE(arc.GetLength(), length);
|
||||||
|
QCOMPARE(arc.GetEndAngle(), endAngle);
|
||||||
|
QCOMPARE(arc.IsFlipped(), flipped);
|
||||||
|
QCOMPARE(arc.GetRadius(), radius);
|
||||||
|
QCOMPARE(arc.AngleArc(), arcAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -116,82 +137,147 @@ void TST_VArc::TestGetPoints_data()
|
||||||
QTest::addColumn<qreal>("endAngle");
|
QTest::addColumn<qreal>("endAngle");
|
||||||
|
|
||||||
QTest::newRow("Full circle: radius 10") << 10.0 << 0.0 << 360.0;
|
QTest::newRow("Full circle: radius 10") << 10.0 << 0.0 << 360.0;
|
||||||
|
QTest::newRow("Full circle: radius -10") << -10.0 << 0.0 << 360.0;
|
||||||
QTest::newRow("Full circle: radius 150") << 150.0 << 0.0 << 360.0;
|
QTest::newRow("Full circle: radius 150") << 150.0 << 0.0 << 360.0;
|
||||||
|
QTest::newRow("Full circle: radius -150") << -150.0 << 0.0 << 360.0;
|
||||||
QTest::newRow("Full circle: radius 1500") << 1500.0 << 0.0 << 360.0;
|
QTest::newRow("Full circle: radius 1500") << 1500.0 << 0.0 << 360.0;
|
||||||
|
QTest::newRow("Full circle: radius -1500") << -1500.0 << 0.0 << 360.0;
|
||||||
QTest::newRow("Full circle: radius 50000") << 50000.0 << 0.0 << 360.0;
|
QTest::newRow("Full circle: radius 50000") << 50000.0 << 0.0 << 360.0;
|
||||||
|
QTest::newRow("Full circle: radius -50000") << -50000.0 << 0.0 << 360.0;
|
||||||
QTest::newRow("Full circle: radius 90000") << 90000.0 << 0.0 << 360.0;
|
QTest::newRow("Full circle: radius 90000") << 90000.0 << 0.0 << 360.0;
|
||||||
|
QTest::newRow("Full circle: radius -90000") << -90000.0 << 0.0 << 360.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 45 degree, radius 100") << 100.0 << 0.0 << 10.5;
|
QTest::newRow("Arc less than 45 degree, radius 100") << 100.0 << 0.0 << 10.5;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radius -100") << -100.0 << 0.0 << 10.5;
|
||||||
QTest::newRow("Arc less than 45 degree, radius 150") << 150.0 << 0.0 << 10.5;
|
QTest::newRow("Arc less than 45 degree, radius 150") << 150.0 << 0.0 << 10.5;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radius -150") << -150.0 << 0.0 << 10.5;
|
||||||
QTest::newRow("Arc less than 45 degree, radius 1500") << 1500.0 << 0.0 << 10.5;
|
QTest::newRow("Arc less than 45 degree, radius 1500") << 1500.0 << 0.0 << 10.5;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radius -1500") << -1500.0 << 0.0 << 10.5;
|
||||||
QTest::newRow("Arc less than 45 degree, radius 50000") << 50000.0 << 0.0 << 10.5;
|
QTest::newRow("Arc less than 45 degree, radius 50000") << 50000.0 << 0.0 << 10.5;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radius -50000") << -50000.0 << 0.0 << 10.5;
|
||||||
QTest::newRow("Arc less than 45 degree, radius 90000") << 90000.0 << 0.0 << 10.5;
|
QTest::newRow("Arc less than 45 degree, radius 90000") << 90000.0 << 0.0 << 10.5;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radius -90000") << -90000.0 << 0.0 << 10.5;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radius 100") << 100.0 << 0.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radius 100") << 100.0 << 0.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radius -100") << -100.0 << 0.0 << 45.0;
|
||||||
QTest::newRow("Arc 45 degree, radius 150") << 150.0 << 0.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radius 150") << 150.0 << 0.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radius -150") << -150.0 << 0.0 << 45.0;
|
||||||
QTest::newRow("Arc 45 degree, radius 1500") << 1500.0 << 0.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radius 1500") << 1500.0 << 0.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radius -1500") << -1500.0 << 0.0 << 45.0;
|
||||||
QTest::newRow("Arc 45 degree, radius 50000") << 50000.0 << 0.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radius 50000") << 50000.0 << 0.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radius -50000") << -50000.0 << 0.0 << 45.0;
|
||||||
QTest::newRow("Arc 45 degree, radius 90000") << 90000.0 << 0.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radius 90000") << 90000.0 << 0.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radius -90000") << -90000.0 << 0.0 << 45.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radius 100") << 100.0 << 0.0 << 75.0;
|
QTest::newRow("Arc less than 90 degree, radius 100") << 100.0 << 0.0 << 75.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radius -100") << -100.0 << 0.0 << 75.0;
|
||||||
QTest::newRow("Arc less than 90 degree, radius 150") << 150.0 << 0.0 << 75.0;
|
QTest::newRow("Arc less than 90 degree, radius 150") << 150.0 << 0.0 << 75.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radius -150") << -150.0 << 0.0 << 75.0;
|
||||||
QTest::newRow("Arc less than 90 degree, radius 1500") << 1500.0 << 0.0 << 75.0;
|
QTest::newRow("Arc less than 90 degree, radius 1500") << 1500.0 << 0.0 << 75.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radius -1500") << -1500.0 << 0.0 << 75.0;
|
||||||
QTest::newRow("Arc less than 90 degree, radius 50000") << 50000.0 << 0.0 << 75.0;
|
QTest::newRow("Arc less than 90 degree, radius 50000") << 50000.0 << 0.0 << 75.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radius -50000") << -50000.0 << 0.0 << 75.0;
|
||||||
QTest::newRow("Arc less than 90 degree, radius 90000") << 90000.0 << 0.0 << 75.0;
|
QTest::newRow("Arc less than 90 degree, radius 90000") << 90000.0 << 0.0 << 75.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radius -90000") << -90000.0 << 0.0 << 75.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 90 degree, radius 100") << 100.0 << 0.0 << 90.0;
|
QTest::newRow("Arc 90 degree, radius 100") << 100.0 << 0.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radius -100") << -100.0 << 0.0 << 90.0;
|
||||||
QTest::newRow("Arc 90 degree, radius 150") << 150.0 << 0.0 << 90.0;
|
QTest::newRow("Arc 90 degree, radius 150") << 150.0 << 0.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radius -150") << -150.0 << 0.0 << 90.0;
|
||||||
QTest::newRow("Arc 90 degree, radius 1500") << 1500.0 << 0.0 << 90.0;
|
QTest::newRow("Arc 90 degree, radius 1500") << 1500.0 << 0.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radius -1500") << -1500.0 << 0.0 << 90.0;
|
||||||
QTest::newRow("Arc 90 degree, radius 50000") << 50000.0 << 0.0 << 90.0;
|
QTest::newRow("Arc 90 degree, radius 50000") << 50000.0 << 0.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radius -50000") << -50000.0 << 0.0 << 90.0;
|
||||||
QTest::newRow("Arc 90 degree, radius 90000") << 90000.0 << 0.0 << 90.0;
|
QTest::newRow("Arc 90 degree, radius 90000") << 90000.0 << 0.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radius -90000") << -90000.0 << 0.0 << 90.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radius 100") << 100.0 << 0.0 << 110.6;
|
QTest::newRow("Arc less than 135 degree, radius 100") << 100.0 << 0.0 << 110.6;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radius -100") << -100.0 << 0.0 << 110.6;
|
||||||
QTest::newRow("Arc less than 135 degree, radius 150") << 150.0 << 0.0 << 110.6;
|
QTest::newRow("Arc less than 135 degree, radius 150") << 150.0 << 0.0 << 110.6;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radius -150") << -150.0 << 0.0 << 110.6;
|
||||||
QTest::newRow("Arc less than 135 degree, radius 1500") << 1500.0 << 0.0 << 110.6;
|
QTest::newRow("Arc less than 135 degree, radius 1500") << 1500.0 << 0.0 << 110.6;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radius -1500") << -1500.0 << 0.0 << 110.6;
|
||||||
QTest::newRow("Arc less than 135 degree, radius 50000") << 50000.0 << 0.0 << 110.6;
|
QTest::newRow("Arc less than 135 degree, radius 50000") << 50000.0 << 0.0 << 110.6;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radius -50000") << -50000.0 << 0.0 << 110.6;
|
||||||
QTest::newRow("Arc less than 135 degree, radius 90000") << 90000.0 << 0.0 << 110.6;
|
QTest::newRow("Arc less than 135 degree, radius 90000") << 90000.0 << 0.0 << 110.6;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radius -90000") << -90000.0 << 0.0 << 110.6;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radius 100") << 100.0 << 0.0 << 135.0;
|
QTest::newRow("Arc 135 degree, radius 100") << 100.0 << 0.0 << 135.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radius -100") << -100.0 << 0.0 << 135.0;
|
||||||
QTest::newRow("Arc 135 degree, radius 150") << 150.0 << 0.0 << 135.0;
|
QTest::newRow("Arc 135 degree, radius 150") << 150.0 << 0.0 << 135.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radius -150") << -150.0 << 0.0 << 135.0;
|
||||||
QTest::newRow("Arc 135 degree, radius 1500") << 1500.0 << 0.0 << 135.0;
|
QTest::newRow("Arc 135 degree, radius 1500") << 1500.0 << 0.0 << 135.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radius -1500") << -1500.0 << 0.0 << 135.0;
|
||||||
QTest::newRow("Arc 135 degree, radius 50000") << 50000.0 << 0.0 << 135.0;
|
QTest::newRow("Arc 135 degree, radius 50000") << 50000.0 << 0.0 << 135.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radius -50000") << -50000.0 << 0.0 << 135.0;
|
||||||
QTest::newRow("Arc 135 degree, radius 90000") << 90000.0 << 0.0 << 135.0;
|
QTest::newRow("Arc 135 degree, radius 90000") << 90000.0 << 0.0 << 135.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radius -90000") << -90000.0 << 0.0 << 135.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radius 100") << 100.0 << 0.0 << 160.7;
|
QTest::newRow("Arc less than 180 degree, radius 100") << 100.0 << 0.0 << 160.7;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radius -100") << -100.0 << 0.0 << 160.7;
|
||||||
QTest::newRow("Arc less than 180 degree, radius 150") << 150.0 << 0.0 << 160.7;
|
QTest::newRow("Arc less than 180 degree, radius 150") << 150.0 << 0.0 << 160.7;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radius -150") << -150.0 << 0.0 << 160.7;
|
||||||
QTest::newRow("Arc less than 180 degree, radius 1500") << 1500.0 << 0.0 << 160.7;
|
QTest::newRow("Arc less than 180 degree, radius 1500") << 1500.0 << 0.0 << 160.7;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radius -1500") << -1500.0 << 0.0 << 160.7;
|
||||||
QTest::newRow("Arc less than 180 degree, radius 50000") << 50000.0 << 0.0 << 160.7;
|
QTest::newRow("Arc less than 180 degree, radius 50000") << 50000.0 << 0.0 << 160.7;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radius -50000") << -50000.0 << 0.0 << 160.7;
|
||||||
QTest::newRow("Arc less than 180 degree, radius 90000") << 90000.0 << 0.0 << 160.7;
|
QTest::newRow("Arc less than 180 degree, radius 90000") << 90000.0 << 0.0 << 160.7;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radius -90000") << -90000.0 << 0.0 << 160.7;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radius 100") << 100.0 << 0.0 << 180.0;
|
QTest::newRow("Arc 180 degree, radius 100") << 100.0 << 0.0 << 180.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radius -100") << -100.0 << 0.0 << 180.0;
|
||||||
QTest::newRow("Arc 180 degree, radius 150") << 150.0 << 0.0 << 180.0;
|
QTest::newRow("Arc 180 degree, radius 150") << 150.0 << 0.0 << 180.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radius -150") << -150.0 << 0.0 << 180.0;
|
||||||
QTest::newRow("Arc 180 degree, radius 1500") << 1500.0 << 0.0 << 180.0;
|
QTest::newRow("Arc 180 degree, radius 1500") << 1500.0 << 0.0 << 180.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radius -1500") << -1500.0 << 0.0 << 180.0;
|
||||||
QTest::newRow("Arc 180 degree, radius 50000") << 50000.0 << 0.0 << 180.0;
|
QTest::newRow("Arc 180 degree, radius 50000") << 50000.0 << 0.0 << 180.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radius -50000") << -50000.0 << 0.0 << 180.0;
|
||||||
QTest::newRow("Arc 180 degree, radius 90000") << 90000.0 << 0.0 << 180.0;
|
QTest::newRow("Arc 180 degree, radius 90000") << 90000.0 << 0.0 << 180.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radius -90000") << -90000.0 << 0.0 << 180.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radius 100") << 100.0 << 0.0 << 150.3;
|
QTest::newRow("Arc less than 270 degree, radius 100") << 100.0 << 0.0 << 150.3;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radius -100") << -100.0 << 0.0 << 150.3;
|
||||||
QTest::newRow("Arc less than 270 degree, radius 150") << 150.0 << 0.0 << 150.3;
|
QTest::newRow("Arc less than 270 degree, radius 150") << 150.0 << 0.0 << 150.3;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radius -150") << -150.0 << 0.0 << 150.3;
|
||||||
QTest::newRow("Arc less than 270 degree, radius 1500") << 1500.0 << 0.0 << 150.3;
|
QTest::newRow("Arc less than 270 degree, radius 1500") << 1500.0 << 0.0 << 150.3;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radius -1500") << -1500.0 << 0.0 << 150.3;
|
||||||
QTest::newRow("Arc less than 270 degree, radius 50000") << 50000.0 << 0.0 << 150.3;
|
QTest::newRow("Arc less than 270 degree, radius 50000") << 50000.0 << 0.0 << 150.3;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radius -50000") << -50000.0 << 0.0 << 150.3;
|
||||||
QTest::newRow("Arc less than 270 degree, radius 90000") << 90000.0 << 0.0 << 150.3;
|
QTest::newRow("Arc less than 270 degree, radius 90000") << 90000.0 << 0.0 << 150.3;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radius -90000") << -90000.0 << 0.0 << 150.3;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radius 100") << 100.0 << 0.0 << 270.0;
|
QTest::newRow("Arc 270 degree, radius 100") << 100.0 << 0.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radius -100") << -100.0 << 0.0 << 270.0;
|
||||||
QTest::newRow("Arc 270 degree, radius 150") << 150.0 << 0.0 << 270.0;
|
QTest::newRow("Arc 270 degree, radius 150") << 150.0 << 0.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radius -150") << -150.0 << 0.0 << 270.0;
|
||||||
QTest::newRow("Arc 270 degree, radius 1500") << 1500.0 << 0.0 << 270.0;
|
QTest::newRow("Arc 270 degree, radius 1500") << 1500.0 << 0.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radius -1500") << -1500.0 << 0.0 << 270.0;
|
||||||
QTest::newRow("Arc 270 degree, radius 50000") << 50000.0 << 0.0 << 270.0;
|
QTest::newRow("Arc 270 degree, radius 50000") << 50000.0 << 0.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radius -50000") << -50000.0 << 0.0 << 270.0;
|
||||||
QTest::newRow("Arc 270 degree, radius 90000") << 90000.0 << 0.0 << 270.0;
|
QTest::newRow("Arc 270 degree, radius 90000") << 90000.0 << 0.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radius -90000") << -90000.0 << 0.0 << 270.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 360 degree, radius 100") << 100.0 << 0.0 << 340.0;
|
QTest::newRow("Arc less than 360 degree, radius 100") << 100.0 << 0.0 << 340.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radius -100") << -100.0 << 0.0 << 340.0;
|
||||||
QTest::newRow("Arc less than 360 degree, radius 150") << 150.0 << 0.0 << 340.0;
|
QTest::newRow("Arc less than 360 degree, radius 150") << 150.0 << 0.0 << 340.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radius -150") << -150.0 << 0.0 << 340.0;
|
||||||
QTest::newRow("Arc less than 360 degree, radius 1500") << 1500.0 << 0.0 << 340.0;
|
QTest::newRow("Arc less than 360 degree, radius 1500") << 1500.0 << 0.0 << 340.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radius -1500") << -1500.0 << 0.0 << 340.0;
|
||||||
QTest::newRow("Arc less than 360 degree, radius 50000") << 50000.0 << 0.0 << 340.0;
|
QTest::newRow("Arc less than 360 degree, radius 50000") << 50000.0 << 0.0 << 340.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radius -50000") << -50000.0 << 0.0 << 340.0;
|
||||||
QTest::newRow("Arc less than 360 degree, radius 90000") << 90000.0 << 0.0 << 340.0;
|
QTest::newRow("Arc less than 360 degree, radius 90000") << 90000.0 << 0.0 << 340.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radius -90000") << -90000.0 << 0.0 << 340.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 100") << 100.0 << 90.0 << 135.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 100") << 100.0 << 90.0 << 135.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius -100") << -100.0 << 90.0 << 135.0;
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 150") << 150.0 << 90.0 << 135.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 150") << 150.0 << 90.0 << 135.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius -150") << -150.0 << 90.0 << 135.0;
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 1500") << 1500.0 << 90.0 << 135.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 1500") << 1500.0 << 90.0 << 135.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius -1500") << -1500.0 << 90.0 << 135.0;
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 50000") << 50000.0 << 90.0 << 135.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 50000") << 50000.0 << 90.0 << 135.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius -50000") << -50000.0 << 90.0 << 135.0;
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 90000") << 90000.0 << 90.0 << 135.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius 90000") << 90000.0 << 90.0 << 135.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radius -90000") << -90000.0 << 90.0 << 135.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -214,7 +300,7 @@ void TST_VArc::TestGetPoints()
|
||||||
for (auto point : points)
|
for (auto point : points)
|
||||||
{
|
{
|
||||||
QLineF rLine(static_cast<QPointF>(center), point);
|
QLineF rLine(static_cast<QPointF>(center), point);
|
||||||
const qreal value = qAbs(rLine.length() - radius);
|
const qreal value = qAbs(rLine.length() - qAbs(radius));
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
const QString errorMsg = u"Broken the first rule. All points should be on the same distance from "
|
const QString errorMsg = u"Broken the first rule. All points should be on the same distance from "
|
||||||
u"the center. Error ='%1'."_s.arg(value);
|
u"the center. Error ='%1'."_s.arg(value);
|
||||||
|
@ -227,11 +313,11 @@ void TST_VArc::TestGetPoints()
|
||||||
|
|
||||||
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{ // circle square
|
{ // circle square
|
||||||
gSquare = M_PI * radius * radius;
|
gSquare = M_PI * qAbs(radius) * qAbs(radius);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // sector square
|
{ // sector square
|
||||||
gSquare = (M_PI * radius * radius) / 360.0 * arc.AngleArc();
|
gSquare = (M_PI * qAbs(radius) * qAbs(radius)) / 360.0 * arc.AngleArc();
|
||||||
points.append(static_cast<QPointF>(center));
|
points.append(static_cast<QPointF>(center));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +344,7 @@ void TST_VArc::TestRotation_data()
|
||||||
QTest::addColumn<QString>("prefix");
|
QTest::addColumn<QString>("prefix");
|
||||||
|
|
||||||
QTest::newRow("Test arc 1") << QPointF(10, 10) << 10. << 0. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test arc 1") << QPointF(10, 10) << 10. << 0. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test arc 2") << QPointF(10, 10) << -10. << 0. << 90. << QPointF() << 90. << "_r";
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -277,6 +364,7 @@ void TST_VArc::TestRotation()
|
||||||
QCOMPARE(arcOrigin.GetLength(), rotatedArc.GetLength());
|
QCOMPARE(arcOrigin.GetLength(), rotatedArc.GetLength());
|
||||||
QCOMPARE(arcOrigin.AngleArc(), rotatedArc.AngleArc());
|
QCOMPARE(arcOrigin.AngleArc(), rotatedArc.AngleArc());
|
||||||
QCOMPARE(arcOrigin.GetRadius(), rotatedArc.GetRadius());
|
QCOMPARE(arcOrigin.GetRadius(), rotatedArc.GetRadius());
|
||||||
|
QCOMPARE(arcOrigin.IsFlipped(), rotatedArc.IsFlipped());
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
const QString errorMsg = u"The name doesn't contain the prefix '%1'."_s.arg(prefix);
|
const QString errorMsg = u"The name doesn't contain the prefix '%1'."_s.arg(prefix);
|
||||||
QVERIFY2(rotatedArc.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
QVERIFY2(rotatedArc.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
||||||
|
@ -300,16 +388,20 @@ void TST_VArc::TestFlip_data()
|
||||||
|
|
||||||
QLineF axis(QPointF(4, 6), QPointF(12, 6));
|
QLineF axis(QPointF(4, 6), QPointF(12, 6));
|
||||||
|
|
||||||
QTest::newRow("Vertical axis") << center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle()
|
QTest::newRow("Vertical axis, positive radius")
|
||||||
<< axis << "a2";
|
<< center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
|
QTest::newRow("Vertical axis, negative radius")
|
||||||
|
<< center << -radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
|
|
||||||
p1 = QPointF(15, 5);
|
p1 = QPointF(15, 5);
|
||||||
p2 = QPointF(10, 0);
|
p2 = QPointF(10, 0);
|
||||||
|
|
||||||
axis = QLineF(QPointF(9, -1), QPointF(9, 6));
|
axis = QLineF(QPointF(9, -1), QPointF(9, 6));
|
||||||
|
|
||||||
QTest::newRow("Horizontal axis") << center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle()
|
QTest::newRow("Horizontal axis, positive radius")
|
||||||
<< axis << "a2";
|
<< center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
|
QTest::newRow("Horizontal axis, negative radius")
|
||||||
|
<< center << -radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
|
|
||||||
QLineF l(center.x(), center.y(), center.x() + radius, center.y());
|
QLineF l(center.x(), center.y(), center.x() + radius, center.y());
|
||||||
|
|
||||||
|
@ -326,8 +418,10 @@ void TST_VArc::TestFlip_data()
|
||||||
axis = QLineF(p1Axis.x(), p1Axis.y(), p1Axis.x() + radius, p1Axis.y());
|
axis = QLineF(p1Axis.x(), p1Axis.y(), p1Axis.x() + radius, p1Axis.y());
|
||||||
axis.setAngle(45);
|
axis.setAngle(45);
|
||||||
|
|
||||||
QTest::newRow("Diagonal axis") << center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle()
|
QTest::newRow("Diagonal axis, positive radius")
|
||||||
<< axis << "a2";
|
<< center << radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
|
QTest::newRow("Diagonal axis, negative radius")
|
||||||
|
<< center << -radius << QLineF(center, p1).angle() << QLineF(center, p2).angle() << axis << "a2";
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -347,7 +441,7 @@ void TST_VArc::TestFlip()
|
||||||
const QString errorMsg = u"The name doesn't contain the prefix '%1'."_s.arg(prefix);
|
const QString errorMsg = u"The name doesn't contain the prefix '%1'."_s.arg(prefix);
|
||||||
QVERIFY2(res.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
QVERIFY2(res.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
||||||
|
|
||||||
QVERIFY2(res.IsFlipped(), qUtf8Printable("The arc is not flipped"));
|
QVERIFY2(res.IsFlipped() == (radius > 0), qUtf8Printable("The arc is not flipped"));
|
||||||
|
|
||||||
QCOMPARE(originArc.GetLength() * -1, res.GetLength());
|
QCOMPARE(originArc.GetLength() * -1, res.GetLength());
|
||||||
QCOMPARE(originArc.GetRadius(), res.GetRadius());
|
QCOMPARE(originArc.GetRadius(), res.GetRadius());
|
||||||
|
@ -355,7 +449,7 @@ void TST_VArc::TestFlip()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TST_VArc::TestCutArc_data()
|
void TST_VArc::TestCutArcByLength_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QPointF>("center");
|
QTest::addColumn<QPointF>("center");
|
||||||
QTest::addColumn<qreal>("radius");
|
QTest::addColumn<qreal>("radius");
|
||||||
|
@ -364,40 +458,65 @@ void TST_VArc::TestCutArc_data()
|
||||||
QTest::addColumn<qreal>("cutLength");
|
QTest::addColumn<qreal>("cutLength");
|
||||||
QTest::addColumn<QPointF>("cutPoint");
|
QTest::addColumn<QPointF>("cutPoint");
|
||||||
|
|
||||||
QPointF center(189.13625196850393, 344.1267401574803);
|
const QPointF center(189.13625196850393, 344.1267401574803);
|
||||||
qreal radius = ToPixel(10, Unit::Cm);
|
Q_RELAXED_CONSTEXPR qreal radius = ToPixel(10, Unit::Cm);
|
||||||
qreal startAngle = 45.0;
|
|
||||||
qreal length = ToPixel(-10, Unit::Cm);
|
|
||||||
qreal cutLength = ToPixel(6, Unit::Cm);
|
|
||||||
QPointF cutPoint(539.3657292513009, 202.04366960088566);
|
QPointF cutPoint(539.3657292513009, 202.04366960088566);
|
||||||
|
Q_RELAXED_CONSTEXPR qreal length = ToPixel(10, Unit::Cm);
|
||||||
|
|
||||||
// See file <root>/src/app/share/collection/bugs/Issue_#957.val
|
// See file <root>/src/app/share/collection/bugs/Issue_#957.val
|
||||||
QTest::newRow("Arc -10 cm length, cut length 6 cm")
|
QTest::newRow("Arc -10 cm length, cut length 6 cm")
|
||||||
<< center << radius << startAngle << length << cutLength << cutPoint;
|
<< center << radius << 45.0 << -length << ToPixel(6, Unit::Cm) << cutPoint;
|
||||||
|
|
||||||
cutLength = ToPixel(-4, Unit::Cm);
|
|
||||||
|
|
||||||
// Opposite case
|
// Opposite case
|
||||||
QTest::newRow("Arc -10 cm length, cut length -4 cm")
|
QTest::newRow("Arc -10 cm length, cut length -4 cm")
|
||||||
<< center << radius << startAngle << length << cutLength << cutPoint;
|
<< center << radius << 45.0 << -length << ToPixel(-4, Unit::Cm) << cutPoint;
|
||||||
|
|
||||||
startAngle = 135;
|
|
||||||
length = ToPixel(10, Unit::Cm);
|
|
||||||
cutLength = ToPixel(-7, Unit::Cm);
|
|
||||||
cutPoint = QPointF(-145.1588983496871, 167.78888781060192);
|
cutPoint = QPointF(-145.1588983496871, 167.78888781060192);
|
||||||
|
|
||||||
// See file <root>/src/app/share/collection/bugs/Issue_#957.val
|
// See file <root>/src/app/share/collection/bugs/Issue_#957.val
|
||||||
QTest::newRow("Arc 10 cm length, cut length -7 cm")
|
QTest::newRow("Arc 10 cm length, cut length -7 cm")
|
||||||
<< center << radius << startAngle << length << cutLength << cutPoint;
|
<< center << radius << 135. << length << ToPixel(-7, Unit::Cm) << cutPoint;
|
||||||
|
|
||||||
// Opposite case
|
// Opposite case
|
||||||
cutLength = ToPixel(3, Unit::Cm);
|
|
||||||
QTest::newRow("Arc 10 cm length, cut length 3 cm")
|
QTest::newRow("Arc 10 cm length, cut length 3 cm")
|
||||||
<< center << radius << startAngle << length << cutLength << cutPoint;
|
<< center << radius << 135. << length << ToPixel(3, Unit::Cm) << cutPoint;
|
||||||
|
|
||||||
|
QLineF l = QLineF(center, QPointF(center.x() + radius, center.y()));
|
||||||
|
l.setAngle(135);
|
||||||
|
|
||||||
|
QTest::newRow("Arc 10 cm length, cut length 0 cm") << center << radius << 135. << length << 0. << l.p2();
|
||||||
|
|
||||||
|
QTest::newRow("Arc 10 cm length (-10 cm radius), cut length 0 cm")
|
||||||
|
<< center << -radius << 135. << length << 0. << l.p2();
|
||||||
|
|
||||||
|
QTest::newRow("Arc -10 cm length (-10 cm radius), cut length 0 cm")
|
||||||
|
<< center << -radius << 135. << -length << 0. << l.p2();
|
||||||
|
|
||||||
|
QTest::newRow("Arc -10 cm length (10 cm radius), cut length 10 cm")
|
||||||
|
<< center << radius << 135. << -length << length << l.p2();
|
||||||
|
|
||||||
|
QTest::newRow("Arc -10 cm length (-10 cm radius), cut length 10 cm")
|
||||||
|
<< center << -radius << 135. << -length << length << l.p2();
|
||||||
|
|
||||||
|
const qreal arcAngle = qAbs(qRadiansToDegrees(ToPixel(10, Unit::Cm) / qAbs(radius)));
|
||||||
|
l = QLineF(center, QPointF(center.x() + radius, center.y()));
|
||||||
|
l.setAngle(135 + arcAngle);
|
||||||
|
|
||||||
|
QTest::newRow("Arc 10 cm length, cut length 10 cm")
|
||||||
|
<< center << radius << 135. << length << ToPixel(10, Unit::Cm) << l.p2();
|
||||||
|
|
||||||
|
l = QLineF(center, QPointF(center.x() + radius, center.y()));
|
||||||
|
l.setAngle(135 - arcAngle);
|
||||||
|
|
||||||
|
QTest::newRow("Arc -10 cm length (10 cm radius), cut length -10 cm")
|
||||||
|
<< center << radius << 135. << -length << -radius << l.p2();
|
||||||
|
|
||||||
|
QTest::newRow("Arc -10 cm length (-10 cm radius), cut length -10 cm")
|
||||||
|
<< center << -radius << 135. << -length << -radius << l.p2();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TST_VArc::TestCutArc()
|
void TST_VArc::TestCutArcByLength()
|
||||||
{
|
{
|
||||||
QFETCH(QPointF, center);
|
QFETCH(QPointF, center);
|
||||||
QFETCH(qreal, radius);
|
QFETCH(qreal, radius);
|
||||||
|
|
|
@ -34,20 +34,22 @@
|
||||||
class TST_VArc : public AbstractTest
|
class TST_VArc : public AbstractTest
|
||||||
{
|
{
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VArc(QObject *parent = nullptr);
|
explicit TST_VArc(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void CompareTwoWays();
|
void CompareTwoWays();
|
||||||
void NegativeArc();
|
void ArcByLength_data();
|
||||||
|
void ArcByLength();
|
||||||
void TestGetPoints_data();
|
void TestGetPoints_data();
|
||||||
void TestGetPoints();
|
void TestGetPoints();
|
||||||
void TestRotation_data();
|
void TestRotation_data();
|
||||||
void TestRotation();
|
void TestRotation();
|
||||||
void TestFlip_data();
|
void TestFlip_data();
|
||||||
void TestFlip();
|
void TestFlip();
|
||||||
void TestCutArc_data();
|
void TestCutArcByLength_data();
|
||||||
void TestCutArc();
|
void TestCutArcByLength();
|
||||||
void TestCurveIntersectAxis_data();
|
void TestCurveIntersectAxis_data();
|
||||||
void TestCurveIntersectAxis();
|
void TestCurveIntersectAxis();
|
||||||
void EmptyArc();
|
void EmptyArc();
|
||||||
|
|
|
@ -55,22 +55,85 @@ void TST_VEllipticalArc::CompareTwoWays_data()
|
||||||
QTest::addColumn<qreal>("f2");
|
QTest::addColumn<qreal>("f2");
|
||||||
QTest::addColumn<qreal>("rotationAngle");
|
QTest::addColumn<qreal>("rotationAngle");
|
||||||
|
|
||||||
QTest::newRow("Test case 1") << QPointF() << 100. << 200. << 0. << 90.0 << 0.;
|
QTest::newRow("Test case 1, +r, +r") << QPointF() << 100. << 200. << 0. << 90.0 << 0.;
|
||||||
QTest::newRow("Test case 2") << QPointF() << 100. << 200. << 0. << 180.0 << 0.;
|
QTest::newRow("Test case 1, -r, +r") << QPointF() << -100. << 200. << 0. << 90.0 << 0.;
|
||||||
QTest::newRow("Test case 3") << QPointF() << 100. << 200. << 0. << 270.0 << 0.;
|
QTest::newRow("Test case 1, +r, -r") << QPointF() << 100. << -200. << 0. << 90.0 << 0.;
|
||||||
QTest::newRow("Test case 4") << QPointF() << 100. << 200. << 0. << 360.0 << 0.;
|
QTest::newRow("Test case 1, -r, -r") << QPointF() << -100. << -200. << 0. << 90.0 << 0.;
|
||||||
QTest::newRow("Test case 5") << QPointF(10, 10) << 100. << 200. << 0. << 90.0 << 80.;
|
|
||||||
QTest::newRow("Test case 6") << QPointF(10, 10) << 100. << 200. << 0. << 180.0 << 80.;
|
QTest::newRow("Test case 2, +r, +r") << QPointF() << 100. << 200. << 0. << 180.0 << 0.;
|
||||||
QTest::newRow("Test case 7") << QPointF(10, 10) << 100. << 200. << 0. << 270.0 << 80.;
|
QTest::newRow("Test case 2, -r, +r") << QPointF() << -100. << 200. << 0. << 180.0 << 0.;
|
||||||
QTest::newRow("Test case 8") << QPointF(10, 10) << 100. << 200. << 0. << 360.0 << 80.;
|
QTest::newRow("Test case 2, +r, -r") << QPointF() << 100. << -200. << 0. << 180.0 << 0.;
|
||||||
QTest::newRow("Test case 9") << QPointF() << 100. << 200. << 0. << 90.0 << 80.;
|
QTest::newRow("Test case 2, -r, -r") << QPointF() << -100. << -200. << 0. << 180.0 << 0.;
|
||||||
QTest::newRow("Test case 10") << QPointF() << 100. << 200. << 0. << 180.0 << 80.;
|
|
||||||
QTest::newRow("Test case 11") << QPointF() << 100. << 200. << 0. << 270.0 << 80.;
|
QTest::newRow("Test case 3, +r, +r") << QPointF() << 100. << 200. << 0. << 270.0 << 0.;
|
||||||
QTest::newRow("Test case 12") << QPointF() << 100. << 200. << 0. << 360.0 << 80.;
|
QTest::newRow("Test case 3, -r, +r") << QPointF() << -100. << 200. << 0. << 270.0 << 0.;
|
||||||
QTest::newRow("Test case 13") << QPointF(10, 10) << 100. << 200. << 0. << 90.0 << 80.;
|
QTest::newRow("Test case 3, +r, -r") << QPointF() << 100. << -200. << 0. << 270.0 << 0.;
|
||||||
QTest::newRow("Test case 14") << QPointF(10, 10) << 100. << 200. << 0. << 180.0 << 80.;
|
QTest::newRow("Test case 3, -r, -r") << QPointF() << -100. << -200. << 0. << 270.0 << 0.;
|
||||||
QTest::newRow("Test case 15") << QPointF(10, 10) << 100. << 200. << 0. << 270.0 << 80.;
|
|
||||||
QTest::newRow("Test case 16") << QPointF(10, 10) << 100. << 200. << 0. << 360.0 << 80.;
|
QTest::newRow("Test case 4, +r, +r") << QPointF() << 100. << 200. << 0. << 360.0 << 0.;
|
||||||
|
QTest::newRow("Test case 4, -r, +r") << QPointF() << -100. << 200. << 0. << 360.0 << 0.;
|
||||||
|
QTest::newRow("Test case 4, +r, -r") << QPointF() << 100. << -200. << 0. << 360.0 << 0.;
|
||||||
|
QTest::newRow("Test case 4, -r, -r") << QPointF() << -100. << -200. << 0. << 360.0 << 0.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 5, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 5, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 5, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 5, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 6, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 6, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 6, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 6, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 7, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 7, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 7, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 7, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 8, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 8, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 8, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 8, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 360.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 9, +r, +r") << QPointF() << 100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 9, -r, +r") << QPointF() << -100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 9, +r, -r") << QPointF() << 100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 9, -r, -r") << QPointF() << -100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 10, +r, +r") << QPointF() << 100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 10, -r, +r") << QPointF() << -100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 10, +r, -r") << QPointF() << 100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 10, -r, -r") << QPointF() << -100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 11, +r, +r") << QPointF() << 100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 11, -r, +r") << QPointF() << -100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 11, +r, -r") << QPointF() << 100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 11, -r, -r") << QPointF() << -100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 12, +r, +r") << QPointF() << 100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 12, -r, +r") << QPointF() << -100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 12, +r, -r") << QPointF() << 100. << -200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 12, -r, -r") << QPointF() << -100. << -200. << 0. << 360.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 13, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 13, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 13, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
QTest::newRow("Test case 13, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 90.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 14, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 14, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 14, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
QTest::newRow("Test case 14, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 180.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 15, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 15, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 15, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
QTest::newRow("Test case 15, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 270.0 << 80.;
|
||||||
|
|
||||||
|
QTest::newRow("Test case 16, +r, +r") << QPointF(10, 10) << 100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 16, -r, +r") << QPointF(10, 10) << -100. << 200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 16, +r, -r") << QPointF(10, 10) << 100. << -200. << 0. << 360.0 << 80.;
|
||||||
|
QTest::newRow("Test case 16, -r, -r") << QPointF(10, 10) << -100. << -200. << 0. << 360.0 << 80.;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -91,7 +154,7 @@ void TST_VEllipticalArc::CompareTwoWays()
|
||||||
|
|
||||||
VEllipticalArc arc2(length, center, radius1, radius2, f1, rotationAngle);
|
VEllipticalArc arc2(length, center, radius1, radius2, f1, rotationAngle);
|
||||||
|
|
||||||
const qreal lengthEps = ToPixel(0.45, Unit::Mm); // computing error
|
Q_RELAXED_CONSTEXPR qreal lengthEps = ToPixel(0.45, Unit::Mm); // computing error
|
||||||
|
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
QString errorLengthMsg = u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s;
|
QString errorLengthMsg = u"Difference between real and computing lengthes bigger than eps = %1. l1 = %2; l2 = %3"_s;
|
||||||
|
@ -111,30 +174,57 @@ void TST_VEllipticalArc::CompareTwoWays()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
void TST_VEllipticalArc::ArcByLength_data()
|
||||||
void TST_VEllipticalArc::NegativeArc()
|
|
||||||
{
|
{
|
||||||
|
QTest::addColumn<qreal>("radius1");
|
||||||
|
QTest::addColumn<qreal>("radius2");
|
||||||
|
QTest::addColumn<qreal>("f1");
|
||||||
|
QTest::addColumn<qreal>("f2");
|
||||||
|
QTest::addColumn<qreal>("rotationAngle");
|
||||||
|
QTest::addColumn<bool>("flipped");
|
||||||
|
QTest::addColumn<int>("direction");
|
||||||
|
|
||||||
|
QTest::newRow("+r, +r, +length") << 100. << 200. << 1. << 181. << 0. << false << 1;
|
||||||
|
QTest::newRow("+r, +r, -length") << 100. << 200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("-r, +r, +length") << -100. << 200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("-r, +r, -length") << -100. << 200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("+r, -r, +length") << 100. << -200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("+r, -r, -length") << 100. << -200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("-r, -r, +length") << -100. << -200. << 1. << 181. << 0. << true << -1;
|
||||||
|
QTest::newRow("-r, -r, -length") << -100. << -200. << 1. << 181. << 0. << true << -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TST_VEllipticalArc::ArcByLength()
|
||||||
|
{
|
||||||
|
QFETCH(qreal, radius1);
|
||||||
|
QFETCH(qreal, radius2);
|
||||||
|
QFETCH(qreal, f1);
|
||||||
|
QFETCH(qreal, f2);
|
||||||
|
QFETCH(qreal, rotationAngle);
|
||||||
|
QFETCH(bool, flipped);
|
||||||
|
QFETCH(int, direction);
|
||||||
|
|
||||||
const VPointF center;
|
const VPointF center;
|
||||||
const qreal radius1 = 100;
|
|
||||||
const qreal radius2 = 200;
|
|
||||||
const qreal f1 = 1;
|
|
||||||
const qreal f2 = 181;
|
|
||||||
const qreal rotationAngle = 0;
|
|
||||||
|
|
||||||
// Full ellipse
|
// Full ellipse
|
||||||
const qreal h = ((radius1 - radius2) * (radius1 - radius2)) / ((radius1 + radius2) * (radius1 + radius2));
|
const qreal h = ((qAbs(radius1) - qAbs(radius2)) * (qAbs(radius1) - qAbs(radius2))) /
|
||||||
const qreal length = M_PI * (radius1 + radius2) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h))) / 2;
|
((qAbs(radius1) + qAbs(radius2)) * (qAbs(radius1) + qAbs(radius2)));
|
||||||
VEllipticalArc arc(-length, center, radius1, radius2, f1, rotationAngle);
|
const qreal length =
|
||||||
|
(M_PI * (qAbs(radius1) + qAbs(radius2)) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h))) / 2) * direction;
|
||||||
|
VEllipticalArc arc(length, center, radius1, radius2, f1, rotationAngle);
|
||||||
|
|
||||||
const qreal eps = ToPixel(0.45, Unit::Mm); // computing error
|
Q_RELAXED_CONSTEXPR qreal eps = ToPixel(0.45, Unit::Mm); // computing error
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
u"Difference between real and computing lengthes bigger than eps = %1. v1 = %2; v2 = %3"_s;
|
QStringLiteral("Difference between real and computing lengthes bigger than eps = %1. v1 = %2; v2 = %3");
|
||||||
|
|
||||||
QVERIFY2(qAbs(arc.GetLength() + length) <= eps, qUtf8Printable(errorMsg.arg(eps).arg(arc.GetLength()).arg(length)));
|
QVERIFY2(qAbs(arc.GetLength() - length) <= eps, qUtf8Printable(errorMsg.arg(eps).arg(arc.GetLength()).arg(length)));
|
||||||
|
|
||||||
const qreal angleEps = 0.4;
|
const qreal angleEps = 0.4;
|
||||||
QVERIFY2(arc.GetEndAngle() - f2 <= angleEps, qUtf8Printable(errorMsg.arg(eps).arg(arc.GetEndAngle()).arg(f2)));
|
QVERIFY2(arc.GetEndAngle() - f2 <= angleEps, qUtf8Printable(errorMsg.arg(eps).arg(arc.GetEndAngle()).arg(f2)));
|
||||||
|
|
||||||
|
QCOMPARE(arc.IsFlipped(), flipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
|
@ -172,106 +262,445 @@ void TST_VEllipticalArc::TestData()
|
||||||
QTest::addColumn<qreal>("rotationAngle");
|
QTest::addColumn<qreal>("rotationAngle");
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 10, 20; start 0") << 10.0 << 20.0 << 0.0 << 360.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 10, 20; start 0") << 10.0 << 20.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -10, 20; start 0") << -10.0 << 20.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 10, -20; start 0") << 10.0 << -20.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -10, -20; start 0") << -10.0 << -20.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 150, 200; start 0") << 150.0 << 200.0 << 0.0 << 360.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 150, 200; start 0") << 150.0 << 200.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, 200; start 0") << -150.0 << 200.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 150, -200; start 0") << 150.0 << -200.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, -200; start 0") << -150.0 << -200.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 150, 200, rotation 30; start 0") << 150.0 << 200.0 << 0.0 << 360.0 << 30.0;
|
QTest::newRow("Full circle: radiuses 150, 200, rotation 30; start 0") << 150.0 << 200.0 << 0.0 << 360.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, 200, rotation 30; start 0") << -150.0 << 200.0 << 0.0 << 360.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 150, -200, rotation 30; start 0") << 150.0 << -200.0 << 0.0 << 360.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, -200, rotation 30; start 0") << -150.0 << -200.0 << 0.0 << 360.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 1500, 1000; start 0") << 1500.0 << 1000.0 << 0.0 << 360.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 1500, 1000; start 0") << 1500.0 << 1000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, 1000; start 0") << -1500.0 << 1000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, -1000; start 0") << 1500.0 << -1000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, -1000; start 0") << -1500.0 << -1000.0 << 0.0 << 360.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 0") << 1500.0 << 1000.0 << 0.0 << 360.0 << 50.0;
|
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 0") << 1500.0 << 1000.0 << 0.0 << 360.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, 1000, rotation 50; start 0")
|
||||||
|
<< -1500.0 << 1000.0 << 0.0 << 360.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, -1000, rotation 50; start 0")
|
||||||
|
<< 1500.0 << -1000.0 << 0.0 << 360.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, -1000, rotation 50; start 0")
|
||||||
|
<< -1500.0 << -1000.0 << 0.0 << 360.0 << 50.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 15000, 10000, rotation 90; start 0")
|
QTest::newRow("Full circle: radiuses 15000, 10000, rotation 90; start 0")
|
||||||
<< 15000.0 << 10000.0 << 0.0 << 360.0 << 90.0;
|
<< 15000.0 << 10000.0 << 0.0 << 360.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -15000, 10000, rotation 90; start 0")
|
||||||
|
<< -15000.0 << 10000.0 << 0.0 << 360.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 15000, -10000, rotation 90; start 0")
|
||||||
|
<< 15000.0 << -10000.0 << 0.0 << 360.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -15000, -10000, rotation 90; start 0")
|
||||||
|
<< -15000.0 << -10000.0 << 0.0 << 360.0 << 90.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 10, 20; start 90") << 10.0 << 20.0 << 90.0 << 90.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 10, 20; start 90") << 10.0 << 20.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -10, 20; start 90") << -10.0 << 20.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 10, -20; start 90") << 10.0 << -20.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -10, -20; start 90") << -10.0 << -20.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 150, 200; start 90") << 150.0 << 200.0 << 90.0 << 90.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 150, 200; start 90") << 150.0 << 200.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, 200; start 90") << -150.0 << 200.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 150, -200; start 90") << 150.0 << -200.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, -200; start 90") << -150.0 << -200.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 150, 200, rotation 30; start 90") << 150.0 << 200.0 << 90.0 << 90.0 << 30.0;
|
QTest::newRow("Full circle: radiuses 150, 200, rotation 30; start 90") << 150.0 << 200.0 << 90.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, 200, rotation 30; start 90") << -150.0 << 200.0 << 90.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 150, -200, rotation 30; start 90") << 150.0 << -200.0 << 90.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -150, -200, rotation 30; start 90")
|
||||||
|
<< -150.0 << -200.0 << 90.0 << 90.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 1500, 1000; start 90") << 1500.0 << 1000.0 << 90.0 << 90.0 << 0.0;
|
QTest::newRow("Full circle: radiuses 1500, 1000; start 90") << 1500.0 << 1000.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, 1000; start 90") << 1500.0 << -1000.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, -1000; start 90") << 1500.0 << -1000.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -1500, -1000; start 90") << -1500.0 << -1000.0 << 90.0 << 90.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 90")
|
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 90")
|
||||||
<< 1500.0 << 1000.0 << 90.0 << 90.0 << 50.0;
|
<< 1500.0 << 1000.0 << 90.0 << 90.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 90")
|
||||||
|
<< 1500.0 << 1000.0 << 90.0 << 90.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 90")
|
||||||
|
<< 1500.0 << 1000.0 << 90.0 << 90.0 << 50.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 1500, 1000, rotation 50; start 90")
|
||||||
|
<< 1500.0 << 1000.0 << 90.0 << 90.0 << 50.0;
|
||||||
|
|
||||||
QTest::newRow("Full circle: radiuses 15000, 10000, rotation 90; start 90")
|
QTest::newRow("Full circle: radiuses 15000, 10000, rotation 90; start 90")
|
||||||
<< 15000.0 << 10000.0 << 90.0 << 90.0 << 90.0;
|
<< 15000.0 << 10000.0 << 90.0 << 90.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -15000, 10000, rotation 90; start 90")
|
||||||
|
<< -15000.0 << 10000.0 << 90.0 << 90.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses 15000, -10000, rotation 90; start 90")
|
||||||
|
<< 15000.0 << -10000.0 << 90.0 << 90.0 << 90.0;
|
||||||
|
QTest::newRow("Full circle: radiuses -15000, -10000, rotation 90; start 90")
|
||||||
|
<< -15000.0 << -10000.0 << 90.0 << 90.0 << 90.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 10.5 << 0.0;
|
QTest::newRow("Arc less than 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 45 degree, radiuses 150, 50, rotation 180") << 150.0 << 50.0 << 0.0 << 10.5 << 180.0;
|
QTest::newRow("Arc less than 45 degree, radiuses 150, 50, rotation 180") << 150.0 << 50.0 << 0.0 << 10.5 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -150, 50, rotation 180") << -150.0 << 50.0 << 0.0 << 10.5 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 150, -50, rotation 180") << 150.0 << -50.0 << 0.0 << 10.5 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -150, -50, rotation 180")
|
||||||
|
<< -150.0 << -50.0 << 0.0 << 10.5 << 180.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 45 degree, radiuses 1500, 800, rotation 90") << 1500.0 << 800.0 << 0.0 << 10.5 << 90.0;
|
QTest::newRow("Arc less than 45 degree, radiuses 1500, 800, rotation 90") << 1500.0 << 800.0 << 0.0 << 10.5 << 90.0;
|
||||||
QTest::newRow("Arc less than 45 degree, radiuses 15000, 10000, rotation 40")
|
QTest::newRow("Arc less than 45 degree, radiuses -1500, 800, rotation 90")
|
||||||
|
<< -1500.0 << 800.0 << 0.0 << 10.5 << 90.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 1500, -800, rotation 90")
|
||||||
|
<< 1500.0 << -800.0 << 0.0 << 10.5 << 90.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -1500, -800, rotation 90")
|
||||||
|
<< -1500.0 << -800.0 << 0.0 << 10.5 << 90.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 50000, 10000, rotation 40")
|
||||||
<< 50000.0 << 10000.0 << 0.0 << 10.5 << 40.0;
|
<< 50000.0 << 10000.0 << 0.0 << 10.5 << 40.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -50000, 10000, rotation 40")
|
||||||
|
<< 50000.0 << 10000.0 << 0.0 << 10.5 << 40.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 50000, -10000, rotation 40")
|
||||||
|
<< 50000.0 << 10000.0 << 0.0 << 10.5 << 40.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -50000, -10000, rotation 40")
|
||||||
|
<< -50000.0 << -10000.0 << 0.0 << 10.5 << 40.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 45 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 10.5 << 0.0;
|
QTest::newRow("Arc less than 45 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 45 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 10.5 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radiuses 100, 50, rotation 45") << 100.0 << 50.0 << 0.0 << 45.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radiuses 100, 50, rotation 45") << 100.0 << 50.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -100, 50, rotation 45") << -100.0 << 50.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 100, -50, rotation 45") << 100.0 << -50.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -100, -50, rotation 45") << -100.0 << -50.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radiuses 150, 15, rotation 30") << 150.0 << 15.0 << 0.0 << 45.0 << 30.0;
|
QTest::newRow("Arc 45 degree, radiuses 150, 15, rotation 30") << 150.0 << 15.0 << 0.0 << 45.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -150, 15, rotation 30") << -150.0 << 15.0 << 0.0 << 45.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 150, -15, rotation 30") << 150.0 << -15.0 << 0.0 << 45.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -150, -15, rotation 30") << -150.0 << -15.0 << 0.0 << 45.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radiuses 1500, 150, rotation 45") << 1500.0 << 150.0 << 0.0 << 45.0 << 45.0;
|
QTest::newRow("Arc 45 degree, radiuses 1500, 150, rotation 45") << 1500.0 << 150.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -1500, 150, rotation 45") << -1500.0 << 150.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 1500, -150, rotation 45") << 1500.0 << -150.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -1500, -150, rotation 45") << -1500.0 << -150.0 << 0.0 << 45.0 << 45.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radiuses 15000, 15000") << 15000.0 << 15000.0 << 0.0 << 45.0 << 0.0;
|
QTest::newRow("Arc 45 degree, radiuses 15000, 15000") << 15000.0 << 15000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -15000, 15000") << -15000.0 << 15000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 15000, -15000") << 15000.0 << -15000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -15000, -15000") << -15000.0 << -15000.0 << 0.0 << 45.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 45 degree, radiuses 15000, 10000, rotation 270") << 15000.0 << 10000.0 << 0.0 << 45.0 << 270.0;
|
QTest::newRow("Arc 45 degree, radiuses 15000, 10000, rotation 270") << 15000.0 << 10000.0 << 0.0 << 45.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -15000, 10000, rotation 270") << -15000.0 << 10000.0 << 0.0 << 45.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses 15000, -10000, rotation 270") << 15000.0 << -10000.0 << 0.0 << 45.0 << 270.0;
|
||||||
|
QTest::newRow("Arc 45 degree, radiuses -15000, -10000, rotation 270")
|
||||||
|
<< -15000.0 << -10000.0 << 0.0 << 45.0 << 270.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radiuses 100, 400, rotation 50") << 100.0 << 400.0 << 0.0 << 75.0 << 50.0;
|
QTest::newRow("Arc less than 90 degree, radiuses 100, 400, rotation 50") << 100.0 << 400.0 << 0.0 << 75.0 << 50.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -100, 400, rotation 50") << -100.0 << 400.0 << 0.0 << 75.0 << 50.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 100, -400, rotation 50") << 100.0 << -400.0 << 0.0 << 75.0 << 50.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -100, -400, rotation 50")
|
||||||
|
<< -100.0 << -400.0 << 0.0 << 75.0 << 50.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radiuses 150, 400, rotation 90") << 150.0 << 400.0 << 0.0 << 75.0 << 90.0;
|
QTest::newRow("Arc less than 90 degree, radiuses 150, 400, rotation 90") << 150.0 << 400.0 << 0.0 << 75.0 << 90.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -150, 400, rotation 90") << -150.0 << 400.0 << 0.0 << 75.0 << 90.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 150, -400, rotation 90") << 150.0 << -400.0 << 0.0 << 75.0 << 90.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -150, -400, rotation 90")
|
||||||
|
<< -150.0 << -400.0 << 0.0 << 75.0 << 90.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radiuses 1500, 50000, rotation 180")
|
QTest::newRow("Arc less than 90 degree, radiuses 1500, 50000, rotation 180")
|
||||||
<< 1500.0 << 50000.0 << 0.0 << 75.0 << 180.0;
|
<< 1500.0 << 50000.0 << 0.0 << 75.0 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -1500, 50000, rotation 180")
|
||||||
|
<< -1500.0 << 50000.0 << 0.0 << 75.0 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 1500, -50000, rotation 180")
|
||||||
|
<< 1500.0 << -50000.0 << 0.0 << 75.0 << 180.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -1500, -50000, rotation 180")
|
||||||
|
<< -1500.0 << -50000.0 << 0.0 << 75.0 << 180.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radiuses 50000, 5000, rotation 30")
|
QTest::newRow("Arc less than 90 degree, radiuses 50000, 5000, rotation 30")
|
||||||
<< 50000.0 << 5000.0 << 0.0 << 75.0 << 30.0;
|
<< 50000.0 << 5000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -50000, 5000, rotation 30")
|
||||||
|
<< -50000.0 << 5000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 50000, -5000, rotation 30")
|
||||||
|
<< 50000.0 << -5000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -50000, -5000, rotation 30")
|
||||||
|
<< -50000.0 << -5000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 90 degree, radiuses 90000, 50000, rotation 30")
|
QTest::newRow("Arc less than 90 degree, radiuses 90000, 50000, rotation 30")
|
||||||
<< 90000.0 << 50000.0 << 0.0 << 75.0 << 30.0;
|
<< 90000.0 << 50000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -90000, 50000, rotation 30")
|
||||||
|
<< -90000.0 << 50000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses 90000, -50000, rotation 30")
|
||||||
|
<< 90000.0 << -50000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 90 degree, radiuses -90000, -50000, rotation 30")
|
||||||
|
<< -90000.0 << -50000.0 << 0.0 << 75.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 90 degree, radiuses 100, 50, rotation 30") << 100.0 << 50.0 << 0.0 << 90.0 << 30.0;
|
QTest::newRow("Arc 90 degree, radiuses 100, 50, rotation 30") << 100.0 << 50.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -100, 50, rotation 30") << -100.0 << 50.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 100, -50, rotation 30") << 100.0 << -50.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -100, -50, rotation 30") << -100.0 << -50.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 90 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 90.0 << 0.0;
|
QTest::newRow("Arc 90 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 90.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 90 degree, radiuses 1500, 800, rotation 70") << 1500.0 << 800.0 << 0.0 << 90.0 << 70.0;
|
QTest::newRow("Arc 90 degree, radiuses 1500, 800, rotation 70") << 1500.0 << 800.0 << 0.0 << 90.0 << 70.0;
|
||||||
QTest::newRow("Arc 90 degree, radiuses 15000, 5000, rotation 30") << 15000.0 << 1500.0 << 0.0 << 90.0 << 30.0;
|
QTest::newRow("Arc 90 degree, radiuses -1500, 800, rotation 70") << -1500.0 << 800.0 << 0.0 << 90.0 << 70.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 1500, -800, rotation 70") << 1500.0 << -800.0 << 0.0 << 90.0 << 70.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -1500, -800, rotation 70") << -1500.0 << -800.0 << 0.0 << 90.0 << 70.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 15000, 1500, rotation 30") << 15000.0 << 1500.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -15000, 1500, rotation 30") << -15000.0 << 1500.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 15000, -1500, rotation 30") << 15000.0 << -1500.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -15000, -1500, rotation 30") << -15000.0 << -1500.0 << 0.0 << 90.0 << 30.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 90 degree, radiuses 15000, 14000, rotation 235") << 15000.0 << 14000.0 << 0.0 << 90.0 << 235.0;
|
QTest::newRow("Arc 90 degree, radiuses 15000, 14000, rotation 235") << 15000.0 << 14000.0 << 0.0 << 90.0 << 235.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -15000, 14000, rotation 235") << -15000.0 << 14000.0 << 0.0 << 90.0 << 235.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses 15000, -14000, rotation 235") << 15000.0 << -14000.0 << 0.0 << 90.0 << 235.0;
|
||||||
|
QTest::newRow("Arc 90 degree, radiuses -15000, -14000, rotation 235")
|
||||||
|
<< -15000.0 << -14000.0 << 0.0 << 90.0 << 235.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radiuses 100, 50, rotation 60") << 100.0 << 50.0 << 0.0 << 110.6 << 60.0;
|
QTest::newRow("Arc less than 135 degree, radiuses 100, 50, rotation 60") << 100.0 << 50.0 << 0.0 << 110.6 << 60.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -100, 50, rotation 60") << -100.0 << 50.0 << 0.0 << 110.6 << 60.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 100, -50, rotation 60") << 100.0 << -50.0 << 0.0 << 110.6 << 60.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -100, -50, rotation 60")
|
||||||
|
<< -100.0 << -50.0 << 0.0 << 110.6 << 60.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radiuses 150, 400, rotation 300")
|
QTest::newRow("Arc less than 135 degree, radiuses 150, 400, rotation 300")
|
||||||
<< 150.0 << 400.0 << 0.0 << 110.6 << 300.0;
|
<< 150.0 << 400.0 << 0.0 << 110.6 << 300.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -150, 400, rotation 300")
|
||||||
|
<< -150.0 << 400.0 << 0.0 << 110.6 << 300.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 150, -400, rotation 300")
|
||||||
|
<< 150.0 << -400.0 << 0.0 << 110.6 << 300.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -150, -400, rotation 300")
|
||||||
|
<< -150.0 << -400.0 << 0.0 << 110.6 << 300.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radiuses 1500, 800, rotation 360")
|
QTest::newRow("Arc less than 135 degree, radiuses 1500, 800, rotation 360")
|
||||||
<< 1500.0 << 800.0 << 0.0 << 110.6 << 360.0;
|
<< 1500.0 << 800.0 << 0.0 << 110.6 << 360.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -1500, 800, rotation 360")
|
||||||
|
<< -1500.0 << 800.0 << 0.0 << 110.6 << 360.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 1500, -800, rotation 360")
|
||||||
|
<< 1500.0 << -800.0 << 0.0 << 110.6 << 360.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -1500, -800, rotation 360")
|
||||||
|
<< -1500.0 << -800.0 << 0.0 << 110.6 << 360.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radiuses 15000, 1500, rotation 290")
|
QTest::newRow("Arc less than 135 degree, radiuses 15000, 1500, rotation 290")
|
||||||
<< 15000.0 << 1500.0 << 0.0 << 110.6 << 290.0;
|
<< 15000.0 << 1500.0 << 0.0 << 110.6 << 290.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -15000, 1500, rotation 290")
|
||||||
|
<< -15000.0 << 1500.0 << 0.0 << 110.6 << 290.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 15000, -1500, rotation 290")
|
||||||
|
<< 15000.0 << -1500.0 << 0.0 << 110.6 << 290.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -15000, -1500, rotation 290")
|
||||||
|
<< -15000.0 << -1500.0 << 0.0 << 110.6 << 290.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 135 degree, radiuses 15000, 1500") << 15000.0 << 1500.0 << 0.0 << 110.6 << 0.0;
|
QTest::newRow("Arc less than 135 degree, radiuses 15000, 1500") << 15000.0 << 1500.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -15000, 1500") << -15000.0 << 1500.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses 15000, -1500") << 15000.0 << -1500.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 135 degree, radiuses -15000, -1500") << -15000.0 << -1500.0 << 0.0 << 110.6 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 135.0 << 0.0;
|
QTest::newRow("Arc 135 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 135.0 << 0.0;
|
QTest::newRow("Arc 135 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 135.0 << 0.0;
|
QTest::newRow("Arc 135 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radiuses 15000, 1500, rotation 20") << 15000.0 << 1500.0 << 0.0 << 135.0 << 20.0;
|
QTest::newRow("Arc 135 degree, radiuses 15000, 1500, rotation 20") << 15000.0 << 1500.0 << 0.0 << 135.0 << 20.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -15000, 1500, rotation 20") << -15000.0 << 1500.0 << 0.0 << 135.0 << 20.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 15000, -1500, rotation 20") << 15000.0 << -1500.0 << 0.0 << 135.0 << 20.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -15000, -1500, rotation 20") << -15000.0 << -1500.0 << 0.0 << 135.0 << 20.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 135 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 135.0 << 0.0;
|
QTest::newRow("Arc 135 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 135 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 160.7 << 0.0;
|
QTest::newRow("Arc less than 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 160.7 << 0.0;
|
QTest::newRow("Arc less than 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 160.7 << 0.0;
|
QTest::newRow("Arc less than 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radiuses 15000, 1500, rotation 270")
|
QTest::newRow("Arc less than 180 degree, radiuses 15000, 1500, rotation 270")
|
||||||
<< 15000.0 << 1500.0 << 0.0 << 160.7 << 270.0;
|
<< 15000.0 << 1500.0 << 0.0 << 160.7 << 270.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -15000, 1500, rotation 270")
|
||||||
|
<< -15000.0 << 1500.0 << 0.0 << 160.7 << 270.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 15000, -1500, rotation 270")
|
||||||
|
<< 15000.0 << -1500.0 << 0.0 << 160.7 << 270.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -15000, -1500, rotation 270")
|
||||||
|
<< -15000.0 << -1500.0 << 0.0 << 160.7 << 270.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 180 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 160.7 << 0.0;
|
QTest::newRow("Arc less than 180 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 180 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 160.7 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 180.0 << 0.0;
|
QTest::newRow("Arc 180 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 180.0 << 0.0;
|
QTest::newRow("Arc 180 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 180.0 << 0.0;
|
QTest::newRow("Arc 180 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radiuses 15000, 1500, rotation 60") << 15000.0 << 1500.0 << 0.0 << 180.0 << 60.0;
|
QTest::newRow("Arc 180 degree, radiuses 15000, 1500, rotation 60") << 15000.0 << 1500.0 << 0.0 << 180.0 << 60.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -15000, 1500, rotation 60") << -15000.0 << 1500.0 << 0.0 << 180.0 << 60.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 15000, -1500, rotation 60") << 15000.0 << -1500.0 << 0.0 << 180.0 << 60.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -15000, -1500, rotation 60") << -15000.0 << -1500.0 << 0.0 << 180.0 << 60.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 180 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 180.0 << 0.0;
|
QTest::newRow("Arc 180 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 180 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 180.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 150.3 << 0.0;
|
QTest::newRow("Arc less than 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 150.3 << 0.0;
|
QTest::newRow("Arc less than 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 150.3 << 0.0;
|
QTest::newRow("Arc less than 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radiuses 15000, 1500, rotation 20")
|
QTest::newRow("Arc less than 270 degree, radiuses 15000, 1500, rotation 20")
|
||||||
<< 15000.0 << 1500.0 << 0.0 << 150.3 << 20.0;
|
<< 15000.0 << 1500.0 << 0.0 << 150.3 << 20.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -15000, 1500, rotation 20")
|
||||||
|
<< -15000.0 << 1500.0 << 0.0 << 150.3 << 20.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 15000, -1500, rotation 20")
|
||||||
|
<< 15000.0 << -1500.0 << 0.0 << 150.3 << 20.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -15000, -1500, rotation 20")
|
||||||
|
<< -15000.0 << -1500.0 << 0.0 << 150.3 << 20.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 270 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 150.3 << 0.0;
|
QTest::newRow("Arc less than 270 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 270 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 150.3 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 270.0 << 0.0;
|
QTest::newRow("Arc 270 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 270.0 << 0.0;
|
QTest::newRow("Arc 270 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 270.0 << 0.0;
|
QTest::newRow("Arc 270 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radiuses 15000, 1500, rotation 90") << 15000.0 << 1500.0 << 0.0 << 270.0 << 90.0;
|
QTest::newRow("Arc 270 degree, radiuses 15000, 1500, rotation 90") << 15000.0 << 1500.0 << 0.0 << 270.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -15000, 1500, rotation 90") << -15000.0 << 1500.0 << 0.0 << 270.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 15000, -1500, rotation 90") << 15000.0 << -1500.0 << 0.0 << 270.0 << 90.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -15000, -1500, rotation 90") << -15000.0 << -1500.0 << 0.0 << 270.0 << 90.0;
|
||||||
|
|
||||||
QTest::newRow("Arc 270 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 270.0 << 0.0;
|
QTest::newRow("Arc 270 degree, radiuses 15000, 10000") << 15000.0 << 10000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -15000, 10000") << -15000.0 << 10000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses 15000, -10000") << 15000.0 << -10000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
QTest::newRow("Arc 270 degree, radiuses -15000, -10000") << -15000.0 << -10000.0 << 0.0 << 270.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 360 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 340.0 << 0.0;
|
QTest::newRow("Arc less than 360 degree, radiuses 100, 50") << 100.0 << 50.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -100, 50") << -100.0 << 50.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 100, -50") << 100.0 << -50.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -100, -50") << -100.0 << -50.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 360 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 340.0 << 0.0;
|
QTest::newRow("Arc less than 360 degree, radiuses 150, 400") << 150.0 << 400.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -150, 400") << -150.0 << 400.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 150, -400") << 150.0 << -400.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -150, -400") << -150.0 << -400.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 360 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 340.0 << 0.0;
|
QTest::newRow("Arc less than 360 degree, radiuses 1500, 800") << 1500.0 << 800.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -1500, 800") << -1500.0 << 800.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 1500, -800") << 1500.0 << -800.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -1500, -800") << -1500.0 << -800.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc less than 360 degree, radiuses 12000, 1200, rotation 30")
|
QTest::newRow("Arc less than 360 degree, radiuses 12000, 1200, rotation 30")
|
||||||
<< 12000.0 << 1200.0 << 0.0 << 340.0 << 30.0;
|
<< 12000.0 << 1200.0 << 0.0 << 340.0 << 30.0;
|
||||||
QTest::newRow("Arc less than 360 degree, radiuses 12000, 10000") << 15000.0 << 10000.0 << 0.0 << 340.0 << 0.0;
|
QTest::newRow("Arc less than 360 degree, radiuses -12000, 1200, rotation 30")
|
||||||
|
<< -12000.0 << 1200.0 << 0.0 << 340.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 12000, -1200, rotation 30")
|
||||||
|
<< 12000.0 << -1200.0 << 0.0 << 340.0 << 30.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -12000, -1200, rotation 30")
|
||||||
|
<< -12000.0 << -1200.0 << 0.0 << 340.0 << 30.0;
|
||||||
|
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 12000, 10000") << 12000.0 << 10000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -12000, 10000") << -12000.0 << 10000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses 12000, -10000") << 12000.0 << -10000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
QTest::newRow("Arc less than 360 degree, radiuses -12000, -10000") << -12000.0 << -10000.0 << 0.0 << 340.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 90.0 << 135.0 << 0.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 100, 50") << 100.0 << 50.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -100, 50") << -100.0 << 50.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 100, -50") << 100.0 << -50.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -100, -50")
|
||||||
|
<< -100.0 << -50.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 150, 400") << 150.0 << 400.0 << 90.0 << 135.0 << 0.0;
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 150, 400") << 150.0 << 400.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -150, 400")
|
||||||
|
<< -150.0 << 400.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 150, -400")
|
||||||
|
<< 150.0 << -400.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -150, -400")
|
||||||
|
<< -150.0 << -400.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, 800")
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, 800")
|
||||||
<< 1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
|
<< 1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -1500, 800")
|
||||||
|
<< -1500.0 << 800.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 1500, -800")
|
||||||
|
<< 1500.0 << -800.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -1500, -800")
|
||||||
|
<< -1500.0 << -800.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 13000, 1000")
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 13000, 1000")
|
||||||
<< 15000.0 << 1000.0 << 90.0 << 135.0 << 0.0;
|
<< 13000.0 << 1000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -13000, 1000")
|
||||||
|
<< -13000.0 << 1000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 13000, -1000")
|
||||||
|
<< 13000.0 << -1000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -13000, -1000")
|
||||||
|
<< -13000.0 << -1000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
|
||||||
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 15000, 10000")
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 15000, 10000")
|
||||||
<< 15000.0 << 10000.0 << 90.0 << 135.0 << 0.0;
|
<< 15000.0 << 10000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -15000, 10000")
|
||||||
|
<< -15000.0 << 10000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses 15000, -10000")
|
||||||
|
<< 15000.0 << -10000.0 << 90.0 << 135.0 << 0.0;
|
||||||
|
QTest::newRow("Arc start 90 degree, angle 45 degree, radiuses -15000, -10000")
|
||||||
|
<< -15000.0 << -10000.0 << 90.0 << 135.0 << 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -326,10 +755,10 @@ void TST_VEllipticalArc::TestGetPoints2()
|
||||||
const qreal c = qSqrt(qAbs(radius2 * radius2 - radius1 * radius1));
|
const qreal c = qSqrt(qAbs(radius2 * radius2 - radius1 * radius1));
|
||||||
// distance from the center to the focus
|
// distance from the center to the focus
|
||||||
|
|
||||||
QPointF focus1 = static_cast<QPointF>(center);
|
auto focus1 = static_cast<QPointF>(center);
|
||||||
QPointF focus2 = static_cast<QPointF>(center);
|
auto focus2 = static_cast<QPointF>(center);
|
||||||
|
|
||||||
if (radius1 < radius2)
|
if (qAbs(radius1) < qAbs(radius2))
|
||||||
{
|
{
|
||||||
focus1.setY(focus1.ry() + c);
|
focus1.setY(focus1.ry() + c);
|
||||||
QLineF line(static_cast<QPointF>(center), focus1);
|
QLineF line(static_cast<QPointF>(center), focus1);
|
||||||
|
@ -354,7 +783,7 @@ void TST_VEllipticalArc::TestGetPoints2()
|
||||||
focus2 = line.p2();
|
focus2 = line.p2();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF ellipsePoint(center.x() + radius1, center.y());
|
QPointF ellipsePoint(center.x() + qAbs(radius1), center.y());
|
||||||
QLineF line(static_cast<QPointF>(center), ellipsePoint);
|
QLineF line(static_cast<QPointF>(center), ellipsePoint);
|
||||||
line.setAngle(line.angle() + rotationAngle);
|
line.setAngle(line.angle() + rotationAngle);
|
||||||
ellipsePoint = line.p2();
|
ellipsePoint = line.p2();
|
||||||
|
@ -401,7 +830,7 @@ void TST_VEllipticalArc::TestGetPoints3()
|
||||||
|
|
||||||
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{ // calculated full ellipse square
|
{ // calculated full ellipse square
|
||||||
const qreal ellipseSquare = M_PI * radius1 * radius2;
|
const qreal ellipseSquare = M_PI * qAbs(radius1) * qAbs(radius2);
|
||||||
const qreal epsSquare = ellipseSquare * 1.7 / 100; // computing error 1.7 % from origin square
|
const qreal epsSquare = ellipseSquare * 1.7 / 100; // computing error 1.7 % from origin square
|
||||||
const qreal arcSquare = qAbs(VAbstractPiece::SumTrapezoids(points) / 2.0);
|
const qreal arcSquare = qAbs(VAbstractPiece::SumTrapezoids(points) / 2.0);
|
||||||
const qreal diffSquare = qAbs(ellipseSquare - arcSquare);
|
const qreal diffSquare = qAbs(ellipseSquare - arcSquare);
|
||||||
|
@ -430,9 +859,15 @@ void TST_VEllipticalArc::TestGetPoints4()
|
||||||
|
|
||||||
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
if (VFuzzyComparePossibleNulls(arc.AngleArc(), 360.0))
|
||||||
{ // calculated full ellipse length
|
{ // calculated full ellipse length
|
||||||
const qreal h = ((radius1 - radius2) * (radius1 - radius2)) / ((radius1 + radius2) * (radius1 + radius2));
|
const qreal h = ((qAbs(radius1) - qAbs(radius2)) * (qAbs(radius1) - qAbs(radius2))) /
|
||||||
const qreal ellipseLength = M_PI * (radius1 + radius2) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h)));
|
((qAbs(radius1) + qAbs(radius2)) * (qAbs(radius1) + qAbs(radius2)));
|
||||||
const qreal epsLength = ToPixel(1, Unit::Mm); // computing error
|
qreal ellipseLength = M_PI * (qAbs(radius1) + qAbs(radius2)) * (1 + 3 * h / (10 + qSqrt(4 - 3 * h)));
|
||||||
|
if (radius1 < 0 || radius2 < 0)
|
||||||
|
{
|
||||||
|
ellipseLength *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_RELAXED_CONSTEXPR qreal epsLength = ToPixel(1, Unit::Mm); // computing error
|
||||||
const qreal arcLength = VEllipticalArc(center, radius1, radius2, 0, 360, 0).GetLength();
|
const qreal arcLength = VEllipticalArc(center, radius1, radius2, 0, 360, 0).GetLength();
|
||||||
const qreal diffLength = qAbs(arcLength - ellipseLength);
|
const qreal diffLength = qAbs(arcLength - ellipseLength);
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
|
@ -487,18 +922,38 @@ void TST_VEllipticalArc::TestGetPoints5()
|
||||||
|
|
||||||
if (points.size() > 2 && qFuzzyIsNull(rotationAngle))
|
if (points.size() > 2 && qFuzzyIsNull(rotationAngle))
|
||||||
{
|
{
|
||||||
const qreal testAccuracy = ToPixel(1.5, Unit::Mm);
|
Q_RELAXED_CONSTEXPR qreal testAccuracy = ToPixel(1.5, Unit::Mm);
|
||||||
|
|
||||||
|
if (!arc.IsFlipped())
|
||||||
|
{
|
||||||
ComparePointsDistance(arc.GetP1(), points.constFirst(), testAccuracy);
|
ComparePointsDistance(arc.GetP1(), points.constFirst(), testAccuracy);
|
||||||
ComparePointsDistance(arc.GetP2(), points.constLast(), testAccuracy);
|
ComparePointsDistance(arc.GetP2(), points.constLast(), testAccuracy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ComparePointsDistance(arc.GetP1(), points.constLast(), testAccuracy);
|
||||||
|
ComparePointsDistance(arc.GetP2(), points.constFirst(), testAccuracy);
|
||||||
|
}
|
||||||
|
|
||||||
const qreal eps = 0.15;
|
const qreal eps = 0.15;
|
||||||
|
|
||||||
|
if (!arc.IsFlipped())
|
||||||
|
{
|
||||||
f1 = QLineF(static_cast<QPointF>(center), points.constFirst()).angle();
|
f1 = QLineF(static_cast<QPointF>(center), points.constFirst()).angle();
|
||||||
QVERIFY2(f1 - stAngle <= eps, qUtf8Printable(QStringLiteral("f1: %1; expected: %2").arg(f1).arg(stAngle)));
|
QVERIFY2(f1 - stAngle <= eps, qUtf8Printable(QStringLiteral("f1: %1; expected: %2").arg(f1).arg(stAngle)));
|
||||||
|
|
||||||
f2 = QLineF(static_cast<QPointF>(center), points.constLast()).angle();
|
f2 = QLineF(static_cast<QPointF>(center), points.constLast()).angle();
|
||||||
QVERIFY2(f2 - enAngle <= eps, qUtf8Printable(QStringLiteral("f2: %1; expected: %2").arg(f2).arg(enAngle)));
|
QVERIFY2(f2 - enAngle <= eps, qUtf8Printable(QStringLiteral("f2: %1; expected: %2").arg(f2).arg(enAngle)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f1 = QLineF(static_cast<QPointF>(center), points.constLast()).angle();
|
||||||
|
QVERIFY2(f1 - stAngle <= eps, qUtf8Printable(QStringLiteral("f1: %1; expected: %2").arg(f1).arg(stAngle)));
|
||||||
|
|
||||||
|
f2 = QLineF(static_cast<QPointF>(center), points.constFirst()).angle();
|
||||||
|
QVERIFY2(f2 - enAngle <= eps, qUtf8Printable(QStringLiteral("f2: %1; expected: %2").arg(f2).arg(enAngle)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -514,17 +969,96 @@ void TST_VEllipticalArc::TestRotation_data()
|
||||||
QTest::addColumn<qreal>("degrees");
|
QTest::addColumn<qreal>("degrees");
|
||||||
QTest::addColumn<QString>("prefix");
|
QTest::addColumn<QString>("prefix");
|
||||||
|
|
||||||
QTest::newRow("Test el arc 1") << QPointF() << 10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 1, +r, +r") << QPointF() << 10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 2") << QPointF() << 10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 1, -r, +r") << QPointF() << -10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 3.2") << QPointF(10, 10) << 10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 1, +r, -r") << QPointF() << 10. << -20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 3.1") << QPointF(10, 10) << 10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 1, -r, -r") << QPointF() << -10. << -20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 3") << QPointF(10, 10) << 10. << 20.0 << 1. << 91. << 90. << QPointF() << 90. << "_r";
|
|
||||||
QTest::newRow("Test el arc 4") << QPointF(10, 10) << 10. << 20.0 << 0. << 90. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 2, +r, +r") << QPointF() << 10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 5") << QPointF(10, 10) << 10. << 20.0 << 0. << 180. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 2, -r, +r") << QPointF() << -10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 6") << QPointF(10, 10) << 10. << 20.0 << 1. << 181. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 2, +r, -r") << QPointF() << 10. << -20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 7") << QPointF(10, 10) << 10. << 20.0 << 0. << 270. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 2, -r, -r") << QPointF() << -10. << -20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
QTest::newRow("Test el arc 8") << QPointF(10, 10) << 10. << 20.0 << 1. << 271. << 90. << QPointF() << 90. << "_r";
|
|
||||||
QTest::newRow("Test el arc 9") << QPointF(10, 10) << 10. << 20.0 << 0. << 360. << 90. << QPointF() << 90. << "_r";
|
QTest::newRow("Test el arc 3.2, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.2, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.2, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.2, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 0. << 90. << 0. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 3.1, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.1, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.1, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3.1, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 1. << 91. << 0. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 3, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 1. << 91. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 1. << 91. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 1. << 91. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 3, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 1. << 91. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 4, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 0. << 90. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 4, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 0. << 90. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 4, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 0. << 90. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 4, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 0. << 90. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 5, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 0. << 180. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 5, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 0. << 180. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 5, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 0. << 180. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 5, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 0. << 180. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 6, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 1. << 181. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 6, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 1. << 181. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 6, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 1. << 181. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 6, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 1. << 181. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 7, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 0. << 270. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 7, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 0. << 270. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 7, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 0. << 270. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 7, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 0. << 270. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 8, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 1. << 271. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 8, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 1. << 271. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 8, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 1. << 271. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 8, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 1. << 271. << 90. << QPointF() << 90. << "_r";
|
||||||
|
|
||||||
|
QTest::newRow("Test el arc 9, +r, +r")
|
||||||
|
<< QPointF(10, 10) << 10. << 20.0 << 0. << 360. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 9, -r, +r")
|
||||||
|
<< QPointF(10, 10) << -10. << 20.0 << 0. << 360. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 9, +r, -r")
|
||||||
|
<< QPointF(10, 10) << 10. << -20.0 << 0. << 360. << 90. << QPointF() << 90. << "_r";
|
||||||
|
QTest::newRow("Test el arc 9, -r, -r")
|
||||||
|
<< QPointF(10, 10) << -10. << -20.0 << 0. << 360. << 90. << QPointF() << 90. << "_r";
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -563,37 +1097,48 @@ void TST_VEllipticalArc::TestRotation()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TST_VEllipticalArc::TestFlip_data()
|
void TST_VEllipticalArc::TestFlip_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<VEllipticalArc>("elArc");
|
QTest::addColumn<qreal>("radius1");
|
||||||
|
QTest::addColumn<qreal>("radius2");
|
||||||
QTest::addColumn<QLineF>("axis");
|
QTest::addColumn<QLineF>("axis");
|
||||||
QTest::addColumn<QString>("prefix");
|
QTest::addColumn<QString>("prefix");
|
||||||
|
|
||||||
const VEllipticalArc elArc(VPointF(), 10., 20.0, 1., 91., 0.);
|
|
||||||
|
|
||||||
QLineF axis(QPointF(600, 30), QPointF(600, 1800));
|
QLineF axis(QPointF(600, 30), QPointF(600, 1800));
|
||||||
|
|
||||||
QTest::newRow("Vertical axis") << elArc << axis << "a2";
|
QTest::newRow("Vertical axis, +r, +r") << 10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Vertical axis, -r, +r") << -10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Vertical axis, +r, -r") << 10. << -20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Vertical axis, -r, -r") << -10. << -20.0 << axis << "a2";
|
||||||
|
|
||||||
axis = QLineF(QPointF(600, 30), QPointF(1200, 30));
|
axis = QLineF(QPointF(600, 30), QPointF(1200, 30));
|
||||||
|
|
||||||
QTest::newRow("Horizontal axis") << elArc << axis << "a2";
|
QTest::newRow("Horizontal axis, +r, +r") << 10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Horizontal axis, -r, +r") << -10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Horizontal axis, +r, -r") << 10. << -20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Horizontal axis, -r, -r") << -10. << -20.0 << axis << "a2";
|
||||||
|
|
||||||
axis = QLineF(QPointF(600, 30), QPointF(600, 1800));
|
axis = QLineF(QPointF(600, 30), QPointF(600, 1800));
|
||||||
axis.setAngle(45);
|
axis.setAngle(45);
|
||||||
|
|
||||||
QTest::newRow("Diagonal axis") << elArc << axis << "a2";
|
QTest::newRow("Diagonal axis, +r, +r") << 10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Diagonal axis, -r, +r") << -10. << 20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Diagonal axis, +r, -r") << 10. << -20.0 << axis << "a2";
|
||||||
|
QTest::newRow("Diagonal axis, -r, -r") << -10. << -20.0 << axis << "a2";
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TST_VEllipticalArc::TestFlip()
|
void TST_VEllipticalArc::TestFlip()
|
||||||
{
|
{
|
||||||
QFETCH(VEllipticalArc, elArc);
|
QFETCH(qreal, radius1);
|
||||||
|
QFETCH(qreal, radius2);
|
||||||
QFETCH(QLineF, axis);
|
QFETCH(QLineF, axis);
|
||||||
QFETCH(QString, prefix);
|
QFETCH(QString, prefix);
|
||||||
|
|
||||||
|
const VEllipticalArc elArc(VPointF(), radius1, radius2, 1., 91., 0.);
|
||||||
|
|
||||||
const VEllipticalArc res = elArc.Flip(axis, prefix);
|
const VEllipticalArc res = elArc.Flip(axis, prefix);
|
||||||
|
|
||||||
// cppcheck-suppress unreadVariable
|
// cppcheck-suppress unreadVariable
|
||||||
const QString errorMsg = QString("The name doesn't contain the prefix '%1'.").arg(prefix);
|
const QString errorMsg = QStringLiteral("The name doesn't contain the prefix '%1'.").arg(prefix);
|
||||||
QVERIFY2(res.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
QVERIFY2(res.name().endsWith(prefix), qUtf8Printable(errorMsg));
|
||||||
|
|
||||||
QCOMPARE(qRound(elArc.GetLength() * -1), qRound(res.GetLength()));
|
QCOMPARE(qRound(elArc.GetLength() * -1), qRound(res.GetLength()));
|
||||||
|
|
|
@ -44,14 +44,15 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void CompareTwoWays_data();
|
void CompareTwoWays_data();
|
||||||
void CompareTwoWays();
|
void CompareTwoWays();
|
||||||
void NegativeArc();
|
void ArcByLength_data();
|
||||||
|
void ArcByLength();
|
||||||
void TestGetPoints1_data();
|
void TestGetPoints1_data();
|
||||||
void TestGetPoints2_data();
|
|
||||||
void TestGetPoints3_data();
|
|
||||||
void TestGetPoints4_data();
|
|
||||||
void TestGetPoints1();
|
void TestGetPoints1();
|
||||||
|
void TestGetPoints2_data();
|
||||||
void TestGetPoints2();
|
void TestGetPoints2();
|
||||||
|
void TestGetPoints3_data();
|
||||||
void TestGetPoints3();
|
void TestGetPoints3();
|
||||||
|
void TestGetPoints4_data();
|
||||||
void TestGetPoints4();
|
void TestGetPoints4();
|
||||||
void TestGetPoints5_data();
|
void TestGetPoints5_data();
|
||||||
void TestGetPoints5();
|
void TestGetPoints5();
|
||||||
|
|
|
@ -42,6 +42,15 @@ TST_VTranslateVars::TST_VTranslateVars(QObject *parent)
|
||||||
m_trMs(nullptr),
|
m_trMs(nullptr),
|
||||||
m_systemLocale(QLocale::system())
|
m_systemLocale(QLocale::system())
|
||||||
{
|
{
|
||||||
|
VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
|
||||||
|
m_translateFomula = settings->IsTranslateFormula();
|
||||||
|
settings->SetTranslateFormula(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TST_VTranslateVars::~TST_VTranslateVars()
|
||||||
|
{
|
||||||
|
VAbstractApplication::VApp()->Settings()->SetTranslateFormula(m_translateFomula);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -158,7 +167,7 @@ void TST_VTranslateVars::PrepareVal(const QString &inputFormula, const QString &
|
||||||
|
|
||||||
auto PREPARE_CASE = [locale](const QString &inputString, const QString &outputString)
|
auto PREPARE_CASE = [locale](const QString &inputString, const QString &outputString)
|
||||||
{
|
{
|
||||||
QString tag = u"%1. String '%2'"_s.arg(locale.name(), inputString);
|
QString tag = QStringLiteral("%1. String '%2'").arg(locale.name(), inputString);
|
||||||
QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale;
|
QTest::newRow(qUtf8Printable(tag)) << inputString << outputString << locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -168,7 +177,7 @@ void TST_VTranslateVars::PrepareVal(const QString &inputFormula, const QString &
|
||||||
outputString = outputFormula + '+'_L1 + outputFormula;
|
outputString = outputFormula + '+'_L1 + outputFormula;
|
||||||
PREPARE_CASE(inputString, outputString);
|
PREPARE_CASE(inputString, outputString);
|
||||||
|
|
||||||
inputString = inputFormula + u"+a"_s;
|
inputString = inputFormula + "+a"_L1;
|
||||||
outputString = outputFormula + u"+a"_s;
|
outputString = outputFormula + "+a"_L1;
|
||||||
PREPARE_CASE(inputString, outputString);
|
PREPARE_CASE(inputString, outputString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ class TST_VTranslateVars : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TST_VTranslateVars(QObject *parent = nullptr);
|
explicit TST_VTranslateVars(QObject *parent = nullptr);
|
||||||
|
~TST_VTranslateVars() override;
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void TestFormulaFromUser_data();
|
void TestFormulaFromUser_data();
|
||||||
|
@ -58,6 +59,7 @@ private:
|
||||||
Q_DISABLE_COPY_MOVE(TST_VTranslateVars) // NOLINT
|
Q_DISABLE_COPY_MOVE(TST_VTranslateVars) // NOLINT
|
||||||
VTranslateVars *m_trMs;
|
VTranslateVars *m_trMs;
|
||||||
QLocale m_systemLocale;
|
QLocale m_systemLocale;
|
||||||
|
bool m_translateFomula{true};
|
||||||
|
|
||||||
void PrepareValFromUser(double d, const QLocale &locale);
|
void PrepareValFromUser(double d, const QLocale &locale);
|
||||||
void PrepareValToUser(double d, const QLocale &locale);
|
void PrepareValToUser(double d, const QLocale &locale);
|
||||||
|
|
Loading…
Reference in a new issue