Save VPiecePath in VContainer class.
--HG-- branch : feature
This commit is contained in:
parent
024f1373f6
commit
8182f2979b
|
@ -179,6 +179,19 @@ VPiece VContainer::GetPiece(quint32 id) const
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPiecePath VContainer::GetPiecePath(quint32 id) const
|
||||
{
|
||||
if (d->piecePaths->contains(id))
|
||||
{
|
||||
return d->piecePaths->value(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VExceptionBadId(tr("Can't find object"), id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddGObject add new GObject to container
|
||||
|
@ -214,6 +227,14 @@ quint32 VContainer::AddPiece(const VPiece &detail)
|
|||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VContainer::AddPiecePath(const VPiecePath &path)
|
||||
{
|
||||
const quint32 id = getNextId();
|
||||
d->piecePaths->insert(id, path);
|
||||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VContainer::getId()
|
||||
{
|
||||
|
@ -295,6 +316,7 @@ void VContainer::ClearForFullParse()
|
|||
|
||||
d->details->clear();
|
||||
d->pieces->clear();
|
||||
d->piecePaths->clear();
|
||||
ClearVariables(VarType::Increment);
|
||||
ClearVariables(VarType::LineAngle);
|
||||
ClearVariables(VarType::LineLength);
|
||||
|
@ -530,6 +552,14 @@ void VContainer::UpdatePiece(quint32 id, const VPiece &detail)
|
|||
UpdateId(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::UpdatePiecePath(quint32 id, const VPiecePath &path)
|
||||
{
|
||||
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||
d->piecePaths->insert(id, path);
|
||||
UpdateId(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VContainer::GetTableValue(const QString &name, MeasurementsType patternType) const
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "variables/vinternalvariable.h"
|
||||
#include "vdetail.h"
|
||||
#include "vpiece.h"
|
||||
#include "vpiecepath.h"
|
||||
#include "vtranslatevars.h"
|
||||
|
||||
class VAbstractCubicBezierPath;
|
||||
|
@ -83,7 +84,9 @@ public:
|
|||
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()),
|
||||
details(QSharedPointer<QHash<quint32, VDetail>>(new QHash<quint32, VDetail>())),
|
||||
pieces(QSharedPointer<QHash<quint32, VPiece>>(new QHash<quint32, VPiece>())),
|
||||
trVars(trVars), patternUnit(patternUnit)
|
||||
piecePaths(QSharedPointer<QHash<quint32, VPiecePath>>(new QHash<quint32, VPiecePath>())),
|
||||
trVars(trVars),
|
||||
patternUnit(patternUnit)
|
||||
{}
|
||||
|
||||
VContainerData(const VContainerData &data)
|
||||
|
@ -112,6 +115,7 @@ public:
|
|||
*/
|
||||
QSharedPointer<QHash<quint32, VDetail>> details;
|
||||
QSharedPointer<QHash<quint32, VPiece>> pieces;
|
||||
QSharedPointer<QHash<quint32, VPiecePath>> piecePaths;
|
||||
|
||||
const VTranslateVars *trVars;
|
||||
const Unit *patternUnit;
|
||||
|
@ -140,6 +144,7 @@ public:
|
|||
static const QSharedPointer<VGObject> GetFakeGObject(quint32 id);
|
||||
const VDetail GetDetail(quint32 id) const;
|
||||
VPiece GetPiece(quint32 id) const;
|
||||
VPiecePath GetPiecePath(quint32 id) const;
|
||||
qreal GetTableValue(const QString& name, MeasurementsType patternType) const;
|
||||
template <typename T>
|
||||
QSharedPointer<T> GetVariable(QString name) const;
|
||||
|
@ -150,6 +155,7 @@ public:
|
|||
quint32 AddGObject(VGObject *obj);
|
||||
quint32 AddDetail(const VDetail &detail);
|
||||
quint32 AddPiece(const VPiece &detail);
|
||||
quint32 AddPiecePath(const VPiecePath &path);
|
||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||
void AddArc(const QSharedPointer<VArc> &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID);
|
||||
void AddSpline(const QSharedPointer<VAbstractBezier> &curve, quint32 id, quint32 parentId = NULL_ID);
|
||||
|
@ -163,6 +169,7 @@ public:
|
|||
void UpdateGObject(quint32 id, VGObject* obj);
|
||||
void UpdateDetail(quint32 id, const VDetail &detail);
|
||||
void UpdatePiece(quint32 id, const VPiece &detail);
|
||||
void UpdatePiecePath(quint32 id, const VPiecePath &path);
|
||||
|
||||
void Clear();
|
||||
void ClearForFullParse();
|
||||
|
|
Loading…
Reference in New Issue
Block a user