Improve creating a piece icon.
Add more information about contour: seam line, seam allowance, notches, grainline, internal paths.
This commit is contained in:
parent
82935a1f03
commit
f3c0af7294
|
@ -76,16 +76,7 @@ void VPCarrouselPiece::RefreshSelection()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QIcon VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const
|
QIcon VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) const
|
||||||
{
|
{
|
||||||
QVector<QPointF> points = m_piece->GetMappedContourPoints(); // seamline
|
QRectF boundingRect = m_piece->DetailBoundingRect();
|
||||||
if(points.isEmpty())
|
|
||||||
{
|
|
||||||
points = m_piece->GetMappedSeamAllowancePoints(); // cutting line
|
|
||||||
}
|
|
||||||
|
|
||||||
QPolygonF shape(points);
|
|
||||||
shape << shape.first();
|
|
||||||
|
|
||||||
QRectF boundingRect = shape.boundingRect();
|
|
||||||
qreal canvasSize = qMax(boundingRect.height(), boundingRect.width());
|
qreal canvasSize = qMax(boundingRect.height(), boundingRect.width());
|
||||||
QRectF canvas = QRectF(0, 0, canvasSize, canvasSize);
|
QRectF canvas = QRectF(0, 0, canvasSize, canvasSize);
|
||||||
|
|
||||||
|
@ -147,7 +138,8 @@ QIcon VPCarrouselPiece::CreatePieceIcon(const QSize &size, bool isDragIcon) cons
|
||||||
painter.setBrush(QBrush(Qt::white));
|
painter.setBrush(QBrush(Qt::white));
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.drawPolygon(shape);
|
m_piece->DrawMiniature(painter);
|
||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
icon.addPixmap(pixmap,iconMode);
|
icon.addPixmap(pixmap,iconMode);
|
||||||
|
|
|
@ -106,7 +106,7 @@ void VPGraphicsPiece::Init()
|
||||||
// initialises the grainline
|
// initialises the grainline
|
||||||
if(m_piece->IsGrainlineEnabled())
|
if(m_piece->IsGrainlineEnabled())
|
||||||
{
|
{
|
||||||
QVector<QPointF> grainLinepoints = m_piece->GetGrainline();
|
QVector<QPointF> grainLinepoints = m_piece->GetMappedGrainline();
|
||||||
if(!grainLinepoints.isEmpty())
|
if(!grainLinepoints.isEmpty())
|
||||||
{
|
{
|
||||||
m_grainline.moveTo(grainLinepoints.first());
|
m_grainline.moveTo(grainLinepoints.first());
|
||||||
|
@ -126,7 +126,7 @@ void VPGraphicsPiece::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialises the passmarks
|
// initialises the passmarks
|
||||||
QVector<VLayoutPassmark> passmarks = m_piece->GetPassmarks();
|
QVector<VLayoutPassmark> passmarks = m_piece->GetMappedPassmarks();
|
||||||
for(auto &passmark : passmarks)
|
for(auto &passmark : passmarks)
|
||||||
{
|
{
|
||||||
for (auto &line : passmark.lines)
|
for (auto &line : passmark.lines)
|
||||||
|
|
|
@ -54,7 +54,7 @@ VPPiece::VPPiece(VLayoutPiece layoutPiece): VLayoutPiece(layoutPiece)
|
||||||
|
|
||||||
// then translate the piece so that the top left corner of the bouding rect of the piece is at the position
|
// then translate the piece so that the top left corner of the bouding rect of the piece is at the position
|
||||||
// (0,0) in the sheet coordinate system
|
// (0,0) in the sheet coordinate system
|
||||||
QRectF boundingRect = DetailBoundingRect();
|
QRectF boundingRect = MappedDetailBoundingRect();
|
||||||
QPointF offset = boundingRect.topLeft();
|
QPointF offset = boundingRect.topLeft();
|
||||||
matrix = GetMatrix();
|
matrix = GetMatrix();
|
||||||
matrix.translate(-offset.x() ,-offset.y());
|
matrix.translate(-offset.x() ,-offset.y());
|
||||||
|
|
|
@ -771,7 +771,7 @@ void VDxfEngine::ExportAAMANotch(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
{
|
{
|
||||||
if (detail.IsSeamAllowance())
|
if (detail.IsSeamAllowance())
|
||||||
{
|
{
|
||||||
const QVector<VLayoutPassmark> passmarks = detail.GetPassmarks();
|
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
|
||||||
for(auto &passmark : passmarks)
|
for(auto &passmark : passmarks)
|
||||||
{
|
{
|
||||||
for (auto &line : passmark.lines)
|
for (auto &line : passmark.lines)
|
||||||
|
@ -788,7 +788,7 @@ void VDxfEngine::ExportAAMANotch(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VDxfEngine::ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
void VDxfEngine::ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
||||||
{
|
{
|
||||||
const QVector<QPointF> grainline = detail.GetGrainline();
|
const QVector<QPointF> grainline = detail.GetMappedGrainline();
|
||||||
if (grainline.count() > 1)
|
if (grainline.count() > 1)
|
||||||
{
|
{
|
||||||
if (DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), QChar('7')))
|
if (DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), QChar('7')))
|
||||||
|
@ -1053,7 +1053,7 @@ void VDxfEngine::ExportASTMNotch(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
{
|
{
|
||||||
if (detail.IsSeamAllowance())
|
if (detail.IsSeamAllowance())
|
||||||
{
|
{
|
||||||
const QVector<VLayoutPassmark> passmarks = detail.GetPassmarks();
|
const QVector<VLayoutPassmark> passmarks = detail.GetMappedPassmarks();
|
||||||
for(auto &passmark : passmarks)
|
for(auto &passmark : passmarks)
|
||||||
{
|
{
|
||||||
DRW_ASTMNotch *notch = new DRW_ASTMNotch();
|
DRW_ASTMNotch *notch = new DRW_ASTMNotch();
|
||||||
|
|
|
@ -303,7 +303,7 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
|
||||||
d->globalContour.SetContour(newGContour);
|
d->globalContour.SetContour(newGContour);
|
||||||
|
|
||||||
VCachedPositions positionChache;
|
VCachedPositions positionChache;
|
||||||
QVector<QPointF> layoutPoints = workDetail.GetLayoutAllowancePoints();
|
QVector<QPointF> layoutPoints = workDetail.GetMappedLayoutAllowancePoints();
|
||||||
positionChache.boundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
positionChache.boundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
||||||
positionChache.layoutAllowancePath = VAbstractPiece::PainterPath(layoutPoints);
|
positionChache.layoutAllowancePath = VAbstractPiece::PainterPath(layoutPoints);
|
||||||
d->positionsCache.append(positionChache);
|
d->positionsCache.append(positionChache);
|
||||||
|
|
|
@ -530,7 +530,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
||||||
det.SetPriority(piece.GetPriority());
|
det.SetPriority(piece.GetPriority());
|
||||||
|
|
||||||
// Very important to set main path first!
|
// Very important to set main path first!
|
||||||
if (det.ContourPath().isEmpty())
|
if (det.MappedContourPath().isEmpty())
|
||||||
{
|
{
|
||||||
throw VException (tr("Piece %1 doesn't have shape.").arg(piece.GetName()));
|
throw VException (tr("Piece %1 doesn't have shape.").arg(piece.GetName()));
|
||||||
}
|
}
|
||||||
|
@ -650,11 +650,17 @@ void VLayoutPiece::SetSeamAllowancePoints(const QVector<QPointF> &points, bool s
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetLayoutAllowancePoints() const
|
QVector<QPointF> VLayoutPiece::GetMappedLayoutAllowancePoints() const
|
||||||
{
|
{
|
||||||
return Map(d->layoutAllowance);
|
return Map(d->layoutAllowance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QPointF> VLayoutPiece::GetLayoutAllowancePoints() const
|
||||||
|
{
|
||||||
|
return d->layoutAllowance;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointF VLayoutPiece::GetPieceTextPosition() const
|
QPointF VLayoutPiece::GetPieceTextPosition() const
|
||||||
{
|
{
|
||||||
|
@ -791,11 +797,17 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutPiece::GetGrainline() const
|
QVector<QPointF> VLayoutPiece::GetMappedGrainline() const
|
||||||
{
|
{
|
||||||
return Map(d->grainlinePoints);
|
return Map(d->grainlinePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QPointF> VLayoutPiece::GetGrainline() const
|
||||||
|
{
|
||||||
|
return d->grainlinePoints;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VLayoutPiece::IsGrainlineEnabled() const
|
bool VLayoutPiece::IsGrainlineEnabled() const
|
||||||
{
|
{
|
||||||
|
@ -956,22 +968,29 @@ int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::DetailBoundingRect() const
|
QRectF VLayoutPiece::MappedDetailBoundingRect() const
|
||||||
{
|
{
|
||||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? BoundingRect(GetMappedSeamAllowancePoints()) :
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? BoundingRect(GetMappedSeamAllowancePoints()) :
|
||||||
BoundingRect(GetMappedContourPoints());
|
BoundingRect(GetMappedContourPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRectF VLayoutPiece::LayoutBoundingRect() const
|
QRectF VLayoutPiece::DetailBoundingRect() const
|
||||||
{
|
{
|
||||||
return BoundingRect(GetLayoutAllowancePoints());
|
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? BoundingRect(GetSeamAllowancePoints()) :
|
||||||
|
BoundingRect(GetContourPoints());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VLayoutPiece::MappedLayoutBoundingRect() const
|
||||||
|
{
|
||||||
|
return BoundingRect(GetMappedLayoutAllowancePoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VLayoutPiece::Diagonal() const
|
qreal VLayoutPiece::Diagonal() const
|
||||||
{
|
{
|
||||||
const QRectF rec = LayoutBoundingRect();
|
const QRectF rec = MappedLayoutBoundingRect();
|
||||||
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,11 +1056,17 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPassmark> VLayoutPiece::GetPassmarks() const
|
QVector<VLayoutPassmark> VLayoutPiece::GetMappedPassmarks() const
|
||||||
{
|
{
|
||||||
return Map(d->passmarks);
|
return Map(d->passmarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VLayoutPassmark> VLayoutPiece::GetPassmarks() const
|
||||||
|
{
|
||||||
|
return d->passmarks;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutPiece::SetPassmarks(const QVector<VLayoutPassmark> &passmarks)
|
void VLayoutPiece::SetPassmarks(const QVector<VLayoutPassmark> &passmarks)
|
||||||
{
|
{
|
||||||
|
@ -1091,6 +1116,12 @@ void VLayoutPiece::SetInternalPaths(const QVector<VLayoutPiecePath> &internalPat
|
||||||
d->m_internalPaths = internalPaths;
|
d->m_internalPaths = internalPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VLayoutPiece::MappedContourPath() const
|
||||||
|
{
|
||||||
|
return d->matrix.map(ContourPath());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::ContourPath() const
|
QPainterPath VLayoutPiece::ContourPath() const
|
||||||
{
|
{
|
||||||
|
@ -1099,7 +1130,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
// contour
|
// contour
|
||||||
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
path = PainterPath(GetMappedContourPoints());
|
path = PainterPath(GetContourPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
// seam allowance
|
// seam allowance
|
||||||
|
@ -1108,7 +1139,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
if (not IsSeamAllowanceBuiltIn())
|
if (not IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
// Draw seam allowance
|
// Draw seam allowance
|
||||||
QVector<QPointF>points = GetMappedSeamAllowancePoints();
|
QVector<QPointF>points = GetSeamAllowancePoints();
|
||||||
|
|
||||||
if (points.last().toPoint() != points.first().toPoint())
|
if (points.last().toPoint() != points.first().toPoint())
|
||||||
{
|
{
|
||||||
|
@ -1128,9 +1159,9 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
// Draw passmarks
|
// Draw passmarks
|
||||||
QPainterPath passmaksPath;
|
QPainterPath passmaksPath;
|
||||||
const QVector<VLayoutPassmark> passmarks = GetPassmarks();
|
const QVector<VLayoutPassmark> passmarks = GetPassmarks();
|
||||||
for(auto &passmark : passmarks)
|
for(const auto &passmark : passmarks)
|
||||||
{
|
{
|
||||||
for (auto &line : passmark.lines)
|
for (const auto &line : passmark.lines)
|
||||||
{
|
{
|
||||||
passmaksPath.moveTo(line.p1());
|
passmaksPath.moveTo(line.p1());
|
||||||
passmaksPath.lineTo(line.p2());
|
passmaksPath.lineTo(line.p2());
|
||||||
|
@ -1145,9 +1176,43 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
QPainterPath VLayoutPiece::MappedLayoutAllowancePath() const
|
||||||
{
|
{
|
||||||
return PainterPath(GetLayoutAllowancePoints());
|
return PainterPath(GetMappedLayoutAllowancePoints());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutPiece::DrawMiniature(QPainter &painter)
|
||||||
|
{
|
||||||
|
painter.drawPath(ContourPath());
|
||||||
|
|
||||||
|
for (auto &path : d->m_internalPaths)
|
||||||
|
{
|
||||||
|
painter.save();
|
||||||
|
|
||||||
|
QPen pen = painter.pen();
|
||||||
|
pen.setStyle(path.PenStyle());
|
||||||
|
painter.setPen(pen);
|
||||||
|
|
||||||
|
painter.drawPath(path.GetPainterPath());
|
||||||
|
|
||||||
|
painter.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &label : d->m_placeLabels)
|
||||||
|
{
|
||||||
|
painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape));
|
||||||
|
}
|
||||||
|
|
||||||
|
QPainterPath path;
|
||||||
|
|
||||||
|
QVector<QPointF> gPoints = GetGrainline();
|
||||||
|
path.moveTo(gPoints.at(0));
|
||||||
|
for (auto p : qAsConst(gPoints))
|
||||||
|
{
|
||||||
|
path.lineTo(p);
|
||||||
|
}
|
||||||
|
painter.drawPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1157,7 +1222,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
|
|
||||||
for (auto &path : d->m_internalPaths)
|
for (auto &path : d->m_internalPaths)
|
||||||
{
|
{
|
||||||
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
auto* pathItem = new QGraphicsPathItem(item);
|
||||||
pathItem->setPath(d->matrix.map(path.GetPainterPath()));
|
pathItem->setPath(d->matrix.map(path.GetPainterPath()));
|
||||||
|
|
||||||
QPen pen = pathItem->pen();
|
QPen pen = pathItem->pen();
|
||||||
|
@ -1166,9 +1231,9 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
pathItem->setPen(pen);
|
pathItem->setPen(pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &label : d->m_placeLabels)
|
for (const auto &label : d->m_placeLabels)
|
||||||
{
|
{
|
||||||
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
auto* pathItem = new QGraphicsPathItem(item);
|
||||||
QPen pen = pathItem->pen();
|
QPen pen = pathItem->pen();
|
||||||
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
pathItem->setPen(pen);
|
pathItem->setPen(pen);
|
||||||
|
@ -1341,7 +1406,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
QVector<QPointF> gPoints = GetGrainline();
|
QVector<QPointF> gPoints = GetMappedGrainline();
|
||||||
path.moveTo(gPoints.at(0));
|
path.moveTo(gPoints.at(0));
|
||||||
for (auto p : qAsConst(gPoints))
|
for (auto p : qAsConst(gPoints))
|
||||||
{
|
{
|
||||||
|
@ -1370,7 +1435,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
||||||
QPen pen = item->pen();
|
QPen pen = item->pen();
|
||||||
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
item->setPen(pen);
|
item->setPen(pen);
|
||||||
item->setPath(ContourPath());
|
item->setPath(MappedContourPath());
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,11 @@ public:
|
||||||
void SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance = true,
|
void SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance = true,
|
||||||
bool seamAllowanceBuiltIn = false);
|
bool seamAllowanceBuiltIn = false);
|
||||||
|
|
||||||
|
QVector<QPointF> GetMappedLayoutAllowancePoints() const;
|
||||||
QVector<QPointF> GetLayoutAllowancePoints() const;
|
QVector<QPointF> GetLayoutAllowancePoints() const;
|
||||||
void SetLayoutAllowancePoints();
|
void SetLayoutAllowancePoints();
|
||||||
|
|
||||||
|
QVector<VLayoutPassmark> GetMappedPassmarks() const;
|
||||||
QVector<VLayoutPassmark> GetPassmarks() const;
|
QVector<VLayoutPassmark> GetPassmarks() const;
|
||||||
void SetPassmarks(const QVector<VLayoutPassmark> &passmarks);
|
void SetPassmarks(const QVector<VLayoutPassmark> &passmarks);
|
||||||
|
|
||||||
|
@ -105,6 +107,7 @@ public:
|
||||||
const VContainer *pattern);
|
const VContainer *pattern);
|
||||||
|
|
||||||
void SetGrainline(const VGrainlineData& geom, const VContainer *pattern);
|
void SetGrainline(const VGrainlineData& geom, const VContainer *pattern);
|
||||||
|
QVector<QPointF> GetMappedGrainline() const;
|
||||||
QVector<QPointF> GetGrainline() const;
|
QVector<QPointF> GetGrainline() const;
|
||||||
bool IsGrainlineEnabled() const;
|
bool IsGrainlineEnabled() const;
|
||||||
qreal GrainlineAngle() const;
|
qreal GrainlineAngle() const;
|
||||||
|
@ -137,8 +140,9 @@ public:
|
||||||
QLineF LayoutEdge(int i) const;
|
QLineF LayoutEdge(int i) const;
|
||||||
int LayoutEdgeByPoint(const QPointF &p1) const;
|
int LayoutEdgeByPoint(const QPointF &p1) const;
|
||||||
|
|
||||||
|
QRectF MappedDetailBoundingRect() const;
|
||||||
QRectF DetailBoundingRect() const;
|
QRectF DetailBoundingRect() const;
|
||||||
QRectF LayoutBoundingRect() const;
|
QRectF MappedLayoutBoundingRect() const;
|
||||||
qreal Diagonal() const;
|
qreal Diagonal() const;
|
||||||
|
|
||||||
static QRectF BoundingRect(QVector<QPointF> points);
|
static QRectF BoundingRect(QVector<QPointF> points);
|
||||||
|
@ -146,8 +150,11 @@ public:
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
qint64 Square() const;
|
qint64 Square() const;
|
||||||
|
|
||||||
|
QPainterPath MappedContourPath() const;
|
||||||
QPainterPath ContourPath() const;
|
QPainterPath ContourPath() const;
|
||||||
QPainterPath LayoutAllowancePath() const;
|
QPainterPath MappedLayoutAllowancePath() const;
|
||||||
|
|
||||||
|
void DrawMiniature(QPainter &painter);
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ void VPosition::SaveCandidate(VBestSquare &bestResult, const VLayoutPiece &detai
|
||||||
QVector<QPointF> newGContour = m_data.gContour.UniteWithContour(detail, globalI, detJ, type);
|
QVector<QPointF> newGContour = m_data.gContour.UniteWithContour(detail, globalI, detJ, type);
|
||||||
newGContour.append(newGContour.first());
|
newGContour.append(newGContour.first());
|
||||||
const QSizeF size = QPolygonF(newGContour).boundingRect().size();
|
const QSizeF size = QPolygonF(newGContour).boundingRect().size();
|
||||||
const QRectF boundingRect = detail.DetailBoundingRect();
|
const QRectF boundingRect = detail.MappedDetailBoundingRect();
|
||||||
const qreal depthPosition = m_data.isOriginPaperOrientationPortrait ? boundingRect.y() : boundingRect.x();
|
const qreal depthPosition = m_data.isOriginPaperOrientationPortrait ? boundingRect.y() : boundingRect.x();
|
||||||
const qreal sidePosition = m_data.isOriginPaperOrientationPortrait ? boundingRect.x() : boundingRect.y();
|
const qreal sidePosition = m_data.isOriginPaperOrientationPortrait ? boundingRect.x() : boundingRect.y();
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ bool VPosition::CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (not detail.IsForceFlipping() && SheetContains(detail.DetailBoundingRect()))
|
if (not detail.IsForceFlipping() && SheetContains(detail.MappedDetailBoundingRect()))
|
||||||
{
|
{
|
||||||
if (not m_data.gContour.GetContour().isEmpty())
|
if (not m_data.gContour.GetContour().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,7 @@ bool VPosition::CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge)
|
||||||
}
|
}
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (SheetContains(detail.DetailBoundingRect()))
|
if (SheetContains(detail.MappedDetailBoundingRect()))
|
||||||
{
|
{
|
||||||
type = Crossing(detail);
|
type = Crossing(detail);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ bool VPosition::CheckRotationEdges(VLayoutPiece &detail, int j, int dEdge, qreal
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CrossingType type = CrossingType::Intersection;
|
CrossingType type = CrossingType::Intersection;
|
||||||
if (SheetContains(detail.DetailBoundingRect()))
|
if (SheetContains(detail.MappedDetailBoundingRect()))
|
||||||
{
|
{
|
||||||
type = Crossing(detail);
|
type = Crossing(detail);
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const
|
||||||
return CrossingType::NoIntersection;
|
return CrossingType::NoIntersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<QPointF> layoutPoints = detail.GetLayoutAllowancePoints();
|
const QVector<QPointF> layoutPoints = detail.GetMappedLayoutAllowancePoints();
|
||||||
const QRectF layoutBoundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
const QRectF layoutBoundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
||||||
const QPainterPath layoutAllowancePath = VAbstractPiece::PainterPath(layoutPoints);
|
const QPainterPath layoutAllowancePath = VAbstractPiece::PainterPath(layoutPoints);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user