Fixed issue 81.
--HG-- branch : develop
This commit is contained in:
parent
3af2859980
commit
7e75a18c1c
|
@ -473,7 +473,7 @@ const QMap<QString, VLengthArc *> VContainer::DataLengthArcs() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const QMap<QString, VLineAngle *> VContainer::DataLineAngles() const
|
const QMap<QString, VLineAngle *> VContainer::DataAngleLines() const
|
||||||
{
|
{
|
||||||
return DataVar<VLineAngle>(VarType::LineAngle);
|
return DataVar<VLineAngle>(VarType::LineAngle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ public:
|
||||||
const QMap<QString, VLengthLine *> DataLengthLines() const;
|
const QMap<QString, VLengthLine *> DataLengthLines() const;
|
||||||
const QMap<QString, VLengthSpline *> DataLengthSplines() const;
|
const QMap<QString, VLengthSpline *> DataLengthSplines() const;
|
||||||
const QMap<QString, VLengthArc *> DataLengthArcs() const;
|
const QMap<QString, VLengthArc *> DataLengthArcs() const;
|
||||||
const QMap<QString, VLineAngle *> DataLineAngles() const;
|
const QMap<QString, VLineAngle *> DataAngleLines() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -423,6 +423,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#include "../../geometry/vpointf.h"
|
#include "../../geometry/vpointf.h"
|
||||||
#include "../../container/vcontainer.h"
|
#include "../../container/vcontainer.h"
|
||||||
|
#include "../../xml/vdomdocument.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -229,7 +230,7 @@ void DialogArc::ValChenged(int row)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QListWidgetItem *item = ui->listWidget->item( row );
|
QListWidgetItem *item = ui->listWidget->item( row );
|
||||||
if (ui->radioButtonLineAngles->isChecked())
|
if (ui->radioButtonAngleLine->isChecked())
|
||||||
{
|
{
|
||||||
qreal angle = *data->GetVariable<VLineAngle*>(item->text())->GetValue();
|
qreal angle = *data->GetVariable<VLineAngle*>(item->text())->GetValue();
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(angle).arg(tr("Value of angle of line."));
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(angle).arg(tr("Value of angle of line."));
|
||||||
|
@ -325,7 +326,8 @@ void DialogArc::CheckState()
|
||||||
void DialogArc::EvalRadius()
|
void DialogArc::EvalRadius()
|
||||||
{
|
{
|
||||||
labelEditFormula = ui->labelEditRadius;
|
labelEditFormula = ui->labelEditRadius;
|
||||||
Eval(ui->plainTextEditFormula->toPlainText(), flagRadius, timerRadius, ui->labelResultRadius);
|
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
|
||||||
|
Eval(ui->plainTextEditFormula->toPlainText(), flagRadius, timerRadius, ui->labelResultRadius, postfix);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -335,7 +337,8 @@ void DialogArc::EvalRadius()
|
||||||
void DialogArc::EvalF1()
|
void DialogArc::EvalF1()
|
||||||
{
|
{
|
||||||
labelEditFormula = ui->labelEditF1;
|
labelEditFormula = ui->labelEditF1;
|
||||||
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1, false);
|
const QString postfix = QStringLiteral("°");
|
||||||
|
Eval(ui->plainTextEditF1->toPlainText(), flagF1, timerF1, ui->labelResultF1, postfix, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -345,7 +348,8 @@ void DialogArc::EvalF1()
|
||||||
void DialogArc::EvalF2()
|
void DialogArc::EvalF2()
|
||||||
{
|
{
|
||||||
labelEditFormula = ui->labelEditF2;
|
labelEditFormula = ui->labelEditF2;
|
||||||
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2, false);
|
const QString postfix = QStringLiteral("°");
|
||||||
|
Eval(ui->plainTextEditF2->toPlainText(), flagF2, timerF2, ui->labelResultF2, postfix, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -357,7 +361,7 @@ void DialogArc::ShowLineAngles()
|
||||||
ui->listWidget->blockSignals(true);
|
ui->listWidget->blockSignals(true);
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
ui->listWidget->blockSignals(false);
|
ui->listWidget->blockSignals(false);
|
||||||
const QMap<QString, VLineAngle *> lineAnglesTable = data->DataLineAngles();
|
const QMap<QString, VLineAngle *> lineAnglesTable = data->DataAngleLines();
|
||||||
QMapIterator<QString, VLineAngle *> i(lineAnglesTable);
|
QMapIterator<QString, VLineAngle *> i(lineAnglesTable);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
</palette>
|
</palette>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>First angle degree</string>
|
<string>First angle</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -439,7 +439,7 @@
|
||||||
</palette>
|
</palette>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Second angle degree</string>
|
<string>Second angle</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -704,7 +704,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButtonLineAngles">
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -762,7 +762,7 @@
|
||||||
<tabstop>radioButtonLengthLine</tabstop>
|
<tabstop>radioButtonLengthLine</tabstop>
|
||||||
<tabstop>radioButtonLengthArc</tabstop>
|
<tabstop>radioButtonLengthArc</tabstop>
|
||||||
<tabstop>radioButtonLengthSpline</tabstop>
|
<tabstop>radioButtonLengthSpline</tabstop>
|
||||||
<tabstop>radioButtonLineAngles</tabstop>
|
<tabstop>radioButtonAngleLine</tabstop>
|
||||||
<tabstop>listWidget</tabstop>
|
<tabstop>listWidget</tabstop>
|
||||||
<tabstop>toolButtonPutHereRadius</tabstop>
|
<tabstop>toolButtonPutHereRadius</tabstop>
|
||||||
<tabstop>toolButtonPutHereF1</tabstop>
|
<tabstop>toolButtonPutHereF1</tabstop>
|
||||||
|
|
|
@ -453,6 +453,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -384,6 +384,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -384,6 +384,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -384,6 +384,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -86,6 +86,15 @@ void DialogEditWrongFormula::DeployFormulaTextEdit()
|
||||||
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogEditWrongFormula::EvalFormula()
|
||||||
|
{
|
||||||
|
SCASSERT(plainTextEditFormula != nullptr);
|
||||||
|
SCASSERT(labelResultCalculation != nullptr);
|
||||||
|
const QString postfix = QStringLiteral("");
|
||||||
|
Eval(plainTextEditFormula->toPlainText(), flagFormula, timerFormula, labelResultCalculation, postfix);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditWrongFormula::CheckState()
|
void DialogEditWrongFormula::CheckState()
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,7 @@ public slots:
|
||||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||||
*/
|
*/
|
||||||
void DeployFormulaTextEdit();
|
void DeployFormulaTextEdit();
|
||||||
|
virtual void EvalFormula();
|
||||||
protected:
|
protected:
|
||||||
virtual void CheckState();
|
virtual void CheckState();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -319,7 +319,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButtonLineAngles">
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -43,13 +43,15 @@
|
||||||
*/
|
*/
|
||||||
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
||||||
formula(QString()), angle(0), basePointId(0), formulaBaseHeight(0), line(nullptr), prepare(false)
|
formulaLength(QString()), formulaAngle(QString()), basePointId(0), formulaBaseHeight(0),
|
||||||
|
formulaBaseHeightAngle(0), line(nullptr), prepare(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitVariables(ui);
|
InitVariables(ui);
|
||||||
InitFormulaUI(ui);
|
InitFormulaUI(ui);
|
||||||
labelEditNamePoint = ui->labelEditNamePoint;
|
labelEditNamePoint = ui->labelEditNamePoint;
|
||||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
|
this->formulaBaseHeightAngle = ui->plainTextEditAngle->height();
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
flagFormula = false;
|
flagFormula = false;
|
||||||
|
@ -59,30 +61,73 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||||
|
|
||||||
InitArrow(ui);
|
connect(ui->toolButtonPutHereLength, &QPushButton::clicked, this, &DialogEndLine::PutHere);
|
||||||
|
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogEndLine::PutAngle);
|
||||||
|
|
||||||
|
connect(ui->toolButtonEqualLength, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
|
||||||
|
connect(ui->toolButtonEqualAngle, &QPushButton::clicked, this, &DialogEndLine::EvalAngle);
|
||||||
|
|
||||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere);
|
|
||||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
|
|
||||||
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula);
|
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged);
|
||||||
|
|
||||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
|
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEndLine::FormulaTextChanged);
|
||||||
|
connect(ui->plainTextEditAngle, &QPlainTextEdit::textChanged, this, &DialogEndLine::AngleTextChanged);
|
||||||
|
|
||||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
|
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEndLine::DeployFormulaTextEdit);
|
||||||
|
connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogEndLine::DeployAngleTextEdit);
|
||||||
|
|
||||||
|
connect(timerFormula, &QTimer::timeout, this, &DialogEndLine::EvalAngle);
|
||||||
|
|
||||||
line = new VisToolEndLine(data);
|
line = new VisToolEndLine(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief PutAngle put variable into formula of angle
|
||||||
|
*/
|
||||||
|
void DialogEndLine::PutAngle()
|
||||||
|
{
|
||||||
|
PutValHere(ui->plainTextEditAngle, ui->listWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief EvalAngle calculate value of angle
|
||||||
|
*/
|
||||||
|
void DialogEndLine::EvalAngle()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditAngle;
|
||||||
|
const QString postfix = QStringLiteral("°");
|
||||||
|
Eval(ui->plainTextEditAngle->toPlainText(), flagError, timerFormula, ui->labelResultCalculationAngle, postfix,
|
||||||
|
false);
|
||||||
|
labelEditFormula = ui->labelEditFormula;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEndLine::FormulaTextChanged()
|
void DialogEndLine::FormulaTextChanged()
|
||||||
{
|
{
|
||||||
this->FormulaChangedPlainText();
|
this->FormulaChangedPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogEndLine::AngleTextChanged()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditAngle;
|
||||||
|
ValFormulaChanged(flagError, ui->plainTextEditFormula, timerFormula);
|
||||||
|
labelEditFormula = ui->labelEditFormula;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEndLine::DeployFormulaTextEdit()
|
void DialogEndLine::DeployFormulaTextEdit()
|
||||||
{
|
{
|
||||||
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogEndLine::DeployAngleTextEdit()
|
||||||
|
{
|
||||||
|
DeployFormula(ui->plainTextEditAngle, ui->pushButtonGrowLengthAngle, formulaBaseHeightAngle);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
@ -143,18 +188,15 @@ void DialogEndLine::setTypeLine(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogEndLine::setFormula(const QString &value)
|
void DialogEndLine::setFormula(const QString &value)
|
||||||
{
|
{
|
||||||
formula = qApp->FormulaToUser(value);
|
formulaLength = qApp->FormulaToUser(value);
|
||||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||||
// of this PlainTextEdit to change 80 to this value
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formula.length() > 80)
|
if (formulaLength.length() > 80)
|
||||||
{
|
{
|
||||||
this->DeployFormulaTextEdit();
|
this->DeployFormulaTextEdit();
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormula->setPlainText(formula);
|
ui->plainTextEditFormula->setPlainText(formulaLength);
|
||||||
line->setLength(formula);
|
line->setLength(formulaLength);
|
||||||
//QTextCursor cursor = ui->plainTextEditFormula->textCursor();
|
|
||||||
//cursor.insertText(value);
|
|
||||||
//ui->plainTextEditFormula->setCursor(cursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -162,11 +204,17 @@ void DialogEndLine::setFormula(const QString &value)
|
||||||
* @brief setAngle set angle of line
|
* @brief setAngle set angle of line
|
||||||
* @param value angle in degree
|
* @param value angle in degree
|
||||||
*/
|
*/
|
||||||
void DialogEndLine::setAngle(const qreal &value)
|
void DialogEndLine::setAngle(const QString &value)
|
||||||
{
|
{
|
||||||
angle = value;
|
formulaAngle = qApp->FormulaToUser(value);
|
||||||
ui->doubleSpinBoxAngle->setValue(angle);
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||||
line->setAngle(angle);
|
// of this PlainTextEdit to change 80 to this value
|
||||||
|
if (formulaAngle.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployAngleTextEdit();
|
||||||
|
}
|
||||||
|
ui->plainTextEditAngle->setPlainText(formulaAngle);
|
||||||
|
line->setAngle(formulaAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -245,14 +293,18 @@ void DialogEndLine::SaveData()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->plainTextEditFormula->toPlainText();
|
|
||||||
formula.replace("\n", " ");
|
formulaLength = ui->plainTextEditFormula->toPlainText();
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
formulaLength.replace("\n", " ");
|
||||||
|
|
||||||
|
formulaAngle = ui->plainTextEditAngle->toPlainText();
|
||||||
|
formulaAngle.replace("\n", " ");
|
||||||
|
|
||||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
|
|
||||||
line->setPoint1Id(basePointId);
|
line->setPoint1Id(basePointId);
|
||||||
line->setLength(formula);
|
line->setLength(formulaLength);
|
||||||
line->setAngle(angle);
|
line->setAngle(formulaAngle);
|
||||||
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ public:
|
||||||
QString getFormula() const;
|
QString getFormula() const;
|
||||||
void setFormula(const QString &value);
|
void setFormula(const QString &value);
|
||||||
|
|
||||||
qreal getAngle() const;
|
QString getAngle() const;
|
||||||
void setAngle(const qreal &value);
|
void setAngle(const QString &value);
|
||||||
|
|
||||||
quint32 getBasePointId() const;
|
quint32 getBasePointId() const;
|
||||||
void setBasePointId(const quint32 &value);
|
void setBasePointId(const quint32 &value);
|
||||||
|
@ -78,6 +78,10 @@ public slots:
|
||||||
* @brief FormulaTextChanged when formula text changes for validation and calc
|
* @brief FormulaTextChanged when formula text changes for validation and calc
|
||||||
*/
|
*/
|
||||||
void FormulaTextChanged();
|
void FormulaTextChanged();
|
||||||
|
void PutAngle();
|
||||||
|
void EvalAngle();
|
||||||
|
void AngleTextChanged();
|
||||||
|
void DeployAngleTextEdit();
|
||||||
protected:
|
protected:
|
||||||
virtual void ShowVisualization();
|
virtual void ShowVisualization();
|
||||||
private:
|
private:
|
||||||
|
@ -93,16 +97,17 @@ private:
|
||||||
QString typeLine;
|
QString typeLine;
|
||||||
|
|
||||||
/** @brief formula formula */
|
/** @brief formula formula */
|
||||||
QString formula;
|
QString formulaLength;
|
||||||
|
|
||||||
/** @brief angle angle of line */
|
/** @brief angle angle of line */
|
||||||
qreal angle;
|
QString formulaAngle;
|
||||||
|
|
||||||
/** @brief basePointId id base point of line */
|
/** @brief basePointId id base point of line */
|
||||||
quint32 basePointId;
|
quint32 basePointId;
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
int formulaBaseHeightAngle;
|
||||||
|
|
||||||
VisToolEndLine *line;
|
VisToolEndLine *line;
|
||||||
|
|
||||||
|
@ -142,17 +147,17 @@ inline QString DialogEndLine::getTypeLine() const
|
||||||
*/
|
*/
|
||||||
inline QString DialogEndLine::getFormula() const
|
inline QString DialogEndLine::getFormula() const
|
||||||
{
|
{
|
||||||
return qApp->FormulaFromUser(formula);
|
return qApp->FormulaFromUser(formulaLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief getAngle return angle of line
|
* @brief getAngle return formula angle of line
|
||||||
* @return angle in degree
|
* @return angle formula
|
||||||
*/
|
*/
|
||||||
inline qreal DialogEndLine::getAngle() const
|
inline QString DialogEndLine::getAngle() const
|
||||||
{
|
{
|
||||||
return angle;
|
return qApp->FormulaFromUser(formulaAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>486</width>
|
<width>641</width>
|
||||||
<height>586</height>
|
<height>565</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButtonPutHere">
|
<widget class="QToolButton" name="toolButtonPutHereLength">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButtonEqual">
|
<widget class="QToolButton" name="toolButtonEqualLength">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Calculate value</string>
|
<string>Calculate value</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -206,6 +206,185 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditAngle">
|
||||||
|
<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>
|
||||||
|
<widget class="QToolButton" name="toolButtonPutHereAngle">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonEqualAngle">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculate value</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelResultCalculationAngle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value of length</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEditAngle">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>4</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="lineWrapMode">
|
||||||
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonGrowLengthAngle">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</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>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
@ -291,219 +470,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Degree of angle</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetMinimumSize</enum>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>28</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowRightUp">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowRightUp.png</normaloff>:/icon/32x32/arrowRightUp.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowLeftUp">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowLeftUp.png</normaloff>:/icon/32x32/arrowLeftUp.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowLeft">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowLeft.png</normaloff>:/icon/32x32/arrowLeft.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowRight">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowRight.png</normaloff>:/icon/32x32/arrowRight.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowUp">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowUp.png</normaloff>:/icon/32x32/arrowUp.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowDown">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowDown.png</normaloff>:/icon/32x32/arrowDown.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowLeftDown">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowLeftDown.png</normaloff>:/icon/32x32/arrowLeftDown.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QToolButton" name="toolButtonArrowRightDown">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/arrowRightDown.png</normaloff>:/icon/32x32/arrowRightDown.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>72</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Angle of line</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>360.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<double>360.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
<item>
|
<item>
|
||||||
|
@ -621,6 +587,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -665,15 +647,6 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>comboBoxBasePoint</tabstop>
|
<tabstop>comboBoxBasePoint</tabstop>
|
||||||
<tabstop>lineEditNamePoint</tabstop>
|
<tabstop>lineEditNamePoint</tabstop>
|
||||||
<tabstop>doubleSpinBoxAngle</tabstop>
|
|
||||||
<tabstop>toolButtonArrowRight</tabstop>
|
|
||||||
<tabstop>toolButtonArrowRightUp</tabstop>
|
|
||||||
<tabstop>toolButtonArrowUp</tabstop>
|
|
||||||
<tabstop>toolButtonArrowLeftUp</tabstop>
|
|
||||||
<tabstop>toolButtonArrowLeft</tabstop>
|
|
||||||
<tabstop>toolButtonArrowLeftDown</tabstop>
|
|
||||||
<tabstop>toolButtonArrowDown</tabstop>
|
|
||||||
<tabstop>toolButtonArrowRightDown</tabstop>
|
|
||||||
<tabstop>comboBoxLineType</tabstop>
|
<tabstop>comboBoxLineType</tabstop>
|
||||||
<tabstop>radioButtonSizeGrowth</tabstop>
|
<tabstop>radioButtonSizeGrowth</tabstop>
|
||||||
<tabstop>radioButtonStandardTable</tabstop>
|
<tabstop>radioButtonStandardTable</tabstop>
|
||||||
|
@ -682,7 +655,7 @@
|
||||||
<tabstop>radioButtonLengthArc</tabstop>
|
<tabstop>radioButtonLengthArc</tabstop>
|
||||||
<tabstop>radioButtonLengthSpline</tabstop>
|
<tabstop>radioButtonLengthSpline</tabstop>
|
||||||
<tabstop>listWidget</tabstop>
|
<tabstop>listWidget</tabstop>
|
||||||
<tabstop>toolButtonEqual</tabstop>
|
<tabstop>toolButtonEqualLength</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -628,6 +628,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -468,6 +468,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -495,6 +495,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonAngleLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -62,8 +62,8 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
||||||
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
listWidget(nullptr), labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr),
|
||||||
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr),
|
||||||
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
||||||
radioButtonLengthCurve(nullptr), lineStyles(VAbstractTool::Styles()), okColor(QColor(76, 76, 76)),
|
radioButtonLengthCurve(nullptr), radioButtonAngleLine(nullptr), lineStyles(VAbstractTool::Styles()),
|
||||||
errorColor(Qt::red), associatedTool(nullptr), toolId(toolId)
|
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), toolId(toolId)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr);
|
SCASSERT(data != nullptr);
|
||||||
timerFormula = new QTimer(this);
|
timerFormula = new QTimer(this);
|
||||||
|
@ -415,6 +415,7 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
|
||||||
ChangeColor(labelEditFormula, Qt::red);
|
ChangeColor(labelEditFormula, Qt::red);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
timer->setSingleShot(true);
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,9 +426,11 @@ void DialogTool::ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer *tim
|
||||||
* @param flag flag state of formula
|
* @param flag flag state of formula
|
||||||
* @param timer timer of formula
|
* @param timer timer of formula
|
||||||
* @param label label for signal error
|
* @param label label for signal error
|
||||||
|
* @param postfix unit name
|
||||||
* @param checkZero true - if formula can't be equal zero
|
* @param checkZero true - if formula can't be equal zero
|
||||||
*/
|
*/
|
||||||
void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, bool checkZero)
|
void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, const QString& postfix,
|
||||||
|
bool checkZero)
|
||||||
{
|
{
|
||||||
SCASSERT(timer != nullptr);
|
SCASSERT(timer != nullptr);
|
||||||
SCASSERT(label != nullptr);
|
SCASSERT(label != nullptr);
|
||||||
|
@ -457,16 +460,16 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
QLocale loc;
|
||||||
if (qApp->getSettings()->value("configuration/osSeparator", 1).toBool())
|
if (qApp->getSettings()->value("configuration/osSeparator", 1).toBool())
|
||||||
{
|
{
|
||||||
QLocale loc = QLocale::system();
|
loc = QLocale::system();
|
||||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QLocale loc = QLocale(QLocale::C);
|
loc = QLocale(QLocale::C);
|
||||||
label->setText(loc.toString(result) + VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
|
||||||
}
|
}
|
||||||
|
label->setText(loc.toString(result) + postfix);
|
||||||
flag = true;
|
flag = true;
|
||||||
ChangeColor(labelEditFormula, okColor);
|
ChangeColor(labelEditFormula, okColor);
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
|
@ -486,7 +489,7 @@ void DialogTool::Eval(const QString &text, bool &flag, QTimer *timer, QLabel *la
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckState();
|
CheckState();
|
||||||
timer->stop();
|
//timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -822,7 +825,8 @@ void DialogTool::EvalFormula()
|
||||||
{
|
{
|
||||||
SCASSERT(plainTextEditFormula != nullptr);
|
SCASSERT(plainTextEditFormula != nullptr);
|
||||||
SCASSERT(labelResultCalculation != nullptr);
|
SCASSERT(labelResultCalculation != nullptr);
|
||||||
Eval(plainTextEditFormula->toPlainText(), flagFormula, timerFormula, labelResultCalculation);
|
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit());
|
||||||
|
Eval(plainTextEditFormula->toPlainText(), flagFormula, timerFormula, labelResultCalculation, postfix);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -885,6 +889,12 @@ void DialogTool::LengthCurves()
|
||||||
ShowVariable(data->DataLengthSplines());
|
ShowVariable(data->DataLengthSplines());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTool::AngleLines()
|
||||||
|
{
|
||||||
|
ShowVariable(data->DataAngleLines());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Increments show in list increment variables
|
* @brief Increments show in list increment variables
|
||||||
|
|
|
@ -103,12 +103,13 @@ public slots:
|
||||||
void ArrowLeftDown();
|
void ArrowLeftDown();
|
||||||
void ArrowRightUp();
|
void ArrowRightUp();
|
||||||
void ArrowRightDown();
|
void ArrowRightDown();
|
||||||
void EvalFormula();
|
virtual void EvalFormula();
|
||||||
void SizeHeight();
|
void SizeHeight();
|
||||||
void Measurements();
|
void Measurements();
|
||||||
void LengthLines();
|
void LengthLines();
|
||||||
void LengthArcs();
|
void LengthArcs();
|
||||||
void LengthCurves();
|
void LengthCurves();
|
||||||
|
void AngleLines();
|
||||||
void Increments();
|
void Increments();
|
||||||
void PutHere();
|
void PutHere();
|
||||||
void PutVal(QListWidgetItem * item);
|
void PutVal(QListWidgetItem * item);
|
||||||
|
@ -184,6 +185,8 @@ protected:
|
||||||
/** @brief radioButtonLengthCurve radio button for lengths of curves variables */
|
/** @brief radioButtonLengthCurve radio button for lengths of curves variables */
|
||||||
QRadioButton *radioButtonLengthCurve;
|
QRadioButton *radioButtonLengthCurve;
|
||||||
|
|
||||||
|
QRadioButton *radioButtonAngleLine;
|
||||||
|
|
||||||
/** @brief lineStyles list supported line styles. */
|
/** @brief lineStyles list supported line styles. */
|
||||||
QStringList lineStyles;
|
QStringList lineStyles;
|
||||||
const QColor okColor;
|
const QColor okColor;
|
||||||
|
@ -213,7 +216,8 @@ protected:
|
||||||
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
||||||
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
||||||
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
||||||
void Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, bool checkZero = true);
|
void Eval(const QString &text, bool &flag, QTimer *timer, QLabel *label, const QString &postfix,
|
||||||
|
bool checkZero = true);
|
||||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
||||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
||||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||||
|
@ -249,6 +253,7 @@ protected:
|
||||||
radioButtonLengthLine = ui->radioButtonLengthLine;
|
radioButtonLengthLine = ui->radioButtonLengthLine;
|
||||||
radioButtonLengthArc = ui->radioButtonLengthArc;
|
radioButtonLengthArc = ui->radioButtonLengthArc;
|
||||||
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
||||||
|
radioButtonAngleLine = ui->radioButtonAngleLine;
|
||||||
|
|
||||||
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||||
|
|
||||||
|
@ -268,6 +273,7 @@ protected:
|
||||||
connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines);
|
connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines);
|
||||||
connect(radioButtonLengthArc, &QRadioButton::clicked, this, &DialogTool::LengthArcs);
|
connect(radioButtonLengthArc, &QRadioButton::clicked, this, &DialogTool::LengthArcs);
|
||||||
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
|
connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves);
|
||||||
|
connect(radioButtonAngleLine, &QRadioButton::clicked, this, &DialogTool::AngleLines);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,7 +74,7 @@ void VToolAlongLine::FullUpdateFromFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formulaLength = domElement.attribute(AttrLength, "");
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ void VToolAlongLine::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void VToolAlongLine::RefreshDataInFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
doc->SetAttribute(domElement, AttrName, point->name());
|
doc->SetAttribute(domElement, AttrName, point->name());
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ void VToolAlongLine::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
dialogTool->setTypeLine(typeLine);
|
dialogTool->setTypeLine(typeLine);
|
||||||
dialogTool->setFormula(formula);
|
dialogTool->setFormula(formulaLength);
|
||||||
dialogTool->setFirstPointId(basePointId);
|
dialogTool->setFirstPointId(basePointId);
|
||||||
dialogTool->setSecondPointId(secondPointId);
|
dialogTool->setSecondPointId(secondPointId);
|
||||||
dialogTool->setPointName(p->name());
|
dialogTool->setPointName(p->name());
|
||||||
|
|
|
@ -111,7 +111,7 @@ void VToolBisector::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
dialogTool->setTypeLine(typeLine);
|
dialogTool->setTypeLine(typeLine);
|
||||||
dialogTool->setFormula(formula);
|
dialogTool->setFormula(formulaLength);
|
||||||
dialogTool->setFirstPointId(firstPointId);
|
dialogTool->setFirstPointId(firstPointId);
|
||||||
dialogTool->setSecondPointId(basePointId);
|
dialogTool->setSecondPointId(basePointId);
|
||||||
dialogTool->setThirdPointId(thirdPointId);
|
dialogTool->setThirdPointId(thirdPointId);
|
||||||
|
@ -223,7 +223,7 @@ void VToolBisector::FullUpdateFromFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formulaLength = domElement.attribute(AttrLength, "");
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||||
basePointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
basePointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt();
|
thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt();
|
||||||
|
@ -278,7 +278,7 @@ void VToolBisector::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||||
|
@ -300,7 +300,7 @@ void VToolBisector::RefreshDataInFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
doc->SetAttribute(domElement, AttrName, point->name());
|
doc->SetAttribute(domElement, AttrName, point->name());
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, firstPointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId);
|
||||||
|
|
|
@ -42,18 +42,17 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine");
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param typeLine line type.
|
* @param typeLine line type.
|
||||||
* @param formula string with formula length of line.
|
* @param formulaLength string with formula length of line.
|
||||||
* @param angle angle of line.
|
* @param formulaAngle formula angle of line.
|
||||||
* @param basePointId id first point of line.
|
* @param basePointId id first point of line.
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||||
const QString &formula, const qreal &angle, const quint32 &basePointId,
|
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
|
||||||
const Source &typeCreation, QGraphicsItem *parent)
|
const Source &typeCreation, QGraphicsItem *parent)
|
||||||
:VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent)
|
:VToolLinePoint(doc, data, id, typeLine, formulaLength, basePointId, 0, parent), formulaAngle(formulaAngle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
AddToFile();
|
AddToFile();
|
||||||
|
@ -76,8 +75,8 @@ void VToolEndLine::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
dialogTool->setTypeLine(typeLine);
|
dialogTool->setTypeLine(typeLine);
|
||||||
dialogTool->setFormula(formula);
|
dialogTool->setFormula(formulaLength);
|
||||||
dialogTool->setAngle(angle);
|
dialogTool->setAngle(formulaAngle);
|
||||||
dialogTool->setBasePointId(basePointId);
|
dialogTool->setBasePointId(basePointId);
|
||||||
dialogTool->setPointName(p->name());
|
dialogTool->setPointName(p->name());
|
||||||
}
|
}
|
||||||
|
@ -98,13 +97,13 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
||||||
SCASSERT(dialogTool);
|
SCASSERT(dialogTool);
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
const QString typeLine = dialogTool->getTypeLine();
|
const QString typeLine = dialogTool->getTypeLine();
|
||||||
QString formula = dialogTool->getFormula();
|
QString formulaLength = dialogTool->getFormula();
|
||||||
const qreal angle = dialogTool->getAngle();
|
QString formulaAngle = dialogTool->getAngle();
|
||||||
const quint32 basePointId = dialogTool->getBasePointId();
|
const quint32 basePointId = dialogTool->getBasePointId();
|
||||||
|
|
||||||
VToolEndLine *point = nullptr;
|
VToolEndLine *point = nullptr;
|
||||||
point=Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
|
point=Create(0, pointName, typeLine, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
|
||||||
Source::FromGui);
|
Document::FullParse, Source::FromGui);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
{
|
{
|
||||||
point->dialog=dialogTool;
|
point->dialog=dialogTool;
|
||||||
|
@ -118,8 +117,8 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
||||||
* @param _id tool id, 0 if tool doesn't exist yet.
|
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||||
* @param pointName point name.
|
* @param pointName point name.
|
||||||
* @param typeLine line type.
|
* @param typeLine line type.
|
||||||
* @param formula string with formula length of line.
|
* @param formulaLength string with formula length of line.
|
||||||
* @param angle angle of line.
|
* @param formulaAngle formula angle of line.
|
||||||
* @param basePointId id first point of line.
|
* @param basePointId id first point of line.
|
||||||
* @param mx label bias x axis.
|
* @param mx label bias x axis.
|
||||||
* @param my label bias y axis.
|
* @param my label bias y axis.
|
||||||
|
@ -131,15 +130,15 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
||||||
* @return the created tool
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||||
QString &formula, const qreal &angle, const quint32 &basePointId,
|
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
|
||||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||||
{
|
{
|
||||||
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
|
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
|
||||||
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||||
|
|
||||||
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
|
line.setLength(qApp->toPixel(CheckFormula(_id, formulaLength, data)));
|
||||||
line.setAngle(angle);
|
line.setAngle(CheckFormula(_id, formulaAngle, data));
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -158,8 +157,8 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
||||||
VDrawTool::AddRecord(id, Tool::EndLineTool, doc);
|
VDrawTool::AddRecord(id, Tool::EndLineTool, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle,
|
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId,
|
||||||
basePointId, typeCreation);
|
typeCreation);
|
||||||
scene->addItem(point);
|
scene->addItem(point);
|
||||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||||
|
@ -181,9 +180,9 @@ void VToolEndLine::FullUpdateFromFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formulaLength = domElement.attribute(AttrLength, "");
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
||||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
formulaAngle = domElement.attribute(AttrAngle, "");
|
||||||
}
|
}
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
@ -224,8 +223,8 @@ void VToolEndLine::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrAngle, angle);
|
doc->SetAttribute(domElement, AttrAngle, formulaAngle);
|
||||||
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
|
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
|
@ -245,8 +244,8 @@ void VToolEndLine::RefreshDataInFile()
|
||||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrAngle, angle);
|
doc->SetAttribute(domElement, AttrAngle, formulaAngle);
|
||||||
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
|
doc->SetAttribute(domElement, AttrBasePoint, basePointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,6 +262,6 @@ void VToolEndLine::SaveDialog(QDomElement &domElement)
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||||
doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
|
doc->SetAttribute(domElement, AttrAngle, dialogTool->getAngle());
|
||||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,15 +39,15 @@ class VToolEndLine : public VToolLinePoint
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
|
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||||
const qreal &angle, const quint32 &basePointId, const Source &typeCreation,
|
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
|
||||||
QGraphicsItem * parent = nullptr);
|
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||||
virtual void setDialog();
|
virtual void setDialog();
|
||||||
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||||
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine, QString &formula,
|
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||||
const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my,
|
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
|
||||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
const Source &typeCreation);
|
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
|
@ -57,6 +57,8 @@ protected:
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
virtual void RefreshDataInFile();
|
virtual void RefreshDataInFile();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
|
private:
|
||||||
|
QString formulaAngle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLENDLINE_H
|
#endif // VTOOLENDLINE_H
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
* @param id object id in container.
|
* @param id object id in container.
|
||||||
* @param typeLine line type.
|
* @param typeLine line type.
|
||||||
* @param formula string with length formula.
|
* @param formulaLength string with length formula.
|
||||||
* @param basePointId id base line point.
|
* @param basePointId id base line point.
|
||||||
* @param angle line angle.
|
* @param angle line angle.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
|
@ -44,7 +44,8 @@
|
||||||
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
|
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
|
||||||
const QString &typeLine, const QString &formula, const quint32 &basePointId,
|
const QString &typeLine, const QString &formula, const quint32 &basePointId,
|
||||||
const qreal &angle, QGraphicsItem *parent)
|
const qreal &angle, QGraphicsItem *parent)
|
||||||
:VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), mainLine(nullptr)
|
:VToolPoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||||
|
mainLine(nullptr)
|
||||||
{
|
{
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
|
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
|
||||||
|
|
|
@ -45,7 +45,7 @@ public slots:
|
||||||
virtual void SetFactor(qreal factor);
|
virtual void SetFactor(qreal factor);
|
||||||
protected:
|
protected:
|
||||||
/** @brief formula string with length formula. */
|
/** @brief formula string with length formula. */
|
||||||
QString formula;
|
QString formulaLength;
|
||||||
|
|
||||||
/** @brief angle line angle. */
|
/** @brief angle line angle. */
|
||||||
qreal angle;
|
qreal angle;
|
||||||
|
|
|
@ -75,7 +75,7 @@ void VToolNormal::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
dialogTool->setTypeLine(typeLine);
|
dialogTool->setTypeLine(typeLine);
|
||||||
dialogTool->setFormula(formula);
|
dialogTool->setFormula(formulaLength);
|
||||||
dialogTool->setAngle(angle);
|
dialogTool->setAngle(angle);
|
||||||
dialogTool->setFirstPointId(basePointId);
|
dialogTool->setFirstPointId(basePointId);
|
||||||
dialogTool->setSecondPointId(secondPointId);
|
dialogTool->setSecondPointId(secondPointId);
|
||||||
|
@ -203,7 +203,7 @@ void VToolNormal::FullUpdateFromFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formulaLength = domElement.attribute(AttrLength, "");
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
angle = domElement.attribute(AttrAngle, "").toDouble();
|
||||||
|
@ -258,7 +258,7 @@ void VToolNormal::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrAngle, angle);
|
doc->SetAttribute(domElement, AttrAngle, angle);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
@ -280,7 +280,7 @@ void VToolNormal::RefreshDataInFile()
|
||||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrAngle, angle);
|
doc->SetAttribute(domElement, AttrAngle, angle);
|
||||||
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
doc->SetAttribute(domElement, AttrFirstPoint, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(domElement, AttrSecondPoint, secondPointId);
|
||||||
|
|
|
@ -74,7 +74,7 @@ void VToolShoulderPoint::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||||
dialogTool->setTypeLine(typeLine);
|
dialogTool->setTypeLine(typeLine);
|
||||||
dialogTool->setFormula(formula);
|
dialogTool->setFormula(formulaLength);
|
||||||
dialogTool->setP1Line(basePointId);
|
dialogTool->setP1Line(basePointId);
|
||||||
dialogTool->setP2Line(p2Line);
|
dialogTool->setP2Line(p2Line);
|
||||||
dialogTool->setPShoulder(pShoulder);
|
dialogTool->setPShoulder(pShoulder);
|
||||||
|
@ -226,7 +226,7 @@ void VToolShoulderPoint::FullUpdateFromFile()
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formulaLength = domElement.attribute(AttrLength, "");
|
||||||
basePointId = domElement.attribute(AttrP1Line, "").toUInt();
|
basePointId = domElement.attribute(AttrP1Line, "").toUInt();
|
||||||
p2Line = domElement.attribute(AttrP2Line, "").toUInt();
|
p2Line = domElement.attribute(AttrP2Line, "").toUInt();
|
||||||
pShoulder = domElement.attribute(AttrPShoulder, "").toUInt();
|
pShoulder = domElement.attribute(AttrPShoulder, "").toUInt();
|
||||||
|
@ -281,7 +281,7 @@ void VToolShoulderPoint::AddToFile()
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrP1Line, basePointId);
|
doc->SetAttribute(domElement, AttrP1Line, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrP2Line, p2Line);
|
doc->SetAttribute(domElement, AttrP2Line, p2Line);
|
||||||
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
|
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
|
||||||
|
@ -303,7 +303,7 @@ void VToolShoulderPoint::RefreshDataInFile()
|
||||||
doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->mx()));
|
doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->mx()));
|
||||||
doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->my()));
|
doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->my()));
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
doc->SetAttribute(domElement, AttrTypeLine, typeLine);
|
||||||
doc->SetAttribute(domElement, AttrLength, formula);
|
doc->SetAttribute(domElement, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(domElement, AttrP1Line, basePointId);
|
doc->SetAttribute(domElement, AttrP1Line, basePointId);
|
||||||
doc->SetAttribute(domElement, AttrP2Line, p2Line);
|
doc->SetAttribute(domElement, AttrP2Line, p2Line);
|
||||||
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
|
doc->SetAttribute(domElement, AttrPShoulder, pShoulder);
|
||||||
|
|
|
@ -109,7 +109,41 @@ qreal VisLine::FindLength(const QString &expression)
|
||||||
<< "--------------------------------------";
|
<< "--------------------------------------";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return qApp->toPixel(length);
|
return qApp->toPixel(FindVal(expression));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VisLine::FindVal(const QString &expression)
|
||||||
|
{
|
||||||
|
qreal val = 0;
|
||||||
|
if (expression.isEmpty())
|
||||||
|
{
|
||||||
|
val = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Replace line return with spaces for calc if exist
|
||||||
|
QString formula = expression;
|
||||||
|
formula.replace("\n", " ");
|
||||||
|
formula = qApp->FormulaFromUser(formula);
|
||||||
|
Calculator *cal = new Calculator(data);
|
||||||
|
val = cal->EvalFormula(formula);
|
||||||
|
delete cal;
|
||||||
|
}
|
||||||
|
catch (qmu::QmuParserError &e)
|
||||||
|
{
|
||||||
|
val = 0;
|
||||||
|
qDebug() << "\nMath parser error:\n"
|
||||||
|
<< "--------------------------------------\n"
|
||||||
|
<< "Message: " << e.GetMsg() << "\n"
|
||||||
|
<< "Expression: " << e.GetExpr() << "\n"
|
||||||
|
<< "--------------------------------------";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -64,6 +64,7 @@ protected:
|
||||||
QString toolTip;
|
QString toolTip;
|
||||||
QRectF PointRect();
|
QRectF PointRect();
|
||||||
qreal FindLength(const QString &expression);
|
qreal FindLength(const QString &expression);
|
||||||
|
qreal FindVal(const QString &expression);
|
||||||
void DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color,
|
void DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color,
|
||||||
Qt::PenStyle style = Qt::SolidLine);
|
Qt::PenStyle style = Qt::SolidLine);
|
||||||
void DrawPoint(QGraphicsEllipseItem *point, const QPointF &pos, const QColor &color);
|
void DrawPoint(QGraphicsEllipseItem *point, const QPointF &pos, const QColor &color);
|
||||||
|
|
|
@ -77,15 +77,15 @@ void VisToolEndLine::RefreshGeometry()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VisToolEndLine::Angle() const
|
QString VisToolEndLine::Angle() const
|
||||||
{
|
{
|
||||||
return this->line().angle();
|
return QString("%1").arg(this->line().angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEndLine::setAngle(const qreal &value)
|
void VisToolEndLine::setAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = value;
|
angle = FindVal(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,8 +41,8 @@ public:
|
||||||
virtual ~VisToolEndLine();
|
virtual ~VisToolEndLine();
|
||||||
|
|
||||||
virtual void RefreshGeometry();
|
virtual void RefreshGeometry();
|
||||||
qreal Angle() const;
|
QString Angle() const;
|
||||||
void setAngle(const qreal &value);
|
void setAngle(const QString &expression);
|
||||||
void setLength(const QString &expression);
|
void setLength(const QString &expression);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VisToolEndLine)
|
Q_DISABLE_COPY(VisToolEndLine)
|
||||||
|
|
|
@ -1124,18 +1124,22 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
|
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
|
||||||
|
|
||||||
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
|
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
|
||||||
QString f = formula;//need for saving fixed formula;
|
QString f = formula;//need for saving fixed formula;
|
||||||
|
|
||||||
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
|
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0");
|
||||||
const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
|
|
||||||
|
|
||||||
VToolEndLine::Create(id, name, typeLine, f, angle, basePointId,
|
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
|
||||||
mx, my, scene, this, data, parse, Source::FromFile);
|
QString angleFix = angle;
|
||||||
|
|
||||||
|
VToolEndLine::Create(id, name, typeLine, f, angleFix, basePointId, mx, my, scene, this, data, parse,
|
||||||
|
Source::FromFile);
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (f != formula)
|
if (f != formula || angleFix != angle)
|
||||||
{
|
{
|
||||||
SetAttribute(domElement, VAbstractTool::AttrLength, f);
|
SetAttribute(domElement, VAbstractTool::AttrRadius, f);
|
||||||
|
SetAttribute(domElement, VAbstractTool::AttrAngle, angleFix);
|
||||||
haveLiteChange();
|
haveLiteChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user