Updated dialog for the tool Spline.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-02-25 21:23:16 +02:00
parent 9219b05a5b
commit 990c03c697
22 changed files with 1131 additions and 202 deletions

View file

@ -768,13 +768,13 @@ qreal VSpline::GetC2Length() const
}
//---------------------------------------------------------------------------------------------------------------------
QString VSpline::C1LengthFormula() const
QString VSpline::GetC1LengthFormula() const
{
return d->c1LengthF;
}
//---------------------------------------------------------------------------------------------------------------------
QString VSpline::C2LengthFormula() const
QString VSpline::GetC2LengthFormula() const
{
return d->c2LengthF;
}

View file

@ -70,8 +70,8 @@ public:
qreal GetC1Length() const;
qreal GetC2Length() const;
QString C1LengthFormula() const;
QString C2LengthFormula() const;
QString GetC1LengthFormula() const;
QString GetC2LengthFormula() const;
qreal GetLength () const;
qreal GetKasm1() const;

View file

@ -33,8 +33,10 @@
#include "../vgeometry/vspline.h"
#include "../vpatterndb/vcontainer.h"
#include "../../visualization/vistoolspline.h"
#include "../support/dialogeditwrongformula.h"
#include <QDebug>
#include <QTimer>
//---------------------------------------------------------------------------------------------------------------------
/**
@ -43,9 +45,42 @@
* @param parent parent widget
*/
DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), spl(), newDuplicate(-1)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogSpline),
spl(),
newDuplicate(-1),
formulaBaseHeightAngle1(0),
formulaBaseHeightAngle2(0),
formulaBaseHeightLength1(0),
formulaBaseHeightLength2(0),
timerAngle1(new QTimer(this)),
timerAngle2(new QTimer(this)),
timerLength1(new QTimer(this)),
timerLength2(new QTimer(this)),
flagAngle1(false),
flagAngle2(false),
flagLength1(false),
flagLength2(false)
{
ui->setupUi(this);
plainTextEditFormula = ui->plainTextEditAngle1F;
formulaBaseHeightAngle1 = ui->plainTextEditAngle1F->height();
formulaBaseHeightAngle2 = ui->plainTextEditAngle2F->height();
formulaBaseHeightLength1 = ui->plainTextEditLength1F->height();
formulaBaseHeightLength2 = ui->plainTextEditLength2F->height();
ui->plainTextEditAngle1F->installEventFilter(this);
ui->plainTextEditAngle2F->installEventFilter(this);
ui->plainTextEditLength1F->installEventFilter(this);
ui->plainTextEditLength2F->installEventFilter(this);
connect(timerAngle1, &QTimer::timeout, this, &DialogSpline::EvalAngle1);
connect(timerAngle2, &QTimer::timeout, this, &DialogSpline::EvalAngle2);
connect(timerLength1, &QTimer::timeout, this, &DialogSpline::EvalLength1);
connect(timerLength2, &QTimer::timeout, this, &DialogSpline::EvalLength2);
InitOkCancelApply(ui);
FillComboBoxPoints(ui->comboBoxP1);
@ -59,6 +94,21 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
connect(ui->comboBoxP4, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &DialogSpline::PointNameChanged);
connect(ui->toolButtonExprAngle1, &QPushButton::clicked, this, &DialogSpline::FXAngle1);
connect(ui->toolButtonExprAngle2, &QPushButton::clicked, this, &DialogSpline::FXAngle2);
connect(ui->toolButtonExprLength1, &QPushButton::clicked, this, &DialogSpline::FXLength1);
connect(ui->toolButtonExprLength2, &QPushButton::clicked, this, &DialogSpline::FXLength2);
connect(ui->plainTextEditAngle1F, &QPlainTextEdit::textChanged, this, &DialogSpline::Angle1Changed);
connect(ui->plainTextEditAngle2F, &QPlainTextEdit::textChanged, this, &DialogSpline::Angle2Changed);
connect(ui->plainTextEditLength1F, &QPlainTextEdit::textChanged, this, &DialogSpline::Length1Changed);
connect(ui->plainTextEditLength2F, &QPlainTextEdit::textChanged, this, &DialogSpline::Length2Changed);
connect(ui->pushButtonGrowAngle1, &QPushButton::clicked, this, &DialogSpline::DeployAngle1TextEdit);
connect(ui->pushButtonGrowAngle2, &QPushButton::clicked, this, &DialogSpline::DeployAngle2TextEdit);
connect(ui->pushButtonGrowLength1, &QPushButton::clicked, this, &DialogSpline::DeployLength1TextEdit);
connect(ui->pushButtonGrowLength2, &QPushButton::clicked, this, &DialogSpline::DeployLength2TextEdit);
vis = new VisToolSpline(data);
auto path = qobject_cast<VisToolSpline *>(vis);
SCASSERT(path != nullptr);
@ -125,14 +175,8 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::SaveData()
{
const qreal angle1 = ui->spinBoxAngle1->value();
const qreal angle2 = ui->spinBoxAngle2->value();
const qreal kAsm1 = ui->doubleSpinBoxKasm1->value();
const qreal kAsm2 = ui->doubleSpinBoxKasm2->value();
const qreal kCurve = ui->doubleSpinBoxKcurve->value();
const quint32 d = spl.GetDuplicate();//Save previous value
spl = VSpline(*GetP1(), *GetP4(), angle1, angle2, kAsm1, kAsm2, kCurve);
spl = CurrentSpline();
newDuplicate <= -1 ? spl.SetDuplicate(d) : spl.SetDuplicate(static_cast<quint32>(newDuplicate));
@ -141,15 +185,173 @@ void DialogSpline::SaveData()
path->setObject1Id(GetP1()->id());
path->setObject4Id(GetP4()->id());
path->SetAngle1(angle1);
path->SetAngle2(angle2);
path->SetKAsm1(kAsm1);
path->SetKAsm2(kAsm2);
path->SetKCurve(kCurve);
path->SetAngle1(spl.GetStartAngle());
path->SetAngle2(spl.GetEndAngle());
path->SetKAsm1(spl.GetKasm1());
path->SetKAsm2(spl.GetKasm2());
path->SetKCurve(spl.GetKcurve());
path->SetMode(Mode::Show);
path->RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::closeEvent(QCloseEvent *event)
{
ui->plainTextEditAngle1F->blockSignals(true);
ui->plainTextEditAngle2F->blockSignals(true);
ui->plainTextEditLength1F->blockSignals(true);
ui->plainTextEditLength2F->blockSignals(true);
DialogTool::closeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::DeployAngle1TextEdit()
{
DeployFormula(ui->plainTextEditAngle1F, ui->pushButtonGrowAngle1, formulaBaseHeightAngle1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::DeployAngle2TextEdit()
{
DeployFormula(ui->plainTextEditAngle2F, ui->pushButtonGrowAngle2, formulaBaseHeightAngle2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::DeployLength1TextEdit()
{
DeployFormula(ui->plainTextEditLength1F, ui->pushButtonGrowLength1, formulaBaseHeightLength1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::DeployLength2TextEdit()
{
DeployFormula(ui->plainTextEditLength2F, ui->pushButtonGrowLength2, formulaBaseHeightLength2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::Angle1Changed()
{
labelEditFormula = ui->labelEditAngle1;
labelResultCalculation = ui->labelResultAngle1;
ValFormulaChanged(flagAngle1, ui->plainTextEditAngle1F, timerAngle1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::Angle2Changed()
{
labelEditFormula = ui->labelEditAngle2;
labelResultCalculation = ui->labelResultAngle2;
ValFormulaChanged(flagAngle2, ui->plainTextEditAngle2F, timerAngle2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::Length1Changed()
{
labelEditFormula = ui->labelEditLength1;
labelResultCalculation = ui->labelResultLength1;
ValFormulaChanged(flagLength1, ui->plainTextEditLength1F, timerLength1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::Length2Changed()
{
labelEditFormula = ui->labelEditLength2;
labelResultCalculation = ui->labelResultLength2;
ValFormulaChanged(flagLength2, ui->plainTextEditLength2F, timerLength2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::FXAngle1()
{
auto dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first control point angle"));
QString angle1F = qApp->TrVars()->FormulaFromUser(ui->plainTextEditAngle1F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(angle1F);
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
angle1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula());
// increase height if needed.
if (angle1F.length() > 80)
{
DeployAngle1TextEdit();
}
ui->plainTextEditAngle1F->setPlainText(angle1F);
MoveCursorToEnd(ui->plainTextEditAngle1F);
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::FXAngle2()
{
auto dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second control point angle"));
QString angle2F = qApp->TrVars()->FormulaFromUser(ui->plainTextEditAngle2F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(angle2F);
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
angle2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula());
// increase height if needed.
if (angle2F.length() > 80)
{
DeployAngle1TextEdit();
}
ui->plainTextEditAngle2F->setPlainText(angle2F);
MoveCursorToEnd(ui->plainTextEditAngle2F);
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::FXLength1()
{
auto dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first control point length"));
QString length1F = qApp->TrVars()->FormulaFromUser(ui->plainTextEditLength1F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length1F);
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula());
// increase height if needed.
if (length1F.length() > 80)
{
DeployLength1TextEdit();
}
ui->plainTextEditLength1F->setPlainText(length1F);
MoveCursorToEnd(ui->plainTextEditLength1F);
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::FXLength2()
{
auto dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second control point length"));
QString length2F = qApp->TrVars()->FormulaFromUser(ui->plainTextEditLength2F->toPlainText(),
qApp->Settings()->GetOsSeparator());
dialog->SetFormula(length2F);
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula());
// increase height if needed.
if (length2F.length() > 80)
{
DeployLength2TextEdit();
}
ui->plainTextEditLength2F->setPlainText(length2F);
MoveCursorToEnd(ui->plainTextEditLength2F);
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
const QSharedPointer<VPointF> DialogSpline::GetP1() const
{
@ -162,6 +364,91 @@ const QSharedPointer<VPointF> DialogSpline::GetP4() const
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::EvalAngle1()
{
labelEditFormula = ui->labelEditAngle1;
Eval(ui->plainTextEditAngle1F->toPlainText(), flagAngle1, ui->labelResultAngle1, degreeSymbol, false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::EvalAngle2()
{
labelEditFormula = ui->labelEditAngle2;
Eval(ui->plainTextEditAngle2F->toPlainText(), flagAngle2, ui->labelResultAngle2, degreeSymbol, false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::EvalLength1()
{
labelEditFormula = ui->labelEditLength1;
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
const qreal length1 = Eval(ui->plainTextEditLength1F->toPlainText(), flagLength1, ui->labelResultLength1, postfix);
if (length1 < 0)
{
flagLength1 = false;
ChangeColor(labelEditFormula, Qt::red);
ui->labelResultLength1->setText(tr("Error") + " (" + postfix + ")");
ui->labelResultLength1->setToolTip(tr("Length can't be negative"));
DialogSpline::CheckState();
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::EvalLength2()
{
labelEditFormula = ui->labelEditLength2;
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
const qreal length2 = Eval(ui->plainTextEditLength2F->toPlainText(), flagLength2, ui->labelResultLength2, postfix);
if (length2 < 0)
{
flagLength2 = false;
ChangeColor(labelEditFormula, Qt::red);
ui->labelResultLength2->setText(tr("Error") + " (" + postfix + ")");
ui->labelResultLength2->setToolTip(tr("Length can't be negative"));
DialogSpline::CheckState();
}
}
//---------------------------------------------------------------------------------------------------------------------
VSpline DialogSpline::CurrentSpline() const
{
QString angle1F = ui->plainTextEditAngle1F->toPlainText();
angle1F.replace("\n", " ");
QString angle2F = ui->plainTextEditAngle2F->toPlainText();
angle2F.replace("\n", " ");
QString length1F = ui->plainTextEditLength1F->toPlainText();
length1F.replace("\n", " ");
QString length2F = ui->plainTextEditLength2F->toPlainText();
length2F.replace("\n", " ");
const QHash<QString, qreal *> vars = data->PlainVariables();
const qreal angle1 = Visualization::FindVal(angle1F, vars);
const qreal angle2 = Visualization::FindVal(angle2F, vars);
const qreal length1 = Visualization::FindLength(length1F, vars);
const qreal length2 = Visualization::FindLength(length2F, vars);
const bool separator = qApp->Settings()->GetOsSeparator();
angle1F = qApp->TrVars()->FormulaFromUser(angle1F, separator);
angle2F = qApp->TrVars()->FormulaFromUser(angle2F, separator);
length1F = qApp->TrVars()->FormulaFromUser(length1F, separator);
length2F = qApp->TrVars()->FormulaFromUser(length2F, separator);
VSpline spline(*GetP1(), *GetP4(), angle1, angle1F, angle2, angle2F, length1, length1F, length2, length2F,
ui->doubleSpinBoxKcurve->value());
return spline;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::PointNameChanged()
{
@ -217,11 +504,13 @@ void DialogSpline::ShowDialog(bool click)
spl = VSpline(*GetP1(), path->GetP2(), path->GetP3(), *GetP4(), ui->doubleSpinBoxKcurve->value());
ui->spinBoxAngle1->setValue(static_cast<qint32>(spl.GetStartAngle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(spl.GetEndAngle()));
const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula());
const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula());
ui->doubleSpinBoxKasm1->setValue(spl.GetKasm1());
ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2());
ui->plainTextEditAngle1F->setPlainText(angle1F);
ui->plainTextEditAngle2F->setPlainText(angle2F);
ui->plainTextEditLength1F->setPlainText(qApp->TrVars()->FormulaToUser(spl.GetC1LengthFormula()));
ui->plainTextEditLength2F->setPlainText(qApp->TrVars()->FormulaToUser(spl.GetC2LengthFormula()));
if (not data->IsUnique(spl.name()))
{
@ -234,6 +523,18 @@ void DialogSpline::ShowDialog(bool click)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::CheckState()
{
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagAngle1 && flagAngle2 && flagLength1 && flagLength2 && flagError);
// In case dialog hasn't apply button
if ( bApply != nullptr)
{
bApply->setEnabled(bOk->isEnabled());
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::ShowVisualization()
{
@ -253,10 +554,18 @@ void DialogSpline::SetSpline(const VSpline &spline)
setCurrentPointId(ui->comboBoxP1, spl.GetP1().id());
setCurrentPointId(ui->comboBoxP4, spl.GetP4().id());
ui->spinBoxAngle1->setValue(static_cast<qint32>(spl.GetStartAngle()));
ui->spinBoxAngle2->setValue(static_cast<qint32>(spl.GetEndAngle()));
ui->doubleSpinBoxKasm1->setValue(spl.GetKasm1());
ui->doubleSpinBoxKasm2->setValue(spl.GetKasm2());
const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula());
const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula());
ui->plainTextEditAngle1F->setPlainText(angle1F);
ui->plainTextEditAngle2F->setPlainText(angle2F);
const QString length1F = qApp->TrVars()->FormulaToUser(spl.GetC1LengthFormula());
const QString length2F = qApp->TrVars()->FormulaToUser(spl.GetC2LengthFormula());
ui->plainTextEditLength1F->setPlainText(length1F);
ui->plainTextEditLength2F->setPlainText(length2F);
ui->doubleSpinBoxKcurve->setValue(spl.GetKcurve());
ui->lineEditSplineName->setText(spl.name());

View file

@ -57,11 +57,28 @@ public slots:
virtual void PointNameChanged() Q_DECL_OVERRIDE;
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
protected:
virtual void CheckState() Q_DECL_OVERRIDE;
virtual void ShowVisualization() Q_DECL_OVERRIDE;
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots:
void DeployAngle1TextEdit();
void DeployAngle2TextEdit();
void DeployLength1TextEdit();
void DeployLength2TextEdit();
void Angle1Changed();
void Angle2Changed();
void Length1Changed();
void Length2Changed();
void FXAngle1();
void FXAngle2();
void FXLength1();
void FXLength2();
private:
Q_DISABLE_COPY(DialogSpline)
@ -73,8 +90,33 @@ private:
qint32 newDuplicate;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeightAngle1;
int formulaBaseHeightAngle2;
int formulaBaseHeightLength1;
int formulaBaseHeightLength2;
/** @brief timerAngle1 timer of check first angle formula */
QTimer *timerAngle1;
QTimer *timerAngle2;
QTimer *timerLength1;
QTimer *timerLength2;
/** @brief flagAngle1 true if value of first angle is correct */
bool flagAngle1;
bool flagAngle2;
bool flagLength1;
bool flagLength2;
const QSharedPointer<VPointF> GetP1() const;
const QSharedPointer<VPointF> GetP4() const;
void EvalAngle1();
void EvalAngle2();
void EvalLength1();
void EvalLength2();
VSpline CurrentSpline() const;
};
#endif // DIALOGSPLINE_H

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>459</width>
<height>289</height>
<width>524</width>
<height>375</height>
</rect>
</property>
<property name="windowTitle">
@ -22,10 +22,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>6</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -62,79 +59,368 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxKasm1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="labelEditLength1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignRight">
<widget class="QToolButton" name="toolButtonExprLength1">
<property name="toolTip">
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="labelResultLength1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value</string>
</property>
<property name="text">
<string notr="true">_</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Angle:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="plainTextEditLength1F">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>Calulation</string>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength1">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="labelEditAngle1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignRight">
<widget class="QToolButton" name="toolButtonExprAngle1">
<property name="toolTip">
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="labelResultAngle1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value</string>
</property>
<property name="text">
<string notr="true">_</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Length ratio:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPlainTextEdit" name="plainTextEditAngle1F">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>Calulation</string>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowAngle1">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
@ -173,79 +459,368 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Length ratio:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="labelEditLength2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Length:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignRight">
<widget class="QToolButton" name="toolButtonExprLength2">
<property name="toolTip">
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_9">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="labelResultLength2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value</string>
</property>
<property name="text">
<string notr="true">_</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxKasm2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPlainTextEdit" name="plainTextEditLength2F">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>Calulation</string>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowLength2">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Angle:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="labelEditAngle2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>159</red>
<green>158</green>
<blue>158</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Angle:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignRight">
<widget class="QToolButton" name="toolButtonExprAngle2">
<property name="toolTip">
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_10">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="labelResultAngle2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>87</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value</string>
</property>
<property name="text">
<string notr="true">_</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QPlainTextEdit" name="plainTextEditAngle2F">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>Calulation</string>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonGrowAngle2">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Show full calculation in message box&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
@ -346,14 +921,16 @@
</widget>
</item>
</layout>
<zorder>buttonBox</zorder>
<zorder>label_2</zorder>
<zorder>doubleSpinBoxKasm1</zorder>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
</widget>
<tabstops>
<tabstop>comboBoxP1</tabstop>
<tabstop>doubleSpinBoxKasm1</tabstop>
<tabstop>spinBoxAngle1</tabstop>
<tabstop>comboBoxP4</tabstop>
<tabstop>doubleSpinBoxKasm2</tabstop>
<tabstop>spinBoxAngle2</tabstop>
<tabstop>doubleSpinBoxKcurve</tabstop>
<tabstop>comboBoxColor</tabstop>
<tabstop>buttonBox</tabstop>

View file

@ -57,7 +57,7 @@ void VisToolAlongLine::setObject2Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolAlongLine::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -61,17 +61,17 @@ void VisToolArc::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VisToolArc::setRadius(const QString &expression)
{
radius = FindLength(expression);
radius = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolArc::setF1(const QString &expression)
{
f1 = FindVal(expression);
f1 = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolArc::setF2(const QString &expression)
{
f2 = FindVal(expression);
f2 = FindVal(expression, Visualization::data->PlainVariables());
}

View file

@ -61,17 +61,17 @@ void VisToolArcWithLength::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VisToolArcWithLength::setRadius(const QString &expression)
{
radius = FindLength(expression);
radius = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolArcWithLength::setF1(const QString &expression)
{
f1 = FindVal(expression);
f1 = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolArcWithLength::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -61,7 +61,7 @@ void VisToolBisector::setObject3Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolBisector::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -94,7 +94,7 @@ QString VisToolCurveIntersectAxis::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolCurveIntersectAxis::SetAngle(const QString &expression)
{
angle = FindVal(expression);
angle = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -72,5 +72,5 @@ void VisToolCutArc::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VisToolCutArc::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -72,5 +72,5 @@ void VisToolCutSpline::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VisToolCutSpline::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -118,5 +118,5 @@ void VisToolCutSplinePath::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VisToolCutSplinePath::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -74,11 +74,11 @@ QString VisToolEndLine::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::SetAngle(const QString &expression)
{
angle = FindVal(expression);
angle = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -110,7 +110,7 @@ QString VisToolLineIntersectAxis::Angle() const
//---------------------------------------------------------------------------------------------------------------------
void VisToolLineIntersectAxis::SetAngle(const QString &expression)
{
angle = FindVal(expression);
angle = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -100,7 +100,7 @@ void VisToolNormal::setObject2Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolNormal::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -84,7 +84,7 @@ void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointFromCircleAndTangent::setCRadius(const QString &value)
{
cRadius = FindLength(value);
cRadius = FindLength(value, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -103,5 +103,5 @@ void VisToolPointOfContact::setRadiusId(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfContact::setRadius(const QString &expression)
{
radius = FindLength(expression);
radius = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -102,13 +102,13 @@ void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfIntersectionCircles::setC1Radius(const QString &value)
{
c1Radius = FindLength(value);
c1Radius = FindLength(value, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolPointOfIntersectionCircles::setC2Radius(const QString &value)
{
c2Radius = FindLength(value);
c2Radius = FindLength(value, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -118,5 +118,5 @@ void VisToolShoulderPoint::setLineP2Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VisToolShoulderPoint::setLength(const QString &expression)
{
length = FindLength(expression);
length = FindLength(expression, Visualization::data->PlainVariables());
}

View file

@ -135,13 +135,13 @@ QRectF Visualization::PointRect(const qreal &radius) const
}
//---------------------------------------------------------------------------------------------------------------------
qreal Visualization::FindLength(const QString &expression)
qreal Visualization::FindLength(const QString &expression, const QHash<QString, qreal *> &vars)
{
return qApp->toPixel(FindVal(expression));
return qApp->toPixel(FindVal(expression, vars));
}
//---------------------------------------------------------------------------------------------------------------------
qreal Visualization::FindVal(const QString &expression)
qreal Visualization::FindVal(const QString &expression, const QHash<QString, qreal *> &vars)
{
qreal val = 0;
if (expression.isEmpty())
@ -157,7 +157,7 @@ qreal Visualization::FindVal(const QString &expression)
formula.replace("\n", " ");
formula = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
Calculator *cal = new Calculator();
val = cal->EvalFormula(data->PlainVariables(), formula);
val = cal->EvalFormula(vars, formula);
delete cal;
}
catch (qmu::QmuParserError &e)

View file

@ -58,6 +58,9 @@ public:
Mode GetMode() const;
void SetMode(const Mode &value);
static qreal FindLength(const QString &expression, const QHash<QString, qreal *> &vars);
static qreal FindVal(const QString &expression, const QHash<QString, qreal *> &vars);
signals:
void ToolTip(const QString &toolTip);
public slots:
@ -79,8 +82,6 @@ protected:
QGraphicsEllipseItem *InitPoint(const QColor &color, QGraphicsItem *parent) const;
QRectF PointRect(const qreal &radius) const;
qreal FindLength(const QString &expression);
qreal FindVal(const QString &expression);
void DrawPoint(QGraphicsEllipseItem *point, const QPointF &pos, const QColor &color,
Qt::PenStyle style = Qt::SolidLine);
virtual void DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color,