2014-03-10 16:55:51 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vindividualmeasurements.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2014-03-10 16:55:51 +01:00
|
|
|
** @date 8 3, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vindividualmeasurements.h"
|
2014-05-16 12:00:33 +02:00
|
|
|
#include "../widgets/vapplication.h"
|
2014-03-10 16:55:51 +01:00
|
|
|
|
2014-03-26 05:39:07 +01:00
|
|
|
const QString VIndividualMeasurements::AttrValue = QStringLiteral("value");
|
|
|
|
const QString VIndividualMeasurements::TagFamily_name = QStringLiteral("family-name");
|
|
|
|
const QString VIndividualMeasurements::TagGiven_name = QStringLiteral("given-name");
|
|
|
|
const QString VIndividualMeasurements::TagBirth_date = QStringLiteral("birth-date");
|
|
|
|
const QString VIndividualMeasurements::TagSex = QStringLiteral("sex");
|
|
|
|
const QString VIndividualMeasurements::TagUnit = QStringLiteral("unit");
|
2014-05-16 12:00:33 +02:00
|
|
|
const QString VIndividualMeasurements::TagEmail = QStringLiteral("email");
|
2014-03-28 14:11:46 +01:00
|
|
|
const QString VIndividualMeasurements::SexMale = QStringLiteral("male");
|
|
|
|
const QString VIndividualMeasurements::SexFemale = QStringLiteral("female");
|
2014-03-21 11:08:29 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-10 16:55:51 +01:00
|
|
|
VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data)
|
2014-05-02 13:11:30 +02:00
|
|
|
{}
|
2014-03-14 15:12:53 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-26 05:39:07 +01:00
|
|
|
Valentina::Units VIndividualMeasurements::Unit() const
|
2014-03-14 15:12:53 +01:00
|
|
|
{
|
2014-03-26 05:39:07 +01:00
|
|
|
const QString unit = UniqueTagText(TagUnit, UnitCM);
|
2014-03-24 16:02:57 +01:00
|
|
|
return VDomDocument::StrToUnits(unit);
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-26 05:39:07 +01:00
|
|
|
void VIndividualMeasurements::setUnit(const Valentina::Units &unit)
|
|
|
|
{
|
2014-03-28 14:11:46 +01:00
|
|
|
setTagText(TagUnit, UnitsToStr(unit));
|
2014-03-26 05:39:07 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-14 15:12:53 +01:00
|
|
|
void VIndividualMeasurements::Measurements()
|
|
|
|
{
|
|
|
|
//head and neck
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(headGirth);
|
|
|
|
Measurement(midNeckGirth);
|
|
|
|
Measurement(neckBaseGirth);
|
|
|
|
Measurement(headAndNeckLength);
|
2014-03-14 15:12:53 +01:00
|
|
|
//torso
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(centerFrontWaistLength);
|
|
|
|
Measurement(centerBackWaistLength);
|
|
|
|
Measurement(shoulderLength);
|
|
|
|
Measurement(sideWaistLength);
|
|
|
|
Measurement(trunkLength);
|
|
|
|
Measurement(shoulderGirth);
|
|
|
|
Measurement(upperChestGirth);
|
|
|
|
Measurement(bustGirth);
|
|
|
|
Measurement(underBustGirth);
|
|
|
|
Measurement(waistGirth);
|
|
|
|
Measurement(highHipGirth);
|
|
|
|
Measurement(hipGirth);
|
|
|
|
Measurement(upperFrontChestWidth);
|
|
|
|
Measurement(frontChestWidth);
|
|
|
|
Measurement(acrossFrontShoulderWidth);
|
|
|
|
Measurement(acrossBackShoulderWidth);
|
|
|
|
Measurement(upperBackWidth);
|
|
|
|
Measurement(backWidth);
|
|
|
|
Measurement(bustpointToBustpoint);
|
|
|
|
Measurement(halterBustpointToBustpoint);
|
|
|
|
Measurement(neckToBustpoint);
|
|
|
|
Measurement(crotchLength);
|
|
|
|
Measurement(riseHeight);
|
|
|
|
Measurement(shoulderDrop);
|
|
|
|
Measurement(shoulderSlopeDegrees);
|
|
|
|
Measurement(frontShoulderSlopeLength);
|
|
|
|
Measurement(backShoulderSlopeLength);
|
|
|
|
Measurement(frontShoulderToWaistLength);
|
|
|
|
Measurement(backShoulderToWaistLength);
|
|
|
|
Measurement(frontNeckArc);
|
|
|
|
Measurement(backNeckArc);
|
|
|
|
Measurement(frontUpperChestArc);
|
|
|
|
Measurement(backUpperChestArc);
|
|
|
|
Measurement(frontWaistArc);
|
|
|
|
Measurement(backWaistArc);
|
|
|
|
Measurement(frontUpperHipArc);
|
|
|
|
Measurement(backUpperHipArc);
|
|
|
|
Measurement(frontHipArc);
|
|
|
|
Measurement(backHipArc);
|
|
|
|
Measurement(chestSlope);
|
|
|
|
Measurement(backSlope);
|
|
|
|
Measurement(frontWaistSlope);
|
|
|
|
Measurement(backWaistSlope);
|
|
|
|
Measurement(frontNeckToUpperChestHeight);
|
|
|
|
Measurement(frontNeckToBustHeight);
|
2014-03-14 15:12:53 +01:00
|
|
|
//arm
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(armscyeGirth);
|
|
|
|
Measurement(elbowGirth);
|
|
|
|
Measurement(upperArmGirth);
|
|
|
|
Measurement(wristGirth);
|
|
|
|
Measurement(scyeDepth);
|
|
|
|
Measurement(shoulderAndArmLength);
|
|
|
|
Measurement(underarmLength);
|
|
|
|
Measurement(cervicaleToWristLength);
|
|
|
|
Measurement(shoulderToElbowLength);
|
|
|
|
Measurement(armLength);
|
2014-03-14 15:12:53 +01:00
|
|
|
//hand
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(handWidth);
|
|
|
|
Measurement(handLength);
|
|
|
|
Measurement(handGirth);
|
2014-03-14 15:12:53 +01:00
|
|
|
//leg
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(thighGirth);
|
|
|
|
Measurement(midThighGirth);
|
|
|
|
Measurement(kneeGirth);
|
|
|
|
Measurement(calfGirth);
|
|
|
|
Measurement(ankleGirth);
|
|
|
|
Measurement(kneeHeight);
|
|
|
|
Measurement(ankleHeight);
|
2014-03-14 15:12:53 +01:00
|
|
|
//foot
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(footWidth);
|
|
|
|
Measurement(footLength);
|
2014-03-14 15:12:53 +01:00
|
|
|
//heights
|
2014-05-16 12:00:33 +02:00
|
|
|
Measurement(height);
|
|
|
|
Measurement(cervicaleHeight);
|
|
|
|
Measurement(cervicaleToKneeHeight);
|
|
|
|
Measurement(waistHeight);
|
|
|
|
Measurement(highHipHeight);
|
|
|
|
Measurement(hipHeight);
|
|
|
|
Measurement(waistToHipHeight);
|
|
|
|
Measurement(waistToKneeHeight);
|
|
|
|
Measurement(crotchHeight);
|
|
|
|
//extended
|
|
|
|
Measurement(size);
|
|
|
|
Measurement(heightFrontNeckBasePoint);
|
|
|
|
Measurement(heightBaseNeckSidePoint);
|
|
|
|
Measurement(heightShoulderPoint);
|
|
|
|
Measurement(heightNipplePoint);
|
|
|
|
Measurement(heightBackAngleAxilla);
|
|
|
|
Measurement(heightScapularPoint);
|
|
|
|
Measurement(heightUnderButtockFolds);
|
|
|
|
Measurement(hipsExcludingProtrudingAbdomen);
|
|
|
|
Measurement(girthFootInstep);
|
|
|
|
Measurement(sideWaistToFloor);
|
|
|
|
Measurement(frontWaistToFloor);
|
|
|
|
Measurement(arcThroughGroinArea);
|
|
|
|
Measurement(waistToPlaneSeat);
|
|
|
|
Measurement(neckToRadialPoint);
|
|
|
|
Measurement(neckToThirdFinger);
|
|
|
|
Measurement(neckToFirstLineChestCircumference);
|
|
|
|
Measurement(frontWaistLength);
|
|
|
|
Measurement(arcThroughShoulderJoint);
|
|
|
|
Measurement(neckToBackLineChestCircumference);
|
|
|
|
Measurement(waistToNeckSide);
|
|
|
|
Measurement(arcLengthUpperBody);
|
|
|
|
Measurement(chestWidth);
|
|
|
|
Measurement(anteroposteriorDiameterHands);
|
|
|
|
Measurement(heightClavicularPoint);
|
|
|
|
Measurement(heightArmholeSlash);
|
|
|
|
Measurement(slashShoulderHeight);
|
|
|
|
Measurement(halfGirthNeck);
|
|
|
|
Measurement(halfGirthNeckForShirts);
|
|
|
|
Measurement(halfGirthChestFirst);
|
|
|
|
Measurement(halfGirthChestSecond);
|
|
|
|
Measurement(halfGirthChestThird);
|
|
|
|
Measurement(halfGirthWaist);
|
|
|
|
Measurement(halfGirthHipsConsideringProtrudingAbdomen);
|
|
|
|
Measurement(halfGirthHipsExcludingProtrudingAbdomen);
|
|
|
|
Measurement(girthKneeFlexedFeet);
|
|
|
|
Measurement(neckTransverseDiameter);
|
|
|
|
Measurement(frontSlashShoulderHeight);
|
|
|
|
Measurement(neckToFrontWaistLine);
|
|
|
|
Measurement(handVerticalDiameter);
|
|
|
|
Measurement(neckToKneePoint);
|
|
|
|
Measurement(waistToKnee);
|
|
|
|
Measurement(shoulderHeight);
|
|
|
|
Measurement(headHeight);
|
|
|
|
Measurement(bodyPosition);
|
|
|
|
Measurement(arcBehindShoulderGirdle);
|
|
|
|
Measurement(neckToNeckBase);
|
|
|
|
Measurement(depthWaistFirst);
|
|
|
|
Measurement(depthWaistSecond);
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-14 15:12:53 +01:00
|
|
|
void VIndividualMeasurements::Measurement(const QString &tag)
|
|
|
|
{
|
|
|
|
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
|
|
|
if (nodeList.isEmpty())
|
|
|
|
{
|
2014-03-28 14:11:46 +01:00
|
|
|
qDebug()<<"Measurement" << tag <<"doesn't exist"<<Q_FUNC_INFO;
|
2014-03-14 15:12:53 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const QDomNode domNode = nodeList.at(0);
|
|
|
|
if (domNode.isNull() == false && domNode.isElement())
|
|
|
|
{
|
|
|
|
const QDomElement domElement = domNode.toElement();
|
|
|
|
if (domElement.isNull() == false)
|
|
|
|
{
|
2014-05-16 12:00:33 +02:00
|
|
|
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
|
2014-03-14 15:12:53 +01:00
|
|
|
|
|
|
|
if (Unit() == Valentina::Mm)//Convert to Cm.
|
|
|
|
{
|
2014-05-16 12:00:33 +02:00
|
|
|
value = value / 10.0;
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
2014-05-16 12:00:33 +02:00
|
|
|
data->AddMeasurement(tag, VMeasurement(value, qApp->GuiText(tag), qApp->Description(tag), tag));
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
QString VIndividualMeasurements::FamilyName() const
|
2014-03-14 15:12:53 +01:00
|
|
|
{
|
2014-03-26 05:39:07 +01:00
|
|
|
return UniqueTagText(TagFamily_name, "");
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
void VIndividualMeasurements::setFamilyName(const QString &text)
|
|
|
|
{
|
|
|
|
setTagText(TagFamily_name, text);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
QString VIndividualMeasurements::GivenName() const
|
2014-03-14 15:12:53 +01:00
|
|
|
{
|
2014-03-26 05:39:07 +01:00
|
|
|
return UniqueTagText(TagGiven_name, "");
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
void VIndividualMeasurements::setGivenName(const QString &text)
|
|
|
|
{
|
|
|
|
setTagText(TagGiven_name, text);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
QDate VIndividualMeasurements::BirthDate() const
|
2014-03-14 15:12:53 +01:00
|
|
|
{
|
2014-03-28 14:11:46 +01:00
|
|
|
const QString date = UniqueTagText(TagBirth_date, "1900-01-01");
|
|
|
|
return QDate::fromString(date, "yyyy-MM-dd");
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
void VIndividualMeasurements::setBirthDate(const QDate &date)
|
2014-03-14 15:12:53 +01:00
|
|
|
{
|
2014-03-28 14:11:46 +01:00
|
|
|
setTagText(TagBirth_date, date.toString("yyyy-MM-dd"));
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
VIndividualMeasurements::Genders VIndividualMeasurements::Sex() const
|
|
|
|
{
|
|
|
|
return StrToGender(UniqueTagText(TagSex, ""));
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
void VIndividualMeasurements::setSex(const VIndividualMeasurements::Genders &sex)
|
|
|
|
{
|
|
|
|
setTagText(TagSex, GenderToStr(sex));
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
QString VIndividualMeasurements::Mail() const
|
|
|
|
{
|
|
|
|
return UniqueTagText(TagEmail, "");
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
void VIndividualMeasurements::setMail(const QString &text)
|
|
|
|
{
|
|
|
|
setTagText(TagEmail, text);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Genders &sex)
|
|
|
|
{
|
|
|
|
switch (sex)
|
|
|
|
{
|
|
|
|
case Male:
|
|
|
|
return SexMale;
|
|
|
|
case Female:
|
|
|
|
return SexFemale;
|
|
|
|
default:
|
|
|
|
return SexMale;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-28 14:11:46 +01:00
|
|
|
VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex)
|
|
|
|
{
|
|
|
|
QStringList genders;
|
|
|
|
genders << SexMale << SexFemale;
|
|
|
|
switch (genders.indexOf(sex))
|
|
|
|
{
|
|
|
|
case 0: // SexMale
|
|
|
|
return Male;
|
|
|
|
case 1: // SexFemale
|
|
|
|
return Female;
|
|
|
|
default:
|
|
|
|
return Male;
|
|
|
|
}
|
2014-03-14 15:12:53 +01:00
|
|
|
}
|