Internal paths in layout now support pen style.
--HG-- branch : develop
This commit is contained in:
parent
2b7851f354
commit
aace2e0178
|
@ -18,7 +18,9 @@ HEADERS += \
|
||||||
$$PWD/vabstractpiece.h \
|
$$PWD/vabstractpiece.h \
|
||||||
$$PWD/vabstractpiece_p.h \
|
$$PWD/vabstractpiece_p.h \
|
||||||
$$PWD/vlayoutpiece.h \
|
$$PWD/vlayoutpiece.h \
|
||||||
$$PWD/vlayoutpiece_p.h
|
$$PWD/vlayoutpiece_p.h \
|
||||||
|
$$PWD/vlayoutpiecepath.h \
|
||||||
|
$$PWD/vlayoutpiecepath_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/vlayoutgenerator.cpp \
|
$$PWD/vlayoutgenerator.cpp \
|
||||||
|
@ -31,6 +33,7 @@ SOURCES += \
|
||||||
$$PWD/vposter.cpp \
|
$$PWD/vposter.cpp \
|
||||||
$$PWD/vgraphicsfillitem.cpp \
|
$$PWD/vgraphicsfillitem.cpp \
|
||||||
$$PWD/vabstractpiece.cpp \
|
$$PWD/vabstractpiece.cpp \
|
||||||
$$PWD/vlayoutpiece.cpp
|
$$PWD/vlayoutpiece.cpp \
|
||||||
|
$$PWD/vlayoutpiecepath.cpp
|
||||||
|
|
||||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
|
@ -57,6 +57,24 @@ class QGraphicsPathItem;
|
||||||
class QLineF;
|
class QLineF;
|
||||||
class VAbstractPattern;
|
class VAbstractPattern;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VContainer *pattern)
|
||||||
|
{
|
||||||
|
QVector<VLayoutPiecePath> paths;
|
||||||
|
const QVector<quint32> pathsId = piece.GetInternalPaths();
|
||||||
|
for (int i = 0; i < pathsId.size(); ++i)
|
||||||
|
{
|
||||||
|
const VPiecePath path = pattern->GetPiecePath(pathsId.at(i));
|
||||||
|
if (path.GetType() == PiecePathType::InternalPath)
|
||||||
|
{
|
||||||
|
paths.append(VLayoutPiecePath(path.PathPoints(pattern), path.GetPenType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiece::VLayoutPiece()
|
VLayoutPiece::VLayoutPiece()
|
||||||
:VAbstractPiece(), d(new VLayoutPieceData)
|
:VAbstractPiece(), d(new VLayoutPieceData)
|
||||||
|
@ -89,7 +107,8 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
|
||||||
VLayoutPiece det;
|
VLayoutPiece det;
|
||||||
det.SetCountourPoints(piece.MainPathPoints(pattern));
|
det.SetCountourPoints(piece.MainPathPoints(pattern));
|
||||||
det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance());
|
det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance());
|
||||||
det.SetInternlaPathsPoints(piece.GetInternalPathsPoints(pattern));
|
det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
|
||||||
|
|
||||||
det.SetName(piece.GetName());
|
det.SetName(piece.GetName());
|
||||||
const VPatternPieceData& data = piece.GetPatternPieceData();
|
const VPatternPieceData& data = piece.GetPatternPieceData();
|
||||||
if (data.IsVisible() == true)
|
if (data.IsVisible() == true)
|
||||||
|
@ -500,15 +519,15 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QVector<QPointF>> VLayoutPiece::GetInternlaPathsPoints() const
|
QVector<VLayoutPiecePath> VLayoutPiece::GetInternalPaths() const
|
||||||
{
|
{
|
||||||
return d->m_internalPaths;
|
return d->m_internalPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutPiece::SetInternlaPathsPoints(const QVector<QVector<QPointF>> &internalPathsPoints)
|
void VLayoutPiece::SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths)
|
||||||
{
|
{
|
||||||
d->m_internalPaths = internalPathsPoints;
|
d->m_internalPaths = internalPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -708,6 +727,18 @@ void VLayoutPiece::CreateTextItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
||||||
|
{
|
||||||
|
SCASSERT(parent != nullptr)
|
||||||
|
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
||||||
|
item->setPath(d->matrix.map(d->m_internalPaths.at(i).GetPainterPath()));
|
||||||
|
|
||||||
|
QPen pen = item->pen();
|
||||||
|
pen.setStyle(d->m_internalPaths.at(i).PenStyle());
|
||||||
|
item->setPen(pen);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief CreateTextItem Creates the i-th text item
|
* @brief CreateTextItem Creates the i-th text item
|
||||||
|
@ -719,9 +750,7 @@ void VLayoutPiece::CreateTextItem(int i, QGraphicsItem *parent) const
|
||||||
SCASSERT(parent != nullptr)
|
SCASSERT(parent != nullptr)
|
||||||
|
|
||||||
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
||||||
QTransform transform = d->matrix;
|
QPainterPath path = d->matrix.map(d->m_liPP.at(i));
|
||||||
|
|
||||||
QPainterPath path = transform.map(d->m_liPP[i]);
|
|
||||||
|
|
||||||
if (d->mirror == true)
|
if (d->mirror == true)
|
||||||
{
|
{
|
||||||
|
@ -735,7 +764,8 @@ void VLayoutPiece::CreateTextItem(int i, QGraphicsItem *parent) const
|
||||||
points = Map(Mirror(d->patternInfo));
|
points = Map(Mirror(d->patternInfo));
|
||||||
}
|
}
|
||||||
QPointF ptCenter = (points.at(1) + points.at(3))/2;
|
QPointF ptCenter = (points.at(1) + points.at(3))/2;
|
||||||
qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x()));
|
qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(),
|
||||||
|
points.at(1).x() - points.at(0).x()));
|
||||||
|
|
||||||
// we need to move the center back to the origin, rotate it to align it with x axis,
|
// we need to move the center back to the origin, rotate it to align it with x axis,
|
||||||
// then mirror it to obtain the proper text direction, rotate it and translate it back to original position.
|
// then mirror it to obtain the proper text direction, rotate it and translate it back to original position.
|
||||||
|
@ -779,9 +809,12 @@ QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
||||||
QGraphicsItem *VLayoutPiece::GetItem() const
|
QGraphicsItem *VLayoutPiece::GetItem() const
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||||
QPainterPath contour = ContourPath();
|
item->setPath(ContourPath());
|
||||||
contour.addPath(InternalPathsPath());
|
|
||||||
item->setPath(contour);
|
for (int i = 0; i < d->m_internalPaths.count(); ++i)
|
||||||
|
{
|
||||||
|
CreateInternalPathItem(i, item);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < d->m_liPP.count(); ++i)
|
for (int i = 0; i < d->m_liPP.count(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -813,29 +846,6 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
||||||
item->setPath(path);
|
item->setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QPainterPath VLayoutPiece::InternalPathsPath() const
|
|
||||||
{
|
|
||||||
QPainterPath allPaths;
|
|
||||||
allPaths.setFillRule(Qt::WindingFill);
|
|
||||||
|
|
||||||
for (qint32 i = 0; i < d->m_internalPaths.count(); ++i)
|
|
||||||
{
|
|
||||||
const QVector<QPointF> points = Map(d->m_internalPaths.at(i));
|
|
||||||
QPainterPath path;
|
|
||||||
path.setFillRule(Qt::WindingFill);
|
|
||||||
path.moveTo(points.at(0));
|
|
||||||
for (qint32 j = 1; j < points.count(); ++j)
|
|
||||||
{
|
|
||||||
path.lineTo(points.at(j));
|
|
||||||
}
|
|
||||||
path.lineTo(points.at(0));
|
|
||||||
allPaths.addPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return allPaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::DetailPath() const
|
QVector<QPointF> VLayoutPiece::DetailPath() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,6 +59,7 @@ class VLayoutPieceData;
|
||||||
class VPatternInfoGeometry;
|
class VPatternInfoGeometry;
|
||||||
class VPatternPieceData;
|
class VPatternPieceData;
|
||||||
class VGrainlineGeometry;
|
class VGrainlineGeometry;
|
||||||
|
class VLayoutPiecePath;
|
||||||
|
|
||||||
class VLayoutPiece :public VAbstractPiece
|
class VLayoutPiece :public VAbstractPiece
|
||||||
{
|
{
|
||||||
|
@ -79,8 +80,8 @@ public:
|
||||||
QVector<QPointF> GetLayoutAllowancePoints() const;
|
QVector<QPointF> GetLayoutAllowancePoints() const;
|
||||||
void SetLayoutAllowancePoints();
|
void SetLayoutAllowancePoints();
|
||||||
|
|
||||||
QVector<QVector<QPointF>> GetInternlaPathsPoints() const;
|
QVector<VLayoutPiecePath> GetInternalPaths() const;
|
||||||
void SetInternlaPathsPoints(const QVector<QVector<QPointF>> &internalPathsPoints);
|
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
||||||
|
|
||||||
void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
|
void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
|
||||||
|
|
||||||
|
@ -130,11 +131,10 @@ private:
|
||||||
void ClearTextItems();
|
void ClearTextItems();
|
||||||
void CreateTextItems();
|
void CreateTextItems();
|
||||||
|
|
||||||
|
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
||||||
void CreateTextItem(int i, QGraphicsItem *parent) const;
|
void CreateTextItem(int i, QGraphicsItem *parent) const;
|
||||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||||
|
|
||||||
QPainterPath InternalPathsPath() const;
|
|
||||||
|
|
||||||
static QVector<VSAPoint> PrepareAllowance(const QVector<QPointF> &points);
|
static QVector<VSAPoint> PrepareAllowance(const QVector<QPointF> &points);
|
||||||
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
||||||
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include "../vpatterndb/vpatternpiecedata.h"
|
#include "../vpatterndb/vpatternpiecedata.h"
|
||||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||||
|
#include "../vmisc/diagnostic.h"
|
||||||
|
#include "vlayoutpiecepath.h"
|
||||||
|
|
||||||
#include "vtextmanager.h"
|
#include "vtextmanager.h"
|
||||||
|
|
||||||
|
@ -96,8 +98,8 @@ public:
|
||||||
/** @brief layoutAllowance list of layout allowance points. */
|
/** @brief layoutAllowance list of layout allowance points. */
|
||||||
QVector<QPointF> layoutAllowance;
|
QVector<QPointF> layoutAllowance;
|
||||||
|
|
||||||
/** @brief m_internalPaths list of internal paths points. */
|
/** @brief m_internalPaths list of internal paths. */
|
||||||
QVector<QVector<QPointF>> m_internalPaths;
|
QVector<VLayoutPiecePath> m_internalPaths;
|
||||||
|
|
||||||
/** @brief matrix transformation matrix*/
|
/** @brief matrix transformation matrix*/
|
||||||
QTransform matrix;
|
QTransform matrix;
|
||||||
|
|
107
src/libs/vlayout/vlayoutpiecepath.cpp
Normal file
107
src/libs/vlayout/vlayoutpiecepath.cpp
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 8 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
|
||||||
|
** <https://bitbucket.org/dismine/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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "vlayoutpiecepath.h"
|
||||||
|
#include "vlayoutpiecepath_p.h"
|
||||||
|
|
||||||
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLayoutPiecePath::VLayoutPiecePath()
|
||||||
|
: d(new VLayoutPiecePathData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLayoutPiecePath::VLayoutPiecePath(const QVector<QPointF> &points, Qt::PenStyle penStyle)
|
||||||
|
: d(new VLayoutPiecePathData(points, penStyle))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLayoutPiecePath::VLayoutPiecePath(const VLayoutPiecePath &path)
|
||||||
|
: d(path.d)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLayoutPiecePath &VLayoutPiecePath::operator=(const VLayoutPiecePath &path)
|
||||||
|
{
|
||||||
|
if ( &path == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
d = path.d;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLayoutPiecePath::~VLayoutPiecePath()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VLayoutPiecePath::GetPainterPath() const
|
||||||
|
{
|
||||||
|
QPainterPath path;
|
||||||
|
path.setFillRule(Qt::WindingFill);
|
||||||
|
if (not d->m_points.isEmpty())
|
||||||
|
{
|
||||||
|
path.moveTo(d->m_points.at(0));
|
||||||
|
for (qint32 j = 1; j < d->m_points.count(); ++j)
|
||||||
|
{
|
||||||
|
path.lineTo(d->m_points.at(j));
|
||||||
|
}
|
||||||
|
path.lineTo(d->m_points.at(0));
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QPointF> VLayoutPiecePath::Points() const
|
||||||
|
{
|
||||||
|
return d->m_points;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutPiecePath::SetPoints(const QVector<QPointF> &points)
|
||||||
|
{
|
||||||
|
d->m_points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Qt::PenStyle VLayoutPiecePath::PenStyle() const
|
||||||
|
{
|
||||||
|
return d->m_penStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutPiecePath::SetPenStyle(const Qt::PenStyle &penStyle)
|
||||||
|
{
|
||||||
|
d->m_penStyle = penStyle;
|
||||||
|
}
|
61
src/libs/vlayout/vlayoutpiecepath.h
Normal file
61
src/libs/vlayout/vlayoutpiecepath.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 8 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
|
||||||
|
** <https://bitbucket.org/dismine/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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VLAYOUTPIECEPATH_H
|
||||||
|
#define VLAYOUTPIECEPATH_H
|
||||||
|
|
||||||
|
#include <QPointF>
|
||||||
|
#include <QSharedDataPointer>
|
||||||
|
|
||||||
|
class VLayoutPiecePathData;
|
||||||
|
class QPainterPath;
|
||||||
|
|
||||||
|
class VLayoutPiecePath
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLayoutPiecePath();
|
||||||
|
VLayoutPiecePath(const QVector<QPointF> &points, Qt::PenStyle penStyle = Qt::SolidLine);
|
||||||
|
VLayoutPiecePath(const VLayoutPiecePath &path);
|
||||||
|
VLayoutPiecePath &operator=(const VLayoutPiecePath &path);
|
||||||
|
virtual ~VLayoutPiecePath();
|
||||||
|
|
||||||
|
QPainterPath GetPainterPath() const;
|
||||||
|
|
||||||
|
QVector<QPointF> Points() const;
|
||||||
|
void SetPoints(const QVector<QPointF> &points);
|
||||||
|
|
||||||
|
Qt::PenStyle PenStyle() const;
|
||||||
|
void SetPenStyle(const Qt::PenStyle &PenStyle);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSharedDataPointer<VLayoutPiecePathData> d;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_TYPEINFO(VLayoutPiecePath, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
|
#endif // VLAYOUTPIECEPATH_H
|
78
src/libs/vlayout/vlayoutpiecepath_p.h
Normal file
78
src/libs/vlayout/vlayoutpiecepath_p.h
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 8 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
|
||||||
|
** <https://bitbucket.org/dismine/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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VLAYOUTPIECEPATH_P_H
|
||||||
|
#define VLAYOUTPIECEPATH_P_H
|
||||||
|
|
||||||
|
#include <QSharedData>
|
||||||
|
#include <QPointF>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "../vmisc/diagnostic.h"
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
|
||||||
|
class VLayoutPiecePathData : public QSharedData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLayoutPiecePathData()
|
||||||
|
: m_points(),
|
||||||
|
m_penStyle(Qt::SolidLine)
|
||||||
|
{}
|
||||||
|
|
||||||
|
VLayoutPiecePathData(const QVector<QPointF> points, Qt::PenStyle penStyle)
|
||||||
|
: m_points(points),
|
||||||
|
m_penStyle(penStyle)
|
||||||
|
{}
|
||||||
|
|
||||||
|
VLayoutPiecePathData(const VLayoutPiecePathData &path)
|
||||||
|
: QSharedData(path),
|
||||||
|
m_points(path.m_points),
|
||||||
|
m_penStyle(path.m_penStyle)
|
||||||
|
{}
|
||||||
|
|
||||||
|
~VLayoutPiecePathData();
|
||||||
|
|
||||||
|
/** @brief m_points list of path points. */
|
||||||
|
QVector<QPointF> m_points;
|
||||||
|
|
||||||
|
/** @brief m_penStyle path pen style. */
|
||||||
|
Qt::PenStyle m_penStyle;
|
||||||
|
|
||||||
|
private:
|
||||||
|
VLayoutPiecePathData &operator=(const VLayoutPiecePathData &) Q_DECL_EQ_DELETE;
|
||||||
|
};
|
||||||
|
|
||||||
|
VLayoutPiecePathData::~VLayoutPiecePathData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
#endif // VLAYOUTPIECEPATH_P_H
|
||||||
|
|
|
@ -177,21 +177,6 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
|
||||||
return Equidistant(pointsEkv, width);
|
return Equidistant(pointsEkv, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QVector<QVector<QPointF>> VPiece::GetInternalPathsPoints(const VContainer *data) const
|
|
||||||
{
|
|
||||||
QVector<QVector<QPointF>> pathsPoints;
|
|
||||||
for (int i = 0; i < d->m_internalPaths.size(); ++i)
|
|
||||||
{
|
|
||||||
const VPiecePath path = data->GetPiecePath(d->m_internalPaths.at(i));
|
|
||||||
if (path.GetType() == PiecePathType::InternalPath)
|
|
||||||
{
|
|
||||||
pathsPoints.append(path.PathPoints(data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pathsPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,8 +64,6 @@ public:
|
||||||
QVector<VPointF> MainPathNodePoints(const VContainer *data) const;
|
QVector<VPointF> MainPathNodePoints(const VContainer *data) const;
|
||||||
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
||||||
|
|
||||||
QVector<QVector<QPointF>> GetInternalPathsPoints(const VContainer *data) const;
|
|
||||||
|
|
||||||
QPainterPath MainPathPath(const VContainer *data) const;
|
QPainterPath MainPathPath(const VContainer *data) const;
|
||||||
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user