Refactoring. New parent VAbstractFloatItemData.
--HG-- branch : feature
This commit is contained in:
parent
1710e3cdb7
commit
3cfefbe698
63
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp
Normal file
63
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 23 2, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 "vabstractfloatitemdata.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractFloatItemData::VAbstractFloatItemData()
|
||||||
|
: m_ptPos(),
|
||||||
|
m_bVisible(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VAbstractFloatItemData::~VAbstractFloatItemData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPointF VAbstractFloatItemData::GetPos() const
|
||||||
|
{
|
||||||
|
return m_ptPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractFloatItemData::SetPos(const QPointF &ptPos)
|
||||||
|
{
|
||||||
|
m_ptPos = ptPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractFloatItemData::IsVisible() const
|
||||||
|
{
|
||||||
|
return m_bVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractFloatItemData::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bVisible = bVisible;
|
||||||
|
}
|
54
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h
Normal file
54
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 23 2, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 VABSTRACTFLOATITEMDATA_H
|
||||||
|
#define VABSTRACTFLOATITEMDATA_H
|
||||||
|
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
|
class VAbstractFloatItemData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VAbstractFloatItemData();
|
||||||
|
virtual ~VAbstractFloatItemData();
|
||||||
|
|
||||||
|
// methods, which set and return values of different parameters
|
||||||
|
QPointF GetPos() const;
|
||||||
|
void SetPos(const QPointF& ptPos);
|
||||||
|
|
||||||
|
bool IsVisible() const;
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** @brief m_ptPos position of label's top left corner */
|
||||||
|
QPointF m_ptPos;
|
||||||
|
/** @brief m_bVisible visibility flag */
|
||||||
|
bool m_bVisible;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VABSTRACTFLOATITEMDATA_H
|
|
@ -31,80 +31,49 @@
|
||||||
#include "vgrainlinedata.h"
|
#include "vgrainlinedata.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
VGrainlineData::VGrainlineData()
|
VGrainlineData::VGrainlineData()
|
||||||
:m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth)
|
: VAbstractFloatItemData(),
|
||||||
|
m_qsLength(),
|
||||||
|
m_dRotation(),
|
||||||
|
m_eArrowType(atBoth)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VGrainlineData::~VGrainlineData()
|
||||||
QPointF VGrainlineData::GetPos() const
|
{}
|
||||||
{
|
|
||||||
return m_ptPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VGrainlineData::SetPos(const QPointF &ptPos)
|
|
||||||
{
|
|
||||||
m_ptPos = ptPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QString VGrainlineData::GetLength() const
|
QString VGrainlineData::GetLength() const
|
||||||
{
|
{
|
||||||
return m_qsLength;
|
return m_qsLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VGrainlineData::SetLength(const QString& qsLen)
|
void VGrainlineData::SetLength(const QString& qsLen)
|
||||||
{
|
{
|
||||||
m_qsLength = qsLen;
|
m_qsLength = qsLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
QString VGrainlineData::GetRotation() const
|
QString VGrainlineData::GetRotation() const
|
||||||
{
|
{
|
||||||
return m_qsRotation;
|
return m_dRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VGrainlineData::SetRotation(const QString& qsRot)
|
void VGrainlineData::SetRotation(const QString& qsRot)
|
||||||
{
|
{
|
||||||
m_qsRotation = qsRot;
|
m_dRotation = qsRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool VGrainlineData::IsVisible() const
|
|
||||||
{
|
|
||||||
return m_bVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void VGrainlineData::SetVisible(bool bVisible)
|
|
||||||
{
|
|
||||||
m_bVisible = bVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
VGrainlineData::ArrowType VGrainlineData::GetArrowType() const
|
VGrainlineData::ArrowType VGrainlineData::GetArrowType() const
|
||||||
{
|
{
|
||||||
return m_eArrowType;
|
return m_eArrowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void VGrainlineData::SetArrowType(ArrowType eAT)
|
void VGrainlineData::SetArrowType(ArrowType eAT)
|
||||||
{
|
{
|
||||||
m_eArrowType = eAT;
|
m_eArrowType = eAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,16 @@
|
||||||
#ifndef VGRAINLINEGEOMETRY_H
|
#ifndef VGRAINLINEGEOMETRY_H
|
||||||
#define VGRAINLINEGEOMETRY_H
|
#define VGRAINLINEGEOMETRY_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
|
||||||
|
#include "vabstractfloatitemdata.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VGrainlineData class holds information about a grainline like
|
* @brief The VGrainlineData class holds information about a grainline like
|
||||||
* position, size, rotation and visibility
|
* position, size, rotation and visibility
|
||||||
*/
|
*/
|
||||||
class VGrainlineData
|
class VGrainlineData : public VAbstractFloatItemData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// denotes the type of arrow for the grainline
|
// denotes the type of arrow for the grainline
|
||||||
|
@ -49,40 +50,25 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
VGrainlineData();
|
VGrainlineData();
|
||||||
|
virtual ~VGrainlineData();
|
||||||
|
|
||||||
// methods, which set and return values of different parameters
|
// methods, which set and return values of different parameters
|
||||||
QPointF GetPos() const;
|
QString GetLength() const;
|
||||||
void SetPos(const QPointF& ptPos);
|
void SetLength(const QString& qsLen);
|
||||||
QString GetLength() const;
|
|
||||||
void SetLength(const QString& qsLen);
|
QString GetRotation() const;
|
||||||
QString GetRotation() const;
|
void SetRotation(const QString& qsRot);
|
||||||
void SetRotation(const QString& qsRot);
|
|
||||||
bool IsVisible() const;
|
ArrowType GetArrowType() const;
|
||||||
void SetVisible(bool bVisible);
|
void SetArrowType(ArrowType eAT);
|
||||||
ArrowType GetArrowType() const;
|
|
||||||
void SetArrowType(ArrowType eAT);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/** @brief m_dLength formula to calculate the length of grainline */
|
||||||
* @brief m_ptPos position of grainline's center
|
QString m_qsLength;
|
||||||
*/
|
/** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */
|
||||||
QPointF m_ptPos;
|
QString m_dRotation;
|
||||||
/**
|
/** @brief m_eArrowType type of arrow on the grainline */
|
||||||
* @brief m_dLength formula to calculate the length of grainline
|
ArrowType m_eArrowType;
|
||||||
*/
|
|
||||||
QString m_qsLength;
|
|
||||||
/**
|
|
||||||
* @brief m_dRotation formula to calculate the rotation of grainline in [degrees]
|
|
||||||
*/
|
|
||||||
QString m_qsRotation;
|
|
||||||
/**
|
|
||||||
* @brief m_bVisible visibility flag
|
|
||||||
*/
|
|
||||||
bool m_bVisible;
|
|
||||||
/**
|
|
||||||
* @brief m_eArrowType type of arrow on the grainline
|
|
||||||
*/
|
|
||||||
ArrowType m_eArrowType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VGRAINLINEGEOMETRY_H
|
#endif // VGRAINLINEGEOMETRY_H
|
||||||
|
|
|
@ -30,30 +30,17 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternLabelData::VPatternLabelData()
|
VPatternLabelData::VPatternLabelData()
|
||||||
: m_ptPos(),
|
: VAbstractFloatItemData(),
|
||||||
m_dLabelWidth(0),
|
m_dLabelWidth(0),
|
||||||
m_dLabelHeight(0),
|
m_dLabelHeight(0),
|
||||||
m_iFontSize(0),
|
m_iFontSize(0),
|
||||||
m_dRotation(0),
|
m_dRotation(0)
|
||||||
m_bVisible(true)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternLabelData::~VPatternLabelData()
|
VPatternLabelData::~VPatternLabelData()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QPointF VPatternLabelData::GetPos() const
|
|
||||||
{
|
|
||||||
return m_ptPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VPatternLabelData::SetPos(const QPointF& ptPos)
|
|
||||||
{
|
|
||||||
m_ptPos = ptPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VPatternLabelData::GetLabelWidth() const
|
qreal VPatternLabelData::GetLabelWidth() const
|
||||||
{
|
{
|
||||||
|
@ -101,15 +88,3 @@ void VPatternLabelData::SetRotation(qreal dRot)
|
||||||
{
|
{
|
||||||
m_dRotation = dRot;
|
m_dRotation = dRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool VPatternLabelData::IsVisible() const
|
|
||||||
{
|
|
||||||
return m_bVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VPatternLabelData::SetVisible(bool bVal)
|
|
||||||
{
|
|
||||||
m_bVisible = bVal;
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,21 +30,19 @@
|
||||||
#define VPATTERNINFOGEOMETRY_H
|
#define VPATTERNINFOGEOMETRY_H
|
||||||
|
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QtGlobal>
|
|
||||||
|
#include "vabstractfloatitemdata.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VPatternLabelData class holds the information about pattern info label geometry
|
* @brief The VPatternLabelData class holds the information about pattern info label geometry
|
||||||
*/
|
*/
|
||||||
class VPatternLabelData
|
class VPatternLabelData : public VAbstractFloatItemData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VPatternLabelData();
|
VPatternLabelData();
|
||||||
virtual ~VPatternLabelData();
|
virtual ~VPatternLabelData();
|
||||||
|
|
||||||
// methods, which set up label parameters
|
// methods, which set up label parameters
|
||||||
QPointF GetPos() const;
|
|
||||||
void SetPos(const QPointF& ptPos);
|
|
||||||
|
|
||||||
qreal GetLabelWidth() const;
|
qreal GetLabelWidth() const;
|
||||||
void SetLabelWidth(qreal dLabelW);
|
void SetLabelWidth(qreal dLabelW);
|
||||||
|
|
||||||
|
@ -57,34 +55,15 @@ public:
|
||||||
qreal GetRotation() const;
|
qreal GetRotation() const;
|
||||||
void SetRotation(qreal dRot);
|
void SetRotation(qreal dRot);
|
||||||
|
|
||||||
bool IsVisible() const;
|
|
||||||
void SetVisible(bool bVal);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/** @brief m_dLabelWidth label width */
|
||||||
* @brief m_ptPos position of label's top left corner
|
qreal m_dLabelWidth;
|
||||||
*/
|
/** @brief m_dLabelHeight label height */
|
||||||
QPointF m_ptPos;
|
qreal m_dLabelHeight;
|
||||||
/**
|
/** @brief m_iFontSize label text base font size */
|
||||||
* @brief m_dLabelWidth label width
|
int m_iFontSize;
|
||||||
*/
|
/** @brief m_dRotation label rotation */
|
||||||
qreal m_dLabelWidth;
|
qreal m_dRotation;
|
||||||
/**
|
|
||||||
* @brief m_dLabelHeight label height
|
|
||||||
*/
|
|
||||||
qreal m_dLabelHeight;
|
|
||||||
/**
|
|
||||||
* @brief m_iFontSize label text base font size
|
|
||||||
*/
|
|
||||||
int m_iFontSize;
|
|
||||||
/**
|
|
||||||
* @brief m_dRotation label rotation
|
|
||||||
*/
|
|
||||||
qreal m_dRotation;
|
|
||||||
/**
|
|
||||||
* @brief m_bVisible visibility flag
|
|
||||||
*/
|
|
||||||
bool m_bVisible;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ SOURCES += \
|
||||||
$$PWD/vpiecepath.cpp \
|
$$PWD/vpiecepath.cpp \
|
||||||
$$PWD/floatItemData/vpiecelabeldata.cpp \
|
$$PWD/floatItemData/vpiecelabeldata.cpp \
|
||||||
$$PWD/floatItemData/vpatternlabeldata.cpp \
|
$$PWD/floatItemData/vpatternlabeldata.cpp \
|
||||||
$$PWD/floatItemData/vgrainlinedata.cpp
|
$$PWD/floatItemData/vgrainlinedata.cpp \
|
||||||
|
$$PWD/floatItemData/vabstractfloatitemdata.cpp
|
||||||
|
|
||||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
|
@ -65,4 +66,5 @@ HEADERS += \
|
||||||
$$PWD/vpiecepath_p.h \
|
$$PWD/vpiecepath_p.h \
|
||||||
$$PWD/floatItemData/vpiecelabeldata.h \
|
$$PWD/floatItemData/vpiecelabeldata.h \
|
||||||
$$PWD/floatItemData/vpatternlabeldata.h \
|
$$PWD/floatItemData/vpatternlabeldata.h \
|
||||||
$$PWD/floatItemData/vgrainlinedata.h
|
$$PWD/floatItemData/vgrainlinedata.h \
|
||||||
|
$$PWD/floatItemData/vabstractfloatitemdata.h
|
||||||
|
|
Loading…
Reference in New Issue
Block a user