Fix generation tiles.
This commit is contained in:
parent
22da66e4d8
commit
048035db79
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../vptilefactory.h"
|
#include "../vptilefactory.h"
|
||||||
#include "../layout/vplayout.h"
|
#include "../layout/vplayout.h"
|
||||||
|
#include "../layout/vpsheet.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -24,12 +25,21 @@ auto VPGraphicsTileGrid::boundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
|
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
|
||||||
|
|
||||||
|
QMarginsF sheetMargins;
|
||||||
|
if (not sheet.isNull() && not sheet->IgnoreMargins())
|
||||||
|
{
|
||||||
|
sheetMargins = sheet->GetSheetMargins();
|
||||||
|
}
|
||||||
|
|
||||||
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
||||||
qreal yScale = layout->LayoutSettings().VerticalScale();
|
qreal yScale = layout->LayoutSettings().VerticalScale();
|
||||||
|
|
||||||
QRectF rect(0, 0,
|
qreal width = layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth;
|
||||||
layout->TileFactory()->ColNb(sheet) * (layout->TileFactory()->DrawingAreaWidth() / xScale),
|
qreal height = layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth;
|
||||||
layout->TileFactory()->RowNb(sheet) * (layout->TileFactory()->DrawingAreaHeight() / yScale));
|
|
||||||
|
QRectF rect(sheetMargins.left(), sheetMargins.top(),
|
||||||
|
layout->TileFactory()->ColNb(sheet) * (width / xScale),
|
||||||
|
layout->TileFactory()->RowNb(sheet) * (height / yScale));
|
||||||
|
|
||||||
constexpr qreal halfPenWidth = penWidth/2.;
|
constexpr qreal halfPenWidth = penWidth/2.;
|
||||||
|
|
||||||
|
@ -50,6 +60,12 @@ void VPGraphicsTileGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
{
|
{
|
||||||
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
|
VPSheetPtr sheet = layout->GetSheet(m_sheetUuid);
|
||||||
|
|
||||||
|
QMarginsF sheetMargins;
|
||||||
|
if (not sheet.isNull() && not sheet->IgnoreMargins())
|
||||||
|
{
|
||||||
|
sheetMargins = sheet->GetSheetMargins();
|
||||||
|
}
|
||||||
|
|
||||||
QPen pen(QColor(255,0,0,127), penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen pen(QColor(255,0,0,127), penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
pen.setCosmetic(true);
|
pen.setCosmetic(true);
|
||||||
pen.setStyle(Qt::DashLine);
|
pen.setStyle(Qt::DashLine);
|
||||||
|
@ -60,19 +76,24 @@ void VPGraphicsTileGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
||||||
qreal yScale = layout->LayoutSettings().VerticalScale();
|
qreal yScale = layout->LayoutSettings().VerticalScale();
|
||||||
|
|
||||||
const qreal drawingAreaWidth = layout->TileFactory()->DrawingAreaWidth() / xScale;
|
const qreal width = (layout->TileFactory()->DrawingAreaWidth() - VPTileFactory::tileStripeWidth) / xScale;
|
||||||
const qreal drawingAreaHeight = layout->TileFactory()->DrawingAreaHeight() / yScale;
|
const qreal height = (layout->TileFactory()->DrawingAreaHeight() - VPTileFactory::tileStripeWidth) / yScale;
|
||||||
|
|
||||||
for(int i=0;i<=layout->TileFactory()->ColNb(sheet);i++)
|
const int nbCol = layout->TileFactory()->ColNb(sheet);
|
||||||
|
const int nbRow = layout->TileFactory()->RowNb(sheet);
|
||||||
|
|
||||||
|
for(int i=0;i<=nbCol;++i)
|
||||||
{
|
{
|
||||||
painter->drawLine(QPointF(i*drawingAreaWidth, 0),
|
// vertical lines
|
||||||
QPointF(i*drawingAreaWidth, layout->TileFactory()->RowNb(sheet)*drawingAreaHeight));
|
painter->drawLine(QPointF(sheetMargins.left()+i*width, sheetMargins.top()),
|
||||||
|
QPointF(sheetMargins.left()+i*width, sheetMargins.top() + nbRow*height));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j=0;j<=layout->TileFactory()->RowNb(sheet);j++)
|
for(int j=0;j<=nbRow;++j)
|
||||||
{
|
{
|
||||||
painter->drawLine(QPointF(0, j*drawingAreaHeight),
|
// horizontal lines
|
||||||
QPointF(layout->TileFactory()->ColNb(sheet)*drawingAreaWidth, j*drawingAreaHeight));
|
painter->drawLine(QPointF(sheetMargins.left(), sheetMargins.top()+j*height),
|
||||||
|
QPointF(sheetMargins.left()+nbCol*width, sheetMargins.top()+j*height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings):
|
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings):
|
||||||
m_layout(layout),
|
m_layout(layout),
|
||||||
m_commonSettings(commonSettings),
|
m_commonSettings(commonSettings)
|
||||||
m_infoStripeWidth(UnitConvertor(1, Unit::Cm, Unit::Px))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +30,7 @@ void VPTileFactory::refreshTileInfos()
|
||||||
|
|
||||||
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
{
|
{
|
||||||
m_drawingAreaHeight -= tilesMargins.top() + tilesMargins.bottom() + m_infoStripeWidth;
|
m_drawingAreaHeight -= tilesMargins.top() + tilesMargins.bottom();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_drawingAreaHeight += m_infoStripeWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets the drawing width
|
// sets the drawing width
|
||||||
|
@ -43,11 +38,7 @@ void VPTileFactory::refreshTileInfos()
|
||||||
|
|
||||||
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
if (not layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
{
|
{
|
||||||
m_drawingAreaWidth -= tilesMargins.left() + tilesMargins.right() + m_infoStripeWidth;
|
m_drawingAreaWidth -= tilesMargins.left() + tilesMargins.right();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_drawingAreaWidth += m_infoStripeWidth;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +60,12 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMarginsF sheetMargins;
|
||||||
|
if (not sheet->IgnoreMargins())
|
||||||
|
{
|
||||||
|
sheetMargins = sheet->GetSheetMargins();
|
||||||
|
}
|
||||||
|
|
||||||
const int nbCol = ColNb(sheet);
|
const int nbCol = ColNb(sheet);
|
||||||
const int nbRow = RowNb(sheet);
|
const int nbRow = RowNb(sheet);
|
||||||
|
|
||||||
|
@ -88,17 +85,15 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// paint the content of the page
|
// paint the content of the page
|
||||||
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
||||||
qreal yScale = layout->LayoutSettings().VerticalScale();
|
qreal yScale = layout->LayoutSettings().VerticalScale();
|
||||||
QRectF source = QRectF(col*m_drawingAreaWidth / xScale,
|
QRectF source = QRectF(sheetMargins.left() + col*(m_drawingAreaWidth - tileStripeWidth) / xScale,
|
||||||
row*m_drawingAreaHeight / yScale,
|
sheetMargins.top() + row*(m_drawingAreaHeight - tileStripeWidth) / yScale,
|
||||||
m_drawingAreaWidth / xScale + m_infoStripeWidth,
|
m_drawingAreaWidth / xScale,
|
||||||
m_drawingAreaHeight / yScale + m_infoStripeWidth
|
m_drawingAreaHeight / yScale);
|
||||||
);
|
|
||||||
|
|
||||||
QRectF target = QRectF(col*m_drawingAreaWidth,
|
QRectF target = QRectF(0,
|
||||||
row*m_drawingAreaHeight,
|
0,
|
||||||
m_drawingAreaWidth + m_infoStripeWidth,
|
m_drawingAreaWidth,
|
||||||
m_drawingAreaHeight + m_infoStripeWidth
|
m_drawingAreaHeight);
|
||||||
);
|
|
||||||
sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source,
|
sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source,
|
||||||
Qt::IgnoreAspectRatio);
|
Qt::IgnoreAspectRatio);
|
||||||
|
|
||||||
|
@ -126,34 +121,35 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// add top triangle
|
// add top triangle
|
||||||
QPainterPath triangleTop =
|
QPainterPath triangleTop =
|
||||||
QTransform()
|
QTransform()
|
||||||
.translate(tilesMargins.left()+m_drawingAreaWidth/2, tilesMargins.top())
|
.translate(m_drawingAreaWidth/2, 0)
|
||||||
.map(triangleBasic);
|
.map(triangleBasic);
|
||||||
painter->fillPath(triangleTop, triangleBush);
|
painter->fillPath(triangleTop, triangleBush);
|
||||||
|
|
||||||
// scissors along the top line
|
// scissors along the top line
|
||||||
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_horizontal.svg"));
|
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_horizontal.svg"));
|
||||||
svgRenderer->render(painter, QRectF(tilesMargins.left() + m_drawingAreaWidth,
|
svgRenderer->render(painter, QRectF(m_drawingAreaWidth - tileStripeWidth, 0,
|
||||||
tilesMargins.top(),
|
UnitConvertor(0.95, Unit::Cm, Unit::Px),
|
||||||
UnitConvertor(1, Unit::Cm, Unit::Px),
|
|
||||||
UnitConvertor(0.56, Unit::Cm, Unit::Px)));
|
UnitConvertor(0.56, Unit::Cm, Unit::Px)));
|
||||||
|
|
||||||
// dashed top line (for cutting)
|
// dashed top line (for cutting)
|
||||||
penTileInfos.setStyle(Qt::DashLine);
|
penTileInfos.setStyle(Qt::DashLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
painter->drawLine(QPointF(), QPointF(m_drawingAreaWidth, 0));
|
||||||
tilesMargins.top()),
|
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth + m_infoStripeWidth,
|
|
||||||
tilesMargins.top()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// solid top line stopping at the edge
|
// solid top line stopping at the edge
|
||||||
penTileInfos.setStyle(Qt::SolidLine);
|
penTileInfos.setStyle(Qt::SolidLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
|
||||||
tilesMargins.top()),
|
if(col < nbCol - 1)
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth + ((col < nbCol-1)? m_infoStripeWidth : 0),
|
{
|
||||||
tilesMargins.top()));
|
painter->drawLine(QPointF(), QPointF(m_drawingAreaWidth, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter->drawLine(QPointF(), QPointF(m_drawingAreaWidth - tileStripeWidth, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(col > 0)
|
if(col > 0)
|
||||||
|
@ -161,38 +157,36 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// add left triangle
|
// add left triangle
|
||||||
QPainterPath triangleLeft =
|
QPainterPath triangleLeft =
|
||||||
QTransform()
|
QTransform()
|
||||||
.translate(tilesMargins.left(), tilesMargins.top()+ m_drawingAreaHeight/2)
|
.translate(0, m_drawingAreaHeight/2)
|
||||||
.rotate(-90)
|
.rotate(-90)
|
||||||
.map(triangleBasic);
|
.map(triangleBasic);
|
||||||
painter->fillPath(triangleLeft, triangleBush);
|
painter->fillPath(triangleLeft, triangleBush);
|
||||||
|
|
||||||
// scissors along the left line
|
// scissors along the left line
|
||||||
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_vertical.svg"));
|
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_vertical.svg"));
|
||||||
svgRenderer->render(painter, QRectF(tilesMargins.left(),
|
svgRenderer->render(painter, QRectF(0, m_drawingAreaHeight - tileStripeWidth,
|
||||||
tilesMargins.top()+m_drawingAreaHeight,
|
|
||||||
UnitConvertor(0.56, Unit::Cm, Unit::Px),
|
UnitConvertor(0.56, Unit::Cm, Unit::Px),
|
||||||
UnitConvertor(1, Unit::Cm, Unit::Px)
|
UnitConvertor(0.95, Unit::Cm, Unit::Px)));
|
||||||
));
|
|
||||||
|
|
||||||
// dashed left line (for cutting)
|
// dashed left line (for cutting)
|
||||||
penTileInfos.setStyle(Qt::DashLine);
|
penTileInfos.setStyle(Qt::DashLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
painter->drawLine(QPointF(), QPointF(0, m_drawingAreaHeight));
|
||||||
tilesMargins.top()),
|
|
||||||
QPointF(tilesMargins.left(),
|
|
||||||
tilesMargins.top() + m_drawingAreaHeight + m_infoStripeWidth)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// solid left line at the edge
|
// solid left line at the edge
|
||||||
penTileInfos.setStyle(Qt::SolidLine);
|
penTileInfos.setStyle(Qt::SolidLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
|
||||||
tilesMargins.top()),
|
if(row < nbRow - 1)
|
||||||
QPointF(tilesMargins.left(),
|
{
|
||||||
tilesMargins.top() + m_drawingAreaHeight + ((row < nbRow-1)? m_infoStripeWidth : 0))
|
painter->drawLine(QPointF(), QPointF(0, m_drawingAreaHeight));
|
||||||
);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter->drawLine(QPointF(), QPointF(0, m_drawingAreaHeight - tileStripeWidth));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(row < nbRow-1)
|
if(row < nbRow-1)
|
||||||
|
@ -200,7 +194,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// add bottom triangle
|
// add bottom triangle
|
||||||
QPainterPath triangleBottom =
|
QPainterPath triangleBottom =
|
||||||
QTransform()
|
QTransform()
|
||||||
.translate(tilesMargins.left()+ m_drawingAreaWidth/2, tilesMargins.top()+ m_drawingAreaHeight)
|
.translate(m_drawingAreaWidth/2, m_drawingAreaHeight - tileStripeWidth)
|
||||||
.rotate(180)
|
.rotate(180)
|
||||||
.map(triangleBasic);
|
.map(triangleBasic);
|
||||||
|
|
||||||
|
@ -209,22 +203,25 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// dotted bottom line (for glueing)
|
// dotted bottom line (for glueing)
|
||||||
penTileInfos.setStyle(Qt::DotLine);
|
penTileInfos.setStyle(Qt::DotLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
painter->drawLine(QPointF(0, m_drawingAreaHeight - tileStripeWidth),
|
||||||
tilesMargins.top() + m_drawingAreaHeight),
|
QPointF(m_drawingAreaWidth, m_drawingAreaHeight - tileStripeWidth));
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth + m_infoStripeWidth,
|
|
||||||
tilesMargins.top() + m_drawingAreaHeight)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// solid bottom line at the edge
|
// solid bottom line at the edge
|
||||||
penTileInfos.setStyle(Qt::SolidLine);
|
penTileInfos.setStyle(Qt::SolidLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left(),
|
|
||||||
tilesMargins.top() + m_drawingAreaHeight),
|
if(col < nbCol - 1)
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth + ((col < nbCol-1)? m_infoStripeWidth : 0),
|
{
|
||||||
tilesMargins.top() + m_drawingAreaHeight)
|
painter->drawLine(QPointF(0, m_drawingAreaHeight - tileStripeWidth),
|
||||||
);
|
QPointF(m_drawingAreaWidth, m_drawingAreaHeight - tileStripeWidth));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter->drawLine(QPointF(0, m_drawingAreaHeight - tileStripeWidth),
|
||||||
|
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth));;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(col < nbCol-1)
|
if(col < nbCol-1)
|
||||||
|
@ -232,7 +229,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// add right triangle
|
// add right triangle
|
||||||
QPainterPath triangleRight =
|
QPainterPath triangleRight =
|
||||||
QTransform()
|
QTransform()
|
||||||
.translate(tilesMargins.left()+ m_drawingAreaWidth, tilesMargins.top()+ m_drawingAreaHeight/2)
|
.translate(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight/2)
|
||||||
.rotate(90)
|
.rotate(90)
|
||||||
.map(triangleBasic);
|
.map(triangleBasic);
|
||||||
painter->fillPath(triangleRight, triangleBush);
|
painter->fillPath(triangleRight, triangleBush);
|
||||||
|
@ -240,30 +237,30 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
// dotted right line (for glueing)
|
// dotted right line (for glueing)
|
||||||
penTileInfos.setStyle(Qt::DotLine);
|
penTileInfos.setStyle(Qt::DotLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left() + m_drawingAreaWidth,
|
painter->drawLine(QPointF(m_drawingAreaWidth - tileStripeWidth, 0),
|
||||||
tilesMargins.top()),
|
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight));
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth,
|
|
||||||
tilesMargins.top()+ m_drawingAreaHeight + m_infoStripeWidth)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// solid right line at the edge
|
// solid right line at the edge
|
||||||
penTileInfos.setStyle(Qt::SolidLine);
|
penTileInfos.setStyle(Qt::SolidLine);
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->drawLine(QPointF(tilesMargins.left() + m_drawingAreaWidth,
|
|
||||||
tilesMargins.top()),
|
if(row < nbRow - 1)
|
||||||
QPointF(tilesMargins.left() + m_drawingAreaWidth,
|
{
|
||||||
tilesMargins.top()+ m_drawingAreaHeight + ((row < nbRow-1) ? m_infoStripeWidth : 0))
|
painter->drawLine(QPointF(m_drawingAreaWidth - tileStripeWidth, 0),
|
||||||
);
|
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
painter->drawLine(QPointF(m_drawingAreaWidth - tileStripeWidth, 0),
|
||||||
|
QPointF(m_drawingAreaWidth - tileStripeWidth, m_drawingAreaHeight - tileStripeWidth));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare the painting for the text information
|
// prepare the painting for the text information
|
||||||
QTextDocument td;
|
QTextDocument td;
|
||||||
td.setPageSize(QSizeF(
|
td.setPageSize(QSizeF(m_drawingAreaWidth - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaHeight));
|
||||||
m_drawingAreaWidth - UnitConvertor(2, Unit::Cm, Unit::Px),
|
|
||||||
m_drawingAreaHeight
|
|
||||||
));
|
|
||||||
|
|
||||||
// paint the grid information
|
// paint the grid information
|
||||||
const QString grid = tr("Grid ( %1 , %2 )").arg(row+1).arg(col+1);
|
const QString grid = tr("Grid ( %1 , %2 )").arg(row+1).arg(col+1);
|
||||||
|
@ -276,9 +273,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
.arg(grid));
|
.arg(grid));
|
||||||
painter->setPen(penTileInfos);
|
painter->setPen(penTileInfos);
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->translate(QPointF(tilesMargins.left()+ UnitConvertor(1, Unit::Cm, Unit::Px),
|
painter->translate(QPointF(UnitConvertor(1, Unit::Cm, Unit::Px), m_drawingAreaHeight - tileStripeWidth));
|
||||||
m_drawingAreaHeight + tilesMargins.top()
|
|
||||||
));
|
|
||||||
td.drawContents(painter);
|
td.drawContents(painter);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
|
@ -299,9 +294,8 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
||||||
.arg(page).arg(clippedSheetName));
|
.arg(page).arg(clippedSheetName));
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->rotate(-90);
|
painter->rotate(-90);
|
||||||
painter->translate(QPointF(-(m_drawingAreaHeight+tilesMargins.top()) + UnitConvertor(1, Unit::Cm, Unit::Px),
|
painter->translate(QPointF(-(m_drawingAreaHeight) + UnitConvertor(1, Unit::Cm, Unit::Px),
|
||||||
m_drawingAreaWidth + tilesMargins.left()
|
m_drawingAreaWidth - tileStripeWidth));
|
||||||
));
|
|
||||||
td.drawContents(painter);
|
td.drawContents(painter);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
@ -322,7 +316,7 @@ auto VPTileFactory::RowNb(const VPSheetPtr &sheet) const -> int
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize();
|
QSizeF sheetSize = sheet->GetSheetSize();
|
||||||
return qCeil(sheetSize.height() * yScale / m_drawingAreaHeight);
|
return qCeil(sheetSize.height() * yScale / (m_drawingAreaHeight - tileStripeWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -341,7 +335,7 @@ auto VPTileFactory::ColNb(const VPSheetPtr &sheet) const -> int
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize();
|
QSizeF sheetSize = sheet->GetSheetSize();
|
||||||
return qCeil(sheetSize.width() * xScale / m_drawingAreaWidth);
|
return qCeil(sheetSize.width() * xScale / (m_drawingAreaWidth - tileStripeWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -85,6 +85,11 @@ public:
|
||||||
*/
|
*/
|
||||||
auto DrawingAreaWidth() const -> qreal;
|
auto DrawingAreaWidth() const -> qreal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief tileStripeWidth the width of the info / glueing stripe in Px
|
||||||
|
*/
|
||||||
|
static constexpr qreal tileStripeWidth = UnitConvertor(1, Unit::Cm, Unit::Px);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPTileFactory)
|
Q_DISABLE_COPY(VPTileFactory)
|
||||||
|
|
||||||
|
@ -101,11 +106,6 @@ private:
|
||||||
*/
|
*/
|
||||||
qreal m_drawingAreaWidth{0};
|
qreal m_drawingAreaWidth{0};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief m_infoStripeWidth the width of the info / glueing stripe in Px
|
|
||||||
*/
|
|
||||||
qreal m_infoStripeWidth;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPTILEFACTORY_H
|
#endif // VPTILEFACTORY_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user