Resolved issue #684. Proposal: Add option to only show outer edges on detail.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-05-16 15:16:50 +03:00
parent 13a93ef5df
commit 56dd8ef3b6
17 changed files with 89 additions and 8 deletions

View File

@ -1,6 +1,7 @@
# Version 0.6.0 # Version 0.6.0
- [#682] New feature. Export increments to Excel .csv. - [#682] New feature. Export increments to Excel .csv.
- [#681] Enhance feature: Dashed line options for curves, arcs, etc. - [#681] Enhance feature: Dashed line options for curves, arcs, etc.
- [#684] Proposal: Add option to only show outer edges on detail.
# Version 0.5.1 # Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions. - [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -54,6 +54,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()); ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark()); ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
ui->checkBoxHideMainPath->setChecked(qApp->ValentinaSettings()->IsHideMainPath());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -79,6 +80,7 @@ void PreferencesPatternPage::Apply()
settings->SetUndoCount(ui->undoCount->value()); settings->SetUndoCount(ui->undoCount->value());
settings->SetForbidWorkpieceFlipping(ui->forbidFlippingCheck->isChecked()); settings->SetForbidWorkpieceFlipping(ui->forbidFlippingCheck->isChecked());
settings->SetHideMainPath(ui->checkBoxHideMainPath->isChecked());
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked()) if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
{ {

View File

@ -123,6 +123,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxHideMainPath">
<property name="toolTip">
<string>By default hide the main path if the seam allowance was enabled</string>
</property>
<property name="text">
<string>Hide main path</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -703,6 +703,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0"))); detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0"))); detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr)); detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
QString().setNum(qApp->ValentinaSettings()->IsHideMainPath())));
detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowanceBuiltIn, detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowanceBuiltIn,
falseStr)); falseStr));
detail.SetForbidFlipping(GetParametrBool(domElement, VToolSeamAllowance::AttrForbidFlipping, detail.SetForbidFlipping(GetParametrBool(domElement, VToolSeamAllowance::AttrForbidFlipping,

View File

@ -609,6 +609,7 @@
<xs:attribute name="seamAllowanceBuiltIn" type="xs:boolean"/> <xs:attribute name="seamAllowanceBuiltIn" type="xs:boolean"/>
<xs:attribute name="united" type="xs:boolean"/> <xs:attribute name="united" type="xs:boolean"/>
<xs:attribute name="closed" type="xs:unsignedInt"/> <xs:attribute name="closed" type="xs:unsignedInt"/>
<xs:attribute name="hideMainPath" type="xs:boolean"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>

View File

@ -111,6 +111,18 @@ void VAbstractPiece::SetSeamAllowanceBuiltIn(bool value)
d->m_seamAllowanceBuiltIn = value; d->m_seamAllowanceBuiltIn = value;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsHideMainPath() const
{
return d->m_hideMainPath;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPiece::SetHideMainPath(bool value)
{
d->m_hideMainPath = value;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VAbstractPiece::GetSAWidth() const qreal VAbstractPiece::GetSAWidth() const
{ {

View File

@ -164,6 +164,9 @@ public:
bool IsSeamAllowanceBuiltIn() const; bool IsSeamAllowanceBuiltIn() const;
void SetSeamAllowanceBuiltIn(bool value); void SetSeamAllowanceBuiltIn(bool value);
bool IsHideMainPath() const;
void SetHideMainPath(bool value);
qreal GetSAWidth() const; qreal GetSAWidth() const;
void SetSAWidth(qreal value); void SetSAWidth(qreal value);

View File

@ -47,6 +47,7 @@ public:
m_forbidFlipping(false), m_forbidFlipping(false),
m_seamAllowance(false), m_seamAllowance(false),
m_seamAllowanceBuiltIn(false), m_seamAllowanceBuiltIn(false),
m_hideMainPath(false),
m_width(0) m_width(0)
{} {}
@ -56,6 +57,7 @@ public:
m_forbidFlipping(piece.m_forbidFlipping), m_forbidFlipping(piece.m_forbidFlipping),
m_seamAllowance(piece.m_seamAllowance), m_seamAllowance(piece.m_seamAllowance),
m_seamAllowanceBuiltIn(piece.m_seamAllowanceBuiltIn), m_seamAllowanceBuiltIn(piece.m_seamAllowanceBuiltIn),
m_hideMainPath(piece.m_hideMainPath),
m_width(piece.m_width) m_width(piece.m_width)
{} {}
@ -66,6 +68,7 @@ public:
bool m_forbidFlipping; bool m_forbidFlipping;
bool m_seamAllowance; bool m_seamAllowance;
bool m_seamAllowanceBuiltIn; bool m_seamAllowanceBuiltIn;
bool m_hideMainPath;
qreal m_width; qreal m_width;
private: private:

View File

@ -382,7 +382,7 @@ VLayoutPiece::~VLayoutPiece()
VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern) VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern)
{ {
VLayoutPiece det; VLayoutPiece det;
det.SetCountourPoints(piece.MainPathPoints(pattern)); det.SetCountourPoints(piece.MainPathPoints(pattern), piece.IsHideMainPath());
det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance(), det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance(),
piece.IsSeamAllowanceBuiltIn()); piece.IsSeamAllowanceBuiltIn());
det.SetInternalPaths(ConvertInternalPaths(piece, pattern)); det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
@ -429,9 +429,10 @@ QVector<QPointF> VLayoutPiece::GetContourPoints() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutPiece::SetCountourPoints(const QVector<QPointF> &points) void VLayoutPiece::SetCountourPoints(const QVector<QPointF> &points, bool hideMainPath)
{ {
d->contour = RemoveDublicates(RoundPoints(points), false); d->contour = RemoveDublicates(RoundPoints(points), false);
SetHideMainPath(hideMainPath);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -862,12 +863,16 @@ QPainterPath VLayoutPiece::ContourPath() const
// contour // contour
QVector<QPointF> points = GetContourPoints(); QVector<QPointF> points = GetContourPoints();
path.moveTo(points.at(0));
for (qint32 i = 1; i < points.count(); ++i) if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
{ {
path.lineTo(points.at(i)); path.moveTo(points.at(0));
for (qint32 i = 1; i < points.count(); ++i)
{
path.lineTo(points.at(i));
}
path.lineTo(points.at(0));
} }
path.lineTo(points.at(0));
// seam allowance // seam allowance
if (IsSeamAllowance()) if (IsSeamAllowance())

View File

@ -73,7 +73,7 @@ public:
static VLayoutPiece Create(const VPiece &piece, const VContainer *pattern); static VLayoutPiece Create(const VPiece &piece, const VContainer *pattern);
QVector<QPointF> GetContourPoints() const; QVector<QPointF> GetContourPoints() const;
void SetCountourPoints(const QVector<QPointF> &points); void SetCountourPoints(const QVector<QPointF> &points, bool hideMainPath = false);
QVector<QPointF> GetSeamAllowancePoints() const; QVector<QPointF> GetSeamAllowancePoints() const;
void SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance = true, void SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance = true,

View File

@ -61,6 +61,7 @@ const QString settingConfigurationToolBarStyle = QStringLiteral("confi
const QString settingPatternUser = QStringLiteral("pattern/user"); const QString settingPatternUser = QStringLiteral("pattern/user");
const QString settingPatternUndo = QStringLiteral("pattern/undo"); const QString settingPatternUndo = QStringLiteral("pattern/undo");
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping"); const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark"); const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList"); const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
@ -606,6 +607,18 @@ void VCommonSettings::SetForbidWorkpieceFlipping(bool value)
setValue(settingPatternForbidFlipping, value); setValue(settingPatternForbidFlipping, value);
} }
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsHideMainPath() const
{
return value(settingPatternHideMainPath, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetHideMainPath(bool value)
{
setValue(settingPatternHideMainPath, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsDoublePassmark() const bool VCommonSettings::IsDoublePassmark() const
{ {

View File

@ -133,6 +133,9 @@ public:
bool GetForbidWorkpieceFlipping() const; bool GetForbidWorkpieceFlipping() const;
void SetForbidWorkpieceFlipping(bool value); void SetForbidWorkpieceFlipping(bool value);
bool IsHideMainPath() const;
void SetHideMainPath(bool value);
bool IsDoublePassmark() const; bool IsDoublePassmark() const;
void SetDoublePassmark(bool value); void SetDoublePassmark(bool value);

View File

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

View File

@ -200,6 +200,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
NewMainPathItem(piece.GetPath().at(i)); NewMainPathItem(piece.GetPath().at(i));
} }
uiTabPaths->checkBoxHideMainPath->setChecked(piece.IsHideMainPath());
uiTabPaths->listWidgetCustomSA->blockSignals(true); uiTabPaths->listWidgetCustomSA->blockSignals(true);
uiTabPaths->listWidgetCustomSA->clear(); uiTabPaths->listWidgetCustomSA->clear();
for (int i = 0; i < piece.GetCustomSARecords().size(); ++i) for (int i = 0; i < piece.GetCustomSARecords().size(); ++i)
@ -2079,6 +2080,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked()); piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked()); piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked()); piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked());
piece.SetName(uiTabLabels->lineEditName->text()); piece.SetName(uiTabLabels->lineEditName->text());
piece.SetMx(m_mx); piece.SetMx(m_mx);
piece.SetMy(m_my); piece.SetMy(m_my);

View File

@ -83,6 +83,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxHideMainPath">
<property name="toolTip">
<string>Hide the main path if the seam allowance is enabled</string>
</property>
<property name="text">
<string>Hide main path</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QListWidget" name="listWidgetMainPath"> <widget class="QListWidget" name="listWidgetMainPath">
<property name="dragDropMode"> <property name="dragDropMode">

View File

@ -73,6 +73,7 @@ const QString VToolSeamAllowance::TagPins = QStringLiteral("pins");
const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version"); const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version");
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping"); const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance"); const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance");
const QString VToolSeamAllowance::AttrHideMainPath = QStringLiteral("hideMainPath");
const QString VToolSeamAllowance::AttrSeamAllowanceBuiltIn = QStringLiteral("seamAllowanceBuiltIn"); const QString VToolSeamAllowance::AttrSeamAllowanceBuiltIn = QStringLiteral("seamAllowanceBuiltIn");
const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height"); const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height");
const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united"); const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united");
@ -218,6 +219,7 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout()); doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping()); doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping());
doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance()); doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance());
doc->SetAttribute(domElement, AttrHideMainPath, piece.IsHideMainPath());
const bool saBuiltIn = piece.IsSeamAllowanceBuiltIn(); const bool saBuiltIn = piece.IsSeamAllowanceBuiltIn();
if (saBuiltIn) if (saBuiltIn)
@ -1164,7 +1166,17 @@ void VToolSeamAllowance::RefreshGeometry()
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
const VPiece detail = VAbstractTool::data.GetPiece(id); const VPiece detail = VAbstractTool::data.GetPiece(id);
QPainterPath path = detail.MainPathPath(this->getData()); QPainterPath path;
if (not detail.IsHideMainPath() || not detail.IsSeamAllowance() || detail.IsSeamAllowanceBuiltIn())
{
m_seamAllowance->setBrush(QBrush(Qt::Dense7Pattern));
path = detail.MainPathPath(this->getData());
}
else
{
m_seamAllowance->setBrush(QBrush(Qt::NoBrush)); // Disable if the main path was hidden
}
{ {
QPainterPath mainPath = path; QPainterPath mainPath = path;

View File

@ -63,6 +63,7 @@ public:
static const QString AttrVersion; static const QString AttrVersion;
static const QString AttrForbidFlipping; static const QString AttrForbidFlipping;
static const QString AttrSeamAllowance; static const QString AttrSeamAllowance;
static const QString AttrHideMainPath;
static const QString AttrSeamAllowanceBuiltIn; static const QString AttrSeamAllowanceBuiltIn;
static const QString AttrHeight; static const QString AttrHeight;
static const QString AttrUnited; static const QString AttrUnited;