Return list of all variables.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-15 12:49:15 +03:00
parent bdb3bf9050
commit 4fbae45406
2 changed files with 44 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include "../vgeometry/varc.h"
#include "../vgeometry/vsplinepath.h"
#include "../vmisc/logging.h"
#include "../vmisc/vabstractapplication.h"
#include "vtranslatevars.h"
#include <QLineF>
@ -487,6 +488,33 @@ const QMap<QString, QSharedPointer<VSplineAngle> > VContainer::DataAnglesCurves(
return DataVar<VSplineAngle>(VarType::SplineAngle);
}
//---------------------------------------------------------------------------------------------------------------------
const QHash<QString, const qreal *> VContainer::PlainVariables() const
{
QHash<QString, const qreal *> vars;
QHash<QString, QSharedPointer<VInternalVariable>>::const_iterator i = d->variables.constBegin();
while (i != d->variables.constEnd())
{
QSharedPointer<VInternalVariable> var = i.value();
if ((qApp->patternType() == MeasurementsType::Standard) &&
(var->GetType() == VarType::Measurement || var->GetType() == VarType::Increment))
{
QSharedPointer<VVariable> m = GetVariable<VVariable>(i.key());
m->SetValue(size(), height(), qApp->patternUnit());
}
vars.insert(i.key(), var->GetValue());
}
if (qApp->patternType() == MeasurementsType::Standard)
{
vars.insert(SizeName(), rsize());
vars.insert(HeightName(), rheight());
}
return vars;
}
//---------------------------------------------------------------------------------------------------------------------
bool VContainer::IsUnique(const QString &name)
{
@ -590,6 +618,12 @@ qreal VContainer::size()
return _size;
}
//---------------------------------------------------------------------------------------------------------------------
const qreal *VContainer::rsize()
{
return &_size;
}
//---------------------------------------------------------------------------------------------------------------------
QString VContainer::SizeName() const
{
@ -606,6 +640,12 @@ qreal VContainer::height()
return _height;
}
//---------------------------------------------------------------------------------------------------------------------
const qreal *VContainer::rheight()
{
return &_height;
}
//---------------------------------------------------------------------------------------------------------------------
QString VContainer::HeightName() const
{

View File

@ -138,8 +138,10 @@ public:
static void SetHeight(qreal height);
void SetHeightName(const QString &name);
static qreal size();
static const qreal *rsize();
QString SizeName() const;
static qreal height();
static const qreal *rheight();
QString HeightName()const;
bool VariableExist(const QString& name);
@ -160,6 +162,8 @@ public:
const QMap<QString, QSharedPointer<VArcAngle> > DataAnglesArcs() const;
const QMap<QString, QSharedPointer<VSplineAngle> > DataAnglesCurves() const;
const QHash<QString, const qreal *> PlainVariables() const;
static bool IsUnique(const QString &name);
const Unit *GetPatternUnit() const;