Parsing individual measurements table.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-14 16:12:53 +02:00
parent ed568678be
commit 7d01bca72d
16 changed files with 404 additions and 161 deletions

View File

@ -9,98 +9,98 @@
<body-measurements> <body-measurements>
<unit>mm</unit> <unit>mm</unit>
<head_and_neck> <head_and_neck>
<head_girth name="Огол" value="0.0" gui_text="Обхват головы" description="Номер размерного признака 48"/> <head_girth name="Огол" m_number="M1" value="0.0" gui_text="Обхват головы" description="Номер размерного признака 48"/>
<mid_neck_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <mid_neck_girth name="" m_number="M2" value="0.0" gui_text="" description="" ignore="true"/>
<neck_base_girth name="Ош" value="0.0" gui_text="Обхват шеи" description="Номер размерного признака 13"/> <neck_base_girth name="Ош" m_number="M3" value="0.0" gui_text="Обхват шеи" description="Номер размерного признака 13"/>
<head_and_neck_length name="" value="0.0" gui_text="" description="" ignore="true"/> <head_and_neck_length name="" m_number="M4" value="0.0" gui_text="" description="" ignore="true"/>
</head_and_neck> </head_and_neck>
<torso> <torso>
<center_front_waist_length name="" value="0.0" gui_text="" description="" ignore="true"/> <center_front_waist_length name="" m_number="M5" value="0.0" gui_text="" description="" ignore="true"/>
<center_back_waist_length name="Дтс" value="0.0" gui_text="Длина спины до талии с учетом выступа лопаток" description="Номер размерного признака 40"/> <center_back_waist_length name="Дтс" m_number="M6" value="0.0" gui_text="Длина спины до талии с учетом выступа лопаток" description="Номер размерного признака 40"/>
<shoulder_length name="Шп" value="0.0" gui_text="Длина плечевого ската" description="Номер размерного признака 31"/> <shoulder_length name="Шп" m_number="M7" value="0.0" gui_text="Длина плечевого ската" description="Номер размерного признака 31"/>
<side_waist_length name="Дб" value="0.0" gui_text="Длина боковой части" description="Разница между меркой 11 и 7"/> <side_waist_length name="Дб" m_number="M8" value="0.0" gui_text="Длина боковой части" description="Разница между меркой 11 и 7"/>
<trunk_length name="" value="0.0" gui_text="" description="" ignore="true"/> <trunk_length name="" m_number="M9" value="0.0" gui_text="" description="" ignore="true"/>
<shoulder_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <shoulder_girth name="" m_number="M10" value="0.0" gui_text="" description="" ignore="true"/>
<upper_chest_girth name="ОгI" value="0.0" gui_text="Обхват груди первый" description="Номер размерного признака 14"/> <upper_chest_girth name="ОгI" m_number="M11" value="0.0" gui_text="Обхват груди первый" description="Номер размерного признака 14"/>
<bust__girth name="ОгII" value="0.0" gui_text="Обхват груди второй" description="Номер размерного признака 15"/> <bust__girth name="ОгII" m_number="M12" value="0.0" gui_text="Обхват груди второй" description="Номер размерного признака 15"/>
<under_bust_girth name="ОгIII" value="0.0" gui_text="Обхват груди третий" description="Номер размерного признака 16"/> <under_bust_girth name="ОгIII" m_number="M13" value="0.0" gui_text="Обхват груди третий" description="Номер размерного признака 16"/>
<waist_girth name="От" value="0.0" gui_text="Обхват талии" description="Номер размерного признака 18"/> <waist_girth name="От" m_number="M14" value="0.0" gui_text="Обхват талии" description="Номер размерного признака 18"/>
<high_hip_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <high_hip_girth name="" m_number="M15" value="0.0" gui_text="" description="" ignore="true"/>
<hip_girth name="Об" value="0.0" gui_text="Обхват бедер с учетом выступания живота" description="Номер размерного признака 19"/> <hip_girth name="Об" m_number="M16" value="0.0" gui_text="Обхват бедер с учетом выступания живота" description="Номер размерного признака 19"/>
<upper_front_chest_width name="Шг1" value="0.0" gui_text="Ширина груди первая" description="Номер размерного признака 45"/> <upper_front_chest_width name="Шг1" m_number="M17" value="0.0" gui_text="Ширина груди первая" description="Номер размерного признака 45"/>
<front_chest_width name="Шг2" value="0.0" gui_text="Ширина груди вторая" description="Номер размерного признака 45"/> <front_chest_width name="Шг2" m_number="M18" value="0.0" gui_text="Ширина груди вторая" description="Номер размерного признака 45"/>
<across_front_shoulder_width name="dпл" value="0.0" gui_text="Плечевой диаметр" description="Номер размерного признака 53"/> <across_front_shoulder_width name="dпл" m_number="M19" value="0.0" gui_text="Плечевой диаметр" description="Номер размерного признака 53"/>
<across_back_shoulder_width name="" value="0.0" gui_text="" description="" ignore="true"/> <across_back_shoulder_width name="" m_number="M20" value="0.0" gui_text="" description="" ignore="true"/>
<upper_back_width name="" value="0.0" gui_text="" description="" ignore="true"/> <upper_back_width name="" m_number="M21" value="0.0" gui_text="" description="" ignore="true"/>
<back_width name="Шс" value="0.0" gui_text="Ширина спины" description="Номер размерного признака 47"/> <back_width name="Шс" m_number="M22" value="0.0" gui_text="Ширина спины" description="Номер размерного признака 47"/>
<bustpoint_to_bustpoint name="Цг" value="0.0" gui_text="Расстояние между сосковыми точками" description="Номер размерного признака 46"/> <bustpoint_to_bustpoint name="Цг" m_number="M23" value="0.0" gui_text="Расстояние между сосковыми точками" description="Номер размерного признака 46"/>
<halter_bustpoint_to_bustpoint name="" value="0.0" gui_text="" description="" ignore="true"/> <halter_bustpoint_to_bustpoint name="" m_number="M24" value="0.0" gui_text="" description="" ignore="true"/>
<neck_to_bustpoint name="Вг" value="0.0" gui_text="Расстояние от точки основания шеи сбоку до сосковой точки (высота груди)" description="Номер размерного признака 35а"/> <neck_to_bustpoint name="Вг" m_number="M25" value="0.0" gui_text="Расстояние от точки основания шеи сбоку до сосковой точки (высота груди)" description="Номер размерного признака 35а"/>
<crotch_length name="" value="0.0" gui_text="" description="" ignore="true"/> <crotch_length name="" m_number="M26" value="0.0" gui_text="" description="" ignore="true"/>
<rise_height name="Дпс" value="0.0" gui_text="Расстояние от линии талии до подъягодичной складки" description="Номер размерного признака 104"/> <rise_height name="Дпс" m_number="M27" value="0.0" gui_text="Расстояние от линии талии до подъягодичной складки" description="Номер размерного признака 104"/>
<shoulder_drop name="" value="0.0" gui_text="" description="" ignore="true"/> <shoulder_drop name="" m_number="M28" value="0.0" gui_text="" description="" ignore="true"/>
<shoulder_slope_degrees name="" value="0.0" gui_text="" description="" ignore="true"/> <shoulder_slope_degrees name="" m_number="M29" value="0.0" gui_text="" description="" ignore="true"/>
<front_shoulder_slope_length name="" value="0.0" gui_text="" description="" ignore="true"/> <front_shoulder_slope_length name="" m_number="M30" value="0.0" gui_text="" description="" ignore="true"/>
<back_shoulder_slope_length name="" value="0.0" gui_text="" description="" ignore="true"/> <back_shoulder_slope_length name="" m_number="M31" value="0.0" gui_text="" description="" ignore="true"/>
<front_shoulder_to_waist_length name="" value="0.0" gui_text="" description="" ignore="true"/> <front_shoulder_to_waist_length name="" m_number="M32" value="0.0" gui_text="" description="" ignore="true"/>
<back_shoulder_to_waist_length name="" value="0.0" gui_text="" description="" ignore="true"/> <back_shoulder_to_waist_length name="" m_number="M33" value="0.0" gui_text="" description="" ignore="true"/>
<front_neck_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <front_neck_arc name="" m_number="M34" value="0.0" gui_text="" description="" ignore="true"/>
<back_neck_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <back_neck_arc name="" m_number="M35" value="0.0" gui_text="" description="" ignore="true"/>
<front_upper-bust_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <front_upper-bust_arc name="" m_number="M36" value="0.0" gui_text="" description="" ignore="true"/>
<back_upper-bust_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <back_upper-bust_arc name="" m_number="M37" value="0.0" gui_text="" description="" ignore="true"/>
<front_waist_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <front_waist_arc name="" m_number="M38" value="0.0" gui_text="" description="" ignore="true"/>
<back_waist_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <back_waist_arc name="" m_number="M39" value="0.0" gui_text="" description="" ignore="true"/>
<front_upper-hip_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <front_upper-hip_arc name="" m_number="M40" value="0.0" gui_text="" description="" ignore="true"/>
<back_upper-hip_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <back_upper-hip_arc name="" m_number="M41" value="0.0" gui_text="" description="" ignore="true"/>
<front_hip_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <front_hip_arc name="" m_number="M42" value="0.0" gui_text="" description="" ignore="true"/>
<back_hip_arc name="" value="0.0" gui_text="" description="" ignore="true"/> <back_hip_arc name="" m_number="M43" value="0.0" gui_text="" description="" ignore="true"/>
<chest_slope name="" value="0.0" gui_text="" description="" ignore="true"/> <chest_slope name="" m_number="M44" value="0.0" gui_text="" description="" ignore="true"/>
<back_slope name="" value="0.0" gui_text="" description="" ignore="true"/> <back_slope name="" m_number="M45" value="0.0" gui_text="" description="" ignore="true"/>
<front_waist_slope name="" value="0.0" gui_text="" description="" ignore="true"/> <front_waist_slope name="" m_number="M46" value="0.0" gui_text="" description="" ignore="true"/>
<back_waist_slope name="" value="0.0" gui_text="" description="" ignore="true"/> <back_waist_slope name="" m_number="M47" value="0.0" gui_text="" description="" ignore="true"/>
<front-neck_to_upper-chest_height name="" value="0.0" gui_text="" description="" ignore="true"/> <front-neck_to_upper-chest_height name="" m_number="M48" value="0.0" gui_text="" description="" ignore="true"/>
<front-neck_to_bust_height name="" value="0.0" gui_text="" description="" ignore="true"/> <front-neck_to_bust_height name="" m_number="M49" value="0.0" gui_text="" description="" ignore="true"/>
</torso> </torso>
<arm> <arm>
<armscye_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <armscye_girth name="" m_number="M50" value="0.0" gui_text="" description="" ignore="true"/>
<elbow_girth name="Олк" value="0.0" gui_text="Обхват локтя" description="Номер размерного признака "/> <elbow_girth name="Олк" m_number="M51" value="0.0" gui_text="Обхват локтя" description="Номер размерного признака "/>
<upper-arm_girth name="Оп" value="0.0" gui_text="Обхват плеча" description="Номер размерного признака 28"/> <upper-arm_girth name="Оп" m_number="M52" value="0.0" gui_text="Обхват плеча" description="Номер размерного признака 28"/>
<wrist_girth name="Озап" value="0.0" gui_text="Обхват запястья" description="Номер размерного признака 105"/> <wrist_girth name="Озап" m_number="M53" value="0.0" gui_text="Обхват запястья" description="Номер размерного признака 105"/>
<scye_depth name="" value="0.0" gui_text="" description="" ignore="true"/> <scye_depth name="" m_number="M54" value="0.0" gui_text="" description="" ignore="true"/>
<shoulder_and_arm_length name="Дзап" value="0.0" gui_text="Расстояние от точки основания шеи сбоку до линии обхвата запястья" description="Номер размерного признака 33"/> <shoulder_and_arm_length name="Дзап" m_number="M55" value="0.0" gui_text="Расстояние от точки основания шеи сбоку до линии обхвата запястья" description="Номер размерного признака 33"/>
<underarm_length name="" value="0.0" gui_text="" description="" ignore="true"/> <underarm_length name="" m_number="M56" value="0.0" gui_text="" description="" ignore="true"/>
<cervicale_to_wrist_length name="" value="0.0" gui_text="" description="" ignore="true"/> <cervicale_to_wrist_length name="" m_number="M57" value="0.0" gui_text="" description="" ignore="true"/>
<shoulder_to_elbow_length name="Дрлок" value="0.0" gui_text="Длина руки до локтя" description="Номер размерного признака 62"/> <shoulder_to_elbow_length name="Дрлок" m_number="M58" value="0.0" gui_text="Длина руки до локтя" description="Номер размерного признака 62"/>
<arm_length name="Дрзап" value="0.0" gui_text="Длина руки до запястья" description="Номер размерного признака 68"/> <arm_length name="Дрзап" m_number="M59" value="0.0" gui_text="Длина руки до запястья" description="Номер размерного признака 68"/>
</arm> </arm>
<hand> <hand>
<hand_width name="" value="0.0" gui_text="" description="" ignore="true"/> <hand_width name="" m_number="M60" value="0.0" gui_text="" description="" ignore="true"/>
<hand_length name="" value="0.0" gui_text="" description="" ignore="true"/> <hand_length name="" m_number="M61" value="0.0" gui_text="" description="" ignore="true"/>
<hand_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <hand_girth name="" m_number="M62" value="0.0" gui_text="" description="" ignore="true"/>
</hand> </hand>
<leg> <leg>
<thigh_girth name="Обед" value="0.0" gui_text="Обхват бедра" description="Номер размерного признака 21"/> <thigh_girth name="Обед" m_number="M63" value="0.0" gui_text="Обхват бедра" description="Номер размерного признака 21"/>
<mid_thigh_girth name="" value="0.0" gui_text="" description="" ignore="true"/> <mid_thigh_girth name="" m_number="M64" value="0.0" gui_text="" description="" ignore="true"/>
<knee_girth name="Ок" value="0.0" gui_text="Обхват колена" description="Номер размерного признака 22"/> <knee_girth name="Ок" m_number="M65" value="0.0" gui_text="Обхват колена" description="Номер размерного признака 22"/>
<calf_girth name="Ои" value="0.0" gui_text="Обхват икры" description="Номер размерного признака 23"/> <calf_girth name="Ои" m_number="M66" value="0.0" gui_text="Обхват икры" description="Номер размерного признака 23"/>
<ankle_girth name="Ощ" value="0.0" gui_text="Обхват щиколотки" description="Номер размерного признака 24"/> <ankle_girth name="Ощ" m_number="M67" value="0.0" gui_text="Обхват щиколотки" description="Номер размерного признака 24"/>
<knee_height name="Вк" value="0.0" gui_text="Высота коленной точки" description="Номер размерного признака 9"/> <knee_height name="Вк" m_number="M68" value="0.0" gui_text="Высота коленной точки" description="Номер размерного признака 9"/>
<ankle_height name="" value="0.0" gui_text="" description="" ignore="true"/> <ankle_height name="" m_number="M69" value="0.0" gui_text="" description="" ignore="true"/>
</leg> </leg>
<foot> <foot>
<foot_width name="" value="0.0" gui_text="" description="" ignore="true"/> <foot_width name="" m_number="M70" value="0.0" gui_text="" description="" ignore="true"/>
<foot_length name="" value="0.0" gui_text="" description="" ignore="true"/> <foot_length name="" m_number="M71" value="0.0" gui_text="" description="" ignore="true"/>
</foot> </foot>
<heights> <heights>
<height name="Р" value="0.0" gui_text="Рост" description="Номер размерного признака 1"/> <height name="Р" m_number="M72" value="0.0" gui_text="Рост" description="Номер размерного признака 1"/>
<cervicale_height name="Вшт" value="0.0" gui_text="Высота точки основания шеи сзади" description="Номер размерного признака 10"/> <cervicale_height name="Вшт" m_number="M73" value="0.0" gui_text="Высота точки основания шеи сзади" description="Номер размерного признака 10"/>
<cervicale_to_knee_height name="" value="0.0" gui_text="" description="" ignore="true"/> <cervicale_to_knee_height name="" m_number="M74" value="0.0" gui_text="" description="" ignore="true"/>
<waist_height name="Влт" value="0.0" gui_text="Высота линии талии" description="Номер размерного признака 7"/> <waist_height name="Влт" m_number="M75" value="0.0" gui_text="Высота линии талии" description="Номер размерного признака 7"/>
<high_hip_height name="" value="0.0" gui_text="" description="" ignore="true"/> <high_hip_height name="" m_number="M76" value="0.0" gui_text="" description="" ignore="true"/>
<hip_height name="" value="0.0" gui_text="" description="" ignore="true"/> <hip_height name="" m_number="M77" value="0.0" gui_text="" description="" ignore="true"/>
<waist_to_hip_height name="" value="0.0" gui_text="" description="" ignore="true"/> <waist_to_hip_height name="" m_number="M78" value="0.0" gui_text="" description="" ignore="true"/>
<waist_to_knee_height name="" value="0.0" gui_text="" description="" ignore="true"/> <waist_to_knee_height name="" m_number="M79" value="0.0" gui_text="" description="" ignore="true"/>
<crotch_height name="Дн" value="0.0" gui_text="Длина ноги по внутренней поверхности" description="Номер размерного признака 27"/> <crotch_height name="Дн" m_number="M80" value="0.0" gui_text="Длина ноги по внутренней поверхности" description="Номер размерного признака 27"/>
</heights> </heights>
</body-measurements> </body-measurements>
</vit> </vit>

View File

@ -2,10 +2,10 @@ SOURCES += \
src/container/vincrementtablerow.cpp \ src/container/vincrementtablerow.cpp \
src/container/vcontainer.cpp \ src/container/vcontainer.cpp \
src/container/calculator.cpp \ src/container/calculator.cpp \
src/container/vstandardtablerow.cpp src/container/vmeasurement.cpp
HEADERS += \ HEADERS += \
src/container/vincrementtablerow.h \ src/container/vincrementtablerow.h \
src/container/vcontainer.h \ src/container/vcontainer.h \
src/container/calculator.h \ src/container/calculator.h \
src/container/vstandardtablerow.h src/container/vmeasurement.h

View File

@ -35,7 +35,7 @@ quint32 VContainer::_id = 0;
VContainer::VContainer() VContainer::VContainer()
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
standardTable(QHash<QString, VStandardTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()), standardTable(QHash<QString, VMeasurement>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
{ {
@ -49,7 +49,7 @@ VContainer &VContainer::operator =(const VContainer &data)
VContainer::VContainer(const VContainer &data) VContainer::VContainer(const VContainer &data)
:_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()), :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash<quint32, VGObject *>()),
standardTable(QHash<QString, VStandardTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()), standardTable(QHash<QString, VMeasurement>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
{ {
@ -143,7 +143,7 @@ val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
} }
} }
const VStandardTableRow VContainer::GetStandardTableCell(const QString &name) const const VMeasurement VContainer::GetMeasurement(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); Q_ASSERT(name.isEmpty()==false);
return GetVariable(standardTable, name); return GetVariable(standardTable, name);
@ -250,11 +250,15 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
qreal VContainer::GetValueStandardTableRow(const QString& name) const qreal VContainer::GetValueStandardTableRow(const QString& name) const
{ {
const VStandardTableRow row = GetStandardTableCell(name); const VMeasurement m = GetMeasurement(name);
const qreal k_size = ( size() - 50.0 ) / 2.0; if (patternType == Pattern::Individual)
const qreal k_growth = ( height() - 176.0 ) / 6.0; {
const qreal value = row.GetBase() + k_size * row.GetKsize() + k_growth * row.GetKgrowth(); return m.GetValue();
return value; }
else
{
return m.GetValue(size(), height());
}
} }
qreal VContainer::GetValueIncrementTableRow(const QString& name) const qreal VContainer::GetValueIncrementTableRow(const QString& name) const

View File

@ -29,7 +29,7 @@
#ifndef VCONTAINER_H #ifndef VCONTAINER_H
#define VCONTAINER_H #define VCONTAINER_H
#include "vstandardtablerow.h" #include "vmeasurement.h"
#include "vincrementtablerow.h" #include "vincrementtablerow.h"
#include "../geometry/varc.h" #include "../geometry/varc.h"
#include "../geometry/vsplinepath.h" #include "../geometry/vsplinepath.h"
@ -107,11 +107,11 @@ public:
*/ */
const VGObject *GetGObject(quint32 id) const; const VGObject *GetGObject(quint32 id) const;
/** /**
* @brief GetStandardTableCell return standard table row by name * @brief GetMeasurement return measurement by name
* @param name name of standard table row * @param name short measurement name
* @return row of standard table * @return measurement
*/ */
const VStandardTableRow GetStandardTableCell(const QString& name) const; const VMeasurement GetMeasurement(const QString& name) const;
/** /**
* @brief GetIncrementTableRow return increment table row by name * @brief GetIncrementTableRow return increment table row by name
* @param name name of increment table row * @param name name of increment table row
@ -147,7 +147,7 @@ public:
* @param id id of detail * @param id id of detail
* @return detail * @return detail
*/ */
const VDetail GetDetail(quint32 id) const; const VDetail GetDetail(quint32 id) const;
/** /**
* @brief getId return current id * @brief getId return current id
* @return current id * @return current id
@ -166,11 +166,11 @@ public:
*/ */
quint32 AddDetail(VDetail detail); quint32 AddDetail(VDetail detail);
/** /**
* @brief AddStandardTableRow add new row of standard table * @brief AddMeasurement add new measurement
* @param name name of row of standard table * @param name short measurement name
* @param row row of standard table * @param row measurement
*/ */
void AddStandardTableRow(const QString& name, const VStandardTableRow &row); void AddMeasurement(const QString& name, const VMeasurement &m);
/** /**
* @brief AddIncrementTableRow add new row of increment table * @brief AddIncrementTableRow add new row of increment table
* @param name name of new row of increment table * @param name name of new row of increment table
@ -236,11 +236,11 @@ public:
*/ */
void UpdateDetail(quint32 id, const VDetail &detail); void UpdateDetail(quint32 id, const VDetail &detail);
/** /**
* @brief UpdateStandardTableCell update standard table row by name * @brief UpdateMeasurement update measurement by name
* @param name name of row * @param name short measurement name
* @param cell row of standard table * @param m measurement
*/ */
void UpdateStandardTableCell(const QString& name, VStandardTableRow cell); void UpdateMeasurement(const QString& name, VMeasurement m);
/** /**
* @brief UpdateIncrementTableRow update increment table row by name * @brief UpdateIncrementTableRow update increment table row by name
* @param name name of row * @param name name of row
@ -345,7 +345,7 @@ public:
* @brief data container with dataStandardTable return container of standard table * @brief data container with dataStandardTable return container of standard table
* @return pointer on container of standard table * @return pointer on container of standard table
*/ */
const QHash<QString, VStandardTableRow> *DataStandardTable() const; const QHash<QString, VMeasurement> *DataStandardTable() const;
/** /**
* @brief data container with dataIncrementTable return container of increment table * @brief data container with dataIncrementTable return container of increment table
* @return pointer on container of increment table * @return pointer on container of increment table
@ -397,7 +397,7 @@ private:
/** /**
* @brief standardTable container of standard table rows * @brief standardTable container of standard table rows
*/ */
QHash<QString, VStandardTableRow> standardTable; QHash<QString, VMeasurement> standardTable;
/** /**
* @brief incrementTable * @brief incrementTable
*/ */
@ -458,14 +458,14 @@ private:
static quint32 AddObject(QHash<key, val> &obj, val value); static quint32 AddObject(QHash<key, val> &obj, val value);
}; };
inline void VContainer::AddStandardTableRow(const QString &name, const VStandardTableRow &row) inline void VContainer::AddMeasurement(const QString &name, const VMeasurement &m)
{ {
standardTable[name] = row; standardTable[name] = m;
} }
inline void VContainer::UpdateStandardTableCell(const QString &name, VStandardTableRow cell) inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m)
{ {
standardTable[name] = cell; standardTable[name] = m;
} }
inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row)
@ -558,7 +558,7 @@ inline const QHash<quint32, VGObject *> *VContainer::DataGObjects() const
return &gObjects; return &gObjects;
} }
inline const QHash<QString, VStandardTableRow> *VContainer::DataStandardTable() const inline const QHash<QString, VMeasurement> *VContainer::DataStandardTable() const
{ {
return &standardTable; return &standardTable;
} }

View File

@ -26,11 +26,29 @@
** **
*************************************************************************/ *************************************************************************/
#include "vstandardtablerow.h" #include "vmeasurement.h"
VStandardTableRow::VStandardTableRow() VMeasurement::VMeasurement()
:base(0), ksize(0), kgrowth(0), gui_text(QString()), number(QString()){} :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()){}
VStandardTableRow::VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth,
const QString &description, const QString &number) const QString &gui_text, const QString &number)
:base(base), ksize(ksize), kgrowth(kgrowth), gui_text(description), number(number){} :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number){}
VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number)
:base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number)
{
}
qreal VMeasurement::GetValue() const
{
return base;
}
qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const
{
const qreal k_size = ( size - 50.0 ) / 2.0;
const qreal k_growth = ( height - 176.0 ) / 6.0;
return base + k_size * ksize + k_growth * kheight;
}

View File

@ -32,15 +32,15 @@
#include <QString> #include <QString>
/** /**
* @brief The VStandardTableRow class keep data row of standard table * @brief The VMeasurement class keep data row of standard table
*/ */
class VStandardTableRow class VMeasurement
{ {
public: public:
/** /**
* @brief VStandardTableRow create empty row * @brief VStandardTableRow create empty row
*/ */
VStandardTableRow(); VMeasurement();
/** /**
* @brief VStandardTableRow create row * @brief VStandardTableRow create row
* @param base value in base size and growth * @param base value in base size and growth
@ -48,9 +48,11 @@ public:
* @param kgrowth increment in growths * @param kgrowth increment in growths
* @param description description of increment * @param description description of increment
*/ */
VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight,
const QString &gui_text = QString(), const QString &number = QString()); const QString &gui_text = QString(), const QString &number = QString());
~VStandardTableRow(){} VMeasurement(const qreal &base, const QString &gui_text = QString(),
const QString &number = QString());
~VMeasurement(){}
/** /**
* @brief GetBase return value in base size and growth * @brief GetBase return value in base size and growth
* @return value * @return value
@ -65,13 +67,15 @@ public:
* @brief GetKgrowth return increment in growths * @brief GetKgrowth return increment in growths
* @return increment * @return increment
*/ */
qreal GetKgrowth() const; qreal GetKheight() const;
/** /**
* @brief GetDescription return description * @brief GetDescription return description
* @return description * @return description
*/ */
QString GetDescription() const; QString GetDescription() const;
QString GetNumber() const; QString GetNumber() const;
qreal GetValue() const;
qreal GetValue(const qreal &size, const qreal &height) const;
private: private:
/** /**
* @brief base value in base size and growth * @brief base value in base size and growth
@ -84,7 +88,7 @@ private:
/** /**
* @brief kgrowth increment in growths * @brief kgrowth increment in growths
*/ */
qreal kgrowth; qreal kheight;
/** /**
* @brief description description measurement * @brief description description measurement
*/ */
@ -92,27 +96,27 @@ private:
QString number; QString number;
}; };
inline qreal VStandardTableRow::GetBase() const inline qreal VMeasurement::GetBase() const
{ {
return base; return base;
} }
inline qreal VStandardTableRow::GetKsize() const inline qreal VMeasurement::GetKsize() const
{ {
return ksize; return ksize;
} }
inline qreal VStandardTableRow::GetKgrowth() const inline qreal VMeasurement::GetKheight() const
{ {
return kgrowth; return kheight;
} }
inline QString VStandardTableRow::GetDescription() const inline QString VMeasurement::GetDescription() const
{ {
return gui_text; return gui_text;
} }
inline QString VStandardTableRow::GetNumber() const inline QString VMeasurement::GetNumber() const
{ {
return number; return number;
} }

View File

@ -64,14 +64,14 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
void DialogIncrements::FillStandardTable() void DialogIncrements::FillStandardTable()
{ {
const QHash<QString, VStandardTableRow> *standardTable = data->DataStandardTable(); const QHash<QString, VMeasurement> *standardTable = data->DataStandardTable();
qint32 currentRow = -1; qint32 currentRow = -1;
QHashIterator<QString, VStandardTableRow> i(*standardTable); QHashIterator<QString, VMeasurement> i(*standardTable);
ui->tableWidgetStandard->setRowCount ( standardTable->size() ); ui->tableWidgetStandard->setRowCount ( standardTable->size() );
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
VStandardTableRow cell = i.value(); VMeasurement cell = i.value();
currentRow++; currentRow++;
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
@ -91,7 +91,7 @@ void DialogIncrements::FillStandardTable()
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetStandard->setItem(currentRow, 3, item); ui->tableWidgetStandard->setItem(currentRow, 3, item);
item = new QTableWidgetItem(QString().setNum(cell.GetKgrowth())); item = new QTableWidgetItem(QString().setNum(cell.GetKheight()));
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetStandard->setItem(currentRow, 4, item); ui->tableWidgetStandard->setItem(currentRow, 4, item);

View File

@ -616,7 +616,7 @@ void DialogTool::ValChenged(int row)
} }
if (radioButtonStandardTable->isChecked()) if (radioButtonStandardTable->isChecked())
{ {
VStandardTableRow stable = data->GetStandardTableCell(item->text()); VMeasurement stable = data->GetMeasurement(item->text());
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableRow(item->text())) QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableRow(item->text()))
.arg(stable.GetDescription()); .arg(stable.GetDescription());
labelDescription->setText(desc); labelDescription->setText(desc);

View File

@ -33,8 +33,8 @@
#include "tablewindow.h" #include "tablewindow.h"
#include "options.h" #include "options.h"
//Default pattern unit. Valentina::Units patternUnit = Valentina::Cm;// Default pattern unit.
Valentina::Units patternUnit = Valentina::Cm; Pattern::Measurements patternType = Pattern::Individual;// Default pattern type.
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const QString translationsPath = QString("/translations"); const QString translationsPath = QString("/translations");

View File

@ -103,6 +103,18 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units )
extern Valentina::Units patternUnit; extern Valentina::Units patternUnit;
namespace Pattern
{
/**
* @brief The Scene enum
*/
enum Measurement { Standard, Individual };
Q_DECLARE_FLAGS(Measurements, Measurement)
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements )
extern Pattern::Measurements patternType;
#define PrintDPI 96.0 #define PrintDPI 96.0
inline double toPixel(double unit) inline double toPixel(double unit)

View File

@ -168,7 +168,14 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
const QString parameter = domElement.attribute(name, defValue); const QString parameter = domElement.attribute(name, defValue);
if (parameter.isEmpty()) if (parameter.isEmpty())
{ {
throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement); if (defValue.isEmpty())
{
throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement);
}
else
{
return defValue;
}
} }
return parameter; return parameter;
} }
@ -258,3 +265,26 @@ bool VDomDocument::ValidatePattern(const QString &schema, const QString &fileNam
return true; return true;
} }
} }
Valentina::Units VDomDocument::Units(const QString &unit)
{
QStringList units;
units << "mm" << "cm" << "in";
Valentina::Units result = Valentina::Cm;
switch (units.indexOf(unit))
{
case 0:// mm
result = Valentina::Mm;
break;
case 1:// cm
result = Valentina::Cm;
break;
case 2:// in
result = Valentina::In;
break;
default:
result = Valentina::Cm;
break;
}
return result;
}

View File

@ -33,6 +33,7 @@
#include <QDomDocument> #include <QDomDocument>
#include <QDebug> #include <QDebug>
#include "../options.h"
#ifdef Q_CC_GNU #ifdef Q_CC_GNU
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -117,6 +118,7 @@ protected:
* @brief data container with data. * @brief data container with data.
*/ */
VContainer *data; VContainer *data;
Valentina::Units Units(const QString &unit);
private: private:
Q_DISABLE_COPY(VDomDocument) Q_DISABLE_COPY(VDomDocument)
/** /**

View File

@ -31,3 +31,187 @@
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
{ {
} }
Valentina::Units VIndividualMeasurements::Unit()
{
const QString unit = UniqueTagText("unit", "cm");
return VDomDocument::Units(unit);
}
void VIndividualMeasurements::Measurements()
{
//head and neck
Measurement("head_girth");
Measurement("mid_neck_girth");
Measurement("neck_base_girth");
Measurement("head_and_neck_length");
//torso
Measurement("center_front_waist_length");
Measurement("center_back_waist_length");
Measurement("shoulder_length");
Measurement("side_waist_length");
Measurement("trunk_length");
Measurement("shoulder_girth");
Measurement("upper_chest_girth");
Measurement("bust__girth");
Measurement("under_bust_girth");
Measurement("waist_girth");
Measurement("high_hip_girth");
Measurement("hip_girth");
Measurement("upper_front_chest_width");
Measurement("front_chest_width");
Measurement("across_front_shoulder_width");
Measurement("across_back_shoulder_width");
Measurement("upper_back_width");
Measurement("back_width");
Measurement("bustpoint_to_bustpoint");
Measurement("halter_bustpoint_to_bustpoint");
Measurement("neck_to_bustpoint");
Measurement("crotch_length");
Measurement("rise_height");
Measurement("shoulder_drop");
Measurement("shoulder_slope_degrees");
Measurement("front_shoulder_slope_length");
Measurement("back_shoulder_slope_length");
Measurement("front_shoulder_to_waist_length");
Measurement("back_shoulder_to_waist_length");
Measurement("front_neck_arc");
Measurement("back_neck_arc");
Measurement("front_upper-bust_arc");
Measurement("back_upper-bust_arc");
Measurement("front_waist_arc");
Measurement("back_waist_arc");
Measurement("front_upper-hip_arc");
Measurement("back_upper-hip_arc");
Measurement("front_hip_arc");
Measurement("back_hip_arc");
Measurement("chest_slope");
Measurement("back_slope");
Measurement("front_waist_slope");
Measurement("back_waist_slope");
Measurement("front-neck_to_upper-chest_height");
Measurement("front-neck_to_bust_height");
//arm
Measurement("armscye_girth");
Measurement("elbow_girth");
Measurement("upper-arm_girth");
Measurement("wrist_girth");
Measurement("scye_depth");
Measurement("shoulder_and_arm_length");
Measurement("underarm_length");
Measurement("cervicale_to_wrist_length");
Measurement("shoulder_to_elbow_length");
Measurement("arm_length");
//hand
Measurement("hand_width");
Measurement("hand_length");
Measurement("hand_girth");
//leg
Measurement("thigh_girth");
Measurement("mid_thigh_girth");
Measurement("knee_girth");
Measurement("calf_girth");
Measurement("ankle_girth");
Measurement("knee_height");
Measurement("ankle_height");
//foot
Measurement("foot_width");
Measurement("foot_length");
//heights
Measurement("height");
Measurement("cervicale_height");
Measurement("cervicale_to_knee_height");
Measurement("waist_height");
Measurement("high_hip_height");
Measurement("hip_height");
Measurement("waist_to_hip_height");
Measurement("waist_to_knee_height");
Measurement("crotch_height");
}
void VIndividualMeasurements::Measurement(const QString &tag)
{
const QDomNodeList nodeList = this->elementsByTagName(tag);
if (nodeList.isEmpty())
{
qWarning()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
return;
}
else
{
const QDomNode domNode = nodeList.at(0);
if (domNode.isNull() == false && domNode.isElement())
{
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
const bool ignore = QVariant(GetParametrString(domElement, "ignore", "false")).toBool();
if (ignore)
{
return;
}
const QString name = GetParametrString(domElement, "name", "");
if (name.isEmpty())
{
return;
}
const QString m_number = GetParametrString(domElement, "m_number", "");
const QString gui_text = GetParametrString(domElement, "gui_text", "");
const qreal value = GetParametrDouble(domElement, "value", "0.0");
const QString description = GetParametrString(domElement, "description", "");
if (Unit() == Valentina::Mm)//Convert to Cm.
{
data->AddMeasurement(name, VMeasurement(value/10.0, gui_text, description));
if (m_number.isEmpty())
{
qWarning()<<"Can't find language-independent measurement name for "<< tag;
return;
}
else
{
data->AddMeasurement(m_number, VMeasurement(value/10.0, gui_text, description));
}
}
else//Cm or inch.
{
data->AddMeasurement(name, VMeasurement(value, gui_text, description));
if (m_number.isEmpty())
{
qWarning()<<"Can't find language-independent measurement name for "<< tag;
return;
}
else
{
data->AddMeasurement(m_number, VMeasurement(value, gui_text, description));
}
}
}
}
}
}
QString VIndividualMeasurements::Language()
{
return UniqueTagText("lang", "en");
}
QString VIndividualMeasurements::FamilyName()
{
return UniqueTagText("family-name", "");
}
QString VIndividualMeasurements::GivenName()
{
return UniqueTagText("given-name", "");
}
QString VIndividualMeasurements::BirthDate()
{
return UniqueTagText("birth-date", "");
}
QString VIndividualMeasurements::Sex()
{
return UniqueTagText("sex", "");
}

View File

@ -35,6 +35,14 @@ class VIndividualMeasurements:public VDomDocument
{ {
public: public:
VIndividualMeasurements(VContainer *data); VIndividualMeasurements(VContainer *data);
Valentina::Units Unit();
void Measurements();
void Measurement(const QString &tag);
QString Language();
QString FamilyName();
QString GivenName();
QString BirthDate();
QString Sex();
}; };
#endif // VINDIVIDUALMEASUREMENTS_H #endif // VINDIVIDUALMEASUREMENTS_H

View File

@ -36,25 +36,7 @@ VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data
Valentina::Units VStandardMeasurements::Unit() Valentina::Units VStandardMeasurements::Unit()
{ {
const QString unit = UniqueTagText("unit", "cm"); const QString unit = UniqueTagText("unit", "cm");
QStringList units; return VDomDocument::Units(unit);
units << "mm" << "cm" << "in";
Valentina::Units result = Valentina::Cm;
switch (units.indexOf(unit))
{
case 0:// mm
result = Valentina::Mm;
break;
case 1:// cm
result = Valentina::Cm;
break;
case 2:// in
result = Valentina::In;
break;
default:
result = Valentina::Cm;
break;
}
return result;
} }
QString VStandardMeasurements::Description() QString VStandardMeasurements::Description()
@ -98,12 +80,12 @@ void VStandardMeasurements::Measurements()
if (Unit() == Valentina::Mm)//Convert to Cm. if (Unit() == Valentina::Mm)//Convert to Cm.
{ {
data->AddStandardTableRow(name, VStandardTableRow(base/10.0, size_increace/10.0, data->AddMeasurement(name, VMeasurement(base/10.0, size_increace/10.0, height_increase/10.0,
height_increase/10.0, gui_text, number)); gui_text, number));
} }
else//Cm or inch. else//Cm or inch.
{ {
data->AddStandardTableRow(name, VStandardTableRow(base, size_increace, height_increase, data->AddMeasurement(name, VMeasurement(base, size_increace, height_increase,
gui_text, number)); gui_text, number));
} }
} }

View File

@ -30,7 +30,6 @@
#define VSTANDARDMEASUREMENTS_H #define VSTANDARDMEASUREMENTS_H
#include "vdomdocument.h" #include "vdomdocument.h"
#include "../options.h"
class VStandardMeasurements:public QObject, public VDomDocument class VStandardMeasurements:public QObject, public VDomDocument
{ {