Added a class to hold pattern piece data
--HG-- branch : feature
This commit is contained in:
parent
80f396d636
commit
05b094deec
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<pattern>
|
<pattern>
|
||||||
<!--Valentina pattern format.-->
|
<!--Valentina pattern format.-->
|
||||||
<version>0.2.4</version>
|
<version>0.3.1</version>
|
||||||
<unit>cm</unit>
|
<unit>cm</unit>
|
||||||
<author/>
|
<author/>
|
||||||
<description/>
|
<description/>
|
||||||
|
|
|
@ -629,6 +629,20 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
}
|
}
|
||||||
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
|
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
|
||||||
}
|
}
|
||||||
|
else if (element.tagName() == TagData)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QString qsName = GetParametrString(element, AttrName);
|
||||||
|
detail.GetPatternPieceData().SetName(qsName);
|
||||||
|
QString qsLetter = GetParametrString(element, AttrLetter);
|
||||||
|
detail.GetPatternPieceData().SetLetter(qsLetter);
|
||||||
|
qDebug() << "Data" << qsName << qsLetter;
|
||||||
|
}
|
||||||
|
catch(const VException& e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
||||||
|
|
|
@ -332,7 +332,7 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="node" maxOccurs="unbounded">
|
<xs:element name="node" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||||
|
|
|
@ -60,12 +60,14 @@ const QString VAbstractPattern::TagGradation = QStringLiteral("gradation");
|
||||||
const QString VAbstractPattern::TagHeights = QStringLiteral("heights");
|
const QString VAbstractPattern::TagHeights = QStringLiteral("heights");
|
||||||
const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
||||||
const QString VAbstractPattern::TagUnit = QStringLiteral("unit");
|
const QString VAbstractPattern::TagUnit = QStringLiteral("unit");
|
||||||
|
const QString VAbstractPattern::TagData = QStringLiteral("data");
|
||||||
|
|
||||||
const QString VAbstractPattern::AttrName = QStringLiteral("name");
|
const QString VAbstractPattern::AttrName = QStringLiteral("name");
|
||||||
const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
|
const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
|
||||||
const QString VAbstractPattern::AttrObject = QStringLiteral("object");
|
const QString VAbstractPattern::AttrObject = QStringLiteral("object");
|
||||||
const QString VAbstractPattern::AttrTool = QStringLiteral("tool");
|
const QString VAbstractPattern::AttrTool = QStringLiteral("tool");
|
||||||
const QString VAbstractPattern::AttrType = QStringLiteral("type");
|
const QString VAbstractPattern::AttrType = QStringLiteral("type");
|
||||||
|
const QString VAbstractPattern::AttrLetter = QStringLiteral("letter");
|
||||||
|
|
||||||
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
|
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
|
||||||
|
|
||||||
|
|
|
@ -155,12 +155,14 @@ public:
|
||||||
static const QString TagHeights;
|
static const QString TagHeights;
|
||||||
static const QString TagSizes;
|
static const QString TagSizes;
|
||||||
static const QString TagUnit;
|
static const QString TagUnit;
|
||||||
|
static const QString TagData;
|
||||||
|
|
||||||
static const QString AttrName;
|
static const QString AttrName;
|
||||||
static const QString AttrVisible;
|
static const QString AttrVisible;
|
||||||
static const QString AttrObject;
|
static const QString AttrObject;
|
||||||
static const QString AttrTool;
|
static const QString AttrTool;
|
||||||
static const QString AttrType;
|
static const QString AttrType;
|
||||||
|
static const QString AttrLetter;
|
||||||
|
|
||||||
static const QString AttrAll;
|
static const QString AttrAll;
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,8 @@ void VPatternConverter::ApplyPatches()
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000203):
|
case (0x000203):
|
||||||
ToV0_2_4();
|
ToV0_2_4();
|
||||||
ValidateXML(XSDSchema(0x000204), fileName);
|
//ValidateXML(XSDSchema(0x000204), fileName);
|
||||||
|
ValidateXML(XSDSchema(0x000302), fileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000204):
|
case (0x000204):
|
||||||
ToV0_2_5();
|
ToV0_2_5();
|
||||||
|
|
|
@ -512,6 +512,17 @@ QVector<VNodeDetail> VDetail::listNodePoint() const
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief Returns the full access to the pattern piece data object
|
||||||
|
* @return pattern piece data object
|
||||||
|
*/
|
||||||
|
VPatternPieceData& VDetail::GetPatternPieceData()
|
||||||
|
{
|
||||||
|
return d->m_ppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief indexOfNode return index in list node using id object.
|
* @brief indexOfNode return index in list node using id object.
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "../vlayout/vabstractdetail.h"
|
#include "../vlayout/vabstractdetail.h"
|
||||||
|
#include "vpatternpiecedata.h"
|
||||||
|
|
||||||
class VDetailData;
|
class VDetailData;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
|
@ -84,6 +85,8 @@ public:
|
||||||
QPainterPath ContourPath(const VContainer *data) const;
|
QPainterPath ContourPath(const VContainer *data) const;
|
||||||
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
||||||
QVector<VNodeDetail> listNodePoint()const;
|
QVector<VNodeDetail> listNodePoint()const;
|
||||||
|
VPatternPieceData& GetPatternPieceData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VDetailData> d;
|
QSharedDataPointer<VDetailData> d;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
#include "vnodedetail.h"
|
#include "vnodedetail.h"
|
||||||
|
#include "vpatternpiecedata.h"
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
|
||||||
#ifdef Q_CC_GNU
|
#ifdef Q_CC_GNU
|
||||||
|
@ -67,6 +68,9 @@ public:
|
||||||
/** @brief my bias y axis. */
|
/** @brief my bias y axis. */
|
||||||
qreal my;
|
qreal my;
|
||||||
|
|
||||||
|
/** @brief Pattern piece data */
|
||||||
|
VPatternPieceData m_ppData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VDetailData &operator=(const VDetailData &) Q_DECL_EQ_DELETE;
|
VDetailData &operator=(const VDetailData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -100,3 +100,9 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
vpatternpiecedata.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
vpatternpiecedata.cpp
|
||||||
|
|
111
src/libs/vpatterndb/vpatternpiecedata.cpp
Normal file
111
src/libs/vpatterndb/vpatternpiecedata.cpp
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vpatternpiecedata.h
|
||||||
|
** @author Bojan Kverh
|
||||||
|
** @date June 16, 2016
|
||||||
|
**
|
||||||
|
** @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 "vpatternpiecedata.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
VPatternPieceData::VPatternPieceData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
VPatternPieceData::~VPatternPieceData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void VPatternPieceData::Append(const MaterialCutPlacement& rMCP)
|
||||||
|
{
|
||||||
|
m_conMCP.append(rMCP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP)
|
||||||
|
{
|
||||||
|
Q_ASSERT(i >= 0);
|
||||||
|
Q_ASSERT(i <= GetMCPCount());
|
||||||
|
m_conMCP.insert(i, rMCP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int VPatternPieceData::GetMCPCount() const
|
||||||
|
{
|
||||||
|
return m_conMCP.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(i >= 0);
|
||||||
|
Q_ASSERT(i < GetMCPCount());
|
||||||
|
return m_conMCP[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void VPatternPieceData::RemoveMCP(int i)
|
||||||
|
{
|
||||||
|
Q_ASSERT(i >= 0);
|
||||||
|
Q_ASSERT(i < GetMCPCount());
|
||||||
|
m_conMCP.removeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
QString VPatternPieceData::GetLetter() const
|
||||||
|
{
|
||||||
|
return m_qsLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void VPatternPieceData::SetLetter(QString qsLetter)
|
||||||
|
{
|
||||||
|
m_qsLetter = qsLetter.left(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
QString VPatternPieceData::GetName() const
|
||||||
|
{
|
||||||
|
return m_qsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void VPatternPieceData::SetName(QString qsName)
|
||||||
|
{
|
||||||
|
m_qsName = qsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
94
src/libs/vpatterndb/vpatternpiecedata.h
Normal file
94
src/libs/vpatterndb/vpatternpiecedata.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
#ifndef VPATTERNPIECEDATA_H
|
||||||
|
#define VPATTERNPIECEDATA_H
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vpatternpiecedata.h
|
||||||
|
** @author Bojan Kverh
|
||||||
|
** @date June 16, 2016
|
||||||
|
**
|
||||||
|
** @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 <QList>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
enum class MaterialType : char
|
||||||
|
{
|
||||||
|
mtFabric,
|
||||||
|
mtLining,
|
||||||
|
mtInterfacing,
|
||||||
|
mtInterlining,
|
||||||
|
mtUserDefined
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class PlacementType : char { ptNone, ptCutOnFold };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This structure holds a material, cut number and placement 3-tuple
|
||||||
|
*/
|
||||||
|
struct MaterialCutPlacement
|
||||||
|
{
|
||||||
|
MaterialType m_eMaterial;
|
||||||
|
QString m_qsMaterialUserDef;
|
||||||
|
int m_iCutNumber;
|
||||||
|
PlacementType m_ePlacement;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QList<MaterialCutPlacement> MCPContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The VPatternPieceData class holds some information about a single
|
||||||
|
* piece like letter, name, material type, cut number and placement.
|
||||||
|
*/
|
||||||
|
class VPatternPieceData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VPatternPieceData();
|
||||||
|
~VPatternPieceData();
|
||||||
|
|
||||||
|
// methods, which operate on MaterialCutPlacement container
|
||||||
|
void Append(const MaterialCutPlacement& rMCP);
|
||||||
|
void Insert(int i, const MaterialCutPlacement& rMCP);
|
||||||
|
int GetMCPCount() const;
|
||||||
|
const MaterialCutPlacement& GetMCP(int i) const;
|
||||||
|
void RemoveMCP(int i);
|
||||||
|
|
||||||
|
// methods, which operate on other members
|
||||||
|
QString GetLetter() const;
|
||||||
|
void SetLetter(QString qsLetter);
|
||||||
|
QString GetName() const;
|
||||||
|
void SetName(QString qsName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** @brief Pattern piece name
|
||||||
|
*/
|
||||||
|
QString m_qsName;
|
||||||
|
/** @brief Pattern piece letter (should be no more than 3 letters)
|
||||||
|
*/
|
||||||
|
QString m_qsLetter;
|
||||||
|
/** @brief List of material, cut number and placement 3-tuples
|
||||||
|
*/
|
||||||
|
MCPContainer m_conMCP;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VPATTERNPIECEDATA_H
|
Loading…
Reference in New Issue
Block a user