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