diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp new file mode 100644 index 000000000..a644098fa --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp @@ -0,0 +1,63 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @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 + ** 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 . + ** + *************************************************************************/ + +#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; +} diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h new file mode 100644 index 000000000..17c07a0d1 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h @@ -0,0 +1,54 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @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 + ** 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 . + ** + *************************************************************************/ + +#ifndef VABSTRACTFLOATITEMDATA_H +#define VABSTRACTFLOATITEMDATA_H + +#include + +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 diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp index 143270a53..2fcdd3310 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp @@ -31,80 +31,49 @@ #include "vgrainlinedata.h" //--------------------------------------------------------------------------------------------------------------------- - VGrainlineData::VGrainlineData() - :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth) + : VAbstractFloatItemData(), + m_qsLength(), + m_dRotation(), + m_eArrowType(atBoth) {} //--------------------------------------------------------------------------------------------------------------------- - -QPointF VGrainlineData::GetPos() const -{ - return m_ptPos; -} +VGrainlineData::~VGrainlineData() +{} //--------------------------------------------------------------------------------------------------------------------- - -void VGrainlineData::SetPos(const QPointF &ptPos) -{ - m_ptPos = ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- - QString VGrainlineData::GetLength() const { return m_qsLength; } //--------------------------------------------------------------------------------------------------------------------- - void VGrainlineData::SetLength(const QString& qsLen) { m_qsLength = qsLen; } //--------------------------------------------------------------------------------------------------------------------- - QString VGrainlineData::GetRotation() const { - return m_qsRotation; + return m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- - 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 { return m_eArrowType; } //--------------------------------------------------------------------------------------------------------------------- - void VGrainlineData::SetArrowType(ArrowType eAT) { m_eArrowType = eAT; } - -//--------------------------------------------------------------------------------------------------------------------- - diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h index 698a4bcb3..1d79b146d 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h @@ -29,15 +29,16 @@ #ifndef VGRAINLINEGEOMETRY_H #define VGRAINLINEGEOMETRY_H -#include #include #include +#include "vabstractfloatitemdata.h" + /** * @brief The VGrainlineData class holds information about a grainline like * position, size, rotation and visibility */ -class VGrainlineData +class VGrainlineData : public VAbstractFloatItemData { public: // denotes the type of arrow for the grainline @@ -49,40 +50,25 @@ public: }; VGrainlineData(); + virtual ~VGrainlineData(); // methods, which set and return values of different parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - QString GetLength() const; - void SetLength(const QString& qsLen); - QString GetRotation() const; - void SetRotation(const QString& qsRot); - bool IsVisible() const; - void SetVisible(bool bVisible); - ArrowType GetArrowType() const; - void SetArrowType(ArrowType eAT); + QString GetLength() const; + void SetLength(const QString& qsLen); + + QString GetRotation() const; + void SetRotation(const QString& qsRot); + + ArrowType GetArrowType() const; + void SetArrowType(ArrowType eAT); private: - /** - * @brief m_ptPos position of grainline's center - */ - QPointF m_ptPos; - /** - * @brief m_dLength formula to calculate the length of grainline - */ - 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; + /** @brief m_dLength formula to calculate the length of grainline */ + QString m_qsLength; + /** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */ + QString m_dRotation; + /** @brief m_eArrowType type of arrow on the grainline */ + ArrowType m_eArrowType; }; #endif // VGRAINLINEGEOMETRY_H diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp index d813cf0c5..ee987a639 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp @@ -30,30 +30,17 @@ //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::VPatternLabelData() - : m_ptPos(), + : VAbstractFloatItemData(), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), - m_dRotation(0), - m_bVisible(true) + m_dRotation(0) {} //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::~VPatternLabelData() {} -//--------------------------------------------------------------------------------------------------------------------- -QPointF VPatternLabelData::GetPos() const -{ - return m_ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPatternLabelData::SetPos(const QPointF& ptPos) -{ - m_ptPos = ptPos; -} - //--------------------------------------------------------------------------------------------------------------------- qreal VPatternLabelData::GetLabelWidth() const { @@ -101,15 +88,3 @@ void VPatternLabelData::SetRotation(qreal dRot) { m_dRotation = dRot; } - -//--------------------------------------------------------------------------------------------------------------------- -bool VPatternLabelData::IsVisible() const -{ - return m_bVisible; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPatternLabelData::SetVisible(bool bVal) -{ - m_bVisible = bVal; -} diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index 1279f2283..0a05dd7b8 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -30,21 +30,19 @@ #define VPATTERNINFOGEOMETRY_H #include -#include + +#include "vabstractfloatitemdata.h" /** * @brief The VPatternLabelData class holds the information about pattern info label geometry */ -class VPatternLabelData +class VPatternLabelData : public VAbstractFloatItemData { public: VPatternLabelData(); virtual ~VPatternLabelData(); // methods, which set up label parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - qreal GetLabelWidth() const; void SetLabelWidth(qreal dLabelW); @@ -57,34 +55,15 @@ public: qreal GetRotation() const; void SetRotation(qreal dRot); - bool IsVisible() const; - void SetVisible(bool bVal); - protected: - /** - * @brief m_ptPos position of label's top left corner - */ - QPointF m_ptPos; - /** - * @brief m_dLabelWidth label width - */ - qreal m_dLabelWidth; - /** - * @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; + /** @brief m_dLabelWidth label width */ + qreal m_dLabelWidth; + /** @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; }; diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 7ce9e3735..81364677e 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -24,7 +24,8 @@ SOURCES += \ $$PWD/vpiecepath.cpp \ $$PWD/floatItemData/vpiecelabeldata.cpp \ $$PWD/floatItemData/vpatternlabeldata.cpp \ - $$PWD/floatItemData/vgrainlinedata.cpp + $$PWD/floatItemData/vgrainlinedata.cpp \ + $$PWD/floatItemData/vabstractfloatitemdata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -65,4 +66,5 @@ HEADERS += \ $$PWD/vpiecepath_p.h \ $$PWD/floatItemData/vpiecelabeldata.h \ $$PWD/floatItemData/vpatternlabeldata.h \ - $$PWD/floatItemData/vgrainlinedata.h + $$PWD/floatItemData/vgrainlinedata.h \ + $$PWD/floatItemData/vabstractfloatitemdata.h