New notch type - Check Notch. Control a notch width and angle with formulas.
This commit is contained in:
parent
66e01d9994
commit
598682e57b
|
@ -25,6 +25,8 @@
|
||||||
- [smart-pattern/valentina#163] Show/hide grainline when export.
|
- [smart-pattern/valentina#163] Show/hide grainline when export.
|
||||||
- Improve calculating notches.
|
- Improve calculating notches.
|
||||||
- Simplify number of versions for DXF AAMA/ASTM.
|
- Simplify number of versions for DXF AAMA/ASTM.
|
||||||
|
- New notch type - Check Notch.
|
||||||
|
- Control a notch width and angle with formulas.
|
||||||
|
|
||||||
# Valentina 0.7.52 September 12, 2022
|
# Valentina 0.7.52 September 12, 2022
|
||||||
- Fix crash when default locale is ru.
|
- Fix crash when default locale is ru.
|
||||||
|
|
|
@ -691,6 +691,7 @@ auto VPLayoutFileReader::ReadNotch() -> VLayoutPassmark
|
||||||
passmark.isBuiltIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr);
|
passmark.isBuiltIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr);
|
||||||
passmark.baseLine = StringToLine(ReadAttributeEmptyString(attribs, ML::AttrBaseLine));
|
passmark.baseLine = StringToLine(ReadAttributeEmptyString(attribs, ML::AttrBaseLine));
|
||||||
passmark.lines = StringToLines(ReadAttributeEmptyString(attribs, ML::AttrPath));
|
passmark.lines = StringToLines(ReadAttributeEmptyString(attribs, ML::AttrPath));
|
||||||
|
passmark.isClockwiseOpening = ReadAttributeBool(attribs, ML::AttrClockwiseOpening, falseStr);
|
||||||
|
|
||||||
QString defaultType = QString::number(static_cast<int>(PassmarkLineType::OneLine));
|
QString defaultType = QString::number(static_cast<int>(PassmarkLineType::OneLine));
|
||||||
passmark.type = static_cast<PassmarkLineType>(ReadAttributeUInt(attribs, ML::AttrType, defaultType));
|
passmark.type = static_cast<PassmarkLineType>(ReadAttributeUInt(attribs, ML::AttrType, defaultType));
|
||||||
|
|
|
@ -334,6 +334,8 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
|
||||||
SetAttribute(ML::AttrType, static_cast<int>(passmark.type));
|
SetAttribute(ML::AttrType, static_cast<int>(passmark.type));
|
||||||
SetAttribute(ML::AttrBaseLine, LineToString(passmark.baseLine));
|
SetAttribute(ML::AttrBaseLine, LineToString(passmark.baseLine));
|
||||||
SetAttribute(ML::AttrPath, LinesToString(passmark.lines));
|
SetAttribute(ML::AttrPath, LinesToString(passmark.lines));
|
||||||
|
SetAttributeOrRemoveIf<bool>(ML::AttrClockwiseOpening, passmark.isClockwiseOpening,
|
||||||
|
[](bool clockwise) noexcept { return not clockwise; });
|
||||||
writeEndElement();
|
writeEndElement();
|
||||||
}
|
}
|
||||||
writeEndElement();
|
writeEndElement();
|
||||||
|
|
|
@ -113,6 +113,7 @@ const QString AttrX = QStringLiteral("x"); // NOLINT(cert-err
|
||||||
const QString AttrY = QStringLiteral("y"); // NOLINT(cert-err58-cpp)
|
const QString AttrY = QStringLiteral("y"); // NOLINT(cert-err58-cpp)
|
||||||
const QString AttrTurnPoint = QStringLiteral("turnPoint"); // NOLINT(cert-err58-cpp)
|
const QString AttrTurnPoint = QStringLiteral("turnPoint"); // NOLINT(cert-err58-cpp)
|
||||||
const QString AttrCurvePoint = QStringLiteral("curvePoint"); // NOLINT(cert-err58-cpp)
|
const QString AttrCurvePoint = QStringLiteral("curvePoint"); // NOLINT(cert-err58-cpp)
|
||||||
|
const QString AttrClockwiseOpening = QStringLiteral("clockwiseOpening"); // NOLINT(cert-err58-cpp)
|
||||||
|
|
||||||
const QString oneWayUpStr = QStringLiteral("oneWayUp"); // NOLINT(cert-err58-cpp)
|
const QString oneWayUpStr = QStringLiteral("oneWayUp"); // NOLINT(cert-err58-cpp)
|
||||||
const QString oneWayDownStr = QStringLiteral("oneWayDown"); // NOLINT(cert-err58-cpp)
|
const QString oneWayDownStr = QStringLiteral("oneWayDown"); // NOLINT(cert-err58-cpp)
|
||||||
|
|
|
@ -118,6 +118,7 @@ extern const QString AttrX;
|
||||||
extern const QString AttrY;
|
extern const QString AttrY;
|
||||||
extern const QString AttrTurnPoint;
|
extern const QString AttrTurnPoint;
|
||||||
extern const QString AttrCurvePoint;
|
extern const QString AttrCurvePoint;
|
||||||
|
extern const QString AttrClockwiseOpening;
|
||||||
|
|
||||||
extern const QString oneWayUpStr;
|
extern const QString oneWayUpStr;
|
||||||
extern const QString oneWayDownStr;
|
extern const QString oneWayDownStr;
|
||||||
|
|
|
@ -138,20 +138,22 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
ui->checkBoxPatternReadOnly->setDisabled(true);
|
ui->checkBoxPatternReadOnly->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------- Passmark length
|
|
||||||
m_variables = pattern->DataMeasurements().keys() + pattern->DataIncrements().keys();
|
m_variables = pattern->DataMeasurements().keys() + pattern->DataIncrements().keys();
|
||||||
m_completer = new QCompleter(m_variables, this);
|
|
||||||
m_completer->setCompletionMode(QCompleter::PopupCompletion);
|
|
||||||
m_completer->setModelSorting(QCompleter::UnsortedModel);
|
|
||||||
m_completer->setFilterMode(Qt::MatchContains);
|
|
||||||
m_completer->setCaseSensitivity(Qt::CaseSensitive);
|
|
||||||
connect(m_completer, QOverload<const QString &>::of(&QCompleter::activated), this, [this]()
|
|
||||||
{
|
|
||||||
ValidatePassmarkLength();
|
|
||||||
DescEdited();
|
|
||||||
});
|
|
||||||
|
|
||||||
ui->lineEditPassmarkLength->setCompleter(m_completer);
|
//----------------------- Passmark length
|
||||||
|
m_completerLength = new QCompleter(m_variables, this);
|
||||||
|
m_completerLength->setCompletionMode(QCompleter::PopupCompletion);
|
||||||
|
m_completerLength->setModelSorting(QCompleter::UnsortedModel);
|
||||||
|
m_completerLength->setFilterMode(Qt::MatchContains);
|
||||||
|
m_completerLength->setCaseSensitivity(Qt::CaseSensitive);
|
||||||
|
connect(m_completerLength, QOverload<const QString &>::of(&QCompleter::activated), this,
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
ValidatePassmarkLength();
|
||||||
|
DescEdited();
|
||||||
|
});
|
||||||
|
|
||||||
|
ui->lineEditPassmarkLength->setCompleter(m_completerLength);
|
||||||
connect(ui->lineEditPassmarkLength, &QLineEdit::textEdited, this, [this]()
|
connect(ui->lineEditPassmarkLength, &QLineEdit::textEdited, this, [this]()
|
||||||
{
|
{
|
||||||
ValidatePassmarkLength();
|
ValidatePassmarkLength();
|
||||||
|
@ -163,6 +165,32 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
ui->lineEditPassmarkLength->setText(m_oldPassmarkLength);
|
ui->lineEditPassmarkLength->setText(m_oldPassmarkLength);
|
||||||
ValidatePassmarkLength();
|
ValidatePassmarkLength();
|
||||||
|
|
||||||
|
//----------------------- Passmark width
|
||||||
|
m_completerWidth = new QCompleter(m_variables, this);
|
||||||
|
m_completerWidth->setCompletionMode(QCompleter::PopupCompletion);
|
||||||
|
m_completerWidth->setModelSorting(QCompleter::UnsortedModel);
|
||||||
|
m_completerWidth->setFilterMode(Qt::MatchContains);
|
||||||
|
m_completerWidth->setCaseSensitivity(Qt::CaseSensitive);
|
||||||
|
connect(m_completerWidth, QOverload<const QString &>::of(&QCompleter::activated), this,
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
ValidatePassmarkWidth();
|
||||||
|
DescEdited();
|
||||||
|
});
|
||||||
|
|
||||||
|
ui->lineEditPassmarkWidth->setCompleter(m_completerWidth);
|
||||||
|
connect(ui->lineEditPassmarkWidth, &QLineEdit::textEdited, this,
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
ValidatePassmarkWidth();
|
||||||
|
DescEdited();
|
||||||
|
});
|
||||||
|
|
||||||
|
ui->lineEditPassmarkWidth->installEventFilter(this);
|
||||||
|
m_oldPassmarkWidth = doc->GetPassmarkWidthVariable();
|
||||||
|
ui->lineEditPassmarkWidth->setText(m_oldPassmarkWidth);
|
||||||
|
ValidatePassmarkWidth();
|
||||||
|
|
||||||
//Initialization change value. Set to default value after initialization
|
//Initialization change value. Set to default value after initialization
|
||||||
m_defaultChanged = false;
|
m_defaultChanged = false;
|
||||||
m_securityChanged = false;
|
m_securityChanged = false;
|
||||||
|
@ -189,7 +217,7 @@ auto DialogPatternProperties::eventFilter(QObject *object, QEvent *event) -> boo
|
||||||
auto *keyEvent = static_cast<QKeyEvent *>(event); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
auto *keyEvent = static_cast<QKeyEvent *>(event); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
if ((keyEvent->key() == Qt::Key_Space) && ((keyEvent->modifiers() & Qt::ControlModifier) != 0U))
|
if ((keyEvent->key() == Qt::Key_Space) && ((keyEvent->modifiers() & Qt::ControlModifier) != 0U))
|
||||||
{
|
{
|
||||||
m_completer->complete();
|
m_completerLength->complete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,6 +225,21 @@ auto DialogPatternProperties::eventFilter(QObject *object, QEvent *event) -> boo
|
||||||
return false;// clazy:exclude=base-class-event
|
return false;// clazy:exclude=base-class-event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui->lineEditPassmarkWidth == qobject_cast<QLineEdit *>(object))
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
auto *keyEvent = static_cast<QKeyEvent *>(event); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||||
|
if ((keyEvent->key() == Qt::Key_Space) && ((keyEvent->modifiers() & Qt::ControlModifier) != 0U))
|
||||||
|
{
|
||||||
|
m_completerWidth->complete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // clazy:exclude=base-class-event
|
||||||
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(object, event);
|
return QDialog::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,12 +283,25 @@ void DialogPatternProperties::SaveDescription()
|
||||||
m_doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
m_doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
||||||
m_doc->SetLabelPrefix(qvariant_cast<QString>(ui->comboBoxLabelLanguage->currentData()));
|
m_doc->SetLabelPrefix(qvariant_cast<QString>(ui->comboBoxLabelLanguage->currentData()));
|
||||||
m_doc->SetPassmarkLengthVariable(ui->lineEditPassmarkLength->text());
|
m_doc->SetPassmarkLengthVariable(ui->lineEditPassmarkLength->text());
|
||||||
|
m_doc->SetPassmarkWidthVariable(ui->lineEditPassmarkWidth->text());
|
||||||
m_doc->SetDefaultPieceLabelPath(ui->lineEditPieceLabelPath->text());
|
m_doc->SetDefaultPieceLabelPath(ui->lineEditPieceLabelPath->text());
|
||||||
|
|
||||||
if (m_oldPassmarkLength != ui->lineEditPassmarkLength->text())
|
const bool lengthChanged = m_oldPassmarkLength != ui->lineEditPassmarkLength->text();
|
||||||
|
const bool widthChanged = m_oldPassmarkWidth != ui->lineEditPassmarkWidth->text();
|
||||||
|
|
||||||
|
if (lengthChanged || widthChanged)
|
||||||
{
|
{
|
||||||
emit UpddatePieces();
|
emit UpddatePieces();
|
||||||
m_oldPassmarkLength = ui->lineEditPassmarkLength->text();
|
|
||||||
|
if (lengthChanged)
|
||||||
|
{
|
||||||
|
m_oldPassmarkLength = ui->lineEditPassmarkLength->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widthChanged)
|
||||||
|
{
|
||||||
|
m_oldPassmarkWidth = ui->lineEditPassmarkWidth->text();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_descriptionChanged = false;
|
m_descriptionChanged = false;
|
||||||
|
@ -285,6 +341,26 @@ void DialogPatternProperties::ValidatePassmarkLength() const
|
||||||
ui->lineEditPassmarkLength->setPalette(palette);
|
ui->lineEditPassmarkLength->setPalette(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternProperties::ValidatePassmarkWidth() const
|
||||||
|
{
|
||||||
|
const QString text = ui->lineEditPassmarkWidth->text();
|
||||||
|
QPalette palette = ui->lineEditPassmarkWidth->palette();
|
||||||
|
const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkWidth->foregroundRole();
|
||||||
|
|
||||||
|
QRegularExpression rx(NameRegExp());
|
||||||
|
if (not text.isEmpty())
|
||||||
|
{
|
||||||
|
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
palette.setColor(foregroundRole, Qt::black);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->lineEditPassmarkWidth->setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::InitImage()
|
void DialogPatternProperties::InitImage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,9 +79,11 @@ private:
|
||||||
QAction *m_changeImageAction{nullptr};
|
QAction *m_changeImageAction{nullptr};
|
||||||
QAction *m_saveImageAction{nullptr};
|
QAction *m_saveImageAction{nullptr};
|
||||||
QAction *m_showImageAction{nullptr};
|
QAction *m_showImageAction{nullptr};
|
||||||
QCompleter *m_completer{nullptr};
|
QCompleter *m_completerLength{nullptr};
|
||||||
|
QCompleter *m_completerWidth{nullptr};
|
||||||
QStringList m_variables{};
|
QStringList m_variables{};
|
||||||
QString m_oldPassmarkLength{};
|
QString m_oldPassmarkLength{};
|
||||||
|
QString m_oldPassmarkWidth{};
|
||||||
QPointer<QTemporaryFile> m_tmpImage{};
|
QPointer<QTemporaryFile> m_tmpImage{};
|
||||||
|
|
||||||
void SaveDescription();
|
void SaveDescription();
|
||||||
|
@ -90,6 +92,7 @@ private:
|
||||||
void InitImage();
|
void InitImage();
|
||||||
|
|
||||||
void ValidatePassmarkLength() const;
|
void ValidatePassmarkLength() const;
|
||||||
|
void ValidatePassmarkWidth() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGPATTERNPROPERTIES_H
|
#endif // DIALOGPATTERNPROPERTIES_H
|
||||||
|
|
|
@ -122,6 +122,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Passmark width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditPassmarkWidth">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
<xs:attribute type="NotchType" name="type" use="optional"/>
|
<xs:attribute type="NotchType" name="type" use="optional"/>
|
||||||
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
|
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
|
||||||
<xs:attribute type="LinesPath" name="path" use="optional"/>
|
<xs:attribute type="LinesPath" name="path" use="optional"/>
|
||||||
|
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -309,6 +310,7 @@
|
||||||
<xs:attribute type="NotchType" name="type" use="optional"/>
|
<xs:attribute type="NotchType" name="type" use="optional"/>
|
||||||
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
|
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
|
||||||
<xs:attribute type="LinesPath" name="path" use="optional"/>
|
<xs:attribute type="LinesPath" name="path" use="optional"/>
|
||||||
|
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -474,22 +476,24 @@
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="NotchType">
|
<xs:simpleType name="NotchType">
|
||||||
<xs:restriction base="xs:unsignedInt">
|
<xs:restriction base="xs:unsignedInt">
|
||||||
<xs:enumeration value="0"/>
|
|
||||||
<!--OneLine-->
|
<!--OneLine-->
|
||||||
<xs:enumeration value="1"/>
|
<xs:enumeration value="0"/>
|
||||||
<!--TwoLines-->
|
<!--TwoLines-->
|
||||||
<xs:enumeration value="2"/>
|
<xs:enumeration value="1"/>
|
||||||
<!--ThreeLines-->
|
<!--ThreeLines-->
|
||||||
<xs:enumeration value="3"/>
|
<xs:enumeration value="2"/>
|
||||||
<!--TMark-->
|
<!--TMark-->
|
||||||
<xs:enumeration value="4"/>
|
<xs:enumeration value="3"/>
|
||||||
<!--VMark-->
|
<!--VMark-->
|
||||||
<xs:enumeration value="5"/>
|
<xs:enumeration value="4"/>
|
||||||
<!--VMark2-->
|
<!--VMark2-->
|
||||||
<xs:enumeration value="6"/>
|
<xs:enumeration value="5"/>
|
||||||
<!--UMark-->
|
<!--UMark-->
|
||||||
<xs:enumeration value="7"/>
|
<xs:enumeration value="6"/>
|
||||||
<!--BoxMark-->
|
<!--BoxMark-->
|
||||||
|
<xs:enumeration value="7"/>
|
||||||
|
<!--CheckMark-->
|
||||||
|
<xs:enumeration value="8"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="CurvePenStyle">
|
<xs:simpleType name="CurvePenStyle">
|
||||||
|
|
|
@ -409,6 +409,7 @@
|
||||||
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
||||||
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
||||||
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkClockwiseOpening" type="xs:boolean"/>
|
||||||
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
||||||
<xs:attribute name="checkWidth" type="xs:string"/>
|
<xs:attribute name="checkWidth" type="xs:string"/>
|
||||||
<xs:attribute name="checkHeight" type="xs:string"/>
|
<xs:attribute name="checkHeight" type="xs:string"/>
|
||||||
|
@ -416,6 +417,10 @@
|
||||||
<xs:attribute name="checkHeightReference" type="checkReference"/>
|
<xs:attribute name="checkHeightReference" type="checkReference"/>
|
||||||
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
||||||
<xs:attribute name="passmarkLength" type="xs:string"/>
|
<xs:attribute name="passmarkLength" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkWidth" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkWidth" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkAngle" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkAngleFormula" type="xs:string"/>
|
||||||
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
|
@ -473,9 +478,14 @@
|
||||||
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
||||||
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
||||||
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkClockwiseOpening" type="xs:boolean"/>
|
||||||
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
||||||
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
||||||
<xs:attribute name="passmarkLength" type="xs:string"/>
|
<xs:attribute name="passmarkLength" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkWidth" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkWidth" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkAngle" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkAngleFormula" type="xs:string"/>
|
||||||
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
|
@ -673,6 +683,7 @@
|
||||||
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
|
||||||
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
|
||||||
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkClockwiseOpening" type="xs:boolean"/>
|
||||||
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
<xs:attribute name="allowCollapse" type="xs:boolean"/>
|
||||||
<xs:attribute name="checkWidth" type="xs:string"/>
|
<xs:attribute name="checkWidth" type="xs:string"/>
|
||||||
<xs:attribute name="checkHeight" type="xs:string"/>
|
<xs:attribute name="checkHeight" type="xs:string"/>
|
||||||
|
@ -681,6 +692,10 @@
|
||||||
<xs:attribute name="checkStop" type="cuttingStop"/>
|
<xs:attribute name="checkStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
<xs:attribute name="manualPassmarkLength" type="xs:boolean"/>
|
||||||
<xs:attribute name="passmarkLength" type="xs:string"/>
|
<xs:attribute name="passmarkLength" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkWidth" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkWidth" type="xs:string"/>
|
||||||
|
<xs:attribute name="manualPassmarkAngle" type="xs:boolean"/>
|
||||||
|
<xs:attribute name="passmarkAngleFormula" type="xs:string"/>
|
||||||
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="singlePassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="leftPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
<xs:attribute name="rightPassmarkCuttingStop" type="cuttingStop"/>
|
||||||
|
@ -1023,6 +1038,7 @@
|
||||||
<xs:enumeration value="vMark2"/>
|
<xs:enumeration value="vMark2"/>
|
||||||
<xs:enumeration value="uMark"/>
|
<xs:enumeration value="uMark"/>
|
||||||
<xs:enumeration value="boxMark"/>
|
<xs:enumeration value="boxMark"/>
|
||||||
|
<xs:enumeration value="checkMark"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
<xs:simpleType name="passmarkAngleType">
|
<xs:simpleType name="passmarkAngleType">
|
||||||
|
|
|
@ -127,6 +127,7 @@ const QString VAbstractPattern::AttrNodePassmark = QStringLiteral("passmark
|
||||||
const QString VAbstractPattern::AttrNodePassmarkLine = QStringLiteral("passmarkLine");
|
const QString VAbstractPattern::AttrNodePassmarkLine = QStringLiteral("passmarkLine");
|
||||||
const QString VAbstractPattern::AttrNodePassmarkAngle = QStringLiteral("passmarkAngle");
|
const QString VAbstractPattern::AttrNodePassmarkAngle = QStringLiteral("passmarkAngle");
|
||||||
const QString VAbstractPattern::AttrNodeShowSecondPassmark = QStringLiteral("showSecondPassmark");
|
const QString VAbstractPattern::AttrNodeShowSecondPassmark = QStringLiteral("showSecondPassmark");
|
||||||
|
const QString VAbstractPattern::AttrNodePassmarkOpening = QStringLiteral("passmarkClockwiseOpening");
|
||||||
const QString VAbstractPattern::AttrNodeTurnPoint = QStringLiteral("turnPoint");
|
const QString VAbstractPattern::AttrNodeTurnPoint = QStringLiteral("turnPoint");
|
||||||
const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
|
const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
|
||||||
const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
|
const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
|
||||||
|
@ -139,6 +140,10 @@ const QString VAbstractPattern::AttrNumber = QStringLiteral("number")
|
||||||
const QString VAbstractPattern::AttrCheckUniqueness = QStringLiteral("checkUniqueness");
|
const QString VAbstractPattern::AttrCheckUniqueness = QStringLiteral("checkUniqueness");
|
||||||
const QString VAbstractPattern::AttrManualPassmarkLength = QStringLiteral("manualPassmarkLength");
|
const QString VAbstractPattern::AttrManualPassmarkLength = QStringLiteral("manualPassmarkLength");
|
||||||
const QString VAbstractPattern::AttrPassmarkLength = QStringLiteral("passmarkLength");
|
const QString VAbstractPattern::AttrPassmarkLength = QStringLiteral("passmarkLength");
|
||||||
|
const QString VAbstractPattern::AttrManualPassmarkWidth = QStringLiteral("manualPassmarkWidth");
|
||||||
|
const QString VAbstractPattern::AttrPassmarkWidth = QStringLiteral("passmarkWidth");
|
||||||
|
const QString VAbstractPattern::AttrManualPassmarkAngle = QStringLiteral("manualPassmarkAngle");
|
||||||
|
const QString VAbstractPattern::AttrPassmarkAngle = QStringLiteral("passmarkAngleFormula");
|
||||||
const QString VAbstractPattern::AttrOpacity = QStringLiteral("opacity");
|
const QString VAbstractPattern::AttrOpacity = QStringLiteral("opacity");
|
||||||
const QString VAbstractPattern::AttrTags = QStringLiteral("tags");
|
const QString VAbstractPattern::AttrTags = QStringLiteral("tags");
|
||||||
const QString VAbstractPattern::AttrTransform = QStringLiteral("transform");
|
const QString VAbstractPattern::AttrTransform = QStringLiteral("transform");
|
||||||
|
@ -786,27 +791,36 @@ auto VAbstractPattern::ParseSANode(const QDomElement &domElement) -> VPieceNode
|
||||||
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0'));
|
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0'));
|
||||||
const bool excluded = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeExcluded, falseStr);
|
const bool excluded = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeExcluded, falseStr);
|
||||||
const bool uniqeness = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrCheckUniqueness, trueStr);
|
const bool uniqeness = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrCheckUniqueness, trueStr);
|
||||||
const QString saBefore = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore,
|
const QString saBefore =
|
||||||
currentSeamAllowance);
|
VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore, currentSeamAllowance);
|
||||||
const QString saAfter = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter,
|
const QString saAfter =
|
||||||
currentSeamAllowance);
|
VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter, currentSeamAllowance);
|
||||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(VDomDocument::GetParametrUInt(domElement, AttrAngle,
|
const PieceNodeAngle angle =
|
||||||
QChar('0')));
|
static_cast<PieceNodeAngle>(VDomDocument::GetParametrUInt(domElement, AttrAngle, QChar('0')));
|
||||||
|
|
||||||
const bool passmark = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmark, falseStr);
|
const bool passmark = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmark, falseStr);
|
||||||
const PassmarkLineType passmarkLine = StringToPassmarkLineType(VDomDocument::GetParametrString(domElement,
|
const PassmarkLineType passmarkLine = StringToPassmarkLineType(
|
||||||
VAbstractPattern::AttrNodePassmarkLine,
|
VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrNodePassmarkLine, strOne));
|
||||||
strOne));
|
const PassmarkAngleType passmarkAngleType = StringToPassmarkAngleType(
|
||||||
const PassmarkAngleType passmarkAngle = StringToPassmarkAngleType(VDomDocument::GetParametrString(domElement,
|
VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrNodePassmarkAngle, strStraightforward));
|
||||||
VAbstractPattern::AttrNodePassmarkAngle,
|
|
||||||
strStraightforward));
|
const bool showSecond =
|
||||||
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeShowSecondPassmark, trueStr);
|
||||||
|
const bool passmarkOpening =
|
||||||
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmarkOpening, falseStr);
|
||||||
|
|
||||||
const bool showSecond = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeShowSecondPassmark,
|
|
||||||
trueStr);
|
|
||||||
const bool manualPassmarkLength =
|
const bool manualPassmarkLength =
|
||||||
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkLength, falseStr);
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkLength, falseStr);
|
||||||
const QString passmarkLength =
|
const QString passmarkLength =
|
||||||
VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkLength);
|
VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkLength);
|
||||||
|
|
||||||
|
const bool manualPassmarkWidth =
|
||||||
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkWidth, falseStr);
|
||||||
|
const QString passmarkWidth = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkWidth);
|
||||||
|
|
||||||
|
const bool manualPassmarkAngle =
|
||||||
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkAngle, falseStr);
|
||||||
|
const QString passmarkAngle = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkAngle);
|
||||||
|
|
||||||
const bool turnPoint =
|
const bool turnPoint =
|
||||||
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeTurnPoint, trueStr);
|
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeTurnPoint, trueStr);
|
||||||
|
@ -850,11 +864,16 @@ auto VAbstractPattern::ParseSANode(const QDomElement &domElement) -> VPieceNode
|
||||||
node.SetExcluded(excluded);
|
node.SetExcluded(excluded);
|
||||||
node.SetCheckUniqueness(uniqeness);
|
node.SetCheckUniqueness(uniqeness);
|
||||||
node.SetShowSecondPassmark(showSecond);
|
node.SetShowSecondPassmark(showSecond);
|
||||||
|
node.SetPassmarkClockwiseOpening(passmarkOpening);
|
||||||
node.SetPassmark(passmark);
|
node.SetPassmark(passmark);
|
||||||
node.SetPassmarkLineType(passmarkLine);
|
node.SetPassmarkLineType(passmarkLine);
|
||||||
node.SetPassmarkAngleType(passmarkAngle);
|
node.SetPassmarkAngleType(passmarkAngleType);
|
||||||
node.SetManualPassmarkLength(manualPassmarkLength);
|
node.SetManualPassmarkLength(manualPassmarkLength);
|
||||||
node.SetFormulaPassmarkLength(passmarkLength);
|
node.SetFormulaPassmarkLength(passmarkLength);
|
||||||
|
node.SetManualPassmarkWidth(manualPassmarkWidth);
|
||||||
|
node.SetFormulaPassmarkWidth(passmarkWidth);
|
||||||
|
node.SetManualPassmarkAngle(manualPassmarkAngle);
|
||||||
|
node.SetFormulaPassmarkAngle(passmarkAngle);
|
||||||
node.SetTurnPoint(turnPoint);
|
node.SetTurnPoint(turnPoint);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@ -1319,6 +1338,31 @@ void VAbstractPattern::SetPassmarkLengthVariable(const QString &name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractPattern::GetPassmarkWidthVariable() const -> QString
|
||||||
|
{
|
||||||
|
const QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
if (pattern.isNull())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetParametrEmptyString(pattern, AttrPassmarkWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetPassmarkWidthVariable(const QString &name)
|
||||||
|
{
|
||||||
|
QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
if (not pattern.isNull())
|
||||||
|
{
|
||||||
|
SetAttribute(pattern, AttrPassmarkWidth, name);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractPattern::GetImage() const -> VPatternImage
|
auto VAbstractPattern::GetImage() const -> VPatternImage
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,9 +106,9 @@ public:
|
||||||
auto ListExpressions() const -> QVector<VFormulaField>;
|
auto ListExpressions() const -> QVector<VFormulaField>;
|
||||||
auto ListIncrementExpressions() const -> QVector<VFormulaField>;
|
auto ListIncrementExpressions() const -> QVector<VFormulaField>;
|
||||||
|
|
||||||
virtual void CreateEmptyFile()=0;
|
virtual void CreateEmptyFile() = 0;
|
||||||
|
|
||||||
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
|
void ChangeActivPP(const QString &name, const Document &parse = Document::FullParse);
|
||||||
auto GetNameActivPP() const -> QString;
|
auto GetNameActivPP() const -> QString;
|
||||||
auto CheckExistNamePP(const QString &name) const -> bool;
|
auto CheckExistNamePP(const QString &name) const -> bool;
|
||||||
auto CountPP() const -> int;
|
auto CountPP() const -> int;
|
||||||
|
@ -119,95 +119,98 @@ public:
|
||||||
auto GetActivNodeElement(const QString &name, QDomElement &element) const -> bool;
|
auto GetActivNodeElement(const QString &name, QDomElement &element) const -> bool;
|
||||||
|
|
||||||
auto getCursor() const -> quint32;
|
auto getCursor() const -> quint32;
|
||||||
void setCursor(const quint32 &value);
|
void setCursor(const quint32 &value);
|
||||||
|
|
||||||
virtual void setXMLContent(const QString &fileName) override;
|
virtual void setXMLContent(const QString &fileName) override;
|
||||||
|
|
||||||
virtual void IncrementReferens(quint32 id) const=0;
|
virtual void IncrementReferens(quint32 id) const = 0;
|
||||||
virtual void DecrementReferens(quint32 id) const=0;
|
virtual void DecrementReferens(quint32 id) const = 0;
|
||||||
|
|
||||||
virtual auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString = 0;
|
virtual auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString = 0;
|
||||||
virtual auto GenerateSuffix() const -> QString = 0;
|
virtual auto GenerateSuffix() const -> QString = 0;
|
||||||
|
|
||||||
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;
|
virtual void UpdateToolData(const quint32 &id, VContainer *data) = 0;
|
||||||
|
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
static auto getTool(quint32 id) -> VDataTool *;
|
static auto getTool(quint32 id) -> VDataTool *;
|
||||||
static void AddTool(quint32 id, VDataTool *tool);
|
static void AddTool(quint32 id, VDataTool *tool);
|
||||||
static void RemoveTool(quint32 id);
|
static void RemoveTool(quint32 id);
|
||||||
|
|
||||||
static auto ParsePieceNodes(const QDomElement &domElement) -> VPiecePath;
|
static auto ParsePieceNodes(const QDomElement &domElement) -> VPiecePath;
|
||||||
static auto ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>;
|
static auto ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>;
|
||||||
static auto ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>;
|
static auto ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>;
|
||||||
static auto ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>;
|
static auto ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>;
|
||||||
|
|
||||||
void AddToolOnRemove(VDataTool *tool);
|
void AddToolOnRemove(VDataTool *tool);
|
||||||
|
|
||||||
auto getHistory() -> QVector<VToolRecord> *;
|
auto getHistory() -> QVector<VToolRecord> *;
|
||||||
auto getLocalHistory() const -> QVector<VToolRecord>;
|
auto getLocalHistory() const -> QVector<VToolRecord>;
|
||||||
|
|
||||||
auto MPath() const -> QString;
|
auto MPath() const -> QString;
|
||||||
void SetMPath(const QString &path);
|
void SetMPath(const QString &path);
|
||||||
|
|
||||||
auto SiblingNodeId(const quint32 &nodeId) const -> quint32;
|
auto SiblingNodeId(const quint32 &nodeId) const -> quint32;
|
||||||
|
|
||||||
auto getPatternPieces() const -> QStringList;
|
auto getPatternPieces() const -> QStringList;
|
||||||
|
|
||||||
auto GetDescription() const -> QString;
|
auto GetDescription() const -> QString;
|
||||||
void SetDescription(const QString &text);
|
void SetDescription(const QString &text);
|
||||||
|
|
||||||
auto GetNotes() const -> QString;
|
auto GetNotes() const -> QString;
|
||||||
void SetNotes(const QString &text);
|
void SetNotes(const QString &text);
|
||||||
|
|
||||||
auto GetPatternName() const -> QString;
|
auto GetPatternName() const -> QString;
|
||||||
void SetPatternName(const QString& qsName);
|
void SetPatternName(const QString &qsName);
|
||||||
|
|
||||||
auto GetCompanyName() const -> QString;
|
auto GetCompanyName() const -> QString;
|
||||||
void SetCompanyName(const QString& qsName);
|
void SetCompanyName(const QString &qsName);
|
||||||
|
|
||||||
auto GetPatternNumber() const -> QString;
|
auto GetPatternNumber() const -> QString;
|
||||||
void SetPatternNumber(const QString &qsNum);
|
void SetPatternNumber(const QString &qsNum);
|
||||||
|
|
||||||
auto GetCustomerName() const -> QString;
|
auto GetCustomerName() const -> QString;
|
||||||
void SetCustomerName(const QString& qsName);
|
void SetCustomerName(const QString &qsName);
|
||||||
|
|
||||||
auto GetCustomerBirthDate() const -> QDate;
|
auto GetCustomerBirthDate() const -> QDate;
|
||||||
void SetCustomerBirthDate(const QDate& date);
|
void SetCustomerBirthDate(const QDate &date);
|
||||||
|
|
||||||
auto GetCustomerEmail() const -> QString;
|
auto GetCustomerEmail() const -> QString;
|
||||||
void SetCustomerEmail(const QString& email);
|
void SetCustomerEmail(const QString &email);
|
||||||
|
|
||||||
auto GetLabelDateFormat() const -> QString;
|
auto GetLabelDateFormat() const -> QString;
|
||||||
void SetLabelDateFormat(const QString &format);
|
void SetLabelDateFormat(const QString &format);
|
||||||
|
|
||||||
auto GetLabelTimeFormat() const -> QString;
|
auto GetLabelTimeFormat() const -> QString;
|
||||||
void SetLabelTimeFormat(const QString &format);
|
void SetLabelTimeFormat(const QString &format);
|
||||||
|
|
||||||
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
||||||
auto GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>;
|
auto GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>;
|
||||||
|
|
||||||
auto SetWatermarkPath(const QString &path) -> bool;
|
auto SetWatermarkPath(const QString &path) -> bool;
|
||||||
auto GetWatermarkPath() const -> QString;
|
auto GetWatermarkPath() const -> QString;
|
||||||
|
|
||||||
void SetPatternMaterials(const QMap<int, QString> &materials);
|
void SetPatternMaterials(const QMap<int, QString> &materials);
|
||||||
auto GetPatternMaterials() const -> QMap<int, QString>;
|
auto GetPatternMaterials() const -> QMap<int, QString>;
|
||||||
|
|
||||||
auto GetFinalMeasurements() const -> QVector<VFinalMeasurement>;
|
auto GetFinalMeasurements() const -> QVector<VFinalMeasurement>;
|
||||||
void SetFinalMeasurements(const QVector<VFinalMeasurement> &measurements);
|
void SetFinalMeasurements(const QVector<VFinalMeasurement> &measurements);
|
||||||
|
|
||||||
auto GetDefaultPieceLabelPath() const -> QString;
|
auto GetDefaultPieceLabelPath() const -> QString;
|
||||||
void SetDefaultPieceLabelPath(const QString &path);
|
void SetDefaultPieceLabelPath(const QString &path);
|
||||||
|
|
||||||
void SetPatternWasChanged(bool changed);
|
void SetPatternWasChanged(bool changed);
|
||||||
auto GetPatternWasChanged() const -> bool;
|
auto GetPatternWasChanged() const -> bool;
|
||||||
|
|
||||||
auto GetPassmarkLengthVariable() const -> QString;
|
auto GetPassmarkLengthVariable() const -> QString;
|
||||||
void SetPassmarkLengthVariable(const QString &name);
|
void SetPassmarkLengthVariable(const QString &name);
|
||||||
|
|
||||||
|
auto GetPassmarkWidthVariable() const -> QString;
|
||||||
|
void SetPassmarkWidthVariable(const QString &name);
|
||||||
|
|
||||||
auto GetImage() const -> VPatternImage;
|
auto GetImage() const -> VPatternImage;
|
||||||
auto SetImage(const VPatternImage &image) -> bool;
|
auto SetImage(const VPatternImage &image) -> bool;
|
||||||
void DeleteImage();
|
void DeleteImage();
|
||||||
|
|
||||||
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
|
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
|
||||||
void SaveBackgroundImages(const QVector<VBackgroundPatternImage> &images);
|
void SaveBackgroundImages(const QVector<VBackgroundPatternImage> &images);
|
||||||
|
@ -216,24 +219,24 @@ public:
|
||||||
void DeleteBackgroundImage(const QUuid &id);
|
void DeleteBackgroundImage(const QUuid &id);
|
||||||
|
|
||||||
auto GetVersion() const -> QString;
|
auto GetVersion() const -> QString;
|
||||||
void SetVersion();
|
void SetVersion();
|
||||||
|
|
||||||
auto IsModified() const -> bool;
|
auto IsModified() const -> bool;
|
||||||
void SetModified(bool modified);
|
void SetModified(bool modified);
|
||||||
|
|
||||||
auto GetDraw(const QString &name) const -> QDomElement;
|
auto GetDraw(const QString &name) const -> QDomElement;
|
||||||
|
|
||||||
void ParseGroups(const QDomElement &domElement);
|
void ParseGroups(const QDomElement &domElement);
|
||||||
auto CreateGroups(const QString &patternPieceName = QString()) -> QDomElement;
|
auto CreateGroups(const QString &patternPieceName = QString()) -> QDomElement;
|
||||||
auto CreateGroup(quint32 id, const QString &name, const QStringList &tags, const QMap<quint32, quint32> &groupData,
|
auto CreateGroup(quint32 id, const QString &name, const QStringList &tags, const QMap<quint32, quint32> &groupData,
|
||||||
vidtype tool = null_id) -> QDomElement;
|
vidtype tool = null_id) -> QDomElement;
|
||||||
auto GroupLinkedToTool(vidtype toolId) const -> vidtype;
|
auto GroupLinkedToTool(vidtype toolId) const -> vidtype;
|
||||||
|
|
||||||
auto GetGroupName(quint32 id) -> QString;
|
auto GetGroupName(quint32 id) -> QString;
|
||||||
void SetGroupName(quint32 id, const QString &name);
|
void SetGroupName(quint32 id, const QString &name);
|
||||||
|
|
||||||
auto GetGroupTags(vidtype id) -> QStringList;
|
auto GetGroupTags(vidtype id) -> QStringList;
|
||||||
void SetGroupTags(quint32 id, const QStringList &tags);
|
void SetGroupTags(quint32 id, const QStringList &tags);
|
||||||
|
|
||||||
auto GetDimensionAValue() -> double;
|
auto GetDimensionAValue() -> double;
|
||||||
void SetDimensionAValue(double value);
|
void SetDimensionAValue(double value);
|
||||||
|
@ -327,6 +330,7 @@ public:
|
||||||
static const QString AttrNodePassmarkLine;
|
static const QString AttrNodePassmarkLine;
|
||||||
static const QString AttrNodePassmarkAngle;
|
static const QString AttrNodePassmarkAngle;
|
||||||
static const QString AttrNodeShowSecondPassmark;
|
static const QString AttrNodeShowSecondPassmark;
|
||||||
|
static const QString AttrNodePassmarkOpening;
|
||||||
static const QString AttrNodeTurnPoint;
|
static const QString AttrNodeTurnPoint;
|
||||||
static const QString AttrSABefore;
|
static const QString AttrSABefore;
|
||||||
static const QString AttrSAAfter;
|
static const QString AttrSAAfter;
|
||||||
|
@ -339,6 +343,10 @@ public:
|
||||||
static const QString AttrCheckUniqueness;
|
static const QString AttrCheckUniqueness;
|
||||||
static const QString AttrManualPassmarkLength;
|
static const QString AttrManualPassmarkLength;
|
||||||
static const QString AttrPassmarkLength;
|
static const QString AttrPassmarkLength;
|
||||||
|
static const QString AttrManualPassmarkWidth;
|
||||||
|
static const QString AttrPassmarkWidth;
|
||||||
|
static const QString AttrManualPassmarkAngle;
|
||||||
|
static const QString AttrPassmarkAngle;
|
||||||
static const QString AttrOpacity;
|
static const QString AttrOpacity;
|
||||||
static const QString AttrTags;
|
static const QString AttrTags;
|
||||||
static const QString AttrTransform;
|
static const QString AttrTransform;
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer26, (UTF8STRING("26"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer80, (UTF8STRING("80"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer81, (UTF8STRING("81"))) // NOLINT
|
||||||
// Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer82, (UTF8STRING("82"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer83, (UTF8STRING("83"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer84, (UTF8STRING("84"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const UTF8STRING, layer85, (UTF8STRING("85"))) // NOLINT
|
||||||
|
@ -1175,10 +1175,10 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
||||||
// Slit notch
|
// Slit notch
|
||||||
notch->layer = *layer4;
|
notch->layer = *layer4;
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::VMark:
|
case PassmarkLineType::ExternalVMark:
|
||||||
case PassmarkLineType::VMark2:
|
case PassmarkLineType::InternalVMark:
|
||||||
{ // V-Notch
|
{ // V-Notch
|
||||||
QLineF boundaryLine(ConstFirst(passmark.lines).p2(), ConstLast(passmark.lines).p2());
|
QLineF boundaryLine(ConstFirst(passmark.lines).p1(), ConstLast(passmark.lines).p2());
|
||||||
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
notch->thickness = FromPixel(boundaryLine.length(), m_varInsunits); // width
|
||||||
notch->layer = *layer4;
|
notch->layer = *layer4;
|
||||||
break;
|
break;
|
||||||
|
@ -1207,6 +1207,22 @@ void VDxfEngine::ExportASTMNotch(const QSharedPointer<dx_ifaceBlock> &detailBloc
|
||||||
notch->layer = *layer83;
|
notch->layer = *layer83;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PassmarkLineType::CheckMark:
|
||||||
|
{ // Check Notch
|
||||||
|
const QLineF &line1 = ConstFirst(passmark.lines);
|
||||||
|
const QLineF &line2 = ConstLast(passmark.lines);
|
||||||
|
|
||||||
|
qreal width = QLineF(line1.p1(), line2.p2()).length();
|
||||||
|
|
||||||
|
if (not passmark.isClockwiseOpening)
|
||||||
|
{ // a counter clockwise opening
|
||||||
|
width *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
notch->thickness = FromPixel(width, m_varInsunits); // width
|
||||||
|
notch->layer = *layer82;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case PassmarkLineType::LAST_ONE_DO_NOT_USE:
|
case PassmarkLineType::LAST_ONE_DO_NOT_USE:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
const quint32 VLayoutPassmark::streamHeader = 0x943E2759; // CRC-32Q string "VLayoutPassmark"
|
const quint32 VLayoutPassmark::streamHeader = 0x943E2759; // CRC-32Q string "VLayoutPassmark"
|
||||||
const quint16 VLayoutPassmark::classVersion = 1;
|
const quint16 VLayoutPassmark::classVersion = 2;
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -44,14 +44,7 @@ auto operator<<(QDataStream &dataStream, const VLayoutPassmark &data) -> QDataSt
|
||||||
{
|
{
|
||||||
dataStream << VLayoutPassmark::streamHeader << VLayoutPassmark::classVersion;
|
dataStream << VLayoutPassmark::streamHeader << VLayoutPassmark::classVersion;
|
||||||
|
|
||||||
// Added in classVersion = 1
|
dataStream << data.lines << data.type << data.baseLine << data.isBuiltIn << data.isClockwiseOpening;
|
||||||
dataStream << data.lines;
|
|
||||||
dataStream << data.type;
|
|
||||||
dataStream << data.baseLine;
|
|
||||||
dataStream << data.isBuiltIn;
|
|
||||||
|
|
||||||
// Added in classVersion = 2
|
|
||||||
|
|
||||||
return dataStream;
|
return dataStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,15 +74,12 @@ auto operator>>(QDataStream &dataStream, VLayoutPassmark &data) -> QDataStream &
|
||||||
throw VException(message);
|
throw VException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataStream >> data.lines;
|
dataStream >> data.lines >> data.type >> data.baseLine >> data.isBuiltIn;
|
||||||
dataStream >> data.type;
|
|
||||||
dataStream >> data.baseLine;
|
|
||||||
dataStream >> data.isBuiltIn;
|
|
||||||
|
|
||||||
// if (actualClassVersion >= 2)
|
if (actualClassVersion >= 2)
|
||||||
// {
|
{
|
||||||
|
dataStream >> data.isClockwiseOpening;
|
||||||
// }
|
}
|
||||||
|
|
||||||
return dataStream;
|
return dataStream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,10 +66,11 @@ enum class PlaceLabelType : quint8
|
||||||
|
|
||||||
struct VLayoutPassmark
|
struct VLayoutPassmark
|
||||||
{
|
{
|
||||||
QVector<QLineF> lines{};
|
QVector<QLineF> lines{};
|
||||||
PassmarkLineType type{PassmarkLineType::OneLine};
|
PassmarkLineType type{PassmarkLineType::OneLine};
|
||||||
QLineF baseLine{};
|
QLineF baseLine{};
|
||||||
bool isBuiltIn{false};
|
bool isBuiltIn{false};
|
||||||
|
bool isClockwiseOpening{false};
|
||||||
|
|
||||||
friend auto operator<<(QDataStream& dataStream, const VLayoutPassmark& data) -> QDataStream&;
|
friend auto operator<<(QDataStream& dataStream, const VLayoutPassmark& data) -> QDataStream&;
|
||||||
friend auto operator>>(QDataStream& dataStream, VLayoutPassmark& data) -> QDataStream&;
|
friend auto operator>>(QDataStream& dataStream, VLayoutPassmark& data) -> QDataStream&;
|
||||||
|
|
|
@ -1556,6 +1556,28 @@ auto VSAPoint::toJson() const -> QJsonObject
|
||||||
pointObject[QLatin1String("angle")] = static_cast<int>(m_angle);
|
pointObject[QLatin1String("angle")] = static_cast<int>(m_angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_manualPassmarkLength)
|
||||||
|
{
|
||||||
|
pointObject[QLatin1String("manualPassmarkLength")] = m_manualPassmarkLength;
|
||||||
|
pointObject[QLatin1String("passmarkLength")] = m_passmarkLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_manualPassmarkWidth)
|
||||||
|
{
|
||||||
|
pointObject[QLatin1String("manualPassmarkWidth")] = m_manualPassmarkWidth;
|
||||||
|
pointObject[QLatin1String("passmarkWidth")] = m_passmarkWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pointObject[QLatin1String("passmarkClockwiseOpening")] = m_passmarkClockwiseOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_manualPassmarkAngle)
|
||||||
|
{
|
||||||
|
pointObject[QLatin1String("manualPassmarkAngle")] = m_manualPassmarkAngle;
|
||||||
|
pointObject[QLatin1String("passmarkAngle")] = m_passmarkAngle;
|
||||||
|
}
|
||||||
|
|
||||||
return pointObject;
|
return pointObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,6 +293,7 @@ auto PrepareSAPassmark(const VPiece &piece, const VContainer *pattern, const VPa
|
||||||
layoutPassmark.lines = lines;
|
layoutPassmark.lines = lines;
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = false;
|
layoutPassmark.isBuiltIn = false;
|
||||||
|
layoutPassmark.isClockwiseOpening = pData.passmarkSAPoint.IsPassmarkClockwiseOpening();
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
return layoutPassmark;
|
return layoutPassmark;
|
||||||
|
@ -354,6 +355,7 @@ auto PreapreBuiltInSAPassmark(const VPiece &piece, const VContainer *pattern, co
|
||||||
layoutPassmark.baseLine = ConstFirst (baseLines);
|
layoutPassmark.baseLine = ConstFirst (baseLines);
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = true;
|
layoutPassmark.isBuiltIn = true;
|
||||||
|
layoutPassmark.isClockwiseOpening = pData.passmarkSAPoint.IsPassmarkClockwiseOpening();
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
return layoutPassmark;
|
return layoutPassmark;
|
||||||
|
|
|
@ -66,7 +66,12 @@ public:
|
||||||
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
|
Q_DECL_CONSTEXPR auto GetAngleType() const -> PieceNodeAngle;
|
||||||
|
|
||||||
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
|
Q_DECL_CONSTEXPR auto IsManualPasskmarkLength() const -> bool;
|
||||||
|
Q_DECL_CONSTEXPR auto IsManualPasskmarkWidth() const -> bool;
|
||||||
|
Q_DECL_CONSTEXPR auto IsManualPasskmarkAngle() const -> bool;
|
||||||
|
|
||||||
Q_DECL_CONSTEXPR auto GetPasskmarkLength() const -> qreal;
|
Q_DECL_CONSTEXPR auto GetPasskmarkLength() const -> qreal;
|
||||||
|
Q_DECL_CONSTEXPR auto GetPasskmarkWidth() const -> qreal;
|
||||||
|
Q_DECL_CONSTEXPR auto GetPasskmarkAngle() const -> qreal;
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR auto GetSABefore(qreal width) const -> qreal;
|
Q_DECL_RELAXED_CONSTEXPR auto GetSABefore(qreal width) const -> qreal;
|
||||||
Q_DECL_RELAXED_CONSTEXPR auto GetSAAfter(qreal width) const -> qreal;
|
Q_DECL_RELAXED_CONSTEXPR auto GetSAAfter(qreal width) const -> qreal;
|
||||||
|
@ -77,11 +82,19 @@ public:
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetAngleType(PieceNodeAngle value);
|
Q_DECL_RELAXED_CONSTEXPR void SetAngleType(PieceNodeAngle value);
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkWidth(bool value);
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR void SetManualPasskmarkAngle(bool value);
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
|
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkLength(qreal value);
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkWidth(qreal value);
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR void SetPasskmarkAngle(qreal value);
|
||||||
|
|
||||||
Q_DECL_RELAXED_CONSTEXPR auto MaxLocalSA(qreal width) const -> qreal;
|
Q_DECL_RELAXED_CONSTEXPR auto MaxLocalSA(qreal width) const -> qreal;
|
||||||
Q_DECL_RELAXED_CONSTEXPR auto PassmarkLength(qreal width) const -> qreal;
|
Q_DECL_RELAXED_CONSTEXPR auto PassmarkLength(qreal width) const -> qreal;
|
||||||
|
|
||||||
|
Q_DECL_CONSTEXPR auto IsPassmarkClockwiseOpening() const -> bool;
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR void SetPassmarkClockwiseOpening(bool clockwise);
|
||||||
|
|
||||||
auto toJson() const -> QJsonObject;
|
auto toJson() const -> QJsonObject;
|
||||||
|
|
||||||
static constexpr qreal passmarkFactor{0.5};
|
static constexpr qreal passmarkFactor{0.5};
|
||||||
|
@ -89,11 +102,16 @@ public:
|
||||||
static constexpr qreal minSAWidth{accuracyPointOnLine + accuracyPointOnLine*0.5};
|
static constexpr qreal minSAWidth{accuracyPointOnLine + accuracyPointOnLine*0.5};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal m_before{-1};
|
qreal m_before{-1};
|
||||||
qreal m_after{-1};
|
qreal m_after{-1};
|
||||||
PieceNodeAngle m_angle{PieceNodeAngle::ByLength};
|
PieceNodeAngle m_angle{PieceNodeAngle::ByLength};
|
||||||
bool m_manualPassmarkLength{false};
|
bool m_manualPassmarkLength{false};
|
||||||
qreal m_passmarkLength{0};
|
bool m_manualPassmarkWidth{false};
|
||||||
|
bool m_manualPassmarkAngle{false};
|
||||||
|
qreal m_passmarkLength{0};
|
||||||
|
qreal m_passmarkWidth{0};
|
||||||
|
qreal m_passmarkAngle{0};
|
||||||
|
bool m_passmarkClockwiseOpening{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(VSAPoint) // NOLINT
|
Q_DECLARE_METATYPE(VSAPoint) // NOLINT
|
||||||
|
@ -176,24 +194,72 @@ Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkLength() const -> bool
|
||||||
return m_manualPassmarkLength;
|
return m_manualPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkWidth() const -> bool
|
||||||
|
{
|
||||||
|
return m_manualPassmarkWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_CONSTEXPR inline auto VSAPoint::IsManualPasskmarkAngle() const -> bool
|
||||||
|
{
|
||||||
|
return m_manualPassmarkAngle;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkLength(bool value)
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkLength(bool value)
|
||||||
{
|
{
|
||||||
m_manualPassmarkLength = value;
|
m_manualPassmarkLength = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkWidth(bool value)
|
||||||
|
{
|
||||||
|
m_manualPassmarkWidth = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetManualPasskmarkAngle(bool value)
|
||||||
|
{
|
||||||
|
m_manualPassmarkAngle = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkLength() const -> qreal
|
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkLength() const -> qreal
|
||||||
{
|
{
|
||||||
return m_passmarkLength;
|
return m_passmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkWidth() const -> qreal
|
||||||
|
{
|
||||||
|
return m_passmarkWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_CONSTEXPR inline auto VSAPoint::GetPasskmarkAngle() const -> qreal
|
||||||
|
{
|
||||||
|
return m_passmarkAngle;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkLength(qreal value)
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkLength(qreal value)
|
||||||
{
|
{
|
||||||
m_passmarkLength = value;
|
m_passmarkLength = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkWidth(qreal value)
|
||||||
|
{
|
||||||
|
m_passmarkWidth = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPasskmarkAngle(qreal value)
|
||||||
|
{
|
||||||
|
m_passmarkAngle = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::MaxLocalSA(qreal width) const -> qreal
|
Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::MaxLocalSA(qreal width) const -> qreal
|
||||||
{
|
{
|
||||||
|
@ -213,6 +279,18 @@ Q_DECL_RELAXED_CONSTEXPR inline auto VSAPoint::PassmarkLength(qreal width) const
|
||||||
return m_passmarkLength;
|
return m_passmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline bool VSAPoint::IsPassmarkClockwiseOpening() const
|
||||||
|
{
|
||||||
|
return m_passmarkClockwiseOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_RELAXED_CONSTEXPR inline void VSAPoint::SetPassmarkClockwiseOpening(bool clockwise)
|
||||||
|
{
|
||||||
|
m_passmarkClockwiseOpening = clockwise;
|
||||||
|
}
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
#endif // VSAPOINT_H
|
#endif // VSAPOINT_H
|
||||||
|
|
|
@ -328,6 +328,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) //
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUMark, (QLatin1String("uMark"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUMark, (QLatin1String("uMark"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBoxMark, (QLatin1String("boxMark"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strBoxMark, (QLatin1String("boxMark"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strCheckMark, (QLatin1String("checkMark"))) // NOLINT
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
||||||
|
@ -342,14 +343,16 @@ auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
||||||
return strThree;
|
return strThree;
|
||||||
case PassmarkLineType::TMark:
|
case PassmarkLineType::TMark:
|
||||||
return *strTMark;
|
return *strTMark;
|
||||||
case PassmarkLineType::VMark:
|
case PassmarkLineType::ExternalVMark:
|
||||||
return *strVMark;
|
return *strVMark;
|
||||||
case PassmarkLineType::VMark2:
|
case PassmarkLineType::InternalVMark:
|
||||||
return *strVMark2;
|
return *strVMark2;
|
||||||
case PassmarkLineType::UMark:
|
case PassmarkLineType::UMark:
|
||||||
return *strUMark;
|
return *strUMark;
|
||||||
case PassmarkLineType::BoxMark:
|
case PassmarkLineType::BoxMark:
|
||||||
return *strBoxMark;
|
return *strBoxMark;
|
||||||
|
case PassmarkLineType::CheckMark:
|
||||||
|
return *strCheckMark;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +364,7 @@ auto PassmarkLineTypeToString(PassmarkLineType type) -> QString
|
||||||
auto StringToPassmarkLineType(const QString &value) -> PassmarkLineType
|
auto StringToPassmarkLineType(const QString &value) -> PassmarkLineType
|
||||||
{
|
{
|
||||||
const QStringList values{strOne, strTwo, strThree, *strTMark, *strVMark,
|
const QStringList values{strOne, strTwo, strThree, *strTMark, *strVMark,
|
||||||
*strVMark2, *strUMark, *strBoxMark};
|
*strVMark2, *strUMark, *strBoxMark, *strCheckMark};
|
||||||
|
|
||||||
switch(values.indexOf(value))
|
switch(values.indexOf(value))
|
||||||
{
|
{
|
||||||
|
@ -374,13 +377,15 @@ auto StringToPassmarkLineType(const QString &value) -> PassmarkLineType
|
||||||
case 3: // strTMark
|
case 3: // strTMark
|
||||||
return PassmarkLineType::TMark;
|
return PassmarkLineType::TMark;
|
||||||
case 4: // strVMark
|
case 4: // strVMark
|
||||||
return PassmarkLineType::VMark;
|
return PassmarkLineType::ExternalVMark;
|
||||||
case 5: // strVMark2
|
case 5: // strVMark2
|
||||||
return PassmarkLineType::VMark2;
|
return PassmarkLineType::InternalVMark;
|
||||||
case 6: // strUMark
|
case 6: // strUMark
|
||||||
return PassmarkLineType::UMark;
|
return PassmarkLineType::UMark;
|
||||||
case 7: // strBoxMark
|
case 7: // strBoxMark
|
||||||
return PassmarkLineType::BoxMark;
|
return PassmarkLineType::BoxMark;
|
||||||
|
case 8: // strCheckMark
|
||||||
|
return PassmarkLineType::CheckMark;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,10 +111,11 @@ enum class PassmarkLineType : quint8
|
||||||
TwoLines = 1,
|
TwoLines = 1,
|
||||||
ThreeLines = 2,
|
ThreeLines = 2,
|
||||||
TMark = 3,
|
TMark = 3,
|
||||||
VMark = 4,
|
ExternalVMark = 4,
|
||||||
VMark2 = 5,
|
InternalVMark = 5,
|
||||||
UMark = 6,
|
UMark = 6,
|
||||||
BoxMark = 7,
|
BoxMark = 7,
|
||||||
|
CheckMark = 8,
|
||||||
LAST_ONE_DO_NOT_USE
|
LAST_ONE_DO_NOT_USE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -63,6 +63,7 @@ struct VPiecePassmarkData
|
||||||
vsizetype passmarkIndex{-1}; // NOLINT(misc-non-private-member-variables-in-classes)
|
vsizetype passmarkIndex{-1}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
vidtype id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
vidtype id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
qreal globalPassmarkLength{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
qreal globalPassmarkLength{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
qreal globalPassmarkWidth{0}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
auto toJson() const -> QJsonObject;
|
auto toJson() const -> QJsonObject;
|
||||||
};
|
};
|
||||||
|
@ -104,6 +105,17 @@ public:
|
||||||
private:
|
private:
|
||||||
VPiecePassmarkData m_data{};
|
VPiecePassmarkData m_data{};
|
||||||
bool m_null{true};
|
bool m_null{true};
|
||||||
|
|
||||||
|
auto PassmarkIntersection(const QVector<QPointF> &path, QLineF line, qreal width) const -> QLineF;
|
||||||
|
|
||||||
|
auto PassmarkStraightforwardBaseLine(const QPointF &seamPassmarkSAPoint) const -> QVector<QLineF>;
|
||||||
|
auto PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const QPointF &seamPassmarkSAPoint,
|
||||||
|
const QVector<QPointF> &seamAllowance) const -> QVector<QLineF>;
|
||||||
|
auto PassmarkIntersectionBaseLine(const QVector<QPointF> &path, PassmarkSide side) const -> QVector<QLineF>;
|
||||||
|
auto PassmarkIntersection2BaseLine(const QVector<QPointF> &path, PassmarkSide side) const -> QVector<QLineF>;
|
||||||
|
|
||||||
|
auto CreatePassmarkLines(const QVector<QLineF> &lines, const QVector<QPointF> &seamAllowance,
|
||||||
|
PassmarkSide side) const -> QVector<QLineF>;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPASSMARK_H
|
#endif // VPASSMARK_H
|
||||||
|
|
|
@ -1116,6 +1116,7 @@ auto VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousI
|
||||||
passmarkData.passmarkIndex = passmarkIndex;
|
passmarkData.passmarkIndex = passmarkIndex;
|
||||||
passmarkData.id = path.at(passmarkIndex).GetId();
|
passmarkData.id = path.at(passmarkIndex).GetId();
|
||||||
passmarkData.globalPassmarkLength = ToPixel(GlobalPassmarkLength(data), *data->GetPatternUnit());
|
passmarkData.globalPassmarkLength = ToPixel(GlobalPassmarkLength(data), *data->GetPatternUnit());
|
||||||
|
passmarkData.globalPassmarkWidth = ToPixel(GlobalPassmarkWidth(data), *data->GetPatternUnit());
|
||||||
|
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -1202,6 +1203,40 @@ auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPiece::GlobalPassmarkWidth(const VContainer *data) const
|
||||||
|
{
|
||||||
|
QString passmarkWidthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkWidthVariable();
|
||||||
|
if (passmarkWidthVariable.isEmpty())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal width = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSharedPointer<VInternalVariable> var = data->GetVariable<VInternalVariable>(passmarkWidthVariable);
|
||||||
|
width = *var->GetValue();
|
||||||
|
|
||||||
|
if (VAbstractValApplication::VApp()->toPixel(width) <= accuracyPointOnLine)
|
||||||
|
{
|
||||||
|
const QString errorMsg = QObject::tr("Invalid global value for a passmark width. Piece '%1'. Width is "
|
||||||
|
"less than minimal allowed.")
|
||||||
|
.arg(GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &)
|
||||||
|
{
|
||||||
|
width = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
#if !defined(V_NO_ASSERT)
|
#if !defined(V_NO_ASSERT)
|
||||||
// Use for writing tests
|
// Use for writing tests
|
||||||
|
|
|
@ -173,6 +173,7 @@ private:
|
||||||
auto DBToJson(const VContainer *data) const -> QJsonObject;
|
auto DBToJson(const VContainer *data) const -> QJsonObject;
|
||||||
|
|
||||||
auto GlobalPassmarkLength(const VContainer *data) const -> qreal;
|
auto GlobalPassmarkLength(const VContainer *data) const -> qreal;
|
||||||
|
auto GlobalPassmarkWidth(const VContainer *data) const -> qreal;
|
||||||
|
|
||||||
void TestInternalPathCuttingPathIntersection(const VContainer *data) const;
|
void TestInternalPathCuttingPathIntersection(const VContainer *data) const;
|
||||||
void TestInternalPathsIntersections(const VContainer *data) const;
|
void TestInternalPathsIntersections(const VContainer *data) const;
|
||||||
|
|
|
@ -317,14 +317,44 @@ void VPieceNode::SetFormulaPassmarkLength(const QString &formula)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::GetFormulaPassmarkWidth() const -> QString
|
||||||
|
{
|
||||||
|
return d->m_formulaPassmarkWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPieceNode::SetFormulaPassmarkWidth(const QString &formula)
|
||||||
|
{
|
||||||
|
if (d->m_typeTool == Tool::NodePoint)
|
||||||
|
{
|
||||||
|
d->m_formulaPassmarkWidth = formula;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::GetFormulaPassmarkAngle() const -> QString
|
||||||
|
{
|
||||||
|
return d->m_formulaPassmarkAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPieceNode::SetFormulaPassmarkAngle(const QString &formula)
|
||||||
|
{
|
||||||
|
if (d->m_typeTool == Tool::NodePoint)
|
||||||
|
{
|
||||||
|
d->m_formulaPassmarkAngle = formula;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const -> qreal
|
auto VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const -> qreal
|
||||||
{
|
{
|
||||||
if (d->m_manualPassmarkLength)
|
if (d->m_manualPassmarkLength)
|
||||||
{
|
{
|
||||||
VFormula formula(d->m_formulaPassmarkLength, data);
|
VFormula formula(d->m_formulaPassmarkLength, data);
|
||||||
formula.setCheckZero(false);
|
formula.setCheckZero(true);
|
||||||
formula.setCheckLessThanZero(false);
|
formula.setCheckLessThanZero(true);
|
||||||
formula.Eval();
|
formula.Eval();
|
||||||
|
|
||||||
if (formula.error())
|
if (formula.error())
|
||||||
|
@ -349,6 +379,74 @@ auto VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const -> q
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::GetPassmarkWidth(const VContainer *data, Unit unit) const -> qreal
|
||||||
|
{
|
||||||
|
if (d->m_manualPassmarkWidth)
|
||||||
|
{
|
||||||
|
VFormula formula(d->m_formulaPassmarkWidth, data);
|
||||||
|
formula.setCheckZero(true);
|
||||||
|
formula.setCheckLessThanZero(false);
|
||||||
|
formula.Eval();
|
||||||
|
|
||||||
|
if (formula.error())
|
||||||
|
{
|
||||||
|
QString nodeName;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
nodeName = data->GetGObject(d->m_id)->name();
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString errorMsg = QObject::tr("Cannot calculate passmark width for point '%1'. Reason: %2.")
|
||||||
|
.arg(nodeName, formula.Reason());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToPixel(formula.getDoubleValue(), unit);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::GetPassmarkAngle(const VContainer *data) const -> qreal
|
||||||
|
{
|
||||||
|
if (d->m_manualPassmarkAngle)
|
||||||
|
{
|
||||||
|
VFormula formula(d->m_formulaPassmarkAngle, data);
|
||||||
|
formula.setCheckZero(false);
|
||||||
|
formula.setCheckLessThanZero(false);
|
||||||
|
formula.Eval();
|
||||||
|
|
||||||
|
if (formula.error())
|
||||||
|
{
|
||||||
|
QString nodeName;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
nodeName = data->GetGObject(d->m_id)->name();
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString errorMsg = QObject::tr("Cannot calculate passmark angle for point '%1'. Reason: %2.")
|
||||||
|
.arg(nodeName, formula.Reason());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return formula.getDoubleValue();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPieceNode::GetAngleType() const -> PieceNodeAngle
|
auto VPieceNode::GetAngleType() const -> PieceNodeAngle
|
||||||
{
|
{
|
||||||
|
@ -427,6 +525,18 @@ void VPieceNode::SetShowSecondPassmark(bool value)
|
||||||
d->m_isShowSecondPassmark = value;
|
d->m_isShowSecondPassmark = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::IsPassmarkClockwiseOpening() const -> bool
|
||||||
|
{
|
||||||
|
return d->m_isPassmarkClockwiseOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPieceNode::SetPassmarkClockwiseOpening(bool value)
|
||||||
|
{
|
||||||
|
d->m_isPassmarkClockwiseOpening = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPieceNode::IsCheckUniqueness() const -> bool
|
auto VPieceNode::IsCheckUniqueness() const -> bool
|
||||||
{
|
{
|
||||||
|
@ -451,6 +561,30 @@ void VPieceNode::SetManualPassmarkLength(bool value)
|
||||||
d->m_manualPassmarkLength = value;
|
d->m_manualPassmarkLength = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::IsManualPassmarkWidth() const -> bool
|
||||||
|
{
|
||||||
|
return d->m_manualPassmarkWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPieceNode::SetManualPassmarkWidth(bool value)
|
||||||
|
{
|
||||||
|
d->m_manualPassmarkWidth = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPieceNode::IsManualPassmarkAngle() const -> bool
|
||||||
|
{
|
||||||
|
return d->m_manualPassmarkAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPieceNode::SetManualPassmarkAngle(bool value)
|
||||||
|
{
|
||||||
|
d->m_manualPassmarkAngle = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPieceNode::IsTurnPoint() const -> bool
|
auto VPieceNode::IsTurnPoint() const -> bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,15 @@ public:
|
||||||
auto GetFormulaPassmarkLength() const -> QString;
|
auto GetFormulaPassmarkLength() const -> QString;
|
||||||
void SetFormulaPassmarkLength(const QString &formula);
|
void SetFormulaPassmarkLength(const QString &formula);
|
||||||
|
|
||||||
|
auto GetFormulaPassmarkWidth() const -> QString;
|
||||||
|
void SetFormulaPassmarkWidth(const QString &formula);
|
||||||
|
|
||||||
|
auto GetFormulaPassmarkAngle() const -> QString;
|
||||||
|
void SetFormulaPassmarkAngle(const QString &formula);
|
||||||
|
|
||||||
auto GetPassmarkLength(const VContainer *data, Unit unit) const -> qreal;
|
auto GetPassmarkLength(const VContainer *data, Unit unit) const -> qreal;
|
||||||
|
auto GetPassmarkWidth(const VContainer *data, Unit unit) const -> qreal;
|
||||||
|
auto GetPassmarkAngle(const VContainer *data) const -> qreal;
|
||||||
|
|
||||||
auto GetAngleType() const -> PieceNodeAngle;
|
auto GetAngleType() const -> PieceNodeAngle;
|
||||||
void SetAngleType(PieceNodeAngle type);
|
void SetAngleType(PieceNodeAngle type);
|
||||||
|
@ -103,12 +111,21 @@ public:
|
||||||
auto IsShowSecondPassmark() const -> bool;
|
auto IsShowSecondPassmark() const -> bool;
|
||||||
void SetShowSecondPassmark(bool value);
|
void SetShowSecondPassmark(bool value);
|
||||||
|
|
||||||
|
auto IsPassmarkClockwiseOpening() const -> bool;
|
||||||
|
void SetPassmarkClockwiseOpening(bool value);
|
||||||
|
|
||||||
auto IsCheckUniqueness() const -> bool;
|
auto IsCheckUniqueness() const -> bool;
|
||||||
void SetCheckUniqueness(bool value);
|
void SetCheckUniqueness(bool value);
|
||||||
|
|
||||||
auto IsManualPassmarkLength() const -> bool;
|
auto IsManualPassmarkLength() const -> bool;
|
||||||
void SetManualPassmarkLength(bool value);
|
void SetManualPassmarkLength(bool value);
|
||||||
|
|
||||||
|
auto IsManualPassmarkWidth() const -> bool;
|
||||||
|
void SetManualPassmarkWidth(bool value);
|
||||||
|
|
||||||
|
auto IsManualPassmarkAngle() const -> bool;
|
||||||
|
void SetManualPassmarkAngle(bool value);
|
||||||
|
|
||||||
auto IsTurnPoint() const -> bool;
|
auto IsTurnPoint() const -> bool;
|
||||||
void SetTurnPoint(bool value);
|
void SetTurnPoint(bool value);
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -92,6 +92,8 @@ public:
|
||||||
QString m_formulaWidthBefore{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString m_formulaWidthBefore{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString m_formulaWidthAfter{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString m_formulaWidthAfter{currentSeamAllowance}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QString m_formulaPassmarkLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
QString m_formulaPassmarkLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
QString m_formulaPassmarkWidth{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
QString m_formulaPassmarkAngle{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
PieceNodeAngle m_angleType{PieceNodeAngle::ByLength}; // NOLINT(misc-non-private-member-variables-in-classes)
|
PieceNodeAngle m_angleType{PieceNodeAngle::ByLength}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
|
@ -100,7 +102,8 @@ public:
|
||||||
PassmarkAngleType m_passmarkAngleType{// NOLINT(misc-non-private-member-variables-in-classes)
|
PassmarkAngleType m_passmarkAngleType{// NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
PassmarkAngleType::Straightforward};
|
PassmarkAngleType::Straightforward};
|
||||||
|
|
||||||
bool m_isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool m_isShowSecondPassmark{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
bool m_isPassmarkClockwiseOpening{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point.
|
/** @brief m_checkUniqueness need in cases where different points have the same coordinates, become one point.
|
||||||
* By default the check enabled. Disable it only if in a path cannot be used just one point. For example if
|
* By default the check enabled. Disable it only if in a path cannot be used just one point. For example if
|
||||||
|
@ -108,6 +111,8 @@ public:
|
||||||
bool m_checkUniqueness{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool m_checkUniqueness{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
bool m_manualPassmarkLength{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool m_manualPassmarkLength{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
bool m_manualPassmarkWidth{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
bool m_manualPassmarkAngle{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
bool m_turnPoint{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool m_turnPoint{true}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
|
@ -115,7 +120,7 @@ private:
|
||||||
Q_DISABLE_ASSIGN_MOVE(VPieceNodeData) // NOLINT
|
Q_DISABLE_ASSIGN_MOVE(VPieceNodeData) // NOLINT
|
||||||
|
|
||||||
static constexpr quint32 streamHeader = 0x2198CBC8; // CRC-32Q string "VPieceNodeData"
|
static constexpr quint32 streamHeader = 0x2198CBC8; // CRC-32Q string "VPieceNodeData"
|
||||||
static constexpr quint16 classVersion = 2;
|
static constexpr quint16 classVersion = 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
// See https://stackoverflow.com/a/46719572/3045403
|
// See https://stackoverflow.com/a/46719572/3045403
|
||||||
|
@ -133,7 +138,8 @@ inline auto operator<<(QDataStream &out, const VPieceNodeData &p) -> QDataStream
|
||||||
out << p.m_id << p.m_typeTool << p.m_reverse << p.m_excluded << p.m_isPassmark << p.m_formulaWidthBefore
|
out << p.m_id << p.m_typeTool << p.m_reverse << p.m_excluded << p.m_isPassmark << p.m_formulaWidthBefore
|
||||||
<< p.m_formulaWidthAfter << p.m_formulaPassmarkLength << p.m_angleType << p.m_passmarkLineType
|
<< p.m_formulaWidthAfter << p.m_formulaPassmarkLength << p.m_angleType << p.m_passmarkLineType
|
||||||
<< p.m_passmarkAngleType << p.m_isShowSecondPassmark << p.m_checkUniqueness << p.m_manualPassmarkLength
|
<< p.m_passmarkAngleType << p.m_isShowSecondPassmark << p.m_checkUniqueness << p.m_manualPassmarkLength
|
||||||
<< p.m_turnPoint;
|
<< p.m_turnPoint << p.m_formulaPassmarkWidth << p.m_formulaPassmarkAngle << p.m_manualPassmarkWidth
|
||||||
|
<< p.m_manualPassmarkAngle << p.m_isPassmarkClockwiseOpening;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +190,12 @@ inline auto operator>>(QDataStream &in, VPieceNodeData &p) -> QDataStream &
|
||||||
in >> p.m_turnPoint;
|
in >> p.m_turnPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actualClassVersion >= 3)
|
||||||
|
{
|
||||||
|
in >> p.m_formulaPassmarkWidth >> p.m_formulaPassmarkAngle >> p.m_manualPassmarkWidth >>
|
||||||
|
p.m_manualPassmarkAngle >> p.m_isPassmarkClockwiseOpening;
|
||||||
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,10 +212,8 @@ auto IntersectionWithCuttingContour(const QVector<QPointF> &cuttingPath, const Q
|
||||||
*connection = first;
|
*connection = first;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return VAbstractCurve::CurveIntersectAxis(first, FindTipDirection(points), cuttingPath, connection);
|
||||||
return VAbstractCurve::CurveIntersectAxis(first, FindTipDirection(points), cuttingPath, connection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1143,6 +1141,11 @@ auto VPiecePath::PreparePointEkv(const VPieceNode &node, const VContainer *data)
|
||||||
p.SetAngleType(node.GetAngleType());
|
p.SetAngleType(node.GetAngleType());
|
||||||
p.SetManualPasskmarkLength(node.IsManualPassmarkLength());
|
p.SetManualPasskmarkLength(node.IsManualPassmarkLength());
|
||||||
p.SetPasskmarkLength(node.GetPassmarkLength(data, *data->GetPatternUnit()));
|
p.SetPasskmarkLength(node.GetPassmarkLength(data, *data->GetPatternUnit()));
|
||||||
|
p.SetManualPasskmarkWidth(node.IsManualPassmarkWidth());
|
||||||
|
p.SetPasskmarkWidth(node.GetPassmarkWidth(data, *data->GetPatternUnit()));
|
||||||
|
p.SetManualPasskmarkAngle(node.IsManualPassmarkAngle());
|
||||||
|
p.SetPasskmarkAngle(node.GetPassmarkAngle(data));
|
||||||
|
p.SetPassmarkClockwiseOpening(node.IsPassmarkClockwiseOpening());
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,11 @@ void AbstractTest::PassmarkDataFromJson(const QString &json, VPiecePassmarkData
|
||||||
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("globalPassmarkLength"), globalPassmarkLength,
|
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("globalPassmarkLength"), globalPassmarkLength,
|
||||||
QString::number(NULL_ID));
|
QString::number(NULL_ID));
|
||||||
data.globalPassmarkLength = globalPassmarkLength;
|
data.globalPassmarkLength = globalPassmarkLength;
|
||||||
|
|
||||||
|
qreal globalPassmarkWidth;
|
||||||
|
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("globalPassmarkWidth"), globalPassmarkWidth,
|
||||||
|
QString::number(NULL_ID));
|
||||||
|
data.globalPassmarkWidth = globalPassmarkWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -310,6 +310,50 @@ inline auto AbstractTest::PointFromJson(const QJsonObject &pointObject, VSAPoint
|
||||||
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("angle"), angleType,
|
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("angle"), angleType,
|
||||||
QString::number(static_cast<int>(PieceNodeAngle::ByLength)));
|
QString::number(static_cast<int>(PieceNodeAngle::ByLength)));
|
||||||
point.SetAngleType(angleType);
|
point.SetAngleType(angleType);
|
||||||
|
|
||||||
|
bool manualPassmarkLength = false;
|
||||||
|
AbstractTest::ReadBooleanValue(pointObject, QLatin1String("manualPassmarkLength"), manualPassmarkLength,
|
||||||
|
QStringLiteral("0"));
|
||||||
|
point.SetManualPasskmarkLength(manualPassmarkLength);
|
||||||
|
|
||||||
|
if (manualPassmarkLength)
|
||||||
|
{
|
||||||
|
qreal passmarkLength = 0;
|
||||||
|
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("passmarkLength"), passmarkLength,
|
||||||
|
QStringLiteral("0"));
|
||||||
|
point.SetPasskmarkLength(passmarkLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool manualPassmarkWidth = false;
|
||||||
|
AbstractTest::ReadBooleanValue(pointObject, QLatin1String("manualPassmarkWidth"), manualPassmarkWidth,
|
||||||
|
QStringLiteral("0"));
|
||||||
|
point.SetManualPasskmarkWidth(manualPassmarkWidth);
|
||||||
|
|
||||||
|
if (manualPassmarkWidth)
|
||||||
|
{
|
||||||
|
qreal passmarkWidth = 0;
|
||||||
|
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("passmarkWidth"), passmarkWidth, QStringLiteral("0"));
|
||||||
|
point.SetPasskmarkWidth(passmarkWidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool passmarkClockwiseOpening = false;
|
||||||
|
AbstractTest::ReadBooleanValue(pointObject, QLatin1String("passmarkClockwiseOpening"), passmarkClockwiseOpening,
|
||||||
|
QStringLiteral("0"));
|
||||||
|
point.SetPassmarkClockwiseOpening(passmarkClockwiseOpening);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool manualPassmarkAngle = false;
|
||||||
|
AbstractTest::ReadBooleanValue(pointObject, QLatin1String("manualPassmarkAngle"), manualPassmarkAngle,
|
||||||
|
QStringLiteral("0"));
|
||||||
|
point.SetManualPasskmarkAngle(manualPassmarkAngle);
|
||||||
|
|
||||||
|
if (manualPassmarkAngle)
|
||||||
|
{
|
||||||
|
qreal passmarkAngle = 0;
|
||||||
|
AbstractTest::ReadDoubleValue(pointObject, QStringLiteral("passmarkAngle"), passmarkAngle, QStringLiteral("0"));
|
||||||
|
point.SetPasskmarkAngle(passmarkAngle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -180,7 +180,7 @@ auto RowNode(QListWidget *listWidget, int i) -> VPieceNode
|
||||||
|
|
||||||
if (i < 0 || i >= listWidget->count())
|
if (i < 0 || i >= listWidget->count())
|
||||||
{
|
{
|
||||||
return VPieceNode();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const QListWidgetItem *rowItem = listWidget->item(i);
|
const QListWidgetItem *rowItem = listWidget->item(i);
|
||||||
|
@ -651,10 +651,10 @@ auto GetNodeName(const VContainer *data, const VPieceNode &node, bool showPassma
|
||||||
case PassmarkLineType::TMark:
|
case PassmarkLineType::TMark:
|
||||||
name += QStringLiteral("┴");
|
name += QStringLiteral("┴");
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::VMark:
|
case PassmarkLineType::ExternalVMark:
|
||||||
name += QStringLiteral("⊼");
|
name += QStringLiteral("⊼");
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::VMark2:
|
case PassmarkLineType::InternalVMark:
|
||||||
name += QStringLiteral("⊽");
|
name += QStringLiteral("⊽");
|
||||||
break;
|
break;
|
||||||
case PassmarkLineType::UMark:
|
case PassmarkLineType::UMark:
|
||||||
|
@ -663,6 +663,9 @@ auto GetNodeName(const VContainer *data, const VPieceNode &node, bool showPassma
|
||||||
case PassmarkLineType::BoxMark:
|
case PassmarkLineType::BoxMark:
|
||||||
name += QStringLiteral("⎕");
|
name += QStringLiteral("⎕");
|
||||||
break;
|
break;
|
||||||
|
case PassmarkLineType::CheckMark:
|
||||||
|
name += QStringLiteral("✓");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,17 @@
|
||||||
#include "../../../tools/vtoolseamallowance.h"
|
#include "../../../tools/vtoolseamallowance.h"
|
||||||
#include "../../support/dialogeditwrongformula.h"
|
#include "../../support/dialogeditwrongformula.h"
|
||||||
#include "../vmisc/vmodifierkey.h"
|
#include "../vmisc/vmodifierkey.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
|
#include "../vmisc/backport/qscopeguard.h"
|
||||||
|
#else
|
||||||
|
#include <QScopeGuard>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -64,7 +71,9 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
|
||||||
m_timerWidthBefore(new QTimer(this)),
|
m_timerWidthBefore(new QTimer(this)),
|
||||||
m_timerWidthAfter(new QTimer(this)),
|
m_timerWidthAfter(new QTimer(this)),
|
||||||
m_timerVisible(new QTimer(this)),
|
m_timerVisible(new QTimer(this)),
|
||||||
m_timerPassmarkLength(new QTimer(this))
|
m_timerPassmarkLength(new QTimer(this)),
|
||||||
|
m_timerPassmarkWidth(new QTimer(this)),
|
||||||
|
m_timerPassmarkAngle(new QTimer(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitOkCancel(ui);
|
InitOkCancel(ui);
|
||||||
|
@ -265,7 +274,7 @@ void DialogPiecePath::CheckState()
|
||||||
}
|
}
|
||||||
|
|
||||||
const int tabPassmarksIndex = ui->tabWidget->indexOf(ui->tabPassmarks);
|
const int tabPassmarksIndex = ui->tabWidget->indexOf(ui->tabPassmarks);
|
||||||
if (m_flagFormulaPassmarkLength)
|
if (m_flagFormulaPassmarkLength && m_flagFormulaPassmarkWidth && m_flagFormulaPassmarkAngle)
|
||||||
{
|
{
|
||||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, QIcon());
|
ui->tabWidget->setTabIcon(tabPassmarksIndex, QIcon());
|
||||||
}
|
}
|
||||||
|
@ -276,7 +285,8 @@ void DialogPiecePath::CheckState()
|
||||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->comboBoxPassmarks->setEnabled(m_flagFormulaPassmarkLength);
|
ui->comboBoxPassmarks->setEnabled(m_flagFormulaPassmarkLength && m_flagFormulaPassmarkWidth &&
|
||||||
|
m_flagFormulaPassmarkAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -516,134 +526,72 @@ void DialogPiecePath::PassmarkChanged(int index)
|
||||||
ui->groupBoxMarkType->setDisabled(true);
|
ui->groupBoxMarkType->setDisabled(true);
|
||||||
ui->groupBoxAngleType->setDisabled(true);
|
ui->groupBoxAngleType->setDisabled(true);
|
||||||
ui->groupBoxManualLength->setDisabled(true);
|
ui->groupBoxManualLength->setDisabled(true);
|
||||||
|
ui->groupBoxManualWidth->setDisabled(true);
|
||||||
|
ui->groupBoxManualAngle->setDisabled(true);
|
||||||
|
|
||||||
|
ui->labelEditPassmarkLength->setDisabled(true);
|
||||||
|
ui->labelEditPassmarkWidth->setDisabled(true);
|
||||||
|
ui->labelEditPassmarkAngle->setDisabled(true);
|
||||||
|
|
||||||
|
ui->checkBoxClockwiseOpening->setDisabled(true);
|
||||||
ui->checkBoxShowSecondPassmark->setDisabled(true);
|
ui->checkBoxShowSecondPassmark->setDisabled(true);
|
||||||
|
|
||||||
|
ui->checkBoxClockwiseOpening->blockSignals(true);
|
||||||
ui->checkBoxShowSecondPassmark->blockSignals(true);
|
ui->checkBoxShowSecondPassmark->blockSignals(true);
|
||||||
|
|
||||||
ui->groupBoxManualLength->blockSignals(true);
|
ui->groupBoxManualLength->blockSignals(true);
|
||||||
|
ui->groupBoxManualWidth->blockSignals(true);
|
||||||
|
ui->groupBoxManualAngle->blockSignals(true);
|
||||||
ui->groupBoxMarkType->blockSignals(true);
|
ui->groupBoxMarkType->blockSignals(true);
|
||||||
ui->groupBoxAngleType->blockSignals(true);
|
ui->groupBoxAngleType->blockSignals(true);
|
||||||
|
|
||||||
|
ui->checkBoxClockwiseOpening->setChecked(false);
|
||||||
|
|
||||||
ui->groupBoxManualLength->setChecked(false);
|
ui->groupBoxManualLength->setChecked(false);
|
||||||
|
ui->groupBoxManualWidth->setChecked(false);
|
||||||
|
ui->groupBoxManualAngle->setChecked(false);
|
||||||
|
|
||||||
if (index != -1)
|
auto EnableSignals = qScopeGuard(
|
||||||
{
|
[this]
|
||||||
const VPiecePath path = CreatePath();
|
|
||||||
const int nodeIndex = path.indexOfNode(ui->comboBoxPassmarks->currentData().toUInt());
|
|
||||||
if (nodeIndex != -1)
|
|
||||||
{
|
{
|
||||||
const VPieceNode &node = path.at(nodeIndex);
|
ui->checkBoxClockwiseOpening->blockSignals(false);
|
||||||
|
ui->checkBoxShowSecondPassmark->blockSignals(false);
|
||||||
|
ui->groupBoxManualLength->blockSignals(false);
|
||||||
|
ui->groupBoxManualWidth->blockSignals(false);
|
||||||
|
ui->groupBoxManualAngle->blockSignals(false);
|
||||||
|
ui->groupBoxMarkType->blockSignals(false);
|
||||||
|
ui->groupBoxAngleType->blockSignals(false);
|
||||||
|
});
|
||||||
|
|
||||||
// Passmark length
|
if (index == -1)
|
||||||
ui->groupBoxManualLength->setEnabled(true);
|
{
|
||||||
|
return;
|
||||||
if (node.IsManualPassmarkLength())
|
|
||||||
{
|
|
||||||
ui->groupBoxManualLength->setChecked(true);
|
|
||||||
|
|
||||||
QString passmarkLength = node.GetFormulaPassmarkLength();
|
|
||||||
passmarkLength = VAbstractApplication::VApp()->TrVars()
|
|
||||||
->FormulaToUser(passmarkLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
|
||||||
if (passmarkLength.length() > 80)// increase height if needed.
|
|
||||||
{
|
|
||||||
this->DeployPassmarkLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (passmarkLength.isEmpty())
|
|
||||||
{
|
|
||||||
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
|
||||||
ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
|
||||||
ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
|
||||||
|
|
||||||
// Line type
|
|
||||||
ui->groupBoxMarkType->setEnabled(true);
|
|
||||||
|
|
||||||
switch(node.GetPassmarkLineType())
|
|
||||||
{
|
|
||||||
case PassmarkLineType::OneLine:
|
|
||||||
ui->radioButtonOneLine->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::TwoLines:
|
|
||||||
ui->radioButtonTwoLines->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::ThreeLines:
|
|
||||||
ui->radioButtonThreeLines->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::TMark:
|
|
||||||
ui->radioButtonTMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::VMark:
|
|
||||||
ui->radioButtonVMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::VMark2:
|
|
||||||
ui->radioButtonVMark2->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::UMark:
|
|
||||||
ui->radioButtonUMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::BoxMark:
|
|
||||||
ui->radioButtonBoxMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Angle type
|
|
||||||
ui->groupBoxAngleType->setEnabled(true);
|
|
||||||
|
|
||||||
switch(node.GetPassmarkAngleType())
|
|
||||||
{
|
|
||||||
case PassmarkAngleType::Straightforward:
|
|
||||||
ui->radioButtonStraightforward->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Bisector:
|
|
||||||
ui->radioButtonBisector->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection:
|
|
||||||
ui->radioButtonIntersection->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::IntersectionOnlyLeft:
|
|
||||||
ui->radioButtonIntersectionOnlyLeft->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::IntersectionOnlyRight:
|
|
||||||
ui->radioButtonIntersectionOnlyRight->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2:
|
|
||||||
ui->radioButtonIntersection2->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2OnlyLeft:
|
|
||||||
ui->radioButtonIntersection2OnlyLeft->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2OnlyRight:
|
|
||||||
ui->radioButtonIntersection2OnlyRight->setChecked(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the second option
|
|
||||||
ui->checkBoxShowSecondPassmark->setEnabled(true);
|
|
||||||
ui->checkBoxShowSecondPassmark->setChecked(node.IsShowSecondPassmark());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->checkBoxShowSecondPassmark->blockSignals(false);
|
const VPiecePath path = CreatePath();
|
||||||
|
const int nodeIndex = path.indexOfNode(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (nodeIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ui->groupBoxManualLength->blockSignals(false);
|
const VPieceNode &node = path.at(nodeIndex);
|
||||||
ui->groupBoxMarkType->blockSignals(false);
|
|
||||||
ui->groupBoxAngleType->blockSignals(false);
|
InitPassmarkLengthFormula(node);
|
||||||
|
InitPassmarkWidthFormula(node);
|
||||||
|
InitPassmarkAngleFormula(node);
|
||||||
|
InitPassmarkShapeType(node);
|
||||||
|
InitPassmarkAngleType(node);
|
||||||
|
|
||||||
|
if (node.GetPassmarkLineType() == PassmarkLineType::CheckMark)
|
||||||
|
{
|
||||||
|
ui->checkBoxClockwiseOpening->setEnabled(true);
|
||||||
|
ui->checkBoxClockwiseOpening->setChecked(node.IsPassmarkClockwiseOpening());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the second option
|
||||||
|
ui->checkBoxShowSecondPassmark->setEnabled(true);
|
||||||
|
ui->checkBoxShowSecondPassmark->setChecked(node.IsShowSecondPassmark());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -700,11 +648,11 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id)
|
||||||
}
|
}
|
||||||
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonVMark))
|
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonVMark))
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::VMark;
|
lineType = PassmarkLineType::ExternalVMark;
|
||||||
}
|
}
|
||||||
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonVMark2))
|
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonVMark2))
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::VMark2;
|
lineType = PassmarkLineType::InternalVMark;
|
||||||
}
|
}
|
||||||
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonUMark))
|
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonUMark))
|
||||||
{
|
{
|
||||||
|
@ -714,6 +662,10 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id)
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::BoxMark;
|
lineType = PassmarkLineType::BoxMark;
|
||||||
}
|
}
|
||||||
|
else if (id == ui->buttonGroupMarkType->id(ui->radioButtonCheckMark))
|
||||||
|
{
|
||||||
|
lineType = PassmarkLineType::CheckMark;
|
||||||
|
}
|
||||||
|
|
||||||
rowNode.SetPassmarkLineType(lineType);
|
rowNode.SetPassmarkLineType(lineType);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
@ -796,6 +748,24 @@ void DialogPiecePath::PassmarkShowSecondChanged(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::PassmarkClockwiseOrientationChanged(int state)
|
||||||
|
{
|
||||||
|
const int i = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (i != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetPassmarkClockwiseOpening(state);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
ListChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::EvalWidth()
|
void DialogPiecePath::EvalWidth()
|
||||||
{
|
{
|
||||||
|
@ -913,19 +883,94 @@ void DialogPiecePath::EvalVisible()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::EvalPassmarkLength()
|
void DialogPiecePath::EvalPassmarkLength()
|
||||||
{
|
{
|
||||||
FormulaData formulaData;
|
if (ui->groupBoxManualLength->isChecked())
|
||||||
formulaData.formula = ui->plainTextEditPassmarkLength->toPlainText();
|
{
|
||||||
formulaData.variables = data->DataVariables();
|
if (ui->comboBoxPassmarks->count() > 0)
|
||||||
formulaData.labelEditFormula = ui->labelEditPassmarkLength;
|
{
|
||||||
formulaData.labelResult = ui->labelResultPassmarkLength;
|
FormulaData formulaData;
|
||||||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
formulaData.formula = ui->plainTextEditPassmarkLength->toPlainText();
|
||||||
formulaData.checkZero = false;
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.checkLessThanZero = false;
|
formulaData.labelEditFormula = ui->labelEditPassmarkLength;
|
||||||
|
formulaData.labelResult = ui->labelResultPassmarkLength;
|
||||||
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
formulaData.checkZero = true;
|
||||||
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, m_flagFormulaPassmarkLength);
|
Eval(formulaData, m_flagFormulaPassmarkLength);
|
||||||
|
|
||||||
UpdateNodePassmarkLength(VTranslateVars::TryFormulaFromUser(
|
UpdateNodePassmarkLength(
|
||||||
ui->plainTextEditPassmarkLength->toPlainText(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
VTranslateVars::TryFormulaFromUser(ui->plainTextEditPassmarkLength->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeColor(ui->labelEditPassmarkLength, OkColor(this));
|
||||||
|
ui->labelResultPassmarkLength->setText(tr("<Empty>"));
|
||||||
|
m_flagFormulaPassmarkLength = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::EvalPassmarkWidth()
|
||||||
|
{
|
||||||
|
if (ui->groupBoxManualWidth->isChecked())
|
||||||
|
{
|
||||||
|
if (ui->comboBoxPassmarks->count() > 0)
|
||||||
|
{
|
||||||
|
FormulaData formulaData;
|
||||||
|
formulaData.formula = ui->plainTextEditPassmarkWidth->toPlainText();
|
||||||
|
formulaData.variables = data->DataVariables();
|
||||||
|
formulaData.labelEditFormula = ui->labelEditPassmarkWidth;
|
||||||
|
formulaData.labelResult = ui->labelResultPassmarkWidth;
|
||||||
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
formulaData.checkZero = true;
|
||||||
|
formulaData.checkLessThanZero = false;
|
||||||
|
|
||||||
|
Eval(formulaData, m_flagFormulaPassmarkWidth);
|
||||||
|
|
||||||
|
UpdateNodePassmarkWidth(
|
||||||
|
VTranslateVars::TryFormulaFromUser(ui->plainTextEditPassmarkWidth->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeColor(ui->labelEditPassmarkWidth, OkColor(this));
|
||||||
|
ui->labelResultPassmarkWidth->setText(tr("<Empty>"));
|
||||||
|
m_flagFormulaPassmarkWidth = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::EvalPassmarkAngle()
|
||||||
|
{
|
||||||
|
if (ui->groupBoxManualWidth->isChecked())
|
||||||
|
{
|
||||||
|
if (ui->comboBoxPassmarks->count() > 0)
|
||||||
|
{
|
||||||
|
FormulaData formulaData;
|
||||||
|
formulaData.formula = ui->plainTextEditPassmarkAngle->toPlainText();
|
||||||
|
formulaData.variables = data->DataVariables();
|
||||||
|
formulaData.labelEditFormula = ui->labelEditPassmarkAngle;
|
||||||
|
formulaData.labelResult = ui->labelResultPassmarkAngle;
|
||||||
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
formulaData.checkZero = false;
|
||||||
|
formulaData.checkLessThanZero = false;
|
||||||
|
|
||||||
|
Eval(formulaData, m_flagFormulaPassmarkAngle);
|
||||||
|
|
||||||
|
UpdateNodePassmarkAngle(
|
||||||
|
VTranslateVars::TryFormulaFromUser(ui->plainTextEditPassmarkAngle->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeColor(ui->labelEditPassmarkAngle, OkColor(this));
|
||||||
|
ui->labelResultPassmarkAngle->setText(tr("<Empty>"));
|
||||||
|
m_flagFormulaPassmarkAngle = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -995,6 +1040,32 @@ void DialogPiecePath::FXPassmarkLength()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::FXPassmarkWidth()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit passmark width"));
|
||||||
|
dialog->SetFormula(GetFormulaPassmarkWidth());
|
||||||
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetFormulaPassmarkWidth(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::FXPassmarkAngle()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit passmark angle"));
|
||||||
|
dialog->SetFormula(GetFormulaPassmarkAngle());
|
||||||
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetFormulaPassmarkAngle(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::DeployWidthFormulaTextEdit()
|
void DialogPiecePath::DeployWidthFormulaTextEdit()
|
||||||
{
|
{
|
||||||
|
@ -1025,6 +1096,18 @@ void DialogPiecePath::DeployPassmarkLength()
|
||||||
DeployFormula(this, ui->plainTextEditPassmarkLength, ui->pushButtonGrowPassmarkLength, m_formulaBasePassmarkLength);
|
DeployFormula(this, ui->plainTextEditPassmarkLength, ui->pushButtonGrowPassmarkLength, m_formulaBasePassmarkLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::DeployPassmarkWidth()
|
||||||
|
{
|
||||||
|
DeployFormula(this, ui->plainTextEditPassmarkWidth, ui->pushButtonGrowPassmarkWidth, m_formulaBasePassmarkWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::DeployPassmarkAngle()
|
||||||
|
{
|
||||||
|
DeployFormula(this, ui->plainTextEditPassmarkAngle, ui->pushButtonGrowPassmarkAngle, m_formulaBasePassmarkAngle);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::SetMoveControls()
|
void DialogPiecePath::SetMoveControls()
|
||||||
{
|
{
|
||||||
|
@ -1171,14 +1254,43 @@ void DialogPiecePath::InitSeamAllowanceTab()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::InitPassmarksTab()
|
void DialogPiecePath::InitPassmarksTab()
|
||||||
{
|
{
|
||||||
|
// Length formula
|
||||||
this->m_formulaBasePassmarkLength = ui->plainTextEditPassmarkLength->height();
|
this->m_formulaBasePassmarkLength = ui->plainTextEditPassmarkLength->height();
|
||||||
ui->plainTextEditPassmarkLength->installEventFilter(this);
|
ui->plainTextEditPassmarkLength->installEventFilter(this);
|
||||||
|
|
||||||
m_timerPassmarkLength->setSingleShot(true);
|
m_timerPassmarkLength->setSingleShot(true);
|
||||||
|
|
||||||
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogPiecePath::EvalPassmarkLength);
|
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogPiecePath::EvalPassmarkLength);
|
||||||
|
|
||||||
connect(ui->groupBoxManualLength, &QGroupBox::toggled, this, &DialogPiecePath::EnabledManualPassmarkLength);
|
connect(ui->groupBoxManualLength, &QGroupBox::toggled, this, &DialogPiecePath::EnabledManualPassmarkLength);
|
||||||
|
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogPiecePath::FXPassmarkLength);
|
||||||
|
connect(ui->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkLength->start(formulaTimerTimeout); });
|
||||||
|
connect(ui->pushButtonGrowPassmarkLength, &QPushButton::clicked, this, &DialogPiecePath::DeployPassmarkLength);
|
||||||
|
|
||||||
|
// Width formula
|
||||||
|
this->m_formulaBasePassmarkWidth = ui->plainTextEditPassmarkWidth->height();
|
||||||
|
ui->plainTextEditPassmarkWidth->installEventFilter(this);
|
||||||
|
m_timerPassmarkWidth->setSingleShot(true);
|
||||||
|
|
||||||
|
connect(m_timerPassmarkWidth, &QTimer::timeout, this, &DialogPiecePath::EvalPassmarkWidth);
|
||||||
|
connect(ui->groupBoxManualWidth, &QGroupBox::toggled, this, &DialogPiecePath::EnabledManualPassmarkWidth);
|
||||||
|
connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPiecePath::FXPassmarkWidth);
|
||||||
|
connect(ui->plainTextEditPassmarkWidth, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkWidth->start(formulaTimerTimeout); });
|
||||||
|
connect(ui->pushButtonGrowPassmarkWidth, &QPushButton::clicked, this, &DialogPiecePath::DeployPassmarkWidth);
|
||||||
|
|
||||||
|
// Angle formula
|
||||||
|
this->m_formulaBasePassmarkAngle = ui->plainTextEditPassmarkAngle->height();
|
||||||
|
ui->plainTextEditPassmarkAngle->installEventFilter(this);
|
||||||
|
m_timerPassmarkAngle->setSingleShot(true);
|
||||||
|
|
||||||
|
connect(m_timerPassmarkAngle, &QTimer::timeout, this, &DialogPiecePath::EvalPassmarkAngle);
|
||||||
|
connect(ui->groupBoxManualAngle, &QGroupBox::toggled, this, &DialogPiecePath::EnabledManualPassmarkAngle);
|
||||||
|
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogPiecePath::FXPassmarkAngle);
|
||||||
|
connect(ui->plainTextEditPassmarkAngle, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkAngle->start(formulaTimerTimeout); });
|
||||||
|
connect(ui->pushButtonGrowPassmarkAngle, &QPushButton::clicked, this, &DialogPiecePath::DeployPassmarkAngle);
|
||||||
|
|
||||||
|
// notch list
|
||||||
InitPassmarksList();
|
InitPassmarksList();
|
||||||
connect(ui->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogPiecePath::PassmarkChanged);
|
this, &DialogPiecePath::PassmarkChanged);
|
||||||
|
@ -1195,14 +1307,8 @@ void DialogPiecePath::InitPassmarksTab()
|
||||||
|
|
||||||
connect(ui->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
connect(ui->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||||
&DialogPiecePath::PassmarkShowSecondChanged);
|
&DialogPiecePath::PassmarkShowSecondChanged);
|
||||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogPiecePath::FXPassmarkLength);
|
connect(ui->checkBoxClockwiseOpening, &QCheckBox::stateChanged, this,
|
||||||
|
&DialogPiecePath::PassmarkClockwiseOrientationChanged);
|
||||||
connect(ui->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this, [this]()
|
|
||||||
{
|
|
||||||
m_timerPassmarkLength->start(formulaTimerTimeout);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->pushButtonGrowPassmarkLength, &QPushButton::clicked, this, &DialogPiecePath::DeployPassmarkLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1501,6 +1607,38 @@ void DialogPiecePath::UpdateNodePassmarkLength(const QString &formula)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::UpdateNodePassmarkWidth(const QString &formula)
|
||||||
|
{
|
||||||
|
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetFormulaPassmarkWidth(formula);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::UpdateNodePassmarkAngle(const QString &formula)
|
||||||
|
{
|
||||||
|
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetFormulaPassmarkAngle(formula);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::EnabledManualPassmarkLength()
|
void DialogPiecePath::EnabledManualPassmarkLength()
|
||||||
{
|
{
|
||||||
|
@ -1513,11 +1651,66 @@ void DialogPiecePath::EnabledManualPassmarkLength()
|
||||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetManualPassmarkLength(ui->groupBoxManualLength->isChecked());
|
rowNode.SetManualPassmarkLength(ui->groupBoxManualLength->isChecked());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
ui->toolButtonExprLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->plainTextEditPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->labelEditPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->label_8->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
|
||||||
EvalPassmarkLength();
|
EvalPassmarkLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::EnabledManualPassmarkWidth()
|
||||||
|
{
|
||||||
|
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetManualPassmarkWidth(ui->groupBoxManualWidth->isChecked());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
ui->toolButtonExprWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->plainTextEditPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->labelEditPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->label_4->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
|
||||||
|
EvalPassmarkWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::EnabledManualPassmarkAngle()
|
||||||
|
{
|
||||||
|
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetManualPassmarkAngle(ui->groupBoxManualAngle->isChecked());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
ui->toolButtonExprAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->plainTextEditPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->labelEditPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->label_7->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
|
||||||
|
EvalPassmarkAngle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
||||||
{
|
{
|
||||||
|
@ -1754,6 +1947,48 @@ void DialogPiecePath::SetFormulaPassmarkLength(const QString &formula)
|
||||||
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto DialogPiecePath::GetFormulaPassmarkWidth() const -> QString
|
||||||
|
{
|
||||||
|
QString formula = ui->plainTextEditPassmarkWidth->toPlainText();
|
||||||
|
return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::SetFormulaPassmarkWidth(const QString &formula)
|
||||||
|
{
|
||||||
|
const QString f = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed.
|
||||||
|
if (f.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployPassmarkWidth();
|
||||||
|
}
|
||||||
|
ui->plainTextEditPassmarkWidth->setPlainText(f);
|
||||||
|
MoveCursorToEnd(ui->plainTextEditPassmarkWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto DialogPiecePath::GetFormulaPassmarkAngle() const -> QString
|
||||||
|
{
|
||||||
|
QString formula = ui->plainTextEditPassmarkWidth->toPlainText();
|
||||||
|
return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::SetFormulaPassmarkAngle(const QString &formula)
|
||||||
|
{
|
||||||
|
const QString f = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed.
|
||||||
|
if (f.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployPassmarkAngle();
|
||||||
|
}
|
||||||
|
ui->plainTextEditPassmarkAngle->setPlainText(f);
|
||||||
|
MoveCursorToEnd(ui->plainTextEditPassmarkAngle);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPiecePath::RefreshPathList(const VPiecePath &path)
|
void DialogPiecePath::RefreshPathList(const VPiecePath &path)
|
||||||
{
|
{
|
||||||
|
@ -1765,3 +2000,218 @@ void DialogPiecePath::RefreshPathList(const VPiecePath &path)
|
||||||
}
|
}
|
||||||
ui->listWidget->blockSignals(false);
|
ui->listWidget->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarkLengthFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch depth
|
||||||
|
ui->groupBoxManualLength->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkLength())
|
||||||
|
{
|
||||||
|
ui->groupBoxManualLength->setChecked(true);
|
||||||
|
|
||||||
|
ui->toolButtonExprLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->plainTextEditPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->labelEditPassmarkLength->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
ui->label_8->setEnabled(ui->groupBoxManualLength->isChecked());
|
||||||
|
|
||||||
|
QString passmarkLength = node.GetFormulaPassmarkLength();
|
||||||
|
passmarkLength = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkLength.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passmarkLength.isEmpty())
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
||||||
|
ChangeColor(ui->labelEditPassmarkLength, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarkWidthFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch width
|
||||||
|
if (node.GetPassmarkLineType() != PassmarkLineType::OneLine)
|
||||||
|
{
|
||||||
|
ui->groupBoxManualWidth->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkWidth())
|
||||||
|
{
|
||||||
|
ui->groupBoxManualWidth->setChecked(true);
|
||||||
|
|
||||||
|
ui->toolButtonExprWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->plainTextEditPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->labelEditPassmarkWidth->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
ui->label_4->setEnabled(ui->groupBoxManualWidth->isChecked());
|
||||||
|
|
||||||
|
QString passmarkWidth = node.GetFormulaPassmarkWidth();
|
||||||
|
passmarkWidth = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkWidth, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkWidth.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passmarkWidth.isEmpty())
|
||||||
|
{
|
||||||
|
qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->plainTextEditPassmarkWidth->setPlainText(passmarkWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditPassmarkWidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
ui->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(width));
|
||||||
|
}
|
||||||
|
ChangeColor(ui->labelEditPassmarkWidth, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarkAngleFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch angle
|
||||||
|
if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
|
||||||
|
{
|
||||||
|
ui->groupBoxManualAngle->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkAngle())
|
||||||
|
{
|
||||||
|
ui->groupBoxManualAngle->setChecked(true);
|
||||||
|
|
||||||
|
ui->toolButtonExprAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->plainTextEditPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->pushButtonGrowPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->labelEditPassmarkAngle->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
ui->label_7->setEnabled(ui->groupBoxManualAngle->isChecked());
|
||||||
|
|
||||||
|
QString passmarkAngle = node.GetFormulaPassmarkLength();
|
||||||
|
passmarkAngle = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkAngle.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkAngle();
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->plainTextEditPassmarkAngle->setPlainText(passmarkAngle.isEmpty() ? QString::number(0) : passmarkAngle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->plainTextEditPassmarkAngle->setPlainText(QString::number(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditPassmarkAngle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->plainTextEditPassmarkAngle->setPlainText(QString::number(0));
|
||||||
|
}
|
||||||
|
ChangeColor(ui->labelEditPassmarkAngle, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarkShapeType(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// Line type
|
||||||
|
ui->groupBoxMarkType->setEnabled(true);
|
||||||
|
|
||||||
|
switch (node.GetPassmarkLineType())
|
||||||
|
{
|
||||||
|
case PassmarkLineType::OneLine:
|
||||||
|
ui->radioButtonOneLine->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::TwoLines:
|
||||||
|
ui->radioButtonTwoLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::ThreeLines:
|
||||||
|
ui->radioButtonThreeLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::TMark:
|
||||||
|
ui->radioButtonTMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::ExternalVMark:
|
||||||
|
ui->radioButtonVMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::InternalVMark:
|
||||||
|
ui->radioButtonVMark2->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::UMark:
|
||||||
|
ui->radioButtonUMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::BoxMark:
|
||||||
|
ui->radioButtonBoxMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::CheckMark:
|
||||||
|
ui->radioButtonCheckMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::InitPassmarkAngleType(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// Angle type
|
||||||
|
ui->groupBoxAngleType->setEnabled(true);
|
||||||
|
|
||||||
|
switch (node.GetPassmarkAngleType())
|
||||||
|
{
|
||||||
|
case PassmarkAngleType::Straightforward:
|
||||||
|
ui->radioButtonStraightforward->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Bisector:
|
||||||
|
ui->radioButtonBisector->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection:
|
||||||
|
ui->radioButtonIntersection->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyLeft:
|
||||||
|
ui->radioButtonIntersectionOnlyLeft->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyRight:
|
||||||
|
ui->radioButtonIntersectionOnlyRight->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2:
|
||||||
|
ui->radioButtonIntersection2->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2OnlyLeft:
|
||||||
|
ui->radioButtonIntersection2OnlyLeft->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2OnlyRight:
|
||||||
|
ui->radioButtonIntersection2OnlyRight->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -78,24 +78,31 @@ private slots:
|
||||||
void PassmarkLineTypeChanged(int id);
|
void PassmarkLineTypeChanged(int id);
|
||||||
void PassmarkAngleTypeChanged(int id);
|
void PassmarkAngleTypeChanged(int id);
|
||||||
void PassmarkShowSecondChanged(int state);
|
void PassmarkShowSecondChanged(int state);
|
||||||
|
void PassmarkClockwiseOrientationChanged(int state);
|
||||||
|
|
||||||
void EvalWidth();
|
void EvalWidth();
|
||||||
void EvalWidthBefore();
|
void EvalWidthBefore();
|
||||||
void EvalWidthAfter();
|
void EvalWidthAfter();
|
||||||
void EvalVisible();
|
void EvalVisible();
|
||||||
void EvalPassmarkLength();
|
void EvalPassmarkLength();
|
||||||
|
void EvalPassmarkWidth();
|
||||||
|
void EvalPassmarkAngle();
|
||||||
|
|
||||||
void FXWidth();
|
void FXWidth();
|
||||||
void FXWidthBefore();
|
void FXWidthBefore();
|
||||||
void FXWidthAfter();
|
void FXWidthAfter();
|
||||||
void FXVisible();
|
void FXVisible();
|
||||||
void FXPassmarkLength();
|
void FXPassmarkLength();
|
||||||
|
void FXPassmarkWidth();
|
||||||
|
void FXPassmarkAngle();
|
||||||
|
|
||||||
void DeployWidthFormulaTextEdit();
|
void DeployWidthFormulaTextEdit();
|
||||||
void DeployWidthBeforeFormulaTextEdit();
|
void DeployWidthBeforeFormulaTextEdit();
|
||||||
void DeployWidthAfterFormulaTextEdit();
|
void DeployWidthAfterFormulaTextEdit();
|
||||||
void DeployVisibleFormulaTextEdit();
|
void DeployVisibleFormulaTextEdit();
|
||||||
void DeployPassmarkLength();
|
void DeployPassmarkLength();
|
||||||
|
void DeployPassmarkWidth();
|
||||||
|
void DeployPassmarkAngle();
|
||||||
|
|
||||||
void SetMoveControls();
|
void SetMoveControls();
|
||||||
|
|
||||||
|
@ -110,17 +117,23 @@ private:
|
||||||
QTimer *m_timerWidthAfter;
|
QTimer *m_timerWidthAfter;
|
||||||
QTimer *m_timerVisible;
|
QTimer *m_timerVisible;
|
||||||
QTimer *m_timerPassmarkLength;
|
QTimer *m_timerPassmarkLength;
|
||||||
|
QTimer *m_timerPassmarkWidth;
|
||||||
|
QTimer *m_timerPassmarkAngle;
|
||||||
|
|
||||||
int m_formulaBaseWidth{0};
|
int m_formulaBaseWidth{0};
|
||||||
int m_formulaBaseWidthBefore{0};
|
int m_formulaBaseWidthBefore{0};
|
||||||
int m_formulaBaseWidthAfter{0};
|
int m_formulaBaseWidthAfter{0};
|
||||||
int m_formulaBaseVisible{0};
|
int m_formulaBaseVisible{0};
|
||||||
int m_formulaBasePassmarkLength{0};
|
int m_formulaBasePassmarkLength{0};
|
||||||
|
int m_formulaBasePassmarkWidth{0};
|
||||||
|
int m_formulaBasePassmarkAngle{0};
|
||||||
|
|
||||||
bool m_flagFormulaBefore{true};
|
bool m_flagFormulaBefore{true};
|
||||||
bool m_flagFormulaAfter{true};
|
bool m_flagFormulaAfter{true};
|
||||||
bool m_flagFormulaVisible{true};
|
bool m_flagFormulaVisible{true};
|
||||||
bool m_flagFormulaPassmarkLength{true};
|
bool m_flagFormulaPassmarkLength{true};
|
||||||
|
bool m_flagFormulaPassmarkWidth{true};
|
||||||
|
bool m_flagFormulaPassmarkAngle{true};
|
||||||
bool m_flagName{true}; // We have default name of piece.
|
bool m_flagName{true}; // We have default name of piece.
|
||||||
bool m_flagError{false};
|
bool m_flagError{false};
|
||||||
bool m_flagFormula{false};
|
bool m_flagFormula{false};
|
||||||
|
@ -159,8 +172,12 @@ private:
|
||||||
void UpdateNodeSABefore(const QString &formula);
|
void UpdateNodeSABefore(const QString &formula);
|
||||||
void UpdateNodeSAAfter(const QString &formula);
|
void UpdateNodeSAAfter(const QString &formula);
|
||||||
void UpdateNodePassmarkLength(const QString &formula);
|
void UpdateNodePassmarkLength(const QString &formula);
|
||||||
|
void UpdateNodePassmarkWidth(const QString &formula);
|
||||||
|
void UpdateNodePassmarkAngle(const QString &formula);
|
||||||
|
|
||||||
void EnabledManualPassmarkLength();
|
void EnabledManualPassmarkLength();
|
||||||
|
void EnabledManualPassmarkWidth();
|
||||||
|
void EnabledManualPassmarkAngle();
|
||||||
|
|
||||||
auto GetFormulaSAWidthBefore() const -> QString;
|
auto GetFormulaSAWidthBefore() const -> QString;
|
||||||
auto GetFormulaSAWidthAfter() const -> QString;
|
auto GetFormulaSAWidthAfter() const -> QString;
|
||||||
|
@ -171,9 +188,21 @@ private:
|
||||||
auto GetFormulaPassmarkLength() const -> QString;
|
auto GetFormulaPassmarkLength() const -> QString;
|
||||||
void SetFormulaPassmarkLength(const QString &formula);
|
void SetFormulaPassmarkLength(const QString &formula);
|
||||||
|
|
||||||
|
auto GetFormulaPassmarkWidth() const -> QString;
|
||||||
|
void SetFormulaPassmarkWidth(const QString &formula);
|
||||||
|
|
||||||
|
auto GetFormulaPassmarkAngle() const -> QString;
|
||||||
|
void SetFormulaPassmarkAngle(const QString &formula);
|
||||||
|
|
||||||
auto IsShowNotch() const -> bool;
|
auto IsShowNotch() const -> bool;
|
||||||
|
|
||||||
void RefreshPathList(const VPiecePath &path);
|
void RefreshPathList(const VPiecePath &path);
|
||||||
|
|
||||||
|
void InitPassmarkLengthFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkWidthFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkAngleFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkShapeType(const VPieceNode &node);
|
||||||
|
void InitPassmarkAngleType(const VPieceNode &node);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -58,10 +58,17 @@
|
||||||
#include "ui_tabpaths.h"
|
#include "ui_tabpaths.h"
|
||||||
#include "ui_tabpins.h"
|
#include "ui_tabpins.h"
|
||||||
#include "ui_tabplacelabels.h"
|
#include "ui_tabplacelabels.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
|
#include "../vmisc/backport/qscopeguard.h"
|
||||||
|
#else
|
||||||
|
#include <QScopeGuard>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
@ -145,6 +152,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
||||||
m_timerWidthBefore(new QTimer(this)),
|
m_timerWidthBefore(new QTimer(this)),
|
||||||
m_timerWidthAfter(new QTimer(this)),
|
m_timerWidthAfter(new QTimer(this)),
|
||||||
m_timerPassmarkLength(new QTimer(this)),
|
m_timerPassmarkLength(new QTimer(this)),
|
||||||
|
m_timerPassmarkWidth(new QTimer(this)),
|
||||||
|
m_timerPassmarkAngle(new QTimer(this)),
|
||||||
m_placeholdersMenu(new QMenu(this))
|
m_placeholdersMenu(new QMenu(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -581,17 +590,29 @@ void DialogSeamAllowance::CheckState()
|
||||||
|
|
||||||
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
||||||
|
|
||||||
flagFormulaPassmarkLength = uiTabPassmarks->comboBoxPassmarks->count() == 0;
|
if (uiTabPassmarks->comboBoxPassmarks->count() == 0)
|
||||||
if (flagFormulaPassmarkLength)
|
{
|
||||||
|
flagFormulaPassmarkLength = true;
|
||||||
|
flagFormulaPassmarkWidth = true;
|
||||||
|
flagFormulaPassmarkAngle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flagFormulaPassmarkLength && flagFormulaPassmarkWidth && flagFormulaPassmarkAngle)
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
||||||
|
uiTabPassmarks->tabWidget->setTabIcon(uiTabPassmarks->tabWidget->indexOf(uiTabPassmarks->tabManualShape),
|
||||||
|
QIcon());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks") + '*');
|
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks") + '*');
|
||||||
|
const QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-warning"),
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
|
uiTabPassmarks->tabWidget->setTabIcon(uiTabPassmarks->tabWidget->indexOf(uiTabPassmarks->tabManualShape), icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiTabPassmarks->comboBoxPassmarks->setEnabled(flagFormulaPassmarkLength);
|
uiTabPassmarks->comboBoxPassmarks->setEnabled(flagFormulaPassmarkLength && flagFormulaPassmarkWidth &&
|
||||||
|
flagFormulaPassmarkAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1123,135 +1144,72 @@ void DialogSeamAllowance::PassmarkChanged(int index)
|
||||||
uiTabPassmarks->groupBoxMarkType->setDisabled(true);
|
uiTabPassmarks->groupBoxMarkType->setDisabled(true);
|
||||||
uiTabPassmarks->groupBoxAngleType->setDisabled(true);
|
uiTabPassmarks->groupBoxAngleType->setDisabled(true);
|
||||||
uiTabPassmarks->groupBoxManualLength->setDisabled(true);
|
uiTabPassmarks->groupBoxManualLength->setDisabled(true);
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->setDisabled(true);
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->setDisabled(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->labelEditPassmarkLength->setDisabled(true);
|
||||||
|
uiTabPassmarks->labelEditPassmarkWidth->setDisabled(true);
|
||||||
|
uiTabPassmarks->labelEditPassmarkAngle->setDisabled(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->checkBoxClockwiseOpening->setDisabled(true);
|
||||||
uiTabPassmarks->checkBoxShowSecondPassmark->setDisabled(true);
|
uiTabPassmarks->checkBoxShowSecondPassmark->setDisabled(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->checkBoxClockwiseOpening->blockSignals(true);
|
||||||
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(true);
|
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(true);
|
||||||
|
|
||||||
uiTabPassmarks->groupBoxManualLength->blockSignals(true);
|
uiTabPassmarks->groupBoxManualLength->blockSignals(true);
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->blockSignals(true);
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->blockSignals(true);
|
||||||
uiTabPassmarks->groupBoxMarkType->blockSignals(true);
|
uiTabPassmarks->groupBoxMarkType->blockSignals(true);
|
||||||
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
|
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->checkBoxClockwiseOpening->setChecked(false);
|
||||||
|
|
||||||
uiTabPassmarks->groupBoxManualLength->setChecked(false);
|
uiTabPassmarks->groupBoxManualLength->setChecked(false);
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->setChecked(false);
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->setChecked(false);
|
||||||
|
|
||||||
if (index != -1)
|
auto EnableSignals = qScopeGuard(
|
||||||
{
|
[this]
|
||||||
const VPiece piece = CreatePiece();
|
|
||||||
const int nodeIndex = piece.GetPath().indexOfNode(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
|
||||||
if (nodeIndex != -1)
|
|
||||||
{
|
{
|
||||||
const VPieceNode &node = piece.GetPath().at(nodeIndex);
|
uiTabPassmarks->checkBoxClockwiseOpening->blockSignals(false);
|
||||||
|
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(false);
|
||||||
|
uiTabPassmarks->groupBoxManualLength->blockSignals(false);
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->blockSignals(false);
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->blockSignals(false);
|
||||||
|
uiTabPassmarks->groupBoxMarkType->blockSignals(false);
|
||||||
|
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
|
||||||
|
});
|
||||||
|
|
||||||
// Passmark length
|
if (index == -1)
|
||||||
uiTabPassmarks->groupBoxManualLength->setEnabled(true);
|
{
|
||||||
|
return;
|
||||||
if (node.IsManualPassmarkLength())
|
|
||||||
{
|
|
||||||
uiTabPassmarks->groupBoxManualLength->setChecked(true);
|
|
||||||
|
|
||||||
QString passmarkLength = node.GetFormulaPassmarkLength();
|
|
||||||
passmarkLength = VAbstractApplication::VApp()->TrVars()
|
|
||||||
->FormulaToUser(passmarkLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
|
||||||
if (passmarkLength.length() > 80)// increase height if needed.
|
|
||||||
{
|
|
||||||
this->DeployPassmarkLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (passmarkLength.isEmpty())
|
|
||||||
{
|
|
||||||
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
|
||||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(
|
|
||||||
VAbstractApplication::VApp()->LocaleToString(length));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
|
||||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(
|
|
||||||
VAbstractApplication::VApp()->LocaleToString(length));
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
|
||||||
|
|
||||||
// Line type
|
|
||||||
uiTabPassmarks->groupBoxMarkType->setEnabled(true);
|
|
||||||
|
|
||||||
switch(node.GetPassmarkLineType())
|
|
||||||
{
|
|
||||||
case PassmarkLineType::OneLine:
|
|
||||||
uiTabPassmarks->radioButtonOneLine->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::TwoLines:
|
|
||||||
uiTabPassmarks->radioButtonTwoLines->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::ThreeLines:
|
|
||||||
uiTabPassmarks->radioButtonThreeLines->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::TMark:
|
|
||||||
uiTabPassmarks->radioButtonTMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::VMark:
|
|
||||||
uiTabPassmarks->radioButtonVMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::VMark2:
|
|
||||||
uiTabPassmarks->radioButtonVMark2->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::UMark:
|
|
||||||
uiTabPassmarks->radioButtonUMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkLineType::BoxMark:
|
|
||||||
uiTabPassmarks->radioButtonBoxMark->setChecked(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Angle type
|
|
||||||
uiTabPassmarks->groupBoxAngleType->setEnabled(true);
|
|
||||||
|
|
||||||
switch(node.GetPassmarkAngleType())
|
|
||||||
{
|
|
||||||
case PassmarkAngleType::Straightforward:
|
|
||||||
uiTabPassmarks->radioButtonStraightforward->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Bisector:
|
|
||||||
uiTabPassmarks->radioButtonBisector->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection:
|
|
||||||
uiTabPassmarks->radioButtonIntersection->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::IntersectionOnlyLeft:
|
|
||||||
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::IntersectionOnlyRight:
|
|
||||||
uiTabPassmarks->radioButtonIntersectionOnlyRight->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2:
|
|
||||||
uiTabPassmarks->radioButtonIntersection2->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2OnlyLeft:
|
|
||||||
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setChecked(true);
|
|
||||||
break;
|
|
||||||
case PassmarkAngleType::Intersection2OnlyRight:
|
|
||||||
uiTabPassmarks->radioButtonIntersection2OnlyRight->setChecked(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the second option
|
|
||||||
uiTabPassmarks->checkBoxShowSecondPassmark->setEnabled(true);
|
|
||||||
uiTabPassmarks->checkBoxShowSecondPassmark->setChecked(node.IsShowSecondPassmark());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(false);
|
const VPiece piece = CreatePiece();
|
||||||
uiTabPassmarks->groupBoxManualLength->blockSignals(false);
|
const int nodeIndex = piece.GetPath().indexOfNode(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
uiTabPassmarks->groupBoxMarkType->blockSignals(false);
|
if (nodeIndex == -1)
|
||||||
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VPieceNode &node = piece.GetPath().at(nodeIndex);
|
||||||
|
|
||||||
|
InitPassmarkLengthFormula(node);
|
||||||
|
InitPassmarkWidthFormula(node);
|
||||||
|
InitPassmarkAngleFormula(node);
|
||||||
|
InitPassmarkShapeType(node);
|
||||||
|
InitPassmarkAngleType(node);
|
||||||
|
|
||||||
|
if (node.GetPassmarkLineType() == PassmarkLineType::CheckMark)
|
||||||
|
{
|
||||||
|
uiTabPassmarks->checkBoxClockwiseOpening->setEnabled(true);
|
||||||
|
uiTabPassmarks->checkBoxClockwiseOpening->setChecked(node.IsPassmarkClockwiseOpening());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the second option
|
||||||
|
uiTabPassmarks->checkBoxShowSecondPassmark->setEnabled(true);
|
||||||
|
uiTabPassmarks->checkBoxShowSecondPassmark->setChecked(node.IsShowSecondPassmark());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1598,11 +1556,11 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
|
||||||
}
|
}
|
||||||
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark))
|
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark))
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::VMark;
|
lineType = PassmarkLineType::ExternalVMark;
|
||||||
}
|
}
|
||||||
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark2))
|
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark2))
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::VMark2;
|
lineType = PassmarkLineType::InternalVMark;
|
||||||
}
|
}
|
||||||
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonUMark))
|
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonUMark))
|
||||||
{
|
{
|
||||||
|
@ -1612,6 +1570,10 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
|
||||||
{
|
{
|
||||||
lineType = PassmarkLineType::BoxMark;
|
lineType = PassmarkLineType::BoxMark;
|
||||||
}
|
}
|
||||||
|
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonCheckMark))
|
||||||
|
{
|
||||||
|
lineType = PassmarkLineType::CheckMark;
|
||||||
|
}
|
||||||
|
|
||||||
rowNode.SetPassmarkLineType(lineType);
|
rowNode.SetPassmarkLineType(lineType);
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
@ -1693,6 +1655,24 @@ void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::PassmarkClockwiseOrientationChanged(int state)
|
||||||
|
{
|
||||||
|
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||||
|
if (i != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetPassmarkClockwiseOpening(state);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
ListChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateGrainlineValues()
|
void DialogSeamAllowance::UpdateGrainlineValues()
|
||||||
{
|
{
|
||||||
|
@ -1997,11 +1977,66 @@ void DialogSeamAllowance::EnabledManualPassmarkLength()
|
||||||
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
rowNode.SetManualPassmarkLength(uiTabPassmarks->groupBoxManualLength->isChecked());
|
rowNode.SetManualPassmarkLength(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->label_3->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
|
||||||
EvalPassmarkLength();
|
EvalPassmarkLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::EnabledManualPassmarkWidth()
|
||||||
|
{
|
||||||
|
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetManualPassmarkWidth(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->label_4->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
|
||||||
|
EvalPassmarkWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::EnabledManualPassmarkAngle()
|
||||||
|
{
|
||||||
|
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetManualPassmarkAngle(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->label_5->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
|
||||||
|
EvalPassmarkAngle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::EditGrainlineFormula()
|
void DialogSeamAllowance::EditGrainlineFormula()
|
||||||
{
|
{
|
||||||
|
@ -2362,6 +2397,64 @@ void DialogSeamAllowance::EvalPassmarkLength()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::EvalPassmarkWidth()
|
||||||
|
{
|
||||||
|
if (uiTabPassmarks->groupBoxManualWidth->isChecked())
|
||||||
|
{
|
||||||
|
if (uiTabPassmarks->comboBoxPassmarks->count() > 0)
|
||||||
|
{
|
||||||
|
FormulaData formulaData;
|
||||||
|
formulaData.formula = uiTabPassmarks->plainTextEditPassmarkWidth->toPlainText();
|
||||||
|
formulaData.variables = data->DataVariables();
|
||||||
|
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkWidth;
|
||||||
|
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkWidth;
|
||||||
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
formulaData.checkZero = true;
|
||||||
|
formulaData.checkLessThanZero = false;
|
||||||
|
|
||||||
|
Eval(formulaData, flagFormulaPassmarkWidth);
|
||||||
|
|
||||||
|
UpdateNodePassmarkWidth(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkWidth));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeColor(uiTabPassmarks->labelEditPassmarkWidth, OkColor(this));
|
||||||
|
uiTabPassmarks->labelResultPassmarkWidth->setText(tr("<Empty>"));
|
||||||
|
flagFormulaPassmarkWidth = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::EvalPassmarkAngle()
|
||||||
|
{
|
||||||
|
if (uiTabPassmarks->groupBoxManualAngle->isChecked())
|
||||||
|
{
|
||||||
|
if (uiTabPassmarks->comboBoxPassmarks->count() > 0)
|
||||||
|
{
|
||||||
|
FormulaData formulaData;
|
||||||
|
formulaData.formula = uiTabPassmarks->plainTextEditPassmarkAngle->toPlainText();
|
||||||
|
formulaData.variables = data->DataVariables();
|
||||||
|
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkAngle;
|
||||||
|
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkAngle;
|
||||||
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
formulaData.checkZero = false;
|
||||||
|
formulaData.checkLessThanZero = false;
|
||||||
|
|
||||||
|
Eval(formulaData, flagFormulaPassmarkAngle);
|
||||||
|
|
||||||
|
UpdateNodePassmarkAngle(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkAngle));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeColor(uiTabPassmarks->labelEditPassmarkAngle, OkColor(this));
|
||||||
|
uiTabPassmarks->labelResultPassmarkAngle->setText(tr("<Empty>"));
|
||||||
|
flagFormulaPassmarkAngle = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::FXWidth()
|
void DialogSeamAllowance::FXWidth()
|
||||||
{
|
{
|
||||||
|
@ -2413,7 +2506,33 @@ void DialogSeamAllowance::FXPassmarkLength()
|
||||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormularPassmarkLength(dialog->GetFormula());
|
SetFormulaPassmarkLength(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::FXPassmarkWidth()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit passmark width"));
|
||||||
|
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkWidth));
|
||||||
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetFormulaPassmarkWidth(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::FXPassmarkAngle()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit passmark angle"));
|
||||||
|
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkAngle));
|
||||||
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetFormulaPassmarkAngle(dialog->GetFormula());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2444,6 +2563,20 @@ void DialogSeamAllowance::DeployPassmarkLength()
|
||||||
m_formulaBasePassmarkLength);
|
m_formulaBasePassmarkLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::DeployPassmarkWidth()
|
||||||
|
{
|
||||||
|
DeployFormula(this, uiTabPassmarks->plainTextEditPassmarkWidth, uiTabPassmarks->pushButtonGrowPassmarkWidth,
|
||||||
|
m_formulaBasePassmarkWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::DeployPassmarkAngle()
|
||||||
|
{
|
||||||
|
DeployFormula(this, uiTabPassmarks->plainTextEditPassmarkAngle, uiTabPassmarks->pushButtonGrowPassmarkAngle,
|
||||||
|
m_formulaBasePassmarkAngle);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::GrainlinePinPointChanged()
|
void DialogSeamAllowance::GrainlinePinPointChanged()
|
||||||
{
|
{
|
||||||
|
@ -2910,6 +3043,38 @@ void DialogSeamAllowance::UpdateNodePassmarkLength(const QString &formula)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::UpdateNodePassmarkWidth(const QString &formula)
|
||||||
|
{
|
||||||
|
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetFormulaPassmarkWidth(formula);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::UpdateNodePassmarkAngle(const QString &formula)
|
||||||
|
{
|
||||||
|
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||||
|
if (rowItem)
|
||||||
|
{
|
||||||
|
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
rowNode.SetFormulaPassmarkAngle(formula);
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::InitFancyTabBar()
|
void DialogSeamAllowance::InitFancyTabBar()
|
||||||
{
|
{
|
||||||
|
@ -3412,6 +3577,34 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
connect(uiTabPassmarks->pushButtonGrowPassmarkLength, &QPushButton::clicked, this,
|
connect(uiTabPassmarks->pushButtonGrowPassmarkLength, &QPushButton::clicked, this,
|
||||||
&DialogSeamAllowance::DeployPassmarkLength);
|
&DialogSeamAllowance::DeployPassmarkLength);
|
||||||
|
|
||||||
|
// Width formula
|
||||||
|
this->m_formulaBasePassmarkWidth = uiTabPassmarks->plainTextEditPassmarkWidth->height();
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->installEventFilter(this);
|
||||||
|
m_timerPassmarkWidth->setSingleShot(true);
|
||||||
|
|
||||||
|
connect(m_timerPassmarkWidth, &QTimer::timeout, this, &DialogSeamAllowance::EvalPassmarkWidth);
|
||||||
|
connect(uiTabPassmarks->groupBoxManualWidth, &QGroupBox::toggled, this,
|
||||||
|
&DialogSeamAllowance::EnabledManualPassmarkWidth);
|
||||||
|
connect(uiTabPassmarks->toolButtonExprWidth, &QPushButton::clicked, this, &DialogSeamAllowance::FXPassmarkWidth);
|
||||||
|
connect(uiTabPassmarks->plainTextEditPassmarkWidth, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkWidth->start(formulaTimerTimeout); });
|
||||||
|
connect(uiTabPassmarks->pushButtonGrowPassmarkWidth, &QPushButton::clicked, this,
|
||||||
|
&DialogSeamAllowance::DeployPassmarkWidth);
|
||||||
|
|
||||||
|
// Angle formula
|
||||||
|
this->m_formulaBasePassmarkAngle = uiTabPassmarks->plainTextEditPassmarkAngle->height();
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->installEventFilter(this);
|
||||||
|
m_timerPassmarkAngle->setSingleShot(true);
|
||||||
|
|
||||||
|
connect(m_timerPassmarkAngle, &QTimer::timeout, this, &DialogSeamAllowance::EvalPassmarkAngle);
|
||||||
|
connect(uiTabPassmarks->groupBoxManualAngle, &QGroupBox::toggled, this,
|
||||||
|
&DialogSeamAllowance::EnabledManualPassmarkAngle);
|
||||||
|
connect(uiTabPassmarks->toolButtonExprAngle, &QPushButton::clicked, this, &DialogSeamAllowance::FXPassmarkAngle);
|
||||||
|
connect(uiTabPassmarks->plainTextEditPassmarkAngle, &QPlainTextEdit::textChanged, this,
|
||||||
|
[this]() { m_timerPassmarkAngle->start(formulaTimerTimeout); });
|
||||||
|
connect(uiTabPassmarks->pushButtonGrowPassmarkAngle, &QPushButton::clicked, this,
|
||||||
|
&DialogSeamAllowance::DeployPassmarkAngle);
|
||||||
|
|
||||||
// notch list
|
// notch list
|
||||||
InitPassmarksList();
|
InitPassmarksList();
|
||||||
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
@ -3430,6 +3623,8 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
#endif
|
#endif
|
||||||
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||||
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
||||||
|
connect(uiTabPassmarks->checkBoxClockwiseOpening, &QCheckBox::stateChanged, this,
|
||||||
|
&DialogSeamAllowance::PassmarkClockwiseOrientationChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3502,7 +3697,7 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetFormularPassmarkLength(const QString &formula)
|
void DialogSeamAllowance::SetFormulaPassmarkLength(const QString &formula)
|
||||||
{
|
{
|
||||||
const QString width = VAbstractApplication::VApp()->TrVars()
|
const QString width = VAbstractApplication::VApp()->TrVars()
|
||||||
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
@ -3516,6 +3711,36 @@ void DialogSeamAllowance::SetFormularPassmarkLength(const QString &formula)
|
||||||
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::SetFormulaPassmarkWidth(const QString &formula)
|
||||||
|
{
|
||||||
|
const QString width = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed.
|
||||||
|
if (width.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployPassmarkWidth();
|
||||||
|
}
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(width);
|
||||||
|
|
||||||
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::SetFormulaPassmarkAngle(const QString &formula)
|
||||||
|
{
|
||||||
|
const QString width = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed.
|
||||||
|
if (width.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployPassmarkAngle();
|
||||||
|
}
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setPlainText(width);
|
||||||
|
|
||||||
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkAngle);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::UpdateCurrentCustomSARecord()
|
void DialogSeamAllowance::UpdateCurrentCustomSARecord()
|
||||||
{
|
{
|
||||||
|
@ -3961,6 +4186,225 @@ void DialogSeamAllowance::InitGradationPlaceholders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPassmarkLengthFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch depth
|
||||||
|
uiTabPassmarks->groupBoxManualLength->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkLength())
|
||||||
|
{
|
||||||
|
uiTabPassmarks->groupBoxManualLength->setChecked(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkLength->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
uiTabPassmarks->label_3->setEnabled(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||||
|
|
||||||
|
QString passmarkLength = node.GetFormulaPassmarkLength();
|
||||||
|
passmarkLength = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkLength.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passmarkLength.isEmpty())
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(
|
||||||
|
VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
||||||
|
ChangeColor(uiTabPassmarks->labelEditPassmarkLength, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPassmarkWidthFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch width
|
||||||
|
if (node.GetPassmarkLineType() != PassmarkLineType::OneLine)
|
||||||
|
{
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkWidth())
|
||||||
|
{
|
||||||
|
uiTabPassmarks->groupBoxManualWidth->setChecked(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkWidth->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
uiTabPassmarks->label_4->setEnabled(uiTabPassmarks->groupBoxManualWidth->isChecked());
|
||||||
|
|
||||||
|
QString passmarkWidth = node.GetFormulaPassmarkWidth();
|
||||||
|
passmarkWidth = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkWidth, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkWidth.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (passmarkWidth.isEmpty())
|
||||||
|
{
|
||||||
|
qreal width = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(
|
||||||
|
VAbstractApplication::VApp()->LocaleToString(width));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(passmarkWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(
|
||||||
|
VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkWidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal length = UnitConvertor(0.85, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkWidth->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
|
}
|
||||||
|
ChangeColor(uiTabPassmarks->labelEditPassmarkWidth, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPassmarkAngleFormula(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// notch angle
|
||||||
|
if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
|
||||||
|
{
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->setEnabled(true);
|
||||||
|
|
||||||
|
if (node.IsManualPassmarkAngle())
|
||||||
|
{
|
||||||
|
uiTabPassmarks->groupBoxManualAngle->setChecked(true);
|
||||||
|
|
||||||
|
uiTabPassmarks->toolButtonExprAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->pushButtonGrowPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->labelEditPassmarkAngle->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
uiTabPassmarks->label_5->setEnabled(uiTabPassmarks->groupBoxManualAngle->isChecked());
|
||||||
|
|
||||||
|
QString passmarkAngle = node.GetFormulaPassmarkAngle();
|
||||||
|
passmarkAngle = VAbstractApplication::VApp()->TrVars()->FormulaToUser(
|
||||||
|
passmarkAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
if (passmarkAngle.length() > 80) // increase height if needed.
|
||||||
|
{
|
||||||
|
this->DeployPassmarkAngle();
|
||||||
|
}
|
||||||
|
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setPlainText(passmarkAngle.isEmpty() ? QString::number(0)
|
||||||
|
: passmarkAngle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setPlainText(QString::number(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkAngle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiTabPassmarks->plainTextEditPassmarkAngle->setPlainText(QString::number(0));
|
||||||
|
}
|
||||||
|
ChangeColor(uiTabPassmarks->labelEditPassmarkAngle, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPassmarkShapeType(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// Line type
|
||||||
|
uiTabPassmarks->groupBoxMarkType->setEnabled(true);
|
||||||
|
|
||||||
|
switch (node.GetPassmarkLineType())
|
||||||
|
{
|
||||||
|
case PassmarkLineType::OneLine:
|
||||||
|
uiTabPassmarks->radioButtonOneLine->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::TwoLines:
|
||||||
|
uiTabPassmarks->radioButtonTwoLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::ThreeLines:
|
||||||
|
uiTabPassmarks->radioButtonThreeLines->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::TMark:
|
||||||
|
uiTabPassmarks->radioButtonTMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::ExternalVMark:
|
||||||
|
uiTabPassmarks->radioButtonVMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::InternalVMark:
|
||||||
|
uiTabPassmarks->radioButtonVMark2->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::UMark:
|
||||||
|
uiTabPassmarks->radioButtonUMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::BoxMark:
|
||||||
|
uiTabPassmarks->radioButtonBoxMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkLineType::CheckMark:
|
||||||
|
uiTabPassmarks->radioButtonCheckMark->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPassmarkAngleType(const VPieceNode &node)
|
||||||
|
{
|
||||||
|
// Angle type
|
||||||
|
uiTabPassmarks->groupBoxAngleType->setEnabled(true);
|
||||||
|
|
||||||
|
switch (node.GetPassmarkAngleType())
|
||||||
|
{
|
||||||
|
case PassmarkAngleType::Straightforward:
|
||||||
|
uiTabPassmarks->radioButtonStraightforward->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Bisector:
|
||||||
|
uiTabPassmarks->radioButtonBisector->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection:
|
||||||
|
uiTabPassmarks->radioButtonIntersection->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyLeft:
|
||||||
|
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::IntersectionOnlyRight:
|
||||||
|
uiTabPassmarks->radioButtonIntersectionOnlyRight->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2:
|
||||||
|
uiTabPassmarks->radioButtonIntersection2->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2OnlyLeft:
|
||||||
|
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setChecked(true);
|
||||||
|
break;
|
||||||
|
case PassmarkAngleType::Intersection2OnlyRight:
|
||||||
|
uiTabPassmarks->radioButtonIntersection2OnlyRight->setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetMoveControls()
|
void DialogSeamAllowance::SetMoveControls()
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,7 @@ private slots:
|
||||||
void PassmarkLineTypeChanged(int id);
|
void PassmarkLineTypeChanged(int id);
|
||||||
void PassmarkAngleTypeChanged(int id);
|
void PassmarkAngleTypeChanged(int id);
|
||||||
void PassmarkShowSecondChanged(int state);
|
void PassmarkShowSecondChanged(int state);
|
||||||
|
void PassmarkClockwiseOrientationChanged(int state);
|
||||||
|
|
||||||
void UpdateGrainlineValues();
|
void UpdateGrainlineValues();
|
||||||
void UpdateDetailLabelValues();
|
void UpdateDetailLabelValues();
|
||||||
|
@ -134,21 +135,29 @@ private slots:
|
||||||
void EnabledDetailLabel();
|
void EnabledDetailLabel();
|
||||||
void EnabledPatternLabel();
|
void EnabledPatternLabel();
|
||||||
void EnabledManualPassmarkLength();
|
void EnabledManualPassmarkLength();
|
||||||
|
void EnabledManualPassmarkWidth();
|
||||||
|
void EnabledManualPassmarkAngle();
|
||||||
|
|
||||||
void EvalWidth();
|
void EvalWidth();
|
||||||
void EvalWidthBefore();
|
void EvalWidthBefore();
|
||||||
void EvalWidthAfter();
|
void EvalWidthAfter();
|
||||||
void EvalPassmarkLength();
|
void EvalPassmarkLength();
|
||||||
|
void EvalPassmarkWidth();
|
||||||
|
void EvalPassmarkAngle();
|
||||||
|
|
||||||
void FXWidth();
|
void FXWidth();
|
||||||
void FXWidthBefore();
|
void FXWidthBefore();
|
||||||
void FXWidthAfter();
|
void FXWidthAfter();
|
||||||
void FXPassmarkLength();
|
void FXPassmarkLength();
|
||||||
|
void FXPassmarkWidth();
|
||||||
|
void FXPassmarkAngle();
|
||||||
|
|
||||||
void DeployWidthFormulaTextEdit();
|
void DeployWidthFormulaTextEdit();
|
||||||
void DeployWidthBeforeFormulaTextEdit();
|
void DeployWidthBeforeFormulaTextEdit();
|
||||||
void DeployWidthAfterFormulaTextEdit();
|
void DeployWidthAfterFormulaTextEdit();
|
||||||
void DeployPassmarkLength();
|
void DeployPassmarkLength();
|
||||||
|
void DeployPassmarkWidth();
|
||||||
|
void DeployPassmarkAngle();
|
||||||
|
|
||||||
void GrainlinePinPointChanged();
|
void GrainlinePinPointChanged();
|
||||||
void DetailPinPointChanged();
|
void DetailPinPointChanged();
|
||||||
|
@ -195,6 +204,8 @@ private:
|
||||||
bool flagFormulaBefore{true};
|
bool flagFormulaBefore{true};
|
||||||
bool flagFormulaAfter{true};
|
bool flagFormulaAfter{true};
|
||||||
bool flagFormulaPassmarkLength{true};
|
bool flagFormulaPassmarkLength{true};
|
||||||
|
bool flagFormulaPassmarkWidth{true};
|
||||||
|
bool flagFormulaPassmarkAngle{true};
|
||||||
bool flagMainPathIsValid{true};
|
bool flagMainPathIsValid{true};
|
||||||
bool flagName{true}; // We have default name of piece.
|
bool flagName{true}; // We have default name of piece.
|
||||||
bool flagUUID{true};
|
bool flagUUID{true};
|
||||||
|
@ -224,11 +235,15 @@ private:
|
||||||
int m_formulaBaseWidthBefore{0};
|
int m_formulaBaseWidthBefore{0};
|
||||||
int m_formulaBaseWidthAfter{0};
|
int m_formulaBaseWidthAfter{0};
|
||||||
int m_formulaBasePassmarkLength{0};
|
int m_formulaBasePassmarkLength{0};
|
||||||
|
int m_formulaBasePassmarkWidth{0};
|
||||||
|
int m_formulaBasePassmarkAngle{0};
|
||||||
|
|
||||||
QTimer *m_timerWidth{nullptr};
|
QTimer *m_timerWidth{nullptr};
|
||||||
QTimer *m_timerWidthBefore{nullptr};
|
QTimer *m_timerWidthBefore{nullptr};
|
||||||
QTimer *m_timerWidthAfter{nullptr};
|
QTimer *m_timerWidthAfter{nullptr};
|
||||||
QTimer *m_timerPassmarkLength{nullptr};
|
QTimer *m_timerPassmarkLength{nullptr};
|
||||||
|
QTimer *m_timerPassmarkWidth{nullptr};
|
||||||
|
QTimer *m_timerPassmarkAngle{nullptr};
|
||||||
qreal m_saWidth{0};
|
qreal m_saWidth{0};
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> m_templateLines{};
|
QVector<VLabelTemplateLine> m_templateLines{};
|
||||||
|
@ -266,6 +281,8 @@ private:
|
||||||
void UpdateNodeSABefore(const QString &formula);
|
void UpdateNodeSABefore(const QString &formula);
|
||||||
void UpdateNodeSAAfter(const QString &formula);
|
void UpdateNodeSAAfter(const QString &formula);
|
||||||
void UpdateNodePassmarkLength(const QString &formula);
|
void UpdateNodePassmarkLength(const QString &formula);
|
||||||
|
void UpdateNodePassmarkWidth(const QString &formula);
|
||||||
|
void UpdateNodePassmarkAngle(const QString &formula);
|
||||||
|
|
||||||
void InitFancyTabBar();
|
void InitFancyTabBar();
|
||||||
void InitMainPathTab();
|
void InitMainPathTab();
|
||||||
|
@ -286,7 +303,9 @@ private:
|
||||||
void InitAllPinComboboxes();
|
void InitAllPinComboboxes();
|
||||||
|
|
||||||
void SetFormulaSAWidth(const QString &formula);
|
void SetFormulaSAWidth(const QString &formula);
|
||||||
void SetFormularPassmarkLength(const QString &formula);
|
void SetFormulaPassmarkLength(const QString &formula);
|
||||||
|
void SetFormulaPassmarkWidth(const QString &formula);
|
||||||
|
void SetFormulaPassmarkAngle(const QString &formula);
|
||||||
|
|
||||||
void SetGrainlineAngle(QString angleFormula);
|
void SetGrainlineAngle(QString angleFormula);
|
||||||
void SetGrainlineLength(QString lengthFormula);
|
void SetGrainlineLength(QString lengthFormula);
|
||||||
|
@ -317,6 +336,12 @@ private:
|
||||||
|
|
||||||
void InitGradationPlaceholdersMenu();
|
void InitGradationPlaceholdersMenu();
|
||||||
void InitGradationPlaceholders();
|
void InitGradationPlaceholders();
|
||||||
|
|
||||||
|
void InitPassmarkLengthFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkWidthFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkAngleFormula(const VPieceNode &node);
|
||||||
|
void InitPassmarkShapeType(const VPieceNode &node);
|
||||||
|
void InitPassmarkAngleType(const VPieceNode &node);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -92,6 +92,7 @@ enum class ContextMenuOption : int
|
||||||
VMark2,
|
VMark2,
|
||||||
UMark,
|
UMark,
|
||||||
BoxMark,
|
BoxMark,
|
||||||
|
CheckMark,
|
||||||
Option,
|
Option,
|
||||||
InLayout,
|
InLayout,
|
||||||
ForbidFlipping,
|
ForbidFlipping,
|
||||||
|
@ -505,7 +506,7 @@ void VNodePoint::InitPassmarkLineTypeMenu(QMenu *menu, vidtype pieceId, QHash<in
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(PassmarkLineType::LAST_ONE_DO_NOT_USE) == 8, "Not all types were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(PassmarkLineType::LAST_ONE_DO_NOT_USE) == 9, "Not all types were handled.");
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::OneLine),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::OneLine),
|
||||||
InitPassmarkLineTypeAction(tr("One line"), PassmarkLineType::OneLine));
|
InitPassmarkLineTypeAction(tr("One line"), PassmarkLineType::OneLine));
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::TwoLines),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::TwoLines),
|
||||||
|
@ -515,14 +516,15 @@ void VNodePoint::InitPassmarkLineTypeMenu(QMenu *menu, vidtype pieceId, QHash<in
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::TMark),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::TMark),
|
||||||
InitPassmarkLineTypeAction(tr("T mark"), PassmarkLineType::TMark));
|
InitPassmarkLineTypeAction(tr("T mark"), PassmarkLineType::TMark));
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::VMark),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::VMark),
|
||||||
InitPassmarkLineTypeAction(tr("External V mark"), PassmarkLineType::VMark));
|
InitPassmarkLineTypeAction(tr("External V mark"), PassmarkLineType::ExternalVMark));
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::VMark2),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::VMark2),
|
||||||
InitPassmarkLineTypeAction(tr("Internal V mark"), PassmarkLineType::VMark2));
|
InitPassmarkLineTypeAction(tr("Internal V mark"), PassmarkLineType::InternalVMark));
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::UMark),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::UMark),
|
||||||
InitPassmarkLineTypeAction(tr("U mark"), PassmarkLineType::UMark));
|
InitPassmarkLineTypeAction(tr("U mark"), PassmarkLineType::UMark));
|
||||||
contextMenu.insert(static_cast<int>(ContextMenuOption::BoxMark),
|
contextMenu.insert(static_cast<int>(ContextMenuOption::BoxMark),
|
||||||
InitPassmarkLineTypeAction(tr("Box mark"), PassmarkLineType::BoxMark));
|
InitPassmarkLineTypeAction(tr("Box mark"), PassmarkLineType::BoxMark));
|
||||||
|
contextMenu.insert(static_cast<int>(ContextMenuOption::CheckMark),
|
||||||
|
InitPassmarkLineTypeAction(tr("Check mark"), PassmarkLineType::CheckMark));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -582,7 +584,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
ContextMenuOption selectedOption = static_cast<ContextMenuOption>(
|
ContextMenuOption selectedOption = static_cast<ContextMenuOption>(
|
||||||
contextMenu.key(selectedAction, static_cast<int>(ContextMenuOption::NoSelection)));
|
contextMenu.key(selectedAction, static_cast<int>(ContextMenuOption::NoSelection)));
|
||||||
|
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 33,
|
Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 34,
|
||||||
"Not all options were handled.");
|
"Not all options were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
@ -688,10 +690,10 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
SelectPassmarkLine(PassmarkLineType::TMark);
|
SelectPassmarkLine(PassmarkLineType::TMark);
|
||||||
break;
|
break;
|
||||||
case ContextMenuOption::VMark:
|
case ContextMenuOption::VMark:
|
||||||
SelectPassmarkLine(PassmarkLineType::VMark);
|
SelectPassmarkLine(PassmarkLineType::ExternalVMark);
|
||||||
break;
|
break;
|
||||||
case ContextMenuOption::VMark2:
|
case ContextMenuOption::VMark2:
|
||||||
SelectPassmarkLine(PassmarkLineType::VMark2);
|
SelectPassmarkLine(PassmarkLineType::InternalVMark);
|
||||||
break;
|
break;
|
||||||
case ContextMenuOption::UMark:
|
case ContextMenuOption::UMark:
|
||||||
SelectPassmarkLine(PassmarkLineType::UMark);
|
SelectPassmarkLine(PassmarkLineType::UMark);
|
||||||
|
@ -699,6 +701,9 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
case ContextMenuOption::BoxMark:
|
case ContextMenuOption::BoxMark:
|
||||||
SelectPassmarkLine(PassmarkLineType::BoxMark);
|
SelectPassmarkLine(PassmarkLineType::BoxMark);
|
||||||
break;
|
break;
|
||||||
|
case ContextMenuOption::CheckMark:
|
||||||
|
SelectPassmarkLine(PassmarkLineType::CheckMark);
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,23 +550,66 @@ auto VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagName, con
|
||||||
|
|
||||||
if (type == Tool::NodePoint)
|
if (type == Tool::NodePoint)
|
||||||
{
|
{
|
||||||
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmark, node.IsPassmark());
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodePassmark, node.IsPassmark(),
|
||||||
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkLine,
|
[node](bool passmark) noexcept
|
||||||
PassmarkLineTypeToString(node.GetPassmarkLineType()));
|
{
|
||||||
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkAngle,
|
return not passmark &&
|
||||||
PassmarkAngleTypeToString(node.GetPassmarkAngleType()));
|
node.GetPassmarkLineType() == PassmarkLineType::OneLine &&
|
||||||
|
node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward;
|
||||||
if (not node.IsPassmark()
|
});
|
||||||
&& node.GetPassmarkLineType() == PassmarkLineType::OneLine
|
doc->SetAttributeOrRemoveIf<QString>(
|
||||||
&& node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
|
nod, VAbstractPattern::AttrNodePassmarkLine, PassmarkLineTypeToString(node.GetPassmarkLineType()),
|
||||||
{ // For backward compatebility.
|
[node](const QString &) noexcept
|
||||||
nod.removeAttribute(VAbstractPattern::AttrNodePassmark);
|
{
|
||||||
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkLine);
|
return not node.IsPassmark() && node.GetPassmarkLineType() == PassmarkLineType::OneLine &&
|
||||||
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
|
node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward;
|
||||||
}
|
});
|
||||||
|
doc->SetAttributeOrRemoveIf<QString>(
|
||||||
|
nod, VAbstractPattern::AttrNodePassmarkAngle, PassmarkAngleTypeToString(node.GetPassmarkAngleType()),
|
||||||
|
[node](const QString &) noexcept
|
||||||
|
{
|
||||||
|
return not node.IsPassmark() && node.GetPassmarkLineType() == PassmarkLineType::OneLine &&
|
||||||
|
node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward;
|
||||||
|
});
|
||||||
|
|
||||||
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodeTurnPoint, node.IsTurnPoint(),
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodeTurnPoint, node.IsTurnPoint(),
|
||||||
[](bool value) noexcept {return value;});
|
[](bool value) noexcept { return value; });
|
||||||
|
|
||||||
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodeShowSecondPassmark,
|
||||||
|
node.IsShowSecondPassmark(), [](bool show) noexcept { return show; });
|
||||||
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodePassmarkOpening,
|
||||||
|
node.IsPassmarkClockwiseOpening(),
|
||||||
|
[](bool opening) noexcept { return not opening; });
|
||||||
|
|
||||||
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrManualPassmarkLength,
|
||||||
|
node.IsManualPassmarkLength(),
|
||||||
|
[](bool manualPassmarkLength) noexcept { return not manualPassmarkLength; });
|
||||||
|
doc->SetAttributeOrRemoveIf<QString>(nod, VAbstractPattern::AttrPassmarkLength, node.GetFormulaPassmarkLength(),
|
||||||
|
[node](const QString &) noexcept
|
||||||
|
{ return not node.IsManualPassmarkLength(); });
|
||||||
|
|
||||||
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrManualPassmarkWidth, node.IsManualPassmarkWidth(),
|
||||||
|
[node](bool manualPassmarkWidth) noexcept {
|
||||||
|
return not manualPassmarkWidth ||
|
||||||
|
node.GetPassmarkLineType() == PassmarkLineType::OneLine;
|
||||||
|
});
|
||||||
|
doc->SetAttributeOrRemoveIf<QString>(nod, VAbstractPattern::AttrPassmarkWidth, node.GetFormulaPassmarkWidth(),
|
||||||
|
[node](const QString &) noexcept {
|
||||||
|
return not node.IsManualPassmarkWidth() ||
|
||||||
|
node.GetPassmarkLineType() == PassmarkLineType::OneLine;
|
||||||
|
});
|
||||||
|
|
||||||
|
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrManualPassmarkAngle, node.IsManualPassmarkAngle(),
|
||||||
|
[node](bool manualPassmarkAngle) noexcept {
|
||||||
|
return not manualPassmarkAngle ||
|
||||||
|
node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward;
|
||||||
|
});
|
||||||
|
doc->SetAttributeOrRemoveIf<QString>(nod, VAbstractPattern::AttrPassmarkAngle, node.GetFormulaPassmarkAngle(),
|
||||||
|
[node](const QString &) noexcept {
|
||||||
|
return not node.IsManualPassmarkAngle() ||
|
||||||
|
node.GetPassmarkAngleType() ==
|
||||||
|
PassmarkAngleType::Straightforward;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Wrong configuration.
|
{ // Wrong configuration.
|
||||||
|
@ -575,14 +618,6 @@ auto VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagName, con
|
||||||
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
|
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrNodeShowSecondPassmark, node.IsShowSecondPassmark(),
|
|
||||||
[](bool show) noexcept {return show;});
|
|
||||||
|
|
||||||
doc->SetAttributeOrRemoveIf<bool>(nod, VAbstractPattern::AttrManualPassmarkLength, node.IsManualPassmarkLength(),
|
|
||||||
[](bool manualPassmarkLength) noexcept {return not manualPassmarkLength;});
|
|
||||||
doc->SetAttributeOrRemoveIf<QString>(nod, VAbstractPattern::AttrPassmarkLength, node.GetFormulaPassmarkLength(),
|
|
||||||
[node](const QString &) noexcept {return not node.IsManualPassmarkLength();});
|
|
||||||
|
|
||||||
return nod;
|
return nod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user