2014-08-20 16:05:19 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
2015-05-07 14:31:53 +02:00
|
|
|
** @file vgeometrydef.h
|
2014-08-20 16:05:19 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2015-05-07 14:31:53 +02:00
|
|
|
** @date 7 5, 2015
|
2014-08-20 16:05:19 +02:00
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2014-08-20 16:05:19 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-05-07 14:31:53 +02:00
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2014-08-20 16:05:19 +02:00
|
|
|
**
|
|
|
|
** 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2015-05-07 14:31:53 +02:00
|
|
|
#ifndef VGEOMETRYDEF_H
|
|
|
|
#define VGEOMETRYDEF_H
|
2014-08-20 16:05:19 +02:00
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
#include <QVector>
|
|
|
|
#include <QPolygonF>
|
2019-05-27 13:54:44 +02:00
|
|
|
#include <QTransform>
|
|
|
|
|
|
|
|
#include "../ifc/ifcdef.h"
|
2017-10-15 11:25:20 +02:00
|
|
|
|
2020-01-07 11:54:01 +01:00
|
|
|
enum class GOType : qint8
|
2017-10-15 11:25:20 +02:00
|
|
|
{
|
|
|
|
Point,
|
|
|
|
Arc,
|
|
|
|
EllipticalArc,
|
|
|
|
Spline,
|
|
|
|
SplinePath,
|
|
|
|
CubicBezier,
|
|
|
|
CubicBezierPath,
|
|
|
|
PlaceLabel,
|
|
|
|
Unknown
|
|
|
|
};
|
2020-01-07 11:54:01 +01:00
|
|
|
enum class SplinePointPosition : qint8 { FirstPoint, LastPoint };
|
2014-08-23 08:18:07 +02:00
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
// Keep synchronized with XSD schema
|
2020-01-07 11:54:01 +01:00
|
|
|
enum class PlaceLabelType : quint8
|
2017-10-15 11:25:20 +02:00
|
|
|
{
|
|
|
|
Segment= 0,
|
|
|
|
Rectangle = 1,
|
|
|
|
Cross = 2,
|
|
|
|
Tshaped = 3,
|
|
|
|
Doubletree = 4,
|
|
|
|
Corner = 5,
|
|
|
|
Triangle = 6,
|
|
|
|
Hshaped = 7,
|
2019-04-23 16:42:09 +02:00
|
|
|
Button = 8,
|
|
|
|
Circle = 9
|
2017-10-15 11:25:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef QVector<QPolygonF> PlaceLabelImg;
|
|
|
|
|
|
|
|
struct VLayoutPlaceLabel
|
|
|
|
{
|
2019-07-01 10:02:09 +02:00
|
|
|
QPointF center{};
|
|
|
|
PlaceLabelType type{PlaceLabelType::Button};
|
|
|
|
PlaceLabelImg shape{};
|
2019-05-27 13:54:44 +02:00
|
|
|
QTransform rotationMatrix{};
|
|
|
|
QRectF box{};
|
2019-07-01 10:02:09 +02:00
|
|
|
|
|
|
|
friend QDataStream& operator<<(QDataStream& dataStream, const VLayoutPlaceLabel& data);
|
|
|
|
friend QDataStream& operator>>(QDataStream& dataStream, VLayoutPlaceLabel& data);
|
|
|
|
private:
|
|
|
|
static const quint32 streamHeader;
|
|
|
|
static const quint16 classVersion;
|
2017-10-15 11:25:20 +02:00
|
|
|
};
|
2019-05-27 13:57:36 +02:00
|
|
|
Q_DECLARE_METATYPE(VLayoutPlaceLabel)
|
|
|
|
|
|
|
|
struct VLayoutPassmark
|
|
|
|
{
|
2019-07-01 10:02:09 +02:00
|
|
|
QVector<QLineF> lines{};
|
2019-05-27 13:57:36 +02:00
|
|
|
PassmarkLineType type{PassmarkLineType::OneLine};
|
2019-07-01 10:02:09 +02:00
|
|
|
QLineF baseLine{};
|
|
|
|
bool isBuiltIn{false};
|
|
|
|
|
|
|
|
friend QDataStream& operator<<(QDataStream& dataStream, const VLayoutPassmark& data);
|
|
|
|
friend QDataStream& operator>>(QDataStream& dataStream, VLayoutPassmark& data);
|
|
|
|
private:
|
|
|
|
static const quint32 streamHeader;
|
|
|
|
static const quint16 classVersion;
|
2019-05-27 13:57:36 +02:00
|
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(VLayoutPassmark)
|
2017-10-15 11:25:20 +02:00
|
|
|
|
2020-06-02 12:49:44 +02:00
|
|
|
constexpr qreal accuracyPointOnLine = (0.117/*mm*/ / 25.4) * PrintDPI;
|
2019-07-21 14:04:08 +02:00
|
|
|
|
|
|
|
Q_REQUIRED_RESULT static inline bool VFuzzyComparePoints(const QPointF &p1, const QPointF &p2);
|
|
|
|
static inline bool VFuzzyComparePoints(const QPointF &p1, const QPointF &p2)
|
|
|
|
{
|
|
|
|
return QLineF(p1, p2).length() <= accuracyPointOnLine;
|
|
|
|
}
|
|
|
|
|
2019-07-21 14:22:09 +02:00
|
|
|
Q_REQUIRED_RESULT static inline bool VFuzzyOnAxis(qreal v1, qreal v2);
|
|
|
|
static inline bool VFuzzyOnAxis(qreal v1, qreal v2)
|
|
|
|
{
|
|
|
|
return qAbs(v1 - v2) <= accuracyPointOnLine;
|
|
|
|
}
|
|
|
|
|
2015-05-07 14:31:53 +02:00
|
|
|
#endif // VGEOMETRYDEF_H
|