Each path should know its type.
--HG-- branch : feature
This commit is contained in:
parent
8a5c4a1a37
commit
422fb60dcc
|
@ -1129,9 +1129,6 @@ void MainWindow::ClosedDialogPiecePath(int result)
|
||||||
{
|
{
|
||||||
DialogPiecePath *dialog = qobject_cast<DialogPiecePath*>(dialogTool);
|
DialogPiecePath *dialog = qobject_cast<DialogPiecePath*>(dialogTool);
|
||||||
SCASSERT(dialog != nullptr);
|
SCASSERT(dialog != nullptr);
|
||||||
|
|
||||||
const PiecePathType type = dialog->GetType();
|
|
||||||
const VPiecePath path = dialog->GetPiecePath();
|
|
||||||
//VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
|
//VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
|
||||||
}
|
}
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiece::VPiece()
|
VPiece::VPiece()
|
||||||
: VAbstractPiece(), d(new VPieceData)
|
: VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,8 +42,8 @@ QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
class VPieceData : public QSharedData
|
class VPieceData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPieceData()
|
VPieceData(PiecePathType type)
|
||||||
: m_path(),
|
: m_path(type),
|
||||||
m_mx(0),
|
m_mx(0),
|
||||||
m_my(0),
|
m_my(0),
|
||||||
m_inLayout(true),
|
m_inLayout(true),
|
||||||
|
|
|
@ -39,6 +39,11 @@ VPiecePath::VPiecePath()
|
||||||
: d(new VPiecePathData)
|
: d(new VPiecePathData)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPiecePath::VPiecePath(PiecePathType type)
|
||||||
|
: d(new VPiecePathData(type))
|
||||||
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiecePath::VPiecePath(const VPiecePath &path)
|
VPiecePath::VPiecePath(const VPiecePath &path)
|
||||||
: d (path.d)
|
: d (path.d)
|
||||||
|
@ -101,6 +106,18 @@ void VPiecePath::SetNodes(const QVector<VPieceNode> &nodes)
|
||||||
d->m_nodes = nodes;
|
d->m_nodes = nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PiecePathType VPiecePath::GetType() const
|
||||||
|
{
|
||||||
|
return d->m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPiecePath::SetType(PiecePathType type)
|
||||||
|
{
|
||||||
|
d->m_type = type;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
|
QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
|
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
|
||||||
class VPiecePathData;
|
class VPiecePathData;
|
||||||
class VPieceNode;
|
class VPieceNode;
|
||||||
class QPointF;
|
class QPointF;
|
||||||
|
@ -43,6 +45,7 @@ class VPiecePath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPiecePath();
|
VPiecePath();
|
||||||
|
VPiecePath(PiecePathType type);
|
||||||
VPiecePath(const VPiecePath &path);
|
VPiecePath(const VPiecePath &path);
|
||||||
VPiecePath &operator=(const VPiecePath &path);
|
VPiecePath &operator=(const VPiecePath &path);
|
||||||
~VPiecePath();
|
~VPiecePath();
|
||||||
|
@ -57,6 +60,9 @@ public:
|
||||||
QVector<VPieceNode> GetNodes() const;
|
QVector<VPieceNode> GetNodes() const;
|
||||||
void SetNodes(const QVector<VPieceNode> &nodes);
|
void SetNodes(const QVector<VPieceNode> &nodes);
|
||||||
|
|
||||||
|
PiecePathType GetType() const;
|
||||||
|
void SetType(PiecePathType type);
|
||||||
|
|
||||||
QVector<QPointF> PathPoints(const VContainer *data) const;
|
QVector<QPointF> PathPoints(const VContainer *data) const;
|
||||||
QVector<QPointF> PathNodePoints(const VContainer *data) const;
|
QVector<QPointF> PathNodePoints(const VContainer *data) const;
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,25 @@ class VPiecePathData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPiecePathData()
|
VPiecePathData()
|
||||||
: m_nodes()
|
: m_nodes(),
|
||||||
|
m_type(PiecePathType::Unknown)
|
||||||
|
{}
|
||||||
|
|
||||||
|
VPiecePathData(PiecePathType type)
|
||||||
|
: m_nodes(),
|
||||||
|
m_type(type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VPiecePathData(const VPiecePathData &path)
|
VPiecePathData(const VPiecePathData &path)
|
||||||
: QSharedData(path),
|
: QSharedData(path),
|
||||||
m_nodes(path.m_nodes)
|
m_nodes(path.m_nodes),
|
||||||
|
m_type(path.m_type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~VPiecePathData();
|
~VPiecePathData();
|
||||||
|
|
||||||
QVector<VPieceNode> m_nodes;
|
QVector<VPieceNode> m_nodes;
|
||||||
|
PiecePathType m_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VPiecePathData &operator=(const VPiecePathData &) Q_DECL_EQ_DELETE;
|
VPiecePathData &operator=(const VPiecePathData &) Q_DECL_EQ_DELETE;
|
||||||
|
|
|
@ -261,6 +261,8 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path)
|
||||||
NewItem(path.at(i));
|
NewItem(path.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetType(path.GetType());
|
||||||
|
|
||||||
ValidObjects(PathIsValid());
|
ValidObjects(PathIsValid());
|
||||||
|
|
||||||
ListChanged();
|
ListChanged();
|
||||||
|
@ -345,6 +347,8 @@ VPiecePath DialogPiecePath::CreatePath() const
|
||||||
path.Append(qvariant_cast<VPieceNode>(item->data(Qt::UserRole)));
|
path.Append(qvariant_cast<VPieceNode>(item->data(Qt::UserRole)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path.SetType(GetType());
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,6 @@ public:
|
||||||
VPiecePath GetPiecePath() const;
|
VPiecePath GetPiecePath() const;
|
||||||
void SetPiecePath(const VPiecePath &path);
|
void SetPiecePath(const VPiecePath &path);
|
||||||
|
|
||||||
PiecePathType GetType() const;
|
|
||||||
void SetType(PiecePathType type);
|
|
||||||
|
|
||||||
quint32 GetPieceId() const;
|
quint32 GetPieceId() const;
|
||||||
void SetPieceId(quint32 id);
|
void SetPieceId(quint32 id);
|
||||||
|
|
||||||
|
@ -83,6 +80,9 @@ private:
|
||||||
bool PathIsValid() const;
|
bool PathIsValid() const;
|
||||||
void ValidObjects(bool value);
|
void ValidObjects(bool value);
|
||||||
void NewItem(const VPieceNode &node);
|
void NewItem(const VPieceNode &node);
|
||||||
|
|
||||||
|
PiecePathType GetType() const;
|
||||||
|
void SetType(PiecePathType type);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGPIECEPATH_H
|
#endif // DIALOGPIECEPATH_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user