Added new tool Insert node.
--HG-- branch : feature
This commit is contained in:
parent
20ccbaae01
commit
e995f6f68a
|
@ -666,7 +666,7 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
const quint32 id = VDomDocument::GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
const quint32 id = VDomDocument::GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||||
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, "0");
|
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, "0");
|
||||||
const bool excluded = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeExcluded, "0");
|
const bool excluded = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeExcluded, falseStr);
|
||||||
const QString saBefore = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore,
|
const QString saBefore = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore,
|
||||||
currentSeamAllowance);
|
currentSeamAllowance);
|
||||||
const QString saAfter = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter,
|
const QString saAfter = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter,
|
||||||
|
|
|
@ -58,8 +58,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.4");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.5");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.4.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.5.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
|
|
@ -121,9 +121,9 @@ QVector<QPointF> VPiece::MainPathPoints(const VContainer *data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data) const
|
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data, bool showExcluded) const
|
||||||
{
|
{
|
||||||
return GetPath().PathNodePoints(data);
|
return GetPath().PathNodePoints(data, showExcluded);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -146,6 +146,11 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
|
||||||
for (int i = 0; i< d->m_path.CountNodes(); ++i)
|
for (int i = 0; i< d->m_path.CountNodes(); ++i)
|
||||||
{
|
{
|
||||||
const VPieceNode &node = d->m_path.at(i);
|
const VPieceNode &node = d->m_path.at(i);
|
||||||
|
if (node.IsExcluded())
|
||||||
|
{
|
||||||
|
continue;// skip excluded node
|
||||||
|
}
|
||||||
|
|
||||||
switch (node.GetTypeTool())
|
switch (node.GetTypeTool())
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
|
@ -491,12 +496,16 @@ QVector<CustomSARecord> VPiece::GetValidRecords() const
|
||||||
for (int i = 0; i < d->m_customSARecords.size(); ++i)
|
for (int i = 0; i < d->m_customSARecords.size(); ++i)
|
||||||
{
|
{
|
||||||
const CustomSARecord &record = d->m_customSARecords.at(i);
|
const CustomSARecord &record = d->m_customSARecords.at(i);
|
||||||
|
const int indexStartPoint = d->m_path.indexOfNode(record.startPoint);
|
||||||
|
const int indexEndPoint = d->m_path.indexOfNode(record.endPoint);
|
||||||
|
|
||||||
if (record.startPoint > NULL_ID
|
if (record.startPoint > NULL_ID
|
||||||
&& record.path > NULL_ID
|
&& record.path > NULL_ID
|
||||||
&& record.endPoint > NULL_ID
|
&& record.endPoint > NULL_ID
|
||||||
&& d->m_path.indexOfNode(record.startPoint) != -1
|
&& indexStartPoint != -1
|
||||||
&& d->m_path.indexOfNode(record.endPoint) != -1)
|
&& not d->m_path.at(indexStartPoint).IsExcluded()
|
||||||
|
&& indexEndPoint != -1
|
||||||
|
&& not d->m_path.at(indexEndPoint).IsExcluded())
|
||||||
{
|
{
|
||||||
records.append(record);
|
records.append(record);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
void SetPath(const VPiecePath &path);
|
void SetPath(const VPiecePath &path);
|
||||||
|
|
||||||
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
||||||
QVector<VPointF> MainPathNodePoints(const VContainer *data) const;
|
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
||||||
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
||||||
|
|
||||||
QPainterPath MainPathPath(const VContainer *data) const;
|
QPainterPath MainPathPath(const VContainer *data) const;
|
||||||
|
|
|
@ -243,6 +243,11 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
for (int i = 0; i < CountNodes(); ++i)
|
for (int i = 0; i < CountNodes(); ++i)
|
||||||
{
|
{
|
||||||
|
if (at(i).IsExcluded())
|
||||||
|
{
|
||||||
|
continue;// skip excluded node
|
||||||
|
}
|
||||||
|
|
||||||
switch (at(i).GetTypeTool())
|
switch (at(i).GetTypeTool())
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
|
@ -274,7 +279,7 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data) const
|
QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data, bool showExcluded) const
|
||||||
{
|
{
|
||||||
QVector<VPointF> points;
|
QVector<VPointF> points;
|
||||||
for (int i = 0; i < CountNodes(); ++i)
|
for (int i = 0; i < CountNodes(); ++i)
|
||||||
|
@ -283,8 +288,11 @@ QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data) const
|
||||||
{
|
{
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).GetId());
|
if (showExcluded || not at(i).IsExcluded())
|
||||||
points.append(*point);
|
{
|
||||||
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).GetId());
|
||||||
|
points.append(*point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
void SetPenType(const Qt::PenStyle &type);
|
void SetPenType(const Qt::PenStyle &type);
|
||||||
|
|
||||||
QVector<QPointF> PathPoints(const VContainer *data) const;
|
QVector<QPointF> PathPoints(const VContainer *data) const;
|
||||||
QVector<VPointF> PathNodePoints(const VContainer *data) const;
|
QVector<VPointF> PathNodePoints(const VContainer *data, bool showExcluded = true) const;
|
||||||
QVector<VSAPoint> SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const;
|
QVector<VSAPoint> SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const;
|
||||||
|
|
||||||
QPainterPath PainterPath(const VContainer *data) const;
|
QPainterPath PainterPath(const VContainer *data) const;
|
||||||
|
|
|
@ -79,6 +79,25 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog")
|
||||||
|
|
||||||
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 RowId(QListWidget *listWidget, int i)
|
||||||
|
{
|
||||||
|
SCASSERT(listWidget != nullptr);
|
||||||
|
|
||||||
|
if (i < 0 || i >= listWidget->count())
|
||||||
|
{
|
||||||
|
return NULL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QListWidgetItem *rowItem = listWidget->item(i);
|
||||||
|
SCASSERT(rowItem != nullptr);
|
||||||
|
const VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
return rowNode.GetId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief DialogTool create dialog
|
* @brief DialogTool create dialog
|
||||||
|
@ -411,13 +430,65 @@ quint32 DialogTool::DNumber(const QString &baseName) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 DialogTool::RowId(QListWidget *listWidget, int i)
|
quint32 DialogTool::FindNotExcludedNodeDown(QListWidget *listWidget, int candidate)
|
||||||
{
|
{
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
const QListWidgetItem *rowItem = listWidget->item(i);
|
|
||||||
SCASSERT(rowItem != nullptr);
|
quint32 id = NULL_ID;
|
||||||
const VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
if (candidate < 0 || candidate >= listWidget->count())
|
||||||
return rowNode.GetId();
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = candidate;
|
||||||
|
VPieceNode rowNode;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const QListWidgetItem *rowItem = listWidget->item(i);
|
||||||
|
SCASSERT(rowItem != nullptr);
|
||||||
|
rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
|
if (not rowNode.IsExcluded())
|
||||||
|
{
|
||||||
|
id = rowNode.GetId();
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
while (rowNode.IsExcluded() && i < listWidget->count());
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogTool::FindNotExcludedNodeUp(QListWidget *listWidget, int candidate)
|
||||||
|
{
|
||||||
|
SCASSERT(listWidget != nullptr);
|
||||||
|
|
||||||
|
quint32 id = NULL_ID;
|
||||||
|
if (candidate < 0 || candidate >= listWidget->count())
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = candidate;
|
||||||
|
VPieceNode rowNode;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const QListWidgetItem *rowItem = listWidget->item(i);
|
||||||
|
SCASSERT(rowItem != nullptr);
|
||||||
|
rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
|
if (not rowNode.IsExcluded())
|
||||||
|
{
|
||||||
|
id = rowNode.GetId();
|
||||||
|
}
|
||||||
|
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
while (rowNode.IsExcluded() && i > -1);
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -426,7 +497,9 @@ bool DialogTool::FirstPointEqualLast(QListWidget *listWidget)
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
if (listWidget->count() > 1)
|
if (listWidget->count() > 1)
|
||||||
{
|
{
|
||||||
return RowId(listWidget, 0) == RowId(listWidget, listWidget->count()-1);
|
const quint32 topId = FindNotExcludedNodeDown(listWidget, 0);
|
||||||
|
const quint32 bottomId = FindNotExcludedNodeUp(listWidget, listWidget->count()-1);
|
||||||
|
return topId == bottomId;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +510,10 @@ bool DialogTool::DoublePoints(QListWidget *listWidget)
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
for (int i=0, sz = listWidget->count()-1; i<sz; ++i)
|
for (int i=0, sz = listWidget->count()-1; i<sz; ++i)
|
||||||
{
|
{
|
||||||
if (RowId(listWidget, i) == RowId(listWidget, i+1))
|
const quint32 firstId = FindNotExcludedNodeDown(listWidget, i);
|
||||||
|
const quint32 secondId = FindNotExcludedNodeDown(listWidget, firstId+1);
|
||||||
|
|
||||||
|
if (firstId == secondId)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -459,6 +535,14 @@ QString DialogTool::DialogWarningIcon()
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QFont DialogTool::NodeFont(bool nodeExcluded)
|
||||||
|
{
|
||||||
|
QFont font("Times", 12, QFont::Bold);
|
||||||
|
font.setStrikeOut(nodeExcluded);
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogTool::GetNodeName(const VPieceNode &node) const
|
QString DialogTool::GetNodeName(const VPieceNode &node) const
|
||||||
{
|
{
|
||||||
|
@ -516,7 +600,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
|
||||||
if(canAddNewPoint)
|
if(canAddNewPoint)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(NodeFont(node.IsExcluded()));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
listWidget->addItem(item);
|
listWidget->addItem(item);
|
||||||
listWidget->setCurrentRow(listWidget->count()-1);
|
listWidget->setCurrentRow(listWidget->count()-1);
|
||||||
|
|
|
@ -266,10 +266,12 @@ protected:
|
||||||
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
|
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
|
||||||
quint32 DNumber(const QString &baseName) const;
|
quint32 DNumber(const QString &baseName) const;
|
||||||
|
|
||||||
static quint32 RowId(QListWidget *listWidget, int i);
|
static quint32 FindNotExcludedNodeDown(QListWidget *listWidget, int candidate);
|
||||||
|
static quint32 FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
|
||||||
static bool FirstPointEqualLast(QListWidget *listWidget);
|
static bool FirstPointEqualLast(QListWidget *listWidget);
|
||||||
static bool DoublePoints(QListWidget *listWidget);
|
static bool DoublePoints(QListWidget *listWidget);
|
||||||
static QString DialogWarningIcon();
|
static QString DialogWarningIcon();
|
||||||
|
static QFont NodeFont(bool nodeExcluded);
|
||||||
|
|
||||||
QString GetNodeName(const VPieceNode &node) const;
|
QString GetNodeName(const VPieceNode &node) const;
|
||||||
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
|
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
|
||||||
|
|
|
@ -587,6 +587,10 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
|
||||||
actionReverse->setChecked(rowNode.GetReverse());
|
actionReverse->setChecked(rowNode.GetReverse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction *actionExcluded = menu->addAction(tr("Excluded"));
|
||||||
|
actionExcluded->setCheckable(true);
|
||||||
|
actionExcluded->setChecked(rowNode.IsExcluded());
|
||||||
|
|
||||||
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
|
|
||||||
QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos));
|
QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos));
|
||||||
|
@ -602,6 +606,14 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
|
||||||
rowItem->setText(GetNodeName(rowNode));
|
rowItem->setText(GetNodeName(rowNode));
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
}
|
}
|
||||||
|
else if (selectedAction == actionExcluded)
|
||||||
|
{
|
||||||
|
rowNode.SetExcluded(not rowNode.IsExcluded());
|
||||||
|
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||||
|
rowItem->setText(GetNodeName(rowNode));
|
||||||
|
rowItem->setFont(NodeFont(rowNode.IsExcluded()));
|
||||||
|
ValidObjects(MainPathIsValid());
|
||||||
|
}
|
||||||
|
|
||||||
ListChanged();
|
ListChanged();
|
||||||
}
|
}
|
||||||
|
@ -1989,12 +2001,13 @@ QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
||||||
bool DialogSeamAllowance::MainPathIsValid() const
|
bool DialogSeamAllowance::MainPathIsValid() const
|
||||||
{
|
{
|
||||||
QString url = DialogWarningIcon();
|
QString url = DialogWarningIcon();
|
||||||
|
bool valid = true;
|
||||||
|
|
||||||
if(CreatePiece().MainPathPoints(data).count() < 3)
|
if(CreatePiece().MainPathPoints(data).count() < 3)
|
||||||
{
|
{
|
||||||
url += tr("You need more points!");
|
url += tr("You need more points!");
|
||||||
uiTabPaths->helpLabel->setText(url);
|
uiTabPaths->helpLabel->setText(url);
|
||||||
return false;
|
valid = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2002,23 +2015,33 @@ bool DialogSeamAllowance::MainPathIsValid() const
|
||||||
{
|
{
|
||||||
url += tr("You have to choose points in a clockwise direction!");
|
url += tr("You have to choose points in a clockwise direction!");
|
||||||
uiTabPaths->helpLabel->setText(url);
|
uiTabPaths->helpLabel->setText(url);
|
||||||
return false;
|
valid = false;
|
||||||
}
|
}
|
||||||
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath))
|
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath))
|
||||||
{
|
{
|
||||||
url += tr("First point cannot be equal to the last point!");
|
url += tr("First point cannot be equal to the last point!");
|
||||||
uiTabPaths->helpLabel->setText(url);
|
uiTabPaths->helpLabel->setText(url);
|
||||||
return false;
|
valid = false;
|
||||||
}
|
}
|
||||||
else if (DoublePoints(uiTabPaths->listWidgetMainPath))
|
else if (DoublePoints(uiTabPaths->listWidgetMainPath))
|
||||||
{
|
{
|
||||||
url += tr("You have double points!");
|
url += tr("You have double points!");
|
||||||
uiTabPaths->helpLabel->setText(url);
|
uiTabPaths->helpLabel->setText(url);
|
||||||
return false;
|
valid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uiTabPaths->helpLabel->setText(tr("Ready!"));
|
|
||||||
return true;
|
if (valid)
|
||||||
|
{
|
||||||
|
m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
|
||||||
|
uiTabPaths->helpLabel->setText(tr("Ready!"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2059,7 +2082,7 @@ void DialogSeamAllowance::InitNodesList()
|
||||||
for (int i = 0; i < nodes.size(); ++i)
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
{
|
{
|
||||||
const VPieceNode node = nodes.at(i);
|
const VPieceNode node = nodes.at(i);
|
||||||
if (node.GetTypeTool() == Tool::NodePoint)
|
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
|
||||||
{
|
{
|
||||||
const QString name = GetNodeName(node);
|
const QString name = GetNodeName(node);
|
||||||
|
|
||||||
|
@ -2283,7 +2306,7 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
|
||||||
for (int i = 0; i < nodes.size(); ++i)
|
for (int i = 0; i < nodes.size(); ++i)
|
||||||
{
|
{
|
||||||
const VPieceNode &node = nodes.at(i);
|
const VPieceNode &node = nodes.at(i);
|
||||||
if (node.GetTypeTool() == Tool::NodePoint)
|
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
|
||||||
{
|
{
|
||||||
const QString name = GetNodeName(node);
|
const QString name = GetNodeName(node);
|
||||||
box->addItem(name, node.GetId());
|
box->addItem(name, node.GetId());
|
||||||
|
|
|
@ -58,8 +58,13 @@ const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
|
||||||
*/
|
*/
|
||||||
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
||||||
const QString &drawName, const quint32 &idTool, QObject *parent)
|
const QString &drawName, const quint32 &idTool, QObject *parent)
|
||||||
: VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool),
|
: VAbstractTool(doc, data, id, parent),
|
||||||
currentColor(Qt::black), m_drawName(drawName)
|
parentType(ParentType::Item),
|
||||||
|
idNode(idNode),
|
||||||
|
idTool(idTool),
|
||||||
|
currentColor(Qt::black),
|
||||||
|
m_drawName(drawName),
|
||||||
|
m_exluded(false)
|
||||||
{
|
{
|
||||||
_referens = 0;
|
_referens = 0;
|
||||||
}
|
}
|
||||||
|
@ -140,6 +145,18 @@ void VAbstractNode::GroupVisibility(quint32 object, bool visible)
|
||||||
Q_UNUSED(visible)
|
Q_UNUSED(visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractNode::IsExluded() const
|
||||||
|
{
|
||||||
|
return m_exluded;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractNode::SetExluded(bool exluded)
|
||||||
|
{
|
||||||
|
m_exluded = exluded;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractNode::ToolCreation(const Source &typeCreation)
|
void VAbstractNode::ToolCreation(const Source &typeCreation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,11 +61,12 @@ public:
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
bool IsExluded() const;
|
||||||
|
void SetExluded(bool exluded);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ParentType parentType;
|
ParentType parentType;
|
||||||
|
|
||||||
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
|
|
||||||
protected:
|
|
||||||
/** @brief idNodenode id. */
|
/** @brief idNodenode id. */
|
||||||
quint32 idNode;
|
quint32 idNode;
|
||||||
|
|
||||||
|
@ -77,11 +78,16 @@ protected:
|
||||||
|
|
||||||
QString m_drawName;
|
QString m_drawName;
|
||||||
|
|
||||||
|
bool m_exluded;
|
||||||
|
|
||||||
void AddToModeling(const QDomElement &domElement);
|
void AddToModeling(const QDomElement &domElement);
|
||||||
|
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE {}
|
virtual void SetVisualization() Q_DECL_OVERRIDE {}
|
||||||
|
|
||||||
virtual void ShowNode()=0;
|
virtual void ShowNode()=0;
|
||||||
virtual void HideNode()=0;
|
virtual void HideNode()=0;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VAbstractNode)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VABSTRACTNODE_H
|
#endif // VABSTRACTNODE_H
|
||||||
|
|
|
@ -321,7 +321,7 @@ void VNodePoint::RefreshLine()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodePoint::ShowNode()
|
void VNodePoint::ShowNode()
|
||||||
{
|
{
|
||||||
if (parentType != ParentType::Scene)
|
if (parentType != ParentType::Scene && not m_exluded)
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,6 +453,7 @@ void VToolSeamAllowance::GroupVisibility(quint32 object, bool visible)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::FullUpdateFromFile()
|
void VToolSeamAllowance::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
|
UpdateExcludeState();
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1207,6 +1208,24 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data,
|
||||||
UpdateGrainline();
|
UpdateGrainline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::UpdateExcludeState()
|
||||||
|
{
|
||||||
|
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||||
|
for (int i = 0; i< detail.GetPath().CountNodes(); ++i)
|
||||||
|
{
|
||||||
|
const VPieceNode &node = detail.GetPath().at(i);
|
||||||
|
if (node.GetTypeTool() == Tool::NodePoint)
|
||||||
|
{
|
||||||
|
VNodePoint *tool = qobject_cast<VNodePoint*>(doc->getTool(node.GetId()));
|
||||||
|
SCASSERT(tool != nullptr);
|
||||||
|
|
||||||
|
tool->SetExluded(node.IsExcluded());
|
||||||
|
tool->setVisible(not node.IsExcluded());//Hide excluded point
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::RefreshGeometry()
|
void VToolSeamAllowance::RefreshGeometry()
|
||||||
{
|
{
|
||||||
|
@ -1462,6 +1481,7 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc
|
||||||
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
tool->setParentItem(parent);
|
tool->setParentItem(parent);
|
||||||
tool->SetParentType(ParentType::Item);
|
tool->SetParentType(ParentType::Item);
|
||||||
|
tool->SetExluded(node.IsExcluded());
|
||||||
tool->setVisible(not node.IsExcluded());//Hide excluded point
|
tool->setVisible(not node.IsExcluded());//Hide excluded point
|
||||||
doc->IncrementReferens(node.GetId());
|
doc->IncrementReferens(node.GetId());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -153,6 +153,7 @@ private:
|
||||||
VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
||||||
VMainGraphicsScene *scene, const QString &m_drawName, QGraphicsItem * parent = nullptr);
|
VMainGraphicsScene *scene, const QString &m_drawName, QGraphicsItem * parent = nullptr);
|
||||||
|
|
||||||
|
void UpdateExcludeState();
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
void SaveDialogChange();
|
void SaveDialogChange();
|
||||||
VPieceItem::MoveTypes FindLabelGeometry(const VPatternLabelData &labelData, qreal &rotationAngle, qreal &labelWidth,
|
VPieceItem::MoveTypes FindLabelGeometry(const VPatternLabelData &labelData, qreal &rotationAngle, qreal &labelWidth,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user