valentina/src/libs/vgeometry/vpointf.h

103 lines
3.4 KiB
C
Raw Normal View History

/************************************************************************
**
** @file vpointf.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://gitlab.com/smart-pattern/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/>.
**
*************************************************************************/
2013-07-13 12:51:31 +02:00
#ifndef VPOINTF_H
#define VPOINTF_H
#include <QMetaType>
#include <QSharedDataPointer>
#include <QString>
#include <QTypeInfo>
#include <QtGlobal>
#include "vgobject.h"
class VPointFData;
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
/**
* @brief The VPointF class keep data of point.
*/
2023-07-15 09:58:28 +02:00
class VPointF : public VGObject
{
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;
2023-05-03 13:07:02 +02:00
auto operator=(const VPointF &point) -> VPointF &;
#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 &;
#endif
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);
2023-05-03 13:07:02 +02:00
auto IsShowLabel() const -> bool;
void SetShowLabel(bool hide);
2023-07-15 09:58:28 +02:00
auto ToJson() const -> QJsonObject override;
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:
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
QT_WARNING_POP
2015-10-20 16:32:01 +02:00
2013-07-13 12:51:31 +02:00
#endif // VPOINTF_H