diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index c933be86c..9a8338e8d 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -30,6 +30,7 @@ #include "../vgeometry/varc.h" #include "../vgeometry/vsplinepath.h" #include "../vmisc/logging.h" +#include "../vmisc/vabstractapplication.h" #include "vtranslatevars.h" #include @@ -487,6 +488,33 @@ const QMap > VContainer::DataAnglesCurves( return DataVar(VarType::SplineAngle); } +//--------------------------------------------------------------------------------------------------------------------- +const QHash VContainer::PlainVariables() const +{ + QHash vars; + + QHash>::const_iterator i = d->variables.constBegin(); + while (i != d->variables.constEnd()) + { + QSharedPointer var = i.value(); + if ((qApp->patternType() == MeasurementsType::Standard) && + (var->GetType() == VarType::Measurement || var->GetType() == VarType::Increment)) + { + QSharedPointer m = GetVariable(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 { diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 5d4f8f5f2..ee56467f3 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -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 > DataAnglesArcs() const; const QMap > DataAnglesCurves() const; + const QHash PlainVariables() const; + static bool IsUnique(const QString &name); const Unit *GetPatternUnit() const;