Remove unused classes.
--HG-- branch : develop
This commit is contained in:
parent
df11ffa981
commit
6f5757efaf
|
@ -1,224 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractmeasurements.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 18 6, 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-2015 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 "vabstractmeasurements.h"
|
||||
|
||||
const QString VAbstractMeasurements::TagUnit = QStringLiteral("unit");
|
||||
const QString VAbstractMeasurements::AttrValue = QStringLiteral("value");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractMeasurements::VAbstractMeasurements(VContainer *data)
|
||||
:VDomDocument(), data(data)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractMeasurements::~VAbstractMeasurements()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Measurements help read all measurements.
|
||||
*
|
||||
* Virtual method that keep all common measurements name. Measurements height and size create in different way in
|
||||
* individual and standard measurements, see VIndividualMeasurements::Measurements().
|
||||
*/
|
||||
void VAbstractMeasurements::Measurements()
|
||||
{
|
||||
//Set of measurements common for both standard.
|
||||
//head and neck
|
||||
// Measurement(headGirth_M);
|
||||
// Measurement(midNeckGirth_M);
|
||||
// Measurement(neckBaseGirth_M);
|
||||
// Measurement(headAndNeckLength_M);
|
||||
// //torso
|
||||
// Measurement(centerFrontWaistLength_M);
|
||||
// Measurement(centerBackWaistLength_M);
|
||||
// Measurement(shoulderLength_M);
|
||||
// Measurement(sideWaistLength_M);
|
||||
// Measurement(trunkLength_M);
|
||||
// Measurement(shoulderGirth_M);
|
||||
// Measurement(upperChestGirth_M);
|
||||
// Measurement(bustGirth_M);
|
||||
// Measurement(underBustGirth_M);
|
||||
// Measurement(waistGirth_M);
|
||||
// Measurement(highHipGirth_M);
|
||||
// Measurement(hipGirth_M);
|
||||
// Measurement(upperFrontChestWidth_M);
|
||||
// Measurement(frontChestWidth_M);
|
||||
// Measurement(acrossFrontShoulderWidth_M);
|
||||
// Measurement(acrossBackShoulderWidth_M);
|
||||
// Measurement(upperBackWidth_M);
|
||||
// Measurement(backWidth_M);
|
||||
// Measurement(bustpointToBustpoint_M);
|
||||
// Measurement(halterBustpointToBustpoint_M);
|
||||
// Measurement(neckToBustpoint_M);
|
||||
// Measurement(crotchLength_M);
|
||||
// Measurement(riseHeight_M);
|
||||
// Measurement(shoulderDrop_M);
|
||||
// Measurement(shoulderSlopeDegrees_M);
|
||||
// Measurement(frontShoulderSlopeLength_M);
|
||||
// Measurement(backShoulderSlopeLength_M);
|
||||
// Measurement(frontShoulderToWaistLength_M);
|
||||
// Measurement(backShoulderToWaistLength_M);
|
||||
// Measurement(frontNeckArc_M);
|
||||
// Measurement(backNeckArc_M);
|
||||
// Measurement(frontUpperChestArc_M);
|
||||
// Measurement(backUpperChestArc_M);
|
||||
// Measurement(frontWaistArc_M);
|
||||
// Measurement(backWaistArc_M);
|
||||
// Measurement(frontUpperHipArc_M);
|
||||
// Measurement(backUpperHipArc_M);
|
||||
// Measurement(frontHipArc_M);
|
||||
// Measurement(backHipArc_M);
|
||||
// Measurement(chestSlope_M);
|
||||
// Measurement(backSlope_M);
|
||||
// Measurement(frontWaistSlope_M);
|
||||
// Measurement(backWaistSlope_M);
|
||||
// Measurement(frontNeckToUpperChestHeight_M);
|
||||
// Measurement(frontNeckToBustHeight_M);
|
||||
// Measurement(frontWaistToUpperChest_M);
|
||||
// Measurement(frontWaistToLowerBreast_M);
|
||||
// Measurement(backWaistToUpperChest_M);
|
||||
// Measurement(strapLength_M);
|
||||
// //arm
|
||||
// Measurement(armscyeGirth_M);
|
||||
// Measurement(elbowGirth_M);
|
||||
// Measurement(upperArmGirth_M);
|
||||
// Measurement(wristGirth_M);
|
||||
// Measurement(scyeDepth_M);
|
||||
// Measurement(shoulderAndArmLength_M);
|
||||
// Measurement(underarmLength_M);
|
||||
// Measurement(cervicaleToWristLength_M);
|
||||
// Measurement(shoulderToElbowLength_M);
|
||||
// Measurement(armLength_M);
|
||||
// //hand
|
||||
// Measurement(handWidth_M);
|
||||
// Measurement(handLength_M);
|
||||
// Measurement(handGirth_M);
|
||||
// //leg
|
||||
// Measurement(thighGirth_M);
|
||||
// Measurement(midThighGirth_M);
|
||||
// Measurement(kneeGirth_M);
|
||||
// Measurement(calfGirth_M);
|
||||
// Measurement(ankleGirth_M);
|
||||
// Measurement(kneeHeight_M);
|
||||
// Measurement(ankleHeight_M);
|
||||
// //foot
|
||||
// Measurement(footWidth_M);
|
||||
// Measurement(footLength_M);
|
||||
// //heights
|
||||
// Measurement(cervicaleHeight_M);
|
||||
// Measurement(cervicaleToKneeHeight_M);
|
||||
// Measurement(waistHeight_M);
|
||||
// Measurement(highHipHeight_M);
|
||||
// Measurement(hipHeight_M);
|
||||
// Measurement(waistToHipHeight_M);
|
||||
// Measurement(waistToKneeHeight_M);
|
||||
// Measurement(crotchHeight_M);
|
||||
// //extended
|
||||
// Measurement(heightFrontNeckBasePoint_M);
|
||||
// Measurement(heightBaseNeckSidePoint_M);
|
||||
// Measurement(heightShoulderPoint_M);
|
||||
// Measurement(heightNipplePoint_M);
|
||||
// Measurement(heightBackAngleAxilla_M);
|
||||
// Measurement(heightScapularPoint_M);
|
||||
// Measurement(heightUnderButtockFolds_M);
|
||||
// Measurement(hipsExcludingProtrudingAbdomen_M);
|
||||
// Measurement(girthFootInstep_M);
|
||||
// Measurement(sideWaistToFloor_M);
|
||||
// Measurement(frontWaistToFloor_M);
|
||||
// Measurement(arcThroughGroinArea_M);
|
||||
// Measurement(waistToPlaneSeat_M);
|
||||
// Measurement(neckToRadialPoint_M);
|
||||
// Measurement(neckToThirdFinger_M);
|
||||
// Measurement(neckToFirstLineChestCircumference_M);
|
||||
// Measurement(frontWaistLength_M);
|
||||
// Measurement(arcThroughShoulderJoint_M);
|
||||
// Measurement(neckToBackLineChestCircumference_M);
|
||||
// Measurement(waistToNeckSide_M);
|
||||
// Measurement(arcLengthUpperBody_M);
|
||||
// Measurement(chestWidth_M);
|
||||
// Measurement(anteroposteriorDiameterHands_M);
|
||||
// Measurement(heightClavicularPoint_M);
|
||||
// Measurement(heightArmholeSlash_M);
|
||||
// Measurement(slashShoulderHeight_M);
|
||||
// Measurement(halfGirthNeck_M);
|
||||
// Measurement(halfGirthNeckForShirts_M);
|
||||
// Measurement(halfGirthChestFirst_M);
|
||||
// Measurement(halfGirthChestSecond_M);
|
||||
// Measurement(halfGirthChestThird_M);
|
||||
// Measurement(halfGirthWaist_M);
|
||||
// Measurement(halfGirthHipsConsideringProtrudingAbdomen_M);
|
||||
// Measurement(halfGirthHipsExcludingProtrudingAbdomen_M);
|
||||
// Measurement(girthKneeFlexedFeet_M);
|
||||
// Measurement(neckTransverseDiameter_M);
|
||||
// Measurement(frontSlashShoulderHeight_M);
|
||||
// Measurement(neckToFrontWaistLine_M);
|
||||
// Measurement(handVerticalDiameter_M);
|
||||
// Measurement(neckToKneePoint_M);
|
||||
// Measurement(waistToKnee_M);
|
||||
// Measurement(shoulderHeight_M);
|
||||
// Measurement(headHeight_M);
|
||||
// Measurement(bodyPosition_M);
|
||||
// Measurement(arcBehindShoulderGirdle_M);
|
||||
// Measurement(neckToNeckBase_M);
|
||||
// Measurement(depthWaistFirst_M);
|
||||
// Measurement(depthWaistSecond_M);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VAbstractMeasurements::MUnit() const
|
||||
{
|
||||
const QString unit = UniqueTagText(TagUnit, UnitCM);
|
||||
return VDomDocument::StrToUnits(unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractMeasurements::Measurement(const QString &tag)
|
||||
{
|
||||
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
||||
if (nodeList.isEmpty())
|
||||
{
|
||||
qWarning()<<"Measurement" << tag <<"doesn't exist";
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
const QDomNode domNode = nodeList.at(0);
|
||||
if (domNode.isNull() == false && domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
ReadMeasurement(domElement, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vabstractmeasurements.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 18 6, 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-2015 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VABSTRACTMEASUREMENTS_H
|
||||
#define VABSTRACTMEASUREMENTS_H
|
||||
|
||||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
|
||||
class VAbstractMeasurements : public VDomDocument
|
||||
{
|
||||
public:
|
||||
VAbstractMeasurements(VContainer *data);
|
||||
virtual ~VAbstractMeasurements() Q_DECL_OVERRIDE;
|
||||
virtual void Measurements();
|
||||
Unit MUnit() const;
|
||||
static const QString TagUnit;
|
||||
static const QString AttrValue;
|
||||
protected:
|
||||
/** @brief data container with data. */
|
||||
VContainer *data;
|
||||
|
||||
void Measurement(const QString &tag);
|
||||
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag) = 0;
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractMeasurements)
|
||||
};
|
||||
|
||||
#endif // VABSTRACTMEASUREMENTS_H
|
|
@ -1,165 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vindividualmeasurements.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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-2015 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"
|
||||
#include "../core/vapplication.h"
|
||||
#include <QDate>
|
||||
|
||||
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::TagEmail = QStringLiteral("email");
|
||||
const QString VIndividualMeasurements::SexMale = QStringLiteral("male");
|
||||
const QString VIndividualMeasurements::SexFemale = QStringLiteral("female");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VIndividualMeasurements::VIndividualMeasurements(VContainer *data)
|
||||
:VAbstractMeasurements(data)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VIndividualMeasurements::~VIndividualMeasurements()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setUnit(const Unit &unit)
|
||||
{
|
||||
setTagText(TagUnit, UnitsToStr(unit));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::Measurements()
|
||||
{
|
||||
VAbstractMeasurements::Measurements();
|
||||
//heights
|
||||
Measurement(height_M);
|
||||
//extended
|
||||
Measurement(size_M);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
|
||||
{
|
||||
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
|
||||
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
||||
data->AddVariable(tag, new VMeasurement(data, 0, tag, value, "", true, qApp->TrVars()->GuiText(tag),
|
||||
qApp->TrVars()->Description(tag), tag));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VIndividualMeasurements::FamilyName() const
|
||||
{
|
||||
return UniqueTagText(TagFamily_name, "");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setFamilyName(const QString &text)
|
||||
{
|
||||
setTagText(TagFamily_name, text);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VIndividualMeasurements::GivenName() const
|
||||
{
|
||||
return UniqueTagText(TagGiven_name, "");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setGivenName(const QString &text)
|
||||
{
|
||||
setTagText(TagGiven_name, text);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDate VIndividualMeasurements::BirthDate() const
|
||||
{
|
||||
const QString date = UniqueTagText(TagBirth_date, "1900-01-01");
|
||||
return QDate::fromString(date, "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setBirthDate(const QDate &date)
|
||||
{
|
||||
setTagText(TagBirth_date, date.toString("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
SexType1 VIndividualMeasurements::Sex() const
|
||||
{
|
||||
return StrToGender(UniqueTagText(TagSex, ""));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setSex(const SexType1 &sex)
|
||||
{
|
||||
setTagText(TagSex, GenderToStr(sex));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VIndividualMeasurements::Mail() const
|
||||
{
|
||||
return UniqueTagText(TagEmail, "");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VIndividualMeasurements::setMail(const QString &text)
|
||||
{
|
||||
setTagText(TagEmail, text);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VIndividualMeasurements::GenderToStr(const SexType1 &sex)
|
||||
{
|
||||
switch (sex)
|
||||
{
|
||||
case SexType1::Male:
|
||||
return SexMale;
|
||||
case SexType1::Female:
|
||||
return SexFemale;
|
||||
default:
|
||||
return SexMale;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
SexType1 VIndividualMeasurements::StrToGender(const QString &sex)
|
||||
{
|
||||
QStringList genders = QStringList() << SexMale << SexFemale;
|
||||
switch (genders.indexOf(sex))
|
||||
{
|
||||
case 0: // SexMale
|
||||
return SexType1::Male;
|
||||
case 1: // SexFemale
|
||||
return SexType1::Female;
|
||||
default:
|
||||
return SexType1::Male;
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vindividualmeasurements.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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-2015 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VINDIVIDUALMEASUREMENTS_H
|
||||
#define VINDIVIDUALMEASUREMENTS_H
|
||||
|
||||
#include "vabstractmeasurements.h"
|
||||
|
||||
/*
|
||||
VIT_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
*/
|
||||
// version without patch part
|
||||
#define VIT_MIN_VERSION 0x000200
|
||||
// max support version of format
|
||||
#define VIT_VERSION 0x000200
|
||||
|
||||
enum class SexType1 : char { Male, Female };
|
||||
|
||||
class VIndividualMeasurements:public VAbstractMeasurements
|
||||
{
|
||||
public:
|
||||
VIndividualMeasurements(VContainer *data);
|
||||
virtual ~VIndividualMeasurements() Q_DECL_OVERRIDE;
|
||||
void setUnit(const Unit &unit);
|
||||
virtual void Measurements() Q_DECL_OVERRIDE;
|
||||
QString FamilyName() const;
|
||||
void setFamilyName(const QString &text);
|
||||
QString GivenName() const;
|
||||
void setGivenName(const QString &text);
|
||||
QDate BirthDate() const;
|
||||
void setBirthDate(const QDate &date);
|
||||
SexType1 Sex() const;
|
||||
void setSex(const SexType1 &sex);
|
||||
QString Mail() const;
|
||||
void setMail(const QString &text);
|
||||
|
||||
static const QString TagFamily_name;
|
||||
static const QString TagGiven_name;
|
||||
static const QString TagBirth_date;
|
||||
static const QString TagSex;
|
||||
static const QString TagEmail;
|
||||
static const QString SexMale;
|
||||
static const QString SexFemale;
|
||||
|
||||
static QString GenderToStr(const SexType1 &sex);
|
||||
static SexType1 StrToGender(const QString &sex);
|
||||
protected:
|
||||
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(VIndividualMeasurements)
|
||||
};
|
||||
|
||||
#endif // VINDIVIDUALMEASUREMENTS_H
|
|
@ -1,163 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vstandardmeasurements.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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-2015 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 "vstandardmeasurements.h"
|
||||
#include <QDebug>
|
||||
#include "../core/vapplication.h"
|
||||
#include "../../libs/vmisc/def.h"
|
||||
|
||||
const QString VStandardMeasurements::TagDescription = QStringLiteral("description");
|
||||
const QString VStandardMeasurements::TagId = QStringLiteral("id");
|
||||
const QString VStandardMeasurements::TagSize = QStringLiteral("size");
|
||||
const QString VStandardMeasurements::TagHeight = QStringLiteral("height");
|
||||
|
||||
const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase");
|
||||
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
|
||||
const QString VStandardMeasurements::AttrBase = QStringLiteral("base");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VStandardMeasurements::VStandardMeasurements(VContainer *data)
|
||||
:VAbstractMeasurements(data)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VStandardMeasurements::~VStandardMeasurements()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::OrigDescription ()
|
||||
{
|
||||
const QString desc = UniqueTagText(TagDescription, "");
|
||||
if (desc.isEmpty())
|
||||
{
|
||||
qWarning()<<"Empty description in standard table."<<Q_FUNC_INFO;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::TrDescription()
|
||||
{
|
||||
const QString trDesc = qApp->TrVars()->STDescription(Id());
|
||||
if (trDesc.isEmpty() == false)
|
||||
{
|
||||
return trDesc;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OrigDescription ();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VStandardMeasurements::Id()
|
||||
{
|
||||
const QString id = UniqueTagText(TagId, "");
|
||||
if (id.isEmpty())
|
||||
{
|
||||
qWarning()<<"Empty id value in standard table."<<Q_FUNC_INFO;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VStandardMeasurements::Size() const
|
||||
{
|
||||
return TakeParametr(TagSize, AttrBase, 50);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VStandardMeasurements::Height() const
|
||||
{
|
||||
return TakeParametr(TagHeight, AttrBase, 176);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
|
||||
{
|
||||
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
|
||||
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
||||
|
||||
qreal size_increase = GetParametrDouble(domElement, AttrSize_increase, "0.0");
|
||||
size_increase = UnitConvertor(size_increase, MUnit(), qApp->patternUnit());
|
||||
|
||||
qreal height_increase = GetParametrDouble(domElement, AttrHeight_increase, "0.0");
|
||||
height_increase = UnitConvertor(height_increase, MUnit(), qApp->patternUnit());
|
||||
|
||||
if (MUnit() == Unit::Inch)
|
||||
{
|
||||
qWarning()<<"Standard table can't use inch unit.";
|
||||
}
|
||||
|
||||
data->AddVariable(tag, new VMeasurement(0, tag, Size(), Height(), value, size_increase, height_increase,
|
||||
qApp->TrVars()->GuiText(tag), qApp->TrVars()->Description(tag), tag));
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VStandardMeasurements::TakeParametr(const QString &tag, const QString &attr, qreal defValue) const
|
||||
{
|
||||
const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit());
|
||||
|
||||
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
||||
if (nodeList.isEmpty())
|
||||
{
|
||||
return defVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
const QDomNode domNode = nodeList.at(0);
|
||||
if (domNode.isNull() == false && domNode.isElement())
|
||||
{
|
||||
const QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
qreal value = GetParametrDouble(domElement, attr, QString("%1").arg(defVal));
|
||||
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::SetSize()
|
||||
{
|
||||
data->SetSize(Size());
|
||||
data->SetSizeName(size_M);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VStandardMeasurements::SetHeight()
|
||||
{
|
||||
data->SetHeight(Height());
|
||||
data->SetHeightName(height_M);
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vstandardmeasurements.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @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-2015 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/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VSTANDARDMEASUREMENTS_H
|
||||
#define VSTANDARDMEASUREMENTS_H
|
||||
|
||||
#include "vabstractmeasurements.h"
|
||||
|
||||
/*
|
||||
VST_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
*/
|
||||
// version without patch part
|
||||
#define VST_MIN_VERSION 0x000300
|
||||
// max support version of format
|
||||
#define VST_VERSION 0x000300
|
||||
|
||||
class VStandardMeasurements:public VAbstractMeasurements
|
||||
{
|
||||
public:
|
||||
VStandardMeasurements(VContainer *data);
|
||||
virtual ~VStandardMeasurements() Q_DECL_OVERRIDE;
|
||||
QString OrigDescription ();
|
||||
QString TrDescription ();
|
||||
QString Id();
|
||||
|
||||
qreal Size() const;
|
||||
qreal Height() const;
|
||||
|
||||
void SetSize();
|
||||
void SetHeight();
|
||||
static const QString TagMeasurement;
|
||||
static const QString TagDescription;
|
||||
static const QString TagId;
|
||||
static const QString TagSize;
|
||||
static const QString TagHeight;
|
||||
|
||||
static const QString AttrSize_increase;
|
||||
static const QString AttrHeight_increase;
|
||||
static const QString AttrBase;
|
||||
protected:
|
||||
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(VStandardMeasurements)
|
||||
qreal TakeParametr(const QString &tag, const QString &attr, qreal defValue) const;
|
||||
};
|
||||
|
||||
#endif // VSTANDARDMEASUREMENTS_H
|
|
@ -2,13 +2,7 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/vpattern.h \
|
||||
$$PWD/vstandardmeasurements.h \
|
||||
$$PWD/vindividualmeasurements.h \
|
||||
$$PWD/vabstractmeasurements.h
|
||||
$$PWD/vpattern.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vpattern.cpp \
|
||||
$$PWD/vstandardmeasurements.cpp \
|
||||
$$PWD/vindividualmeasurements.cpp \
|
||||
$$PWD/vabstractmeasurements.cpp
|
||||
$$PWD/vpattern.cpp
|
||||
|
|
Loading…
Reference in New Issue
Block a user