Prepare gradation list.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-07 15:03:24 +03:00
parent 962f6942ea
commit 68a3a15c45
6 changed files with 48 additions and 17 deletions

View File

@ -97,7 +97,7 @@ VMeasurement::~VMeasurement()
{}
//---------------------------------------------------------------------------------------------------------------------
QStringList VMeasurement::ListHeights()
QStringList VMeasurement::ListHeights(QMap<GHeights, bool> heights)
{
QStringList list;
if (qApp->patternUnit() == Unit::Inch)
@ -106,16 +106,29 @@ QStringList VMeasurement::ListHeights()
return list;
}
// from 92 cm to 188 cm
for (int i = 92; i<= 188; i = i+6)
QMap<GHeights, bool>::const_iterator i = heights.constBegin();
while (i != heights.constEnd())
{
ListValue(list, i);
if (i.value())
{
ListValue(list, static_cast<int>(i.key()));
}
++i;
}
if (list.isEmpty())
{
// from 92 cm to 188 cm
for (int i = 92; i<= 188; i = i+6)
{
ListValue(list, i);
}
}
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VMeasurement::ListSizes()
QStringList VMeasurement::ListSizes(QMap<GSizes, bool> sizes)
{
QStringList list;
if (qApp->patternUnit() == Unit::Inch)
@ -124,10 +137,23 @@ QStringList VMeasurement::ListSizes()
return list;
}
// from 22 cm to 56 cm
for (int i = 22; i<= 56; i = i+2)
QMap<GSizes, bool>::const_iterator i = sizes.constBegin();
while (i != sizes.constEnd())
{
ListValue(list, i);
if (i.value())
{
ListValue(list, static_cast<int>(i.key()));
}
++i;
}
if (list.isEmpty())
{
// from 22 cm to 56 cm
for (int i = 22; i<= 56; i = i+2)
{
ListValue(list, i);
}
}
return list;
}

View File

@ -30,6 +30,7 @@
#define VSTANDARDTABLEROW_H
#include "vvariable.h"
#include "../options.h"
#include <QStringList>
@ -52,8 +53,8 @@ public:
QString GetGuiText() const;
QString TagName() const;
void setTagName(const QString &TagName);
static QStringList ListHeights();
static QStringList ListSizes();
static QStringList ListHeights(QMap<GHeights, bool> heights);
static QStringList ListSizes(QMap<GSizes, bool> sizes);
private:
/** @brief description description measurement */
QString gui_text;

View File

@ -762,8 +762,8 @@ void MainWindow::ToolBarOption()
{
if (qApp->patternType() == MeasurementsType::Standard)
{
const QStringList listHeights = VMeasurement::ListHeights();
const QStringList listSizes = VMeasurement::ListSizes();
const QStringList listHeights = VMeasurement::ListHeights(doc->GetGradationHeights());
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes());
SetGradationList(tr("Height: "), listHeights, &MainWindow::ChangedHeight);
SetGradationList(tr("Size: "), listSizes, &MainWindow::ChangedSize);

View File

@ -75,6 +75,13 @@ enum class Draw : char { Calculation, Modeling };
enum class Unit : char { Mm, Cm, Inch };
enum class MeasurementsType : char { Standard, Individual };
enum class GHeights : unsigned char { H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134,
H140=140, H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182,
H188=188 };
enum class GSizes : unsigned char { S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40,
S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56 };
// measurements
extern const QString headGirth_M;
extern const QString midNeckGirth_M;

View File

@ -42,6 +42,7 @@
#include "vindividualmeasurements.h"
#include "../../libs/qmuparser/qmuparsererror.h"
#include "../geometry/varc.h"
#include <QMessageBox>
#include <QUndoStack>

View File

@ -35,11 +35,7 @@
class VDataTool;
class VMainGraphicsScene;
enum class Document : char { LiteParse, LitePPParse, FullParse};
enum class GHeights : char { H92, H98, H104, H110, H116, H122, H128, H134, H140, H146, H152, H158, H164, H170, H176,
H182, H188};
enum class GSizes : char { S22, S24, S26, S28, S30, S32, S34, S36, S38, S40, S42, S44, S46, S48, S50, S52, S54, S56};
enum class Document : char { LiteParse, LitePPParse, FullParse };
/*
VAL_VERSION is (major << 16) + (minor << 8) + patch.