52 #ifndef VABSTRACTPIECE_H
53 #define VABSTRACTPIECE_H
56 #include <QSharedDataPointer>
60 #include "../vmisc/diagnostic.h"
61 #include "../vmisc/def.h"
62 #include "../vgeometry/vgobject.h"
64 template <
class T>
class QVector;
69 QT_WARNING_DISABLE_GCC(
"-Weffc++")
70 QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
79 Q_DECL_CONSTEXPR
VSAPoint(qreal xpos, qreal ypos);
80 Q_DECL_CONSTEXPR
explicit VSAPoint(
const QPointF &p);
82 Q_DECL_CONSTEXPR qreal GetSABefore()
const;
83 qreal GetSABefore(qreal width)
const;
84 void SetSABefore(qreal value);
86 Q_DECL_CONSTEXPR qreal GetSAAfter()
const;
87 qreal GetSAAfter(qreal width)
const;
88 void SetSAAfter(qreal value);
112 : QPointF(xpos, ypos),
172 #ifdef Q_COMPILER_RVALUE_REFS
179 void SetName(
const QString &value);
182 void setColor(
const QString &value);
185 void setFill(
const QString &value);
206 void SetMx(qreal value);
209 void SetMy(qreal value);
227 static bool IsEkvPointOnLine(
const QPointF &iPoint,
const QPointF &prevPoint,
const QPointF &nextPoint);
231 QSharedDataPointer<VAbstractPieceData>
d;
234 const QPointF &crossPoint);
235 static bool ParallelCrossPoint(
const QLineF &line1,
const QLineF &line2, QPointF &point);
238 static Q_DECL_CONSTEXPR qreal
PointPosition(
const QPointF &p,
const QLineF &line);
242 const QPointF &sp1,
const QPointF &sp2,
const QPointF &sp3,
245 const QPointF &sp1,
const QPointF &sp2,
const QPointF &sp3,
248 const QPointF &sp1,
const QPointF &sp2,
const QPointF &sp3,
251 const QPointF &sp1,
const QPointF &sp2,
const QPointF &sp3,
254 const QPointF &sp1,
const QPointF &sp2,
const QPointF &sp3,
257 static QPointF
SingleParallelPoint(
const QPointF &p1,
const QPointF &p2, qreal angle, qreal width);
258 static QLineF
BisectorLine(
const QPointF &p1,
const QPointF &p2,
const QPointF &p3);
275 qDebug()<<
"Only three points.";
291 for (qint32 i = 0; i < buf1.size(); ++i)
296 i == 0 ? prev = buf1.size() - 1 : prev = i-1;
300 if (i == buf1.size() - 1)
305 const T &iPoint = buf1.at(i);
306 const T &prevPoint = buf1.at(prev);
307 const T &nextPoint = buf1.at(next);
309 if (not (
IsEkvPointOnLine(iPoint, prevPoint, nextPoint) && prevPoint == nextPoint)
312 || ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint)))
330 if (removeFirstAndLast)
332 if (not p.isEmpty() && p.size() > 1)
344 for (
int i = 0; i < p.size()-1; ++i)
349 if (not removeFirstAndLast && (i == p.size()-1))
354 p.erase(p.begin() + i + 1);
static QVector< QPointF > AngleByFirstRightAngle(const QPointF &p1, const QPointF &p2, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
bool IsSeamAllowanceBuiltIn() const
bool IsSeamAllowance() const
bool isHideSeamLine() const
static bool isClockwise(const QVector< QPointF > &points)
void setFill(const QString &value)
static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint)
static QVector< QPointF > Equidistant(const QVector< VSAPoint > &points, qreal width)
static bool ParallelCrossPoint(const QLineF &line1, const QLineF &line2, QPointF &point)
static QVector< QPointF > AngleBySecondRightAngle(const QPointF &p2, const QPointF &p3, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
static QLineF createParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width)
static bool Crossing(const QVector< QPointF > &sub1, const QVector< QPointF > &sub2)
static Q_DECL_CONSTEXPR qreal PointPosition(const QPointF &p, const QLineF &line)
static qreal sumTrapezoids(const QVector< QPointF > &points)
static QVector< QPointF > AngleByLength(const QPointF &p2, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
QSharedDataPointer< VAbstractPieceData > d
void SetSAWidth(qreal value)
static QVector< QPointF > EkvPoint(const VSAPoint &p1Line1, const VSAPoint &p2Line1, const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width)
EkvPoint return seam allowance points in place of intersection of two edges. Last points of two edges...
static QVector< QPointF > AngleBySecondSymmetry(const QPointF &p2, const QPointF &p3, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
void SetForbidFlipping(bool value)
static qreal AngleBetweenBisectors(const QLineF &b1, const QLineF &b2)
static QPointF SingleParallelPoint(const QPointF &p1, const QPointF &p2, qreal angle, qreal width)
void setColor(const QString &value)
static qreal MaxLocalSA(const VSAPoint &p, qreal width)
static QVector< QPointF > SubPath(const QVector< QPointF > &path, int startIndex, int endIndex)
void setHideSeamLine(bool value)
void SetName(const QString &value)
static QVector< T > RemoveDublicates(const QVector< T > &points, bool removeFirstAndLast=true)
void SetSeamAllowanceBuiltIn(bool value)
void Swap(VAbstractPiece &piece) Q_DECL_NOTHROW
void SetSeamAllowance(bool value)
virtual ~VAbstractPiece()
static QVector< QPointF > CheckLoops(const QVector< QPointF > &points)
CheckLoops seek and delete loops in equidistant.
static QVector< QPointF > AngleByIntersection(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
static QVector< QPointF > AngleByFirstSymmetry(const QPointF &p1, const QPointF &p2, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3, qreal width)
static QVector< T > CorrectEquidistantPoints(const QVector< T > &points, bool removeFirstAndLast=true)
CorrectEquidistantPoints clear equivalent points and remove point on line from equdistant.
bool IsForbidFlipping() const
static QLineF BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3)
static bool CheckIntersection(const QVector< QPointF > &points, int i, int iNext, int j, int jNext, const QPointF &crossPoint)
VAbstractPiece & operator=(const VAbstractPiece &piece)
static const double accuracyPointOnLine
The VSAPoint class seam allowance point.
Q_DECL_CONSTEXPR VSAPoint()
void SetAngleType(PieceNodeAngle value)
Q_DECL_CONSTEXPR PieceNodeAngle GetAngleType() const
Q_DECL_CONSTEXPR qreal GetSABefore() const
void SetSABefore(qreal value)
Q_DECL_CONSTEXPR qreal GetSAAfter() const
void SetSAAfter(qreal value)
Q_DECLARE_TYPEINFO(VSAPoint, Q_MOVABLE_TYPE)