Fixed bug in Tape. Each Window should has own size and height values.
--HG-- branch : develop
This commit is contained in:
parent
825b0b1431
commit
3999ebd82e
|
@ -83,6 +83,8 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
mUnit(Unit::Cm),
|
mUnit(Unit::Cm),
|
||||||
pUnit(Unit::Cm),
|
pUnit(Unit::Cm),
|
||||||
mType(MeasurementsType::Individual),
|
mType(MeasurementsType::Individual),
|
||||||
|
currentSize(0),
|
||||||
|
currentHeight(0),
|
||||||
curFile(),
|
curFile(),
|
||||||
gradationHeights(nullptr),
|
gradationHeights(nullptr),
|
||||||
gradationSizes(nullptr),
|
gradationSizes(nullptr),
|
||||||
|
@ -179,7 +181,7 @@ void TMainWindow::SetBaseMHeight(int height)
|
||||||
if (mType == MeasurementsType::Multisize)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
const int row = ui->tableWidget->currentRow();
|
const int row = ui->tableWidget->currentRow();
|
||||||
VContainer::SetHeight(UnitConvertor(height, Unit::Cm, mUnit));
|
currentHeight = UnitConvertor(height, Unit::Cm, mUnit);
|
||||||
RefreshData();
|
RefreshData();
|
||||||
ui->tableWidget->selectRow(row);
|
ui->tableWidget->selectRow(row);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +196,7 @@ void TMainWindow::SetBaseMSize(int size)
|
||||||
if (mType == MeasurementsType::Multisize)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
const int row = ui->tableWidget->currentRow();
|
const int row = ui->tableWidget->currentRow();
|
||||||
VContainer::SetSize(UnitConvertor(size, Unit::Cm, mUnit));
|
currentSize = UnitConvertor(size, Unit::Cm, mUnit);
|
||||||
RefreshData();
|
RefreshData();
|
||||||
ui->tableWidget->selectRow(row);
|
ui->tableWidget->selectRow(row);
|
||||||
}
|
}
|
||||||
|
@ -250,6 +252,8 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit);
|
data = new VContainer(qApp->TrVars(), &mUnit);
|
||||||
|
|
||||||
m = new VMeasurements(data);
|
m = new VMeasurements(data);
|
||||||
|
m->SetSize(¤tSize);
|
||||||
|
m->SetHeight(¤tHeight);
|
||||||
m->setXMLContent(path);
|
m->setXMLContent(path);
|
||||||
|
|
||||||
mType = m->Type();
|
mType = m->Type();
|
||||||
|
@ -284,8 +288,8 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
mUnit = m->MUnit();
|
mUnit = m->MUnit();
|
||||||
pUnit = mUnit;
|
pUnit = mUnit;
|
||||||
|
|
||||||
VContainer::SetHeight(m->BaseHeight());
|
currentSize = m->BaseSize();
|
||||||
VContainer::SetSize(m->BaseSize());
|
currentHeight = m->BaseHeight();
|
||||||
|
|
||||||
ui->labelToolTip->setVisible(false);
|
ui->labelToolTip->setVisible(false);
|
||||||
ui->tabWidget->setVisible(true);
|
ui->tabWidget->setVisible(true);
|
||||||
|
@ -358,12 +362,14 @@ void TMainWindow::FileNew()
|
||||||
mType = measurements.Type();
|
mType = measurements.Type();
|
||||||
|
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit);
|
data = new VContainer(qApp->TrVars(), &mUnit);
|
||||||
VContainer::SetHeight(measurements.BaseHeight());
|
currentHeight = measurements.BaseHeight();
|
||||||
VContainer::SetSize(measurements.BaseSize());
|
currentSize = measurements.BaseSize();
|
||||||
|
|
||||||
if (mType == MeasurementsType::Multisize)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
m = new VMeasurements(mUnit, measurements.BaseSize(), measurements.BaseHeight(), data);
|
m = new VMeasurements(mUnit, measurements.BaseSize(), measurements.BaseHeight(), data);
|
||||||
|
m->SetSize(¤tSize);
|
||||||
|
m->SetHeight(¤tHeight);
|
||||||
m_curFileFormatVersion = VVSTConverter::MeasurementMaxVer;
|
m_curFileFormatVersion = VVSTConverter::MeasurementMaxVer;
|
||||||
m_curFileFormatVersionStr = VVSTConverter::MeasurementMaxVerStr;
|
m_curFileFormatVersionStr = VVSTConverter::MeasurementMaxVerStr;
|
||||||
}
|
}
|
||||||
|
@ -1416,7 +1422,7 @@ void TMainWindow::ImportFromPattern()
|
||||||
void TMainWindow::ChangedSize(const QString &text)
|
void TMainWindow::ChangedSize(const QString &text)
|
||||||
{
|
{
|
||||||
const int row = ui->tableWidget->currentRow();
|
const int row = ui->tableWidget->currentRow();
|
||||||
VContainer::SetSize(text.toInt());
|
currentSize = text.toInt();
|
||||||
RefreshData();
|
RefreshData();
|
||||||
search->RefreshList(ui->lineEditFind->text());
|
search->RefreshList(ui->lineEditFind->text());
|
||||||
ui->tableWidget->selectRow(row);
|
ui->tableWidget->selectRow(row);
|
||||||
|
@ -1426,7 +1432,7 @@ void TMainWindow::ChangedSize(const QString &text)
|
||||||
void TMainWindow::ChangedHeight(const QString &text)
|
void TMainWindow::ChangedHeight(const QString &text)
|
||||||
{
|
{
|
||||||
const int row = ui->tableWidget->currentRow();
|
const int row = ui->tableWidget->currentRow();
|
||||||
VContainer::SetHeight(text.toInt());
|
currentHeight = text.toInt();
|
||||||
RefreshData();
|
RefreshData();
|
||||||
search->RefreshList(ui->lineEditFind->text());
|
search->RefreshList(ui->lineEditFind->text());
|
||||||
ui->tableWidget->selectRow(row);
|
ui->tableWidget->selectRow(row);
|
||||||
|
@ -1489,7 +1495,8 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
ui->doubleSpinBoxInHeights->blockSignals(true);
|
ui->doubleSpinBoxInHeights->blockSignals(true);
|
||||||
|
|
||||||
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
|
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
|
||||||
const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit);
|
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
|
||||||
|
pUnit);
|
||||||
ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix);
|
ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix);
|
||||||
|
|
||||||
if (fresh)
|
if (fresh)
|
||||||
|
@ -2353,7 +2360,7 @@ void TMainWindow::SetDefaultHeight(int value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VContainer::SetHeight(gradationHeights->currentText().toInt());
|
currentHeight = gradationHeights->currentText().toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2367,7 +2374,7 @@ void TMainWindow::SetDefaultSize(int value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VContainer::SetSize(gradationSizes->currentText().toInt());
|
currentSize = gradationSizes->currentText().toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2453,7 +2460,8 @@ void TMainWindow::RefreshTable(bool freshCall)
|
||||||
AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
|
AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit);
|
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
|
||||||
|
pUnit);
|
||||||
AddCell(locale().toString(value), currentRow, ColumnCalcValue,
|
AddCell(locale().toString(value), currentRow, ColumnCalcValue,
|
||||||
Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value
|
Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value
|
||||||
|
|
||||||
|
@ -2669,7 +2677,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
||||||
}
|
}
|
||||||
f.replace("\n", " ");
|
f.replace("\n", " ");
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
qreal result = cal->EvalFormula(data->PlainVariables(), f);
|
qreal result = cal->EvalFormula(data->DataVariables(), f);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
@ -2836,6 +2844,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit);
|
data = new VContainer(qApp->TrVars(), &mUnit);
|
||||||
|
|
||||||
m = new VMeasurements(data);
|
m = new VMeasurements(data);
|
||||||
|
m->SetSize(¤tSize);
|
||||||
|
m->SetHeight(¤tHeight);
|
||||||
m->setXMLContent(path);
|
m->setXMLContent(path);
|
||||||
|
|
||||||
mType = m->Type();
|
mType = m->Type();
|
||||||
|
@ -2868,8 +2878,8 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
mUnit = m->MUnit();
|
mUnit = m->MUnit();
|
||||||
pUnit = mUnit;
|
pUnit = mUnit;
|
||||||
|
|
||||||
VContainer::SetHeight(m->BaseHeight());
|
currentHeight = m->BaseHeight();
|
||||||
VContainer::SetSize(m->BaseSize());
|
currentSize = m->BaseSize();
|
||||||
|
|
||||||
ui->labelToolTip->setVisible(false);
|
ui->labelToolTip->setVisible(false);
|
||||||
ui->tabWidget->setVisible(true);
|
ui->tabWidget->setVisible(true);
|
||||||
|
|
|
@ -135,6 +135,8 @@ private:
|
||||||
Unit mUnit;
|
Unit mUnit;
|
||||||
Unit pUnit;
|
Unit pUnit;
|
||||||
MeasurementsType mType;
|
MeasurementsType mType;
|
||||||
|
qreal currentSize;
|
||||||
|
qreal currentHeight;
|
||||||
QString curFile;
|
QString curFile;
|
||||||
QComboBox *gradationHeights;
|
QComboBox *gradationHeights;
|
||||||
QComboBox *gradationSizes;
|
QComboBox *gradationSizes;
|
||||||
|
|
|
@ -352,7 +352,7 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
|
||||||
}
|
}
|
||||||
f.replace("\n", " ");
|
f.replace("\n", " ");
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
const qreal result = cal->EvalFormula(data->PlainVariables(), f);
|
const qreal result = cal->EvalFormula(data->DataVariables(), f);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
|
|
@ -377,6 +377,8 @@ QSharedPointer<VMeasurements> MainWindow::OpenMeasurementFile(const QString &pat
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m = QSharedPointer<VMeasurements>(new VMeasurements(pattern));
|
m = QSharedPointer<VMeasurements>(new VMeasurements(pattern));
|
||||||
|
m->SetSize(VContainer::rsize());
|
||||||
|
m->SetHeight(VContainer::rheight());
|
||||||
m->setXMLContent(path);
|
m->setXMLContent(path);
|
||||||
|
|
||||||
if (m->Type() == MeasurementsType::Unknown)
|
if (m->Type() == MeasurementsType::Unknown)
|
||||||
|
@ -451,8 +453,8 @@ bool MainWindow::LoadMeasurements(const QString &path)
|
||||||
|
|
||||||
if (m->Type() == MeasurementsType::Multisize)
|
if (m->Type() == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
m->SetDataSize();
|
VContainer::SetSize(UnitConvertor(m->BaseSize(), m->MUnit(), *m->GetData()->GetPatternUnit()));
|
||||||
m->SetDataHeight();
|
VContainer::SetHeight(UnitConvertor(m->BaseHeight(), m->MUnit(), *m->GetData()->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -4127,6 +4129,8 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
|
||||||
// Here comes undocumented Valentina's feature.
|
// Here comes undocumented Valentina's feature.
|
||||||
// Because app bundle in Mac OS X doesn't allow setup assosiation for Tape we must do this through Valentina
|
// Because app bundle in Mac OS X doesn't allow setup assosiation for Tape we must do this through Valentina
|
||||||
VMeasurements m(pattern);
|
VMeasurements m(pattern);
|
||||||
|
m.SetSize(VContainer::rsize());
|
||||||
|
m.SetHeight(VContainer::rheight());
|
||||||
m.setXMLContent(fileName);
|
m.setXMLContent(fileName);
|
||||||
|
|
||||||
if (m.Type() == MeasurementsType::Multisize || m.Type() == MeasurementsType::Individual)
|
if (m.Type() == MeasurementsType::Multisize || m.Type() == MeasurementsType::Individual)
|
||||||
|
@ -4626,6 +4630,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
|
QScopedPointer<VMeasurements> m(new VMeasurements(pattern));
|
||||||
|
m->SetSize(VContainer::rsize());
|
||||||
|
m->SetHeight(VContainer::rheight());
|
||||||
m->setXMLContent(mPath);
|
m->setXMLContent(mPath);
|
||||||
|
|
||||||
patternType = m->Type();
|
patternType = m->Type();
|
||||||
|
|
|
@ -3015,7 +3015,7 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok)
|
||||||
QString f = formula;
|
QString f = formula;
|
||||||
f.replace("\n", " ");
|
f.replace("\n", " ");
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
const qreal result = cal->EvalFormula(data->PlainVariables(), f);
|
const qreal result = cal->EvalFormula(data->DataVariables(), f);
|
||||||
|
|
||||||
(qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true;
|
(qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -98,7 +98,9 @@ QString FileComment()
|
||||||
VMeasurements::VMeasurements(VContainer *data)
|
VMeasurements::VMeasurements(VContainer *data)
|
||||||
:VDomDocument(),
|
:VDomDocument(),
|
||||||
data(data),
|
data(data),
|
||||||
type(MeasurementsType::Unknown)
|
type(MeasurementsType::Unknown),
|
||||||
|
m_currentSize(nullptr),
|
||||||
|
m_currentHeight(nullptr)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
}
|
}
|
||||||
|
@ -107,7 +109,9 @@ VMeasurements::VMeasurements(VContainer *data)
|
||||||
VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
||||||
:VDomDocument(),
|
:VDomDocument(),
|
||||||
data(data),
|
data(data),
|
||||||
type(MeasurementsType::Individual)
|
type(MeasurementsType::Individual),
|
||||||
|
m_currentSize(nullptr),
|
||||||
|
m_currentHeight(nullptr)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
|
|
||||||
|
@ -118,7 +122,9 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
||||||
VMeasurements::VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data)
|
VMeasurements::VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data)
|
||||||
:VDomDocument(),
|
:VDomDocument(),
|
||||||
data(data),
|
data(data),
|
||||||
type(MeasurementsType::Multisize)
|
type(MeasurementsType::Multisize),
|
||||||
|
m_currentSize(nullptr),
|
||||||
|
m_currentHeight(nullptr)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
|
|
||||||
|
@ -294,6 +300,9 @@ void VMeasurements::ReadMeasurements() const
|
||||||
|
|
||||||
tempMeash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, BaseSize(),
|
tempMeash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, BaseSize(),
|
||||||
BaseHeight(), base, ksize, kheight));
|
BaseHeight(), base, ksize, kheight));
|
||||||
|
tempMeash->SetSize(m_currentSize);
|
||||||
|
tempMeash->SetHeight(m_currentHeight);
|
||||||
|
tempMeash->SetUnit(data->GetPatternUnit());
|
||||||
|
|
||||||
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
|
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
|
||||||
ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit());
|
ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit());
|
||||||
|
@ -304,6 +313,9 @@ void VMeasurements::ReadMeasurements() const
|
||||||
|
|
||||||
meash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, baseSize, baseHeight,
|
meash = QSharedPointer<VMeasurement>(new VMeasurement(static_cast<quint32>(i), name, baseSize, baseHeight,
|
||||||
base, ksize, kheight, fullName, description));
|
base, ksize, kheight, fullName, description));
|
||||||
|
meash->SetSize(m_currentSize);
|
||||||
|
meash->SetHeight(m_currentHeight);
|
||||||
|
meash->SetUnit(data->GetPatternUnit());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -497,6 +509,18 @@ void VMeasurements::SetReadOnly(bool ro)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurements::SetSize(qreal *size)
|
||||||
|
{
|
||||||
|
m_currentSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurements::SetHeight(qreal *height)
|
||||||
|
{
|
||||||
|
m_currentHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurements::SetMName(const QString &name, const QString &text)
|
void VMeasurements::SetMName(const QString &name, const QString &text)
|
||||||
{
|
{
|
||||||
|
@ -684,15 +708,9 @@ bool VMeasurements::IsDefinedKnownNamesValid() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurements::SetDataSize()
|
VContainer *VMeasurements::GetData() const
|
||||||
{
|
{
|
||||||
VContainer::SetSize(UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit()));
|
return data;
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VMeasurements::SetDataHeight()
|
|
||||||
{
|
|
||||||
VContainer::SetHeight(UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -901,7 +919,7 @@ qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool
|
||||||
QString f = formula;
|
QString f = formula;
|
||||||
f.replace("\n", " ");
|
f.replace("\n", " ");
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
const qreal result = cal->EvalFormula(data->PlainVariables(), f);
|
const qreal result = cal->EvalFormula(data->DataVariables(), f);
|
||||||
|
|
||||||
(qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true;
|
(qIsInf(result) || qIsNaN(result)) ? *ok = false : *ok = true;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -93,6 +93,9 @@ public:
|
||||||
bool IsReadOnly() const;
|
bool IsReadOnly() const;
|
||||||
void SetReadOnly(bool ro);
|
void SetReadOnly(bool ro);
|
||||||
|
|
||||||
|
void SetSize(qreal *size);
|
||||||
|
void SetHeight(qreal *height);
|
||||||
|
|
||||||
void SetMName(const QString &name, const QString &text);
|
void SetMName(const QString &name, const QString &text);
|
||||||
void SetMValue(const QString &name, const QString &text);
|
void SetMValue(const QString &name, const QString &text);
|
||||||
void SetMBaseValue(const QString &name, double value);
|
void SetMBaseValue(const QString &name, double value);
|
||||||
|
@ -137,8 +140,7 @@ public:
|
||||||
|
|
||||||
bool IsDefinedKnownNamesValid() const;
|
bool IsDefinedKnownNamesValid() const;
|
||||||
|
|
||||||
void SetDataSize();
|
VContainer *GetData() const;
|
||||||
void SetDataHeight();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VMeasurements)
|
Q_DISABLE_COPY(VMeasurements)
|
||||||
|
@ -147,6 +149,9 @@ private:
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
MeasurementsType type;
|
MeasurementsType type;
|
||||||
|
|
||||||
|
qreal *m_currentSize;
|
||||||
|
qreal *m_currentHeight;
|
||||||
|
|
||||||
void CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHeight);
|
void CreateEmptyMultisizeFile(Unit unit, int baseSize, int baseHeight);
|
||||||
void CreateEmptyIndividualFile(Unit unit);
|
void CreateEmptyIndividualFile(Unit unit);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), labelData.GetRotation());
|
rotationAngle = cal1.EvalFormula(pattern->DataVariables(), labelData.GetRotation());
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch(qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
|
@ -119,10 +119,10 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
labelWidth = cal1.EvalFormula(pattern->PlainVariables(), labelData.GetLabelWidth());
|
labelWidth = cal1.EvalFormula(pattern->DataVariables(), labelData.GetLabelWidth());
|
||||||
|
|
||||||
Calculator cal2;
|
Calculator cal2;
|
||||||
labelHeight = cal2.EvalFormula(pattern->PlainVariables(), labelData.GetLabelHeight());
|
labelHeight = cal2.EvalFormula(pattern->DataVariables(), labelData.GetLabelHeight());
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch(qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
|
@ -194,11 +194,11 @@ bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), geom.GetRotation());
|
rotationAngle = cal1.EvalFormula(pattern->DataVariables(), geom.GetRotation());
|
||||||
rotationAngle = qDegreesToRadians(rotationAngle);
|
rotationAngle = qDegreesToRadians(rotationAngle);
|
||||||
|
|
||||||
Calculator cal2;
|
Calculator cal2;
|
||||||
length = cal2.EvalFormula(pattern->PlainVariables(), geom.GetLength());
|
length = cal2.EvalFormula(pattern->DataVariables(), geom.GetLength());
|
||||||
length = ToPixel(length, *pattern->GetPatternUnit());
|
length = ToPixel(length, *pattern->GetPatternUnit());
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch(qmu::QmuParserError &e)
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
|
#include "variables/vinternalvariable.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +70,7 @@ Calculator::Calculator()
|
||||||
* @param formula string of formula.
|
* @param formula string of formula.
|
||||||
* @return value of formula.
|
* @return value of formula.
|
||||||
*/
|
*/
|
||||||
qreal Calculator::EvalFormula(const QHash<QString, qreal *> &vars, const QString &formula)
|
qreal Calculator::EvalFormula(const QHash<QString, QSharedPointer<VInternalVariable>> *vars, const QString &formula)
|
||||||
{
|
{
|
||||||
// Parser doesn't know any variable on this stage. So, we just use variable factory that for each unknown variable
|
// Parser doesn't know any variable on this stage. So, we just use variable factory that for each unknown variable
|
||||||
// set value to 0.
|
// set value to 0.
|
||||||
|
@ -115,16 +116,16 @@ qreal Calculator::EvalFormula(const QHash<QString, qreal *> &vars, const QString
|
||||||
* @param tokens all tokens (measurements names, variables with lengths) that parser have found in expression.
|
* @param tokens all tokens (measurements names, variables with lengths) that parser have found in expression.
|
||||||
* @param formula expression, need for throwing better error message.
|
* @param formula expression, need for throwing better error message.
|
||||||
*/
|
*/
|
||||||
void Calculator::InitVariables(const QHash<QString, qreal *> &vars, const QMap<int, QString> &tokens,
|
void Calculator::InitVariables(const QHash<QString, QSharedPointer<VInternalVariable> > *vars,
|
||||||
const QString &formula)
|
const QMap<int, QString> &tokens, const QString &formula)
|
||||||
{
|
{
|
||||||
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
||||||
while (i != tokens.constEnd())
|
while (i != tokens.constEnd())
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (vars.contains(i.value()))
|
if (vars->contains(i.value()))
|
||||||
{
|
{
|
||||||
DefineVar(i.value(), vars.value(i.value()));
|
DefineVar(i.value(), vars->value(i.value())->GetValue());
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include "../qmuparser/qmuformulabase.h"
|
#include "../qmuparser/qmuformulabase.h"
|
||||||
|
|
||||||
|
class VInternalVariable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The Calculator class for calculation formula.
|
* @brief The Calculator class for calculation formula.
|
||||||
*
|
*
|
||||||
|
@ -61,11 +63,12 @@ public:
|
||||||
Calculator();
|
Calculator();
|
||||||
virtual ~Calculator() Q_DECL_EQ_DEFAULT;
|
virtual ~Calculator() Q_DECL_EQ_DEFAULT;
|
||||||
|
|
||||||
qreal EvalFormula(const QHash<QString, qreal *> &vars, const QString &formula);
|
qreal EvalFormula(const QHash<QString, QSharedPointer<VInternalVariable> > *vars, const QString &formula);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(Calculator)
|
Q_DISABLE_COPY(Calculator)
|
||||||
|
|
||||||
void InitVariables(const QHash<QString, qreal *> &vars, const QMap<int, QString> &tokens, const QString &formula);
|
void InitVariables(const QHash<QString, QSharedPointer<VInternalVariable> > *vars, const QMap<int, QString> &tokens,
|
||||||
|
const QString &formula);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALCULATOR_H
|
#endif // CALCULATOR_H
|
||||||
|
|
|
@ -51,9 +51,10 @@ VIncrement::VIncrement()
|
||||||
*/
|
*/
|
||||||
VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula,
|
VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula,
|
||||||
bool ok, const QString &description)
|
bool ok, const QString &description)
|
||||||
:VVariable(name, base, description), d(new VIncrementData(data, index, formula, ok))
|
:VVariable(name, description), d(new VIncrementData(data, index, formula, ok))
|
||||||
{
|
{
|
||||||
SetType(VarType::Increment);
|
SetType(VarType::Increment);
|
||||||
|
VInternalVariable::SetValue(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -79,6 +79,7 @@ qreal *VInternalVariable::GetValue()
|
||||||
return &d->value;
|
return &d->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VInternalVariable::SetValue(const qreal &value)
|
void VInternalVariable::SetValue(const qreal &value)
|
||||||
{
|
{
|
||||||
d->value = value;
|
d->value = value;
|
||||||
|
|
|
@ -54,9 +54,8 @@ public:
|
||||||
void Swap(VInternalVariable &var) Q_DECL_NOTHROW
|
void Swap(VInternalVariable &var) Q_DECL_NOTHROW
|
||||||
{ std::swap(d, var.d); }
|
{ std::swap(d, var.d); }
|
||||||
|
|
||||||
qreal GetValue() const;
|
virtual qreal GetValue() const;
|
||||||
qreal* GetValue();
|
virtual qreal* GetValue();
|
||||||
void SetValue(const qreal &value);
|
|
||||||
|
|
||||||
QString GetName() const;
|
QString GetName() const;
|
||||||
void SetName(const QString &name);
|
void SetName(const QString &name);
|
||||||
|
@ -67,6 +66,8 @@ public:
|
||||||
virtual bool Filter(quint32 id);
|
virtual bool Filter(quint32 id);
|
||||||
|
|
||||||
virtual bool IsNotUsed() const;
|
virtual bool IsNotUsed() const;
|
||||||
|
protected:
|
||||||
|
void SetValue(const qreal &value);
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VInternalVariableData> d;
|
QSharedDataPointer<VInternalVariableData> d;
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,10 +50,11 @@
|
||||||
VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base,
|
VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseSize, qreal baseHeight, const qreal &base,
|
||||||
const qreal &ksize, const qreal &kheight, const QString &gui_text,
|
const qreal &ksize, const qreal &kheight, const QString &gui_text,
|
||||||
const QString &description, const QString &tagName)
|
const QString &description, const QString &tagName)
|
||||||
:VVariable(name, baseSize, baseHeight, base, ksize, kheight, description),
|
:VVariable(name, description),
|
||||||
d(new VMeasurementData(index, gui_text, tagName))
|
d(new VMeasurementData(index, gui_text, tagName, baseSize, baseHeight, base, ksize, kheight))
|
||||||
{
|
{
|
||||||
SetType(VarType::Measurement);
|
SetType(VarType::Measurement);
|
||||||
|
VInternalVariable::SetValue(d->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,9 +69,10 @@ VMeasurement::VMeasurement(quint32 index, const QString &name, qreal baseSize, q
|
||||||
VMeasurement::VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base,
|
VMeasurement::VMeasurement(VContainer *data, quint32 index, const QString &name, const qreal &base,
|
||||||
const QString &formula, bool ok, const QString &gui_text, const QString &description,
|
const QString &formula, bool ok, const QString &gui_text, const QString &description,
|
||||||
const QString &tagName)
|
const QString &tagName)
|
||||||
:VVariable(name, base, description), d(new VMeasurementData(data, index, formula, ok, gui_text, tagName))
|
:VVariable(name, description), d(new VMeasurementData(data, index, formula, ok, gui_text, tagName, base))
|
||||||
{
|
{
|
||||||
SetType(VarType::Measurement);
|
SetType(VarType::Measurement);
|
||||||
|
VInternalVariable::SetValue(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -212,6 +214,29 @@ bool VMeasurement::IsGradationHeightValid(const QString &height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VMeasurement::CalcValue() const
|
||||||
|
{
|
||||||
|
if (d->currentUnit == nullptr || d->currentSize == nullptr || d->currentHeight == nullptr)
|
||||||
|
{
|
||||||
|
return VInternalVariable::GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*d->currentUnit == Unit::Inch)
|
||||||
|
{
|
||||||
|
qWarning("Gradation doesn't support inches");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const qreal sizeIncrement = UnitConvertor(2.0, Unit::Cm, *d->currentUnit);
|
||||||
|
const qreal heightIncrement = UnitConvertor(6.0, Unit::Cm, *d->currentUnit);
|
||||||
|
|
||||||
|
// Formula for calculation gradation
|
||||||
|
const qreal k_size = ( *d->currentSize - d->baseSize ) / sizeIncrement;
|
||||||
|
const qreal k_height = ( *d->currentHeight - d->baseHeight ) / heightIncrement;
|
||||||
|
return d->base + k_size * d->ksize + k_height * d->kheight;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurement::ListValue(QStringList &list, qreal value, Unit patternUnit)
|
void VMeasurement::ListValue(QStringList &list, qreal value, Unit patternUnit)
|
||||||
{
|
{
|
||||||
|
@ -251,14 +276,7 @@ QString VMeasurement::GetFormula() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VMeasurement::IsCustom() const
|
bool VMeasurement::IsCustom() const
|
||||||
{
|
{
|
||||||
if (GetName().indexOf(CustomMSign) == 0)
|
return GetName().indexOf(CustomMSign) == 0;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -273,8 +291,95 @@ bool VMeasurement::IsFormulaOk() const
|
||||||
return d->formulaOk;
|
return d->formulaOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VMeasurement::IsNotUsed() const
|
||||||
|
{
|
||||||
|
return qFuzzyIsNull(d->base) && qFuzzyIsNull(d->ksize) && qFuzzyIsNull(d->kheight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VMeasurement::GetValue() const
|
||||||
|
{
|
||||||
|
return CalcValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal *VMeasurement::GetValue()
|
||||||
|
{
|
||||||
|
VInternalVariable::SetValue(CalcValue());
|
||||||
|
return VInternalVariable::GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer *VMeasurement::GetData()
|
VContainer *VMeasurement::GetData()
|
||||||
{
|
{
|
||||||
return &d->data;
|
return &d->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurement::SetSize(qreal *size)
|
||||||
|
{
|
||||||
|
d->currentSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurement::SetHeight(qreal *height)
|
||||||
|
{
|
||||||
|
d->currentHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurement::SetUnit(const Unit *unit)
|
||||||
|
{
|
||||||
|
d->currentUnit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetBase return value in base size and height
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
qreal VMeasurement::GetBase() const
|
||||||
|
{
|
||||||
|
return d->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMeasurement::SetBase(const qreal &value)
|
||||||
|
{
|
||||||
|
d->base = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetKsize return increment in sizes
|
||||||
|
* @return increment
|
||||||
|
*/
|
||||||
|
qreal VMeasurement::GetKsize() const
|
||||||
|
{
|
||||||
|
return d->ksize;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void VMeasurement::SetKsize(const qreal &value)
|
||||||
|
{
|
||||||
|
d->ksize = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetKheight return increment in heights
|
||||||
|
* @return increment
|
||||||
|
*/
|
||||||
|
qreal VMeasurement::GetKheight() const
|
||||||
|
{
|
||||||
|
return d->kheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// cppcheck-suppress unusedFunction
|
||||||
|
void VMeasurement::SetKheight(const qreal &value)
|
||||||
|
{
|
||||||
|
d->kheight = value;
|
||||||
|
}
|
||||||
|
|
|
@ -80,8 +80,26 @@ public:
|
||||||
int Index() const;
|
int Index() const;
|
||||||
bool IsFormulaOk() const;
|
bool IsFormulaOk() const;
|
||||||
|
|
||||||
|
virtual bool IsNotUsed() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
virtual qreal GetValue() const Q_DECL_OVERRIDE;
|
||||||
|
virtual qreal* GetValue() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
VContainer *GetData();
|
VContainer *GetData();
|
||||||
|
|
||||||
|
void SetSize(qreal *size);
|
||||||
|
void SetHeight(qreal *height);
|
||||||
|
void SetUnit(const Unit *unit);
|
||||||
|
|
||||||
|
qreal GetBase() const;
|
||||||
|
void SetBase(const qreal &value);
|
||||||
|
|
||||||
|
qreal GetKsize() const;
|
||||||
|
void SetKsize(const qreal &value);
|
||||||
|
|
||||||
|
qreal GetKheight() const;
|
||||||
|
void SetKheight(const qreal &value);
|
||||||
|
|
||||||
static QStringList ListHeights(QMap<GHeights, bool> heights, Unit patternUnit);
|
static QStringList ListHeights(QMap<GHeights, bool> heights, Unit patternUnit);
|
||||||
static QStringList ListSizes(QMap<GSizes, bool> sizes, Unit patternUnit);
|
static QStringList ListSizes(QMap<GSizes, bool> sizes, Unit patternUnit);
|
||||||
static QStringList WholeListHeights(Unit patternUnit);
|
static QStringList WholeListHeights(Unit patternUnit);
|
||||||
|
@ -91,6 +109,8 @@ public:
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VMeasurementData> d;
|
QSharedDataPointer<VMeasurementData> d;
|
||||||
|
|
||||||
|
qreal CalcValue() const;
|
||||||
|
|
||||||
static void ListValue(QStringList &list, qreal value, Unit patternUnit);
|
static void ListValue(QStringList &list, qreal value, Unit patternUnit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,19 +42,58 @@ class VMeasurementData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VMeasurementData(quint32 index, const QString &gui_text, const QString &tagName)
|
VMeasurementData(quint32 index, const QString &gui_text, const QString &tagName, qreal baseSize, qreal baseHeight,
|
||||||
:data(VContainer(nullptr, nullptr)), index(index), formula(), gui_text(gui_text), _tagName(tagName),
|
qreal base, qreal ksize, qreal kheight )
|
||||||
formulaOk(true)
|
: data(VContainer(nullptr, nullptr)),
|
||||||
|
index(index),
|
||||||
|
formula(),
|
||||||
|
gui_text(gui_text),
|
||||||
|
_tagName(tagName),
|
||||||
|
formulaOk(true),
|
||||||
|
currentSize(nullptr),
|
||||||
|
currentHeight(nullptr),
|
||||||
|
currentUnit(nullptr),
|
||||||
|
base(base),
|
||||||
|
ksize(ksize),
|
||||||
|
kheight(kheight),
|
||||||
|
baseSize(baseSize),
|
||||||
|
baseHeight(baseHeight)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VMeasurementData(VContainer *data, quint32 index, const QString &formula, bool ok, const QString &gui_text,
|
VMeasurementData(VContainer *data, quint32 index, const QString &formula, bool ok, const QString &gui_text,
|
||||||
const QString &tagName)
|
const QString &tagName, qreal base)
|
||||||
:data(*data), index(index), formula(formula), gui_text(gui_text), _tagName(tagName), formulaOk(ok)
|
: data(*data),
|
||||||
|
index(index),
|
||||||
|
formula(formula),
|
||||||
|
gui_text(gui_text),
|
||||||
|
_tagName(tagName),
|
||||||
|
formulaOk(ok),
|
||||||
|
currentSize(nullptr),
|
||||||
|
currentHeight(nullptr),
|
||||||
|
currentUnit(nullptr),
|
||||||
|
base(base),
|
||||||
|
ksize(0),
|
||||||
|
kheight(0),
|
||||||
|
baseSize(0),
|
||||||
|
baseHeight(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VMeasurementData(const VMeasurementData &m)
|
VMeasurementData(const VMeasurementData &m)
|
||||||
:QSharedData(m), data(m.data), index(m.index), formula(m.formula), gui_text(m.gui_text), _tagName(m._tagName),
|
: QSharedData(m),
|
||||||
formulaOk(m.formulaOk)
|
data(m.data),
|
||||||
|
index(m.index),
|
||||||
|
formula(m.formula),
|
||||||
|
gui_text(m.gui_text),
|
||||||
|
_tagName(m._tagName),
|
||||||
|
formulaOk(m.formulaOk),
|
||||||
|
currentSize(m.currentSize),
|
||||||
|
currentHeight(m.currentHeight),
|
||||||
|
currentUnit(m.currentUnit),
|
||||||
|
base(m.base),
|
||||||
|
ksize(m.ksize),
|
||||||
|
kheight(m.kheight),
|
||||||
|
baseSize(m.baseSize),
|
||||||
|
baseHeight(m.baseHeight)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~VMeasurementData();
|
virtual ~VMeasurementData();
|
||||||
|
@ -66,6 +105,22 @@ public:
|
||||||
QString _tagName;
|
QString _tagName;
|
||||||
bool formulaOk;
|
bool formulaOk;
|
||||||
|
|
||||||
|
qreal *currentSize;
|
||||||
|
qreal *currentHeight;
|
||||||
|
const Unit *currentUnit;
|
||||||
|
|
||||||
|
/** @brief base value in base size and height */
|
||||||
|
qreal base;
|
||||||
|
|
||||||
|
/** @brief ksize increment in sizes */
|
||||||
|
qreal ksize;
|
||||||
|
|
||||||
|
/** @brief kgrowth increment in heights */
|
||||||
|
qreal kheight;
|
||||||
|
|
||||||
|
qreal baseSize;
|
||||||
|
qreal baseHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VMeasurementData &operator=(const VMeasurementData &) Q_DECL_EQ_DELETE;
|
VMeasurementData &operator=(const VMeasurementData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,24 +37,12 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable()
|
VVariable::VVariable()
|
||||||
:VInternalVariable(), d(new VVariableData)
|
:VInternalVariable(), d(new VVariableData)
|
||||||
{
|
{}
|
||||||
VInternalVariable::SetValue(d->base);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable(const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize,
|
VVariable::VVariable(const QString &name, const QString &description)
|
||||||
const qreal &kheight, const QString &description)
|
:VInternalVariable(), d(new VVariableData(description))
|
||||||
:VInternalVariable(), d(new VVariableData(baseSize, baseHeight, base, ksize, kheight, description))
|
|
||||||
{
|
{
|
||||||
VInternalVariable::SetValue(d->base);
|
|
||||||
SetName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VVariable::VVariable(const QString &name, const qreal &base, const QString &description)
|
|
||||||
:d(new VVariableData(base, description))
|
|
||||||
{
|
|
||||||
VInternalVariable::SetValue(base);
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,87 +67,6 @@ VVariable &VVariable::operator=(const VVariable &var)
|
||||||
VVariable::~VVariable()
|
VVariable::~VVariable()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VVariable::SetValue(const qreal &size, const qreal &height, Unit patternUnit)
|
|
||||||
{
|
|
||||||
if (patternUnit == Unit::Inch)
|
|
||||||
{
|
|
||||||
qWarning("Gradation doesn't support inches");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const qreal sizeIncrement = UnitConvertor(2.0, Unit::Cm, patternUnit);
|
|
||||||
const qreal heightIncrement = UnitConvertor(6.0, Unit::Cm, patternUnit);
|
|
||||||
|
|
||||||
// Formula for calculation gradation
|
|
||||||
const qreal k_size = ( size - d->baseSize ) / sizeIncrement;
|
|
||||||
const qreal k_height = ( height - d->baseHeight ) / heightIncrement;
|
|
||||||
VInternalVariable::SetValue(d->base + k_size * d->ksize + k_height * d->kheight);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool VVariable::IsNotUsed() const
|
|
||||||
{
|
|
||||||
if (qFuzzyIsNull(d->base) && qFuzzyIsNull(d->ksize) && qFuzzyIsNull(d->kheight))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetBase return value in base size and height
|
|
||||||
* @return value
|
|
||||||
*/
|
|
||||||
qreal VVariable::GetBase() const
|
|
||||||
{
|
|
||||||
return d->base;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VVariable::SetBase(const qreal &value)
|
|
||||||
{
|
|
||||||
d->base = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetKsize return increment in sizes
|
|
||||||
* @return increment
|
|
||||||
*/
|
|
||||||
qreal VVariable::GetKsize() const
|
|
||||||
{
|
|
||||||
return d->ksize;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VVariable::SetKsize(const qreal &value)
|
|
||||||
{
|
|
||||||
d->ksize = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetKheight return increment in heights
|
|
||||||
* @return increment
|
|
||||||
*/
|
|
||||||
qreal VVariable::GetKheight() const
|
|
||||||
{
|
|
||||||
return d->kheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VVariable::SetKheight(const qreal &value)
|
|
||||||
{
|
|
||||||
d->kheight = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VVariable::GetDescription() const
|
QString VVariable::GetDescription() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,9 +45,7 @@ class VVariable :public VInternalVariable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VVariable();
|
VVariable();
|
||||||
VVariable(const QString &name, qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize = 0,
|
VVariable(const QString &name, const QString &description = QString());
|
||||||
const qreal &kheight = 0, const QString &description = QString());
|
|
||||||
VVariable(const QString &name, const qreal &base, const QString &description = QString());
|
|
||||||
VVariable(const VVariable &var);
|
VVariable(const VVariable &var);
|
||||||
|
|
||||||
virtual ~VVariable() Q_DECL_OVERRIDE;
|
virtual ~VVariable() Q_DECL_OVERRIDE;
|
||||||
|
@ -60,21 +58,9 @@ public:
|
||||||
void Swap(VVariable &var) Q_DECL_NOTHROW
|
void Swap(VVariable &var) Q_DECL_NOTHROW
|
||||||
{ VInternalVariable::Swap(var); std::swap(d, var.d); }
|
{ VInternalVariable::Swap(var); std::swap(d, var.d); }
|
||||||
|
|
||||||
qreal GetBase() const;
|
|
||||||
void SetBase(const qreal &value);
|
|
||||||
|
|
||||||
qreal GetKsize() const;
|
|
||||||
void SetKsize(const qreal &value);
|
|
||||||
|
|
||||||
qreal GetKheight() const;
|
|
||||||
void SetKheight(const qreal &value);
|
|
||||||
|
|
||||||
QString GetDescription() const;
|
QString GetDescription() const;
|
||||||
void SetDescription(const QString &desc);
|
void SetDescription(const QString &desc);
|
||||||
|
|
||||||
void SetValue(const qreal &size, const qreal &height, Unit patternUnit);
|
|
||||||
|
|
||||||
virtual bool IsNotUsed() const Q_DECL_OVERRIDE;
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VVariableData> d;
|
QSharedDataPointer<VVariableData> d;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,41 +42,23 @@ class VVariableData : public QSharedData
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VVariableData()
|
VVariableData()
|
||||||
:base(0), ksize(0), kheight(0), description(QString()), baseSize(0), baseHeight(0)
|
: description()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VVariableData(qreal baseSize, qreal baseHeight, const qreal &base, const qreal &ksize, const qreal &kheight,
|
VVariableData(const QString &description)
|
||||||
const QString &description)
|
: description(description)
|
||||||
:base(base), ksize(ksize), kheight(kheight), description(description), baseSize(baseSize),
|
|
||||||
baseHeight(baseHeight)
|
|
||||||
{}
|
|
||||||
|
|
||||||
VVariableData(const qreal &base, const QString &description)
|
|
||||||
:base(base), ksize(0), kheight(0), description(description), baseSize(0), baseHeight(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VVariableData(const VVariableData &var)
|
VVariableData(const VVariableData &var)
|
||||||
:QSharedData(var), base(var.base), ksize(var.ksize), kheight(var.kheight), description(var.description),
|
: QSharedData(var),
|
||||||
baseSize(var.baseSize), baseHeight(var.baseHeight)
|
description(var.description)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~VVariableData();
|
virtual ~VVariableData();
|
||||||
|
|
||||||
/** @brief base value in base size and height */
|
|
||||||
qreal base;
|
|
||||||
|
|
||||||
/** @brief ksize increment in sizes */
|
|
||||||
qreal ksize;
|
|
||||||
|
|
||||||
/** @brief kgrowth increment in heights */
|
|
||||||
qreal kheight;
|
|
||||||
|
|
||||||
/** @brief description description of increment */
|
/** @brief description description of increment */
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
qreal baseSize;
|
|
||||||
qreal baseHeight;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VVariableData &operator=(const VVariableData &) Q_DECL_EQ_DELETE;
|
VVariableData &operator=(const VVariableData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -538,17 +538,6 @@ void VContainer::UpdatePiecePath(quint32 id, const VPiecePath &path)
|
||||||
UpdateId(id);
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
qreal VContainer::GetTableValue(const QString &name, MeasurementsType patternType) const
|
|
||||||
{
|
|
||||||
QSharedPointer<VVariable> m = GetVariable<VVariable>(name);
|
|
||||||
if (patternType == MeasurementsType::Multisize)
|
|
||||||
{
|
|
||||||
m->SetValue(size(), height(), *GetPatternUnit());
|
|
||||||
}
|
|
||||||
return *m->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief RemoveIncrement remove increment by name from increment table
|
* @brief RemoveIncrement remove increment by name from increment table
|
||||||
|
@ -608,28 +597,6 @@ const QMap<QString, QSharedPointer<VCurveAngle> > VContainer::DataAnglesCurves()
|
||||||
return DataVar<VCurveAngle>(VarType::CurveAngle);
|
return DataVar<VCurveAngle>(VarType::CurveAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
const QHash<QString, qreal *> VContainer::PlainVariables() const
|
|
||||||
{
|
|
||||||
QHash<QString, qreal *> vars;
|
|
||||||
|
|
||||||
auto i = d->variables.constBegin();
|
|
||||||
while (i != d->variables.constEnd())
|
|
||||||
{
|
|
||||||
QSharedPointer<VInternalVariable> var = i.value();
|
|
||||||
if (qApp->patternType() == MeasurementsType::Multisize && var->GetType() == VarType::Measurement)
|
|
||||||
{
|
|
||||||
QSharedPointer<VVariable> m = GetVariable<VVariable>(i.key());
|
|
||||||
m->SetValue(size(), height(), qApp->patternUnit());
|
|
||||||
}
|
|
||||||
vars.insert(i.key(), var->GetValue());
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return vars;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VContainer::IsUnique(const QString &name)
|
bool VContainer::IsUnique(const QString &name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,7 +136,6 @@ public:
|
||||||
static const QSharedPointer<VGObject> GetFakeGObject(quint32 id);
|
static const QSharedPointer<VGObject> GetFakeGObject(quint32 id);
|
||||||
VPiece GetPiece(quint32 id) const;
|
VPiece GetPiece(quint32 id) const;
|
||||||
VPiecePath GetPiecePath(quint32 id) const;
|
VPiecePath GetPiecePath(quint32 id) const;
|
||||||
qreal GetTableValue(const QString& name, MeasurementsType patternType) const;
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
QSharedPointer<T> GetVariable(QString name) const;
|
QSharedPointer<T> GetVariable(QString name) const;
|
||||||
static quint32 getId();
|
static quint32 getId();
|
||||||
|
@ -196,8 +195,6 @@ public:
|
||||||
const QMap<QString, QSharedPointer<VArcRadius> > DataRadiusesArcs() const;
|
const QMap<QString, QSharedPointer<VArcRadius> > DataRadiusesArcs() const;
|
||||||
const QMap<QString, QSharedPointer<VCurveAngle> > DataAnglesCurves() const;
|
const QMap<QString, QSharedPointer<VCurveAngle> > DataAnglesCurves() const;
|
||||||
|
|
||||||
const QHash<QString, qreal *> PlainVariables() const;
|
|
||||||
|
|
||||||
static bool IsUnique(const QString &name);
|
static bool IsUnique(const QString &name);
|
||||||
static QStringList AllUniqueNames();
|
static QStringList AllUniqueNames();
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ void VFormula::Eval()
|
||||||
{
|
{
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal result = cal->EvalFormula(data->PlainVariables(), expression);
|
const qreal result = cal->EvalFormula(data->DataVariables(), expression);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ qreal EvalFormula(const VContainer *data, QString formula)
|
||||||
// Replace line return character with spaces for calc if exist
|
// Replace line return character with spaces for calc if exist
|
||||||
formula.replace("\n", " ");
|
formula.replace("\n", " ");
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
|
const qreal result = cal->EvalFormula(data->DataVariables(), formula);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
|
|
@ -173,14 +173,14 @@ void DialogEditWrongFormula::ValChanged(int row)
|
||||||
{
|
{
|
||||||
const QString name = qApp->TrVars()->VarFromUser(item->text());
|
const QString name = qApp->TrVars()->VarFromUser(item->text());
|
||||||
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
|
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
|
||||||
SetDescription(item->text(), data->GetTableValue(name, qApp->patternType()),
|
SetDescription(item->text(), *data->DataVariables()->value(name)->GetValue(),
|
||||||
UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText());
|
UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ui->radioButtonIncrements->isChecked())
|
if (ui->radioButtonIncrements->isChecked())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
|
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
|
||||||
SetDescription(item->text(), data->GetTableValue(item->text(), qApp->patternType()),
|
SetDescription(item->text(), *data->DataVariables()->value(item->text())->GetValue(),
|
||||||
UnitsToStr(qApp->patternUnit(), true), incr->GetDescription());
|
UnitsToStr(qApp->patternUnit(), true), incr->GetDescription());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ VSpline DialogSpline::CurrentSpline() const
|
||||||
QString length2F = ui->plainTextEditLength2F->toPlainText();
|
QString length2F = ui->plainTextEditLength2F->toPlainText();
|
||||||
length2F.replace("\n", " ");
|
length2F.replace("\n", " ");
|
||||||
|
|
||||||
const QHash<QString, qreal *> vars = data->PlainVariables();
|
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
|
||||||
|
|
||||||
const qreal angle1 = Visualization::FindVal(angle1F, vars);
|
const qreal angle1 = Visualization::FindVal(angle1F, vars);
|
||||||
const qreal angle2 = Visualization::FindVal(angle2F, vars);
|
const qreal angle2 = Visualization::FindVal(angle2F, vars);
|
||||||
|
|
|
@ -325,7 +325,7 @@ void DialogSplinePath::Angle1Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString angle1F = ui->plainTextEditAngle1F->toPlainText().replace("\n", " ");
|
const QString angle1F = ui->plainTextEditAngle1F->toPlainText().replace("\n", " ");
|
||||||
const qreal angle1 = Visualization::FindVal(angle1F, data->PlainVariables());
|
const qreal angle1 = Visualization::FindVal(angle1F, data->DataVariables());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -368,7 +368,7 @@ void DialogSplinePath::Angle2Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString angle2F = ui->plainTextEditAngle2F->toPlainText().replace("\n", " ");
|
const QString angle2F = ui->plainTextEditAngle2F->toPlainText().replace("\n", " ");
|
||||||
const qreal angle2 = Visualization::FindVal(angle2F, data->PlainVariables());
|
const qreal angle2 = Visualization::FindVal(angle2F, data->DataVariables());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -411,7 +411,7 @@ void DialogSplinePath::Length1Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString length1F = ui->plainTextEditLength1F->toPlainText().replace("\n", " ");
|
const QString length1F = ui->plainTextEditLength1F->toPlainText().replace("\n", " ");
|
||||||
const qreal length1 = Visualization::FindLength(length1F, data->PlainVariables());
|
const qreal length1 = Visualization::FindLength(length1F, data->DataVariables());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -445,7 +445,7 @@ void DialogSplinePath::Length2Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString length2F = ui->plainTextEditLength2F->toPlainText().replace("\n", " ");
|
const QString length2F = ui->plainTextEditLength2F->toPlainText().replace("\n", " ");
|
||||||
const qreal length2 = Visualization::FindLength(length2F, data->PlainVariables());
|
const qreal length2 = Visualization::FindLength(length2F, data->DataVariables());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -781,7 +781,7 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
|
||||||
// Translate to internal look.
|
// Translate to internal look.
|
||||||
formula = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
formula = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
result = cal->EvalFormula(data->PlainVariables(), formula);
|
result = cal->EvalFormula(data->DataVariables(), formula);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
qsFormula.replace("\n", " ");
|
qsFormula.replace("\n", " ");
|
||||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
|
@ -1399,7 +1399,7 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
qsFormula.replace("\n", " ");
|
qsFormula.replace("\n", " ");
|
||||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
|
@ -1484,7 +1484,7 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
qsFormula.replace("\n", " ");
|
qsFormula.replace("\n", " ");
|
||||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||||
Calculator cal;
|
Calculator cal;
|
||||||
qreal dVal = cal.EvalFormula(data->PlainVariables(), qsFormula);
|
qreal dVal = cal.EvalFormula(data->DataVariables(), qsFormula);
|
||||||
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
if (qIsInf(dVal) == true || qIsNaN(dVal) == true)
|
||||||
{
|
{
|
||||||
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
throw qmu::QmuParserError(tr("Infinite/undefined result"));
|
||||||
|
|
|
@ -162,7 +162,7 @@ qreal VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VCont
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
result = cal->EvalFormula(data->PlainVariables(), formula);
|
result = cal->EvalFormula(data->DataVariables(), formula);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,7 @@ qreal VAbstractTool::CheckFormula(const quint32 &toolId, QString &formula, VCont
|
||||||
* parsing here. */
|
* parsing here. */
|
||||||
delete dialog;
|
delete dialog;
|
||||||
QScopedPointer<Calculator> cal1(new Calculator());
|
QScopedPointer<Calculator> cal1(new Calculator());
|
||||||
result = cal1->EvalFormula(data->PlainVariables(), formula);
|
result = cal1->EvalFormula(data->DataVariables(), formula);
|
||||||
|
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelD
|
||||||
}
|
}
|
||||||
|
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetRotation());
|
rotationAngle = cal1.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetRotation());
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch(qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
|
@ -1295,12 +1295,12 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelD
|
||||||
const bool widthIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelWidth());
|
const bool widthIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelWidth());
|
||||||
|
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
labelWidth = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetLabelWidth());
|
labelWidth = cal1.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetLabelWidth());
|
||||||
|
|
||||||
const bool heightIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelHeight());
|
const bool heightIsSingle = qmu::QmuTokenParser::IsSingle(labelData.GetLabelHeight());
|
||||||
|
|
||||||
Calculator cal2;
|
Calculator cal2;
|
||||||
labelHeight = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), labelData.GetLabelHeight());
|
labelHeight = cal2.EvalFormula(VAbstractTool::data.DataVariables(), labelData.GetLabelHeight());
|
||||||
|
|
||||||
if (not widthIsSingle || not heightIsSingle)
|
if (not widthIsSingle || not heightIsSingle)
|
||||||
{
|
{
|
||||||
|
@ -1381,7 +1381,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindGrainlineGeometry(const VGrainline
|
||||||
}
|
}
|
||||||
|
|
||||||
Calculator cal1;
|
Calculator cal1;
|
||||||
rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetRotation());
|
rotationAngle = cal1.EvalFormula(VAbstractTool::data.DataVariables(), geom.GetRotation());
|
||||||
|
|
||||||
if (not qmu::QmuTokenParser::IsSingle(geom.GetLength()))
|
if (not qmu::QmuTokenParser::IsSingle(geom.GetLength()))
|
||||||
{
|
{
|
||||||
|
@ -1389,7 +1389,7 @@ VPieceItem::MoveTypes VToolSeamAllowance::FindGrainlineGeometry(const VGrainline
|
||||||
}
|
}
|
||||||
|
|
||||||
Calculator cal2;
|
Calculator cal2;
|
||||||
length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetLength());
|
length = cal2.EvalFormula(VAbstractTool::data.DataVariables(), geom.GetLength());
|
||||||
}
|
}
|
||||||
catch(qmu::QmuParserError &e)
|
catch(qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,7 @@ QString VisToolMove::Angle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolMove::SetAngle(const QString &expression)
|
void VisToolMove::SetAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = FindVal(expression, Visualization::data->PlainVariables());
|
angle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -155,7 +155,7 @@ qreal VisToolMove::LengthValue() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolMove::SetLength(const QString &expression)
|
void VisToolMove::SetLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -205,7 +205,7 @@ QString VisToolRotation::Angle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolRotation::SetAngle(const QString &expression)
|
void VisToolRotation::SetAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = FindVal(expression, Visualization::data->PlainVariables());
|
angle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -66,7 +66,7 @@ void VisToolAlongLine::setObject2Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolAlongLine::setLength(const QString &expression)
|
void VisToolAlongLine::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -72,7 +72,7 @@ void VisToolBisector::setObject3Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolBisector::setLength(const QString &expression)
|
void VisToolBisector::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -105,7 +105,7 @@ QString VisToolCurveIntersectAxis::Angle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolCurveIntersectAxis::SetAngle(const QString &expression)
|
void VisToolCurveIntersectAxis::SetAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = FindVal(expression, Visualization::data->PlainVariables());
|
angle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -96,7 +96,7 @@ QString VisToolEndLine::Angle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEndLine::SetAngle(const QString &expression)
|
void VisToolEndLine::SetAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = FindVal(expression, Visualization::data->PlainVariables());
|
angle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -108,5 +108,5 @@ QString VisToolEndLine::Length() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEndLine::setLength(const QString &expression)
|
void VisToolEndLine::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ QString VisToolLineIntersectAxis::Angle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolLineIntersectAxis::SetAngle(const QString &expression)
|
void VisToolLineIntersectAxis::SetAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
angle = FindVal(expression, Visualization::data->PlainVariables());
|
angle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -110,7 +110,7 @@ void VisToolNormal::setObject2Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolNormal::setLength(const QString &expression)
|
void VisToolNormal::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -92,7 +92,7 @@ void VisToolPointFromCircleAndTangent::setObject2Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointFromCircleAndTangent::setCRadius(const QString &value)
|
void VisToolPointFromCircleAndTangent::setCRadius(const QString &value)
|
||||||
{
|
{
|
||||||
cRadius = FindLength(value, Visualization::data->PlainVariables());
|
cRadius = FindLength(value, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -112,5 +112,5 @@ void VisToolPointOfContact::setRadiusId(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfContact::setRadius(const QString &expression)
|
void VisToolPointOfContact::setRadius(const QString &expression)
|
||||||
{
|
{
|
||||||
radius = FindLength(expression, Visualization::data->PlainVariables());
|
radius = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,13 +111,13 @@ void VisToolPointOfIntersectionCircles::setObject2Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersectionCircles::setC1Radius(const QString &value)
|
void VisToolPointOfIntersectionCircles::setC1Radius(const QString &value)
|
||||||
{
|
{
|
||||||
c1Radius = FindLength(value, Visualization::data->PlainVariables());
|
c1Radius = FindLength(value, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolPointOfIntersectionCircles::setC2Radius(const QString &value)
|
void VisToolPointOfIntersectionCircles::setC2Radius(const QString &value)
|
||||||
{
|
{
|
||||||
c2Radius = FindLength(value, Visualization::data->PlainVariables());
|
c2Radius = FindLength(value, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -129,5 +129,5 @@ void VisToolShoulderPoint::setLineP2Id(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolShoulderPoint::setLength(const QString &expression)
|
void VisToolShoulderPoint::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,17 +69,17 @@ void VisToolArc::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArc::setRadius(const QString &expression)
|
void VisToolArc::setRadius(const QString &expression)
|
||||||
{
|
{
|
||||||
radius = FindLength(expression, Visualization::data->PlainVariables());
|
radius = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArc::setF1(const QString &expression)
|
void VisToolArc::setF1(const QString &expression)
|
||||||
{
|
{
|
||||||
f1 = FindVal(expression, Visualization::data->PlainVariables());
|
f1 = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArc::setF2(const QString &expression)
|
void VisToolArc::setF2(const QString &expression)
|
||||||
{
|
{
|
||||||
f2 = FindVal(expression, Visualization::data->PlainVariables());
|
f2 = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,17 +68,17 @@ void VisToolArcWithLength::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArcWithLength::setRadius(const QString &expression)
|
void VisToolArcWithLength::setRadius(const QString &expression)
|
||||||
{
|
{
|
||||||
radius = FindLength(expression, Visualization::data->PlainVariables());
|
radius = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArcWithLength::setF1(const QString &expression)
|
void VisToolArcWithLength::setF1(const QString &expression)
|
||||||
{
|
{
|
||||||
f1 = FindVal(expression, Visualization::data->PlainVariables());
|
f1 = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolArcWithLength::setLength(const QString &expression)
|
void VisToolArcWithLength::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,5 +82,5 @@ void VisToolCutArc::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolCutArc::setLength(const QString &expression)
|
void VisToolCutArc::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,5 +90,5 @@ void VisToolCutSpline::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolCutSpline::setLength(const QString &expression)
|
void VisToolCutSpline::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,5 +91,5 @@ void VisToolCutSplinePath::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolCutSplinePath::setLength(const QString &expression)
|
void VisToolCutSplinePath::setLength(const QString &expression)
|
||||||
{
|
{
|
||||||
length = FindLength(expression, Visualization::data->PlainVariables());
|
length = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,29 +65,29 @@ void VisToolEllipticalArc::RefreshGeometry()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEllipticalArc::setRadius1(const QString &expression)
|
void VisToolEllipticalArc::setRadius1(const QString &expression)
|
||||||
{
|
{
|
||||||
radius1 = FindLength(expression, Visualization::data->PlainVariables());
|
radius1 = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEllipticalArc::setRadius2(const QString &expression)
|
void VisToolEllipticalArc::setRadius2(const QString &expression)
|
||||||
{
|
{
|
||||||
radius2 = FindLength(expression, Visualization::data->PlainVariables());
|
radius2 = FindLength(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEllipticalArc::setF1(const QString &expression)
|
void VisToolEllipticalArc::setF1(const QString &expression)
|
||||||
{
|
{
|
||||||
f1 = FindVal(expression, Visualization::data->PlainVariables());
|
f1 = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEllipticalArc::setF2(const QString &expression)
|
void VisToolEllipticalArc::setF2(const QString &expression)
|
||||||
{
|
{
|
||||||
f2 = FindVal(expression, Visualization::data->PlainVariables());
|
f2 = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisToolEllipticalArc::setRotationAngle(const QString &expression)
|
void VisToolEllipticalArc::setRotationAngle(const QString &expression)
|
||||||
{
|
{
|
||||||
rotationAngle = FindVal(expression, Visualization::data->PlainVariables());
|
rotationAngle = FindVal(expression, Visualization::data->DataVariables());
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,13 +143,15 @@ VScaledEllipse *Visualization::InitPoint(const QColor &color, QGraphicsItem *par
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal Visualization::FindLength(const QString &expression, const QHash<QString, qreal *> &vars)
|
qreal Visualization::FindLength(const QString &expression,
|
||||||
|
const QHash<QString, QSharedPointer<VInternalVariable> > *vars)
|
||||||
{
|
{
|
||||||
return qApp->toPixel(FindVal(expression, vars));
|
return qApp->toPixel(FindVal(expression, vars));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal Visualization::FindVal(const QString &expression, const QHash<QString, qreal *> &vars)
|
qreal Visualization::FindVal(const QString &expression,
|
||||||
|
const QHash<QString, QSharedPointer<VInternalVariable> > *vars)
|
||||||
{
|
{
|
||||||
qreal val = 0;
|
qreal val = 0;
|
||||||
if (expression.isEmpty())
|
if (expression.isEmpty())
|
||||||
|
|
|
@ -47,6 +47,7 @@ Q_DECLARE_LOGGING_CATEGORY(vVis)
|
||||||
class VScaledEllipse;
|
class VScaledEllipse;
|
||||||
class VScaledLine;
|
class VScaledLine;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
class VInternalVariable;
|
||||||
|
|
||||||
enum class Mode : char {Creation, Show};
|
enum class Mode : char {Creation, Show};
|
||||||
|
|
||||||
|
@ -71,8 +72,8 @@ public:
|
||||||
Mode GetMode() const;
|
Mode GetMode() const;
|
||||||
void SetMode(const Mode &value);
|
void SetMode(const Mode &value);
|
||||||
|
|
||||||
static qreal FindLength(const QString &expression, const QHash<QString, qreal *> &vars);
|
static qreal FindLength(const QString &expression, const QHash<QString, QSharedPointer<VInternalVariable> > *vars);
|
||||||
static qreal FindVal(const QString &expression, const QHash<QString, qreal *> &vars);
|
static qreal FindVal(const QString &expression, const QHash<QString, QSharedPointer<VInternalVariable> > *vars);
|
||||||
signals:
|
signals:
|
||||||
void ToolTip(const QString &toolTip);
|
void ToolTip(const QString &toolTip);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -56,6 +56,8 @@ void TST_VMeasurements::CreateEmptyMultisizeFile()
|
||||||
|
|
||||||
QSharedPointer<VMeasurements> m =
|
QSharedPointer<VMeasurements> m =
|
||||||
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));
|
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));
|
||||||
|
m->SetSize(VContainer::rsize());
|
||||||
|
m->SetHeight(VContainer::rheight());
|
||||||
|
|
||||||
QTemporaryFile file;
|
QTemporaryFile file;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
@ -144,6 +146,8 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
|
||||||
|
|
||||||
QSharedPointer<VMeasurements> m =
|
QSharedPointer<VMeasurements> m =
|
||||||
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));
|
QSharedPointer<VMeasurements>(new VMeasurements(mUnit, size, height, data.data()));
|
||||||
|
m->SetSize(VContainer::rsize());
|
||||||
|
m->SetHeight(VContainer::rheight());
|
||||||
|
|
||||||
const QStringList listSystems = ListPMSystems();
|
const QStringList listSystems = ListPMSystems();
|
||||||
for (int i = 0; i < listSystems.size(); ++i)
|
for (int i = 0; i < listSystems.size(); ++i)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user