Small improvements for passmark.

Added new option that allow localy disable the second passmark on the seam line.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-26 11:22:42 +03:00
parent 39a1c50022
commit c9e005c65b
11 changed files with 110 additions and 25 deletions

View File

@ -355,6 +355,7 @@
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@ -390,6 +391,7 @@
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@ -552,6 +554,7 @@
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -111,6 +111,7 @@ const QString VAbstractPattern::AttrNodeExcluded = QStringLiteral("excluded
const QString VAbstractPattern::AttrNodePassmark = QStringLiteral("passmark");
const QString VAbstractPattern::AttrNodePassmarkLine = QStringLiteral("passmarkLine");
const QString VAbstractPattern::AttrNodePassmarkAngle = QStringLiteral("passmarkAngle");
const QString VAbstractPattern::AttrNodeShowSecondPassmark = QStringLiteral("showSecondPassmark");
const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
const QString VAbstractPattern::AttrStart = QStringLiteral("start");
@ -680,6 +681,9 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
VAbstractPattern::AttrNodePassmarkAngle,
strStraightforward));
const bool showSecond = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeShowSecondPassmark,
trueStr);
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
Tool tool;
@ -715,6 +719,7 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
node.SetFormulaSAAfter(saAfter);
node.SetAngleType(angle);
node.SetExcluded(excluded);
node.SetShowSecondPassmark(showSecond);
node.SetPassmark(passmark);
node.SetPassmarkLineType(passmarkLine);
node.SetPassmarkAngleType(passmarkAngle);

View File

@ -219,6 +219,7 @@ public:
static const QString AttrNodePassmark;
static const QString AttrNodePassmarkLine;
static const QString AttrNodePassmarkAngle;
static const QString AttrNodeShowSecondPassmark;
static const QString AttrSABefore;
static const QString AttrSAAfter;
static const QString AttrStart;

View File

@ -1097,7 +1097,8 @@ QVector<QLineF> VPiece::CreatePassmark(const QVector<VPieceNode> &path, int prev
lines += SAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
if (qApp->Settings()->IsDoublePassmark()
&& path.at(passmarkIndex).IsMainPathNode()
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection)
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection
&& path.at(passmarkIndex).IsShowSecondPassmark())
{
lines += BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
}

View File

@ -301,6 +301,18 @@ void VPieceNode::SetPassmarkAngleType(PassmarkAngleType angleType)
d->m_passmarkAngleType = angleType;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPieceNode::IsShowSecondPassmark() const
{
return d->m_isShowSecondPassmark;
}
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetShowSecondPassmark(bool value)
{
d->m_isShowSecondPassmark = value;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPieceNode::IsExcluded() const
{

View File

@ -95,7 +95,10 @@ public:
void SetPassmarkLineType(PassmarkLineType lineType);
PassmarkAngleType GetPassmarkAngleType() const;
void SetPassmarkAngleType(PassmarkAngleType angleType);
void SetPassmarkAngleType(PassmarkAngleType angleType);
bool IsShowSecondPassmark() const;
void SetShowSecondPassmark(bool value);
private:
QSharedDataPointer<VPieceNodeData> d;
};

View File

@ -51,7 +51,8 @@ public:
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
m_passmarkAngleType(PassmarkAngleType::Straightforward),
m_isShowSecondPassmark(true)
{}
VPieceNodeData(quint32 id, Tool typeTool, bool reverse)
@ -65,7 +66,8 @@ public:
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
m_passmarkAngleType(PassmarkAngleType::Straightforward),
m_isShowSecondPassmark(true)
{
if (m_typeTool == Tool::NodePoint)
{
@ -85,10 +87,11 @@ public:
m_formulaWidthAfter(node.m_formulaWidthAfter),
m_angleType(node.m_angleType),
m_passmarkLineType(node.m_passmarkLineType),
m_passmarkAngleType(node.m_passmarkAngleType)
m_passmarkAngleType(node.m_passmarkAngleType),
m_isShowSecondPassmark(node.m_isShowSecondPassmark)
{}
~VPieceNodeData();
~VPieceNodeData() Q_DECL_EQ_DEFAULT;
friend QDataStream& operator<<(QDataStream& out, const VPieceNodeData& p);
friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p);
@ -120,13 +123,12 @@ public:
PassmarkLineType m_passmarkLineType;
PassmarkAngleType m_passmarkAngleType;
bool m_isShowSecondPassmark;
private:
VPieceNodeData &operator=(const VPieceNodeData &) Q_DECL_EQ_DELETE;
};
VPieceNodeData::~VPieceNodeData()
{}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNodeData &p)
@ -140,7 +142,8 @@ QDataStream &operator<<(QDataStream &out, const VPieceNodeData &p)
<< p.m_formulaWidthAfter
<< static_cast<int>(p.m_angleType)
<< static_cast<int>(p.m_passmarkLineType)
<< static_cast<int>(p.m_passmarkAngleType);
<< static_cast<int>(p.m_passmarkAngleType)
<< p.m_isShowSecondPassmark;
return out;
}
@ -161,7 +164,8 @@ QDataStream &operator>>(QDataStream &in, VPieceNodeData &p)
>> p.m_formulaWidthAfter
>> angleType
>> passmarkLineType
>> passmarkAngleType;
>> passmarkAngleType
>> p.m_isShowSecondPassmark;
p.m_typeTool = static_cast<Tool>(typeTool);
p.m_angleType = static_cast<PieceNodeAngle>(angleType);

View File

@ -855,6 +855,9 @@ void DialogSeamAllowance::PassmarkChanged(int index)
uiTabPassmarks->radioButtonBisector->setDisabled(true);
uiTabPassmarks->radioButtonIntersection->setDisabled(true);
uiTabPassmarks->checkBoxShowSecondPassmark->setDisabled(true);
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(true);
uiTabPassmarks->groupBoxMarkType->blockSignals(true);
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
@ -913,8 +916,15 @@ void DialogSeamAllowance::PassmarkChanged(int index)
default:
break;
}
// Show the second option
uiTabPassmarks->checkBoxShowSecondPassmark->setEnabled(true);
uiTabPassmarks->checkBoxShowSecondPassmark->setChecked(node.IsShowSecondPassmark());
}
}
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(false);
uiTabPassmarks->groupBoxMarkType->blockSignals(false);
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
}
@ -1233,7 +1243,24 @@ void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkShowSecondChanged(int state)
{
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
rowNode.SetShowSecondPassmark(state);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
ListChanged();
}
@ -2757,6 +2784,8 @@ void DialogSeamAllowance::InitPassmarksTab()
this, &DialogSeamAllowance::PassmarkLineTypeChanged);
connect(uiTabPassmarks->buttonGroupAngleType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
&DialogSeamAllowance::PassmarkShowSecondChanged);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -104,6 +104,7 @@ private slots:
void TabChanged(int index);
void PassmarkLineTypeChanged(int id);
void PassmarkAngleTypeChanged(int id);
void PassmarkShowSecondChanged(int state);
void UpdateGrainlineValues();
void UpdateDetailLabelValues();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>222</width>
<height>349</height>
<width>268</width>
<height>377</height>
</rect>
</property>
<property name="windowTitle">
@ -159,6 +159,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowSecondPassmark">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show the second passmark on seam line</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -624,14 +624,16 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
}
}
const bool excluded = node.IsExcluded();
if (excluded)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, excluded);
}
else
{ // For backward compatebility.
nod.removeAttribute(VAbstractPattern::AttrNodeExcluded);
const bool excluded = node.IsExcluded();
if (excluded)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, excluded);
}
else
{ // For backward compatebility.
nod.removeAttribute(VAbstractPattern::AttrNodeExcluded);
}
}
switch (type)
@ -656,11 +658,13 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
break;
}
const unsigned char angleType = static_cast<unsigned char>(node.GetAngleType());
if (angleType > 0)
{
doc->SetAttribute(nod, AttrAngle, angleType);
const unsigned char angleType = static_cast<unsigned char>(node.GetAngleType());
if (angleType > 0)
{
doc->SetAttribute(nod, AttrAngle, angleType);
}
}
if (type == Tool::NodePoint)
@ -687,6 +691,18 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
}
{
const bool showSecond = node.IsShowSecondPassmark();
if (not showSecond)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodeShowSecondPassmark, showSecond);
}
else
{ // For backward compatebility.
nod.removeAttribute(VAbstractPattern::AttrNodeShowSecondPassmark);
}
}
return nod;
}