2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vpointf.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2013-11-15 13:41:26 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
#ifndef VPOINTF_H
|
|
|
|
#define VPOINTF_H
|
|
|
|
|
2016-03-18 22:11:14 +01:00
|
|
|
#include <QMetaType>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QString>
|
|
|
|
#include <QTypeInfo>
|
|
|
|
#include <QtGlobal>
|
2016-03-18 22:11:14 +01:00
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vgobject.h"
|
2016-08-06 20:42:40 +02:00
|
|
|
|
2014-08-20 16:20:53 +02:00
|
|
|
class VPointFData;
|
2014-06-08 20:10:57 +02:00
|
|
|
|
2016-08-06 20:42:40 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_INTEL(2304)
|
2021-09-25 16:18:33 +02:00
|
|
|
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
2015-10-20 16:32:01 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
|
|
|
* @brief The VPointF class keep data of point.
|
|
|
|
*/
|
2023-07-15 09:58:28 +02:00
|
|
|
class VPointF : public VGObject
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
public:
|
2023-07-15 09:58:28 +02:00
|
|
|
VPointF();
|
|
|
|
VPointF(const VPointF &point);
|
|
|
|
explicit VPointF(const QPointF &point);
|
|
|
|
VPointF(qreal x, qreal y, const QString &name, qreal mx, qreal my, quint32 idObject = 0,
|
|
|
|
const Draw &mode = Draw::Calculation);
|
|
|
|
VPointF(const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject = 0,
|
|
|
|
const Draw &mode = Draw::Calculation);
|
|
|
|
~VPointF() override;
|
2017-04-19 12:27:17 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto operator=(const VPointF &point) -> VPointF &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
2023-07-13 16:49:20 +02:00
|
|
|
VPointF(VPointF &&point) noexcept;
|
2023-07-15 09:58:28 +02:00
|
|
|
auto operator=(VPointF &&point) noexcept -> VPointF &;
|
2017-04-19 12:27:17 +02:00
|
|
|
#endif
|
|
|
|
|
2017-03-31 16:04:11 +02:00
|
|
|
explicit operator QPointF() const;
|
2023-05-03 13:07:02 +02:00
|
|
|
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VPointF;
|
|
|
|
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VPointF;
|
|
|
|
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VPointF;
|
|
|
|
auto mx() const -> qreal;
|
|
|
|
auto my() const -> qreal;
|
2023-07-15 09:58:28 +02:00
|
|
|
void setMx(qreal mx);
|
|
|
|
void setMy(qreal my);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto toQPointF() const -> QPointF;
|
|
|
|
auto x() const -> qreal;
|
2023-07-15 09:58:28 +02:00
|
|
|
void setX(const qreal &value);
|
2023-05-03 13:07:02 +02:00
|
|
|
auto y() const -> qreal;
|
2023-07-15 09:58:28 +02:00
|
|
|
void setY(const qreal &value);
|
2016-04-10 13:40:04 +02:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
auto IsShowLabel() const -> bool;
|
2017-09-17 08:17:37 +02:00
|
|
|
void SetShowLabel(bool hide);
|
2017-09-16 16:25:14 +02:00
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
auto ToJson() const -> QJsonObject override;
|
2019-08-29 14:01:27 +02:00
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
void SetAlias(const QString &alias) override;
|
|
|
|
void SetAliasSuffix(const QString &aliasSuffix) override;
|
2020-11-07 14:02:30 +01:00
|
|
|
|
2023-05-03 13:07:02 +02:00
|
|
|
static auto RotatePF(const QPointF &originPoint, const QPointF &point, qreal degrees) -> QPointF;
|
|
|
|
static auto FlipPF(const QLineF &axis, const QPointF &point) -> QPointF;
|
|
|
|
static auto MovePF(const QPointF &originPoint, qreal length, qreal angle) -> QPointF;
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
private:
|
2014-08-20 16:20:53 +02:00
|
|
|
QSharedDataPointer<VPointFData> d;
|
2013-07-13 12:51:31 +02:00
|
|
|
};
|
|
|
|
|
2023-07-15 09:58:28 +02:00
|
|
|
Q_DECLARE_METATYPE(VPointF) // NOLINT
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DECLARE_TYPEINFO(VPointF, Q_MOVABLE_TYPE); // NOLINT
|
2015-11-25 19:56:17 +01:00
|
|
|
|
2016-08-06 20:42:40 +02:00
|
|
|
QT_WARNING_POP
|
2015-10-20 16:32:01 +02:00
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
#endif // VPOINTF_H
|