diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 7d9a6f555..0b636a272 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -861,12 +861,12 @@ void MainWindow::ToolBarOption() const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes()); gradationHeights = SetGradationList(tr("Height: "), listHeights); - SetDefaultHeight(static_cast(GHeights::H176)); + SetDefaultHeight(static_cast(pattern->height())); connect(gradationHeights, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedHeight); gradationSizes = SetGradationList(tr("Size: "), listSizes); - SetDefaultSize(static_cast(GSizes::S50)); + SetDefaultSize(static_cast(pattern->size())); connect(gradationSizes, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::ChangedSize); @@ -890,12 +890,13 @@ QComboBox *MainWindow::SetGradationList(const QString &label, const QStringList } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetDefaultHeight set base height in combobox. + * @param value [in] height value in pattern units. + */ void MainWindow::SetDefaultHeight(int value) { - qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit()); - QString strVal = QString("%1").arg(val); - - qint32 index = gradationHeights->findText(strVal); + const qint32 index = gradationHeights->findText(QString("%1").arg(value)); if (index != -1) { gradationHeights->setCurrentIndex(index); @@ -907,12 +908,13 @@ void MainWindow::SetDefaultHeight(int value) } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetDefaultSize set base size in combobox. + * @param value [in] size value in pattern units. + */ void MainWindow::SetDefaultSize(int value) { - qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit()); - QString strVal = QString("%1").arg(val); - - qint32 index = gradationSizes->findText(strVal); + const qint32 index = gradationSizes->findText(QString("%1").arg(value)); if (index != -1) { gradationSizes->setCurrentIndex(index); diff --git a/src/app/xml/vstandardmeasurements.cpp b/src/app/xml/vstandardmeasurements.cpp index 43124da00..5e010c69c 100644 --- a/src/app/xml/vstandardmeasurements.cpp +++ b/src/app/xml/vstandardmeasurements.cpp @@ -34,8 +34,10 @@ const QString VStandardMeasurements::TagDescription = QStringLiteral("descr const QString VStandardMeasurements::TagId = QStringLiteral("id"); const QString VStandardMeasurements::TagSize = QStringLiteral("size"); const QString VStandardMeasurements::TagHeight = QStringLiteral("height"); + const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase"); const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase"); +const QString VStandardMeasurements::AttrBase = QStringLiteral("base"); //--------------------------------------------------------------------------------------------------------------------- VStandardMeasurements::VStandardMeasurements(VContainer *data) @@ -93,7 +95,7 @@ void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const //--------------------------------------------------------------------------------------------------------------------- -qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) const +qreal VStandardMeasurements::TakeParametr(const QString &tag, const QString &attr, qreal defValue) const { const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit()); @@ -110,7 +112,7 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - qreal value = GetParametrDouble(domElement, AttrValue, QString("%1").arg(defVal)); + qreal value = GetParametrDouble(domElement, attr, QString("%1").arg(defVal)); value = UnitConvertor(value, MUnit(), qApp->patternUnit()); return value; } @@ -122,7 +124,7 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co //--------------------------------------------------------------------------------------------------------------------- void VStandardMeasurements::SetSize() { - const qreal value = TakeParametr(TagSize, 50); + const qreal value = TakeParametr(TagSize, AttrBase, 50); data->SetSize(value); data->SetSizeName(size_M); } @@ -130,7 +132,7 @@ void VStandardMeasurements::SetSize() //--------------------------------------------------------------------------------------------------------------------- void VStandardMeasurements::SetHeight() { - const qreal value = TakeParametr(TagHeight, 176); + const qreal value = TakeParametr(TagHeight, AttrBase, 176); data->SetHeight(value); data->SetHeightName(height_M); } diff --git a/src/app/xml/vstandardmeasurements.h b/src/app/xml/vstandardmeasurements.h index 93082b7bc..70cc3dbc9 100644 --- a/src/app/xml/vstandardmeasurements.h +++ b/src/app/xml/vstandardmeasurements.h @@ -53,13 +53,15 @@ public: static const QString TagId; static const QString TagSize; static const QString TagHeight; + static const QString AttrSize_increase; static const QString AttrHeight_increase; + static const QString AttrBase; protected: virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag); private: Q_DISABLE_COPY(VStandardMeasurements) - qreal TakeParametr(const QString &tag, qreal defValue) const; + qreal TakeParametr(const QString &tag, const QString &attr, qreal defValue) const; }; #endif // VSTANDARDMEASUREMENTS_H diff --git a/src/libs/ifc/schema/standard_measurements.xsd b/src/libs/ifc/schema/standard_measurements.xsd index 97730dd24..913b6db89 100644 --- a/src/libs/ifc/schema/standard_measurements.xsd +++ b/src/libs/ifc/schema/standard_measurements.xsd @@ -15,7 +15,6 @@ -