Added page Tiles Scheme.
This commit is contained in:
parent
a3e5948167
commit
3a76f4a2d8
|
@ -205,16 +205,6 @@ void DialogSaveManualLayout::SetBinaryDXFFormat(bool binary)
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||||
ui->checkBoxBinaryDXF->setChecked(binary);
|
ui->checkBoxBinaryDXF->setChecked(binary);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::SVG:
|
|
||||||
case LayoutExportFormats::PDF:
|
|
||||||
case LayoutExportFormats::PDFTiled:
|
|
||||||
case LayoutExportFormats::PNG:
|
|
||||||
case LayoutExportFormats::OBJ:
|
|
||||||
case LayoutExportFormats::PS:
|
|
||||||
case LayoutExportFormats::EPS:
|
|
||||||
case LayoutExportFormats::NC:
|
|
||||||
case LayoutExportFormats::RLD:
|
|
||||||
case LayoutExportFormats::TIF:
|
|
||||||
default:
|
default:
|
||||||
ui->checkBoxBinaryDXF->setChecked(false);
|
ui->checkBoxBinaryDXF->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
@ -254,16 +244,6 @@ auto DialogSaveManualLayout::IsBinaryDXFFormat() const -> bool
|
||||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||||
return ui->checkBoxBinaryDXF->isChecked();
|
return ui->checkBoxBinaryDXF->isChecked();
|
||||||
case LayoutExportFormats::SVG:
|
|
||||||
case LayoutExportFormats::PDF:
|
|
||||||
case LayoutExportFormats::PDFTiled:
|
|
||||||
case LayoutExportFormats::PNG:
|
|
||||||
case LayoutExportFormats::OBJ:
|
|
||||||
case LayoutExportFormats::PS:
|
|
||||||
case LayoutExportFormats::EPS:
|
|
||||||
case LayoutExportFormats::NC:
|
|
||||||
case LayoutExportFormats::RLD:
|
|
||||||
case LayoutExportFormats::TIF:
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -318,44 +298,10 @@ void DialogSaveManualLayout::SetExportUnified(bool value)
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
ui->checkBoxExportUnified->setChecked(value);
|
ui->checkBoxExportUnified->setChecked(value);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
|
||||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
|
||||||
case LayoutExportFormats::SVG:
|
|
||||||
case LayoutExportFormats::PNG:
|
|
||||||
case LayoutExportFormats::OBJ:
|
|
||||||
case LayoutExportFormats::NC:
|
|
||||||
case LayoutExportFormats::RLD:
|
|
||||||
case LayoutExportFormats::TIF:
|
|
||||||
default:
|
default:
|
||||||
ui->checkBoxExportUnified->setChecked(false);
|
ui->checkBoxExportUnified->setChecked(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -368,39 +314,32 @@ auto DialogSaveManualLayout::IsExportUnified() const -> bool
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
return ui->checkBoxExportUnified->isChecked();
|
return ui->checkBoxExportUnified->isChecked();
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
default:
|
||||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
return false;
|
||||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
}
|
||||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
}
|
||||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
|
||||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
void DialogSaveManualLayout::SetTilesScheme(bool value)
|
||||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
{
|
||||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
switch(Format())
|
||||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
{
|
||||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
case LayoutExportFormats::PDFTiled:
|
||||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
ui->checkBoxTilesScheme->setChecked(value);
|
||||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
default:
|
||||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
ui->checkBoxTilesScheme->setChecked(false);
|
||||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
}
|
||||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
}
|
||||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
|
||||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
bool DialogSaveManualLayout::IsTilesScheme() const
|
||||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
{
|
||||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
switch(Format())
|
||||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
{
|
||||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
case LayoutExportFormats::PDFTiled:
|
||||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
return ui->checkBoxTilesScheme->isChecked();
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
|
||||||
case LayoutExportFormats::SVG:
|
|
||||||
case LayoutExportFormats::PNG:
|
|
||||||
case LayoutExportFormats::OBJ:
|
|
||||||
case LayoutExportFormats::NC:
|
|
||||||
case LayoutExportFormats::RLD:
|
|
||||||
case LayoutExportFormats::TIF:
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -503,6 +442,7 @@ void DialogSaveManualLayout::ShowExample()
|
||||||
ui->checkBoxBinaryDXF->setEnabled(false);
|
ui->checkBoxBinaryDXF->setEnabled(false);
|
||||||
ui->checkBoxTextAsPaths->setEnabled(true);
|
ui->checkBoxTextAsPaths->setEnabled(true);
|
||||||
ui->checkBoxExportUnified->setEnabled(false);
|
ui->checkBoxExportUnified->setEnabled(false);
|
||||||
|
ui->checkBoxTilesScheme->setEnabled(false);
|
||||||
|
|
||||||
switch(currentFormat)
|
switch(currentFormat)
|
||||||
{
|
{
|
||||||
|
@ -539,6 +479,9 @@ void DialogSaveManualLayout::ShowExample()
|
||||||
ui->checkBoxTextAsPaths->setEnabled(false);
|
ui->checkBoxTextAsPaths->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PDFTiled:
|
case LayoutExportFormats::PDFTiled:
|
||||||
|
ui->checkBoxTilesScheme->setEnabled(true);
|
||||||
|
ui->checkBoxExportUnified->setEnabled(true);
|
||||||
|
break;
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
|
|
|
@ -62,6 +62,9 @@ public:
|
||||||
void SetExportUnified(bool value);
|
void SetExportUnified(bool value);
|
||||||
auto IsExportUnified() const -> bool;
|
auto IsExportUnified() const -> bool;
|
||||||
|
|
||||||
|
void SetTilesScheme(bool value);
|
||||||
|
auto IsTilesScheme() const -> bool;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event) override;
|
virtual void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxTilesScheme">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tiles scheme</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -155,7 +155,7 @@ void VPPiece::Update(const VPPiecePtr &piece)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPPiece::GetUniqueID() const
|
auto VPPiece::GetUniqueID() const -> QString
|
||||||
{
|
{
|
||||||
QString id = VLayoutPiece::GetUniqueID();
|
QString id = VLayoutPiece::GetUniqueID();
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,31 @@ void VPSheetSceneData::SetTextAsPaths(bool textAsPaths) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSheetSceneData::PrepareTilesScheme()
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
m_showTilesSchemeTmp = layout->LayoutSettings().GetShowTiles();
|
||||||
|
layout->LayoutSettings().SetShowTiles(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSheetSceneData::ClearTilesScheme()
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = m_layout.toStrongRef();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
layout->LayoutSettings().SetShowTiles(m_showTilesSchemeTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshLayout();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,6 +84,9 @@ public:
|
||||||
|
|
||||||
void SetTextAsPaths(bool textAsPaths) const;
|
void SetTextAsPaths(bool textAsPaths) const;
|
||||||
|
|
||||||
|
void PrepareTilesScheme();
|
||||||
|
void ClearTilesScheme();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPSheetSceneData)
|
Q_DISABLE_COPY(VPSheetSceneData)
|
||||||
|
|
||||||
|
@ -105,6 +108,8 @@ private:
|
||||||
*/
|
*/
|
||||||
bool m_showTilesTmp{false};
|
bool m_showTilesTmp{false};
|
||||||
|
|
||||||
|
bool m_showTilesSchemeTmp{false};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variable to hold temporarly hte value of the show grid
|
* variable to hold temporarly hte value of the show grid
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -156,6 +156,7 @@ struct VPExportData
|
||||||
bool isBinaryDXF{false};
|
bool isBinaryDXF{false};
|
||||||
bool textAsPaths{false};
|
bool textAsPaths{false};
|
||||||
bool exportUnified{true};
|
bool exportUnified{true};
|
||||||
|
bool showTilesScheme{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2440,27 +2441,6 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
|
||||||
printer.setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
|
printer.setCreator(QGuiApplication::applicationDisplayName() + QChar(QChar::Space) +
|
||||||
QCoreApplication::applicationVersion());
|
QCoreApplication::applicationVersion());
|
||||||
|
|
||||||
QPageLayout::Orientation tiledPDFOrientation = m_layout->LayoutSettings().GetTilesOrientation();
|
|
||||||
|
|
||||||
QSizeF tileSize = m_layout->LayoutSettings().GetTilesSize(Unit::Mm);
|
|
||||||
QSizeF pageSize = tiledPDFOrientation == QPageLayout::Portrait ? tileSize
|
|
||||||
: QSizeF(tileSize.height(), tileSize.width());
|
|
||||||
if (not printer.setPageSize(QPageSize(pageSize, QPageSize::Millimeter)))
|
|
||||||
{
|
|
||||||
qWarning() << tr("Cannot set printer page size");
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.setPageOrientation(tiledPDFOrientation);
|
|
||||||
printer.setFullPage(m_layout->LayoutSettings().IgnoreTilesMargins());
|
|
||||||
|
|
||||||
if (not m_layout->LayoutSettings().IgnoreTilesMargins())
|
|
||||||
{
|
|
||||||
if (not printer.setPageMargins(m_layout->LayoutSettings().GetTilesMargins(Unit::Mm), QPageLayout::Millimeter))
|
|
||||||
{
|
|
||||||
qWarning() << tr("Cannot set printer margins");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.setResolution(static_cast<int>(PrintDPI));
|
printer.setResolution(static_cast<int>(PrintDPI));
|
||||||
|
|
||||||
if (data.exportUnified)
|
if (data.exportUnified)
|
||||||
|
@ -2471,25 +2451,11 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
|
||||||
printer.setDocName(QFileInfo(name).baseName());
|
printer.setDocName(QFileInfo(name).baseName());
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
if (not painter.begin(&printer))
|
bool firstPage = true;
|
||||||
{ // failed to open file
|
|
||||||
qCritical() << tr("Failed to open file, is it writable?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
|
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush(QBrush(Qt::NoBrush));
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
|
||||||
|
|
||||||
bool firstSheet = true;
|
|
||||||
for (const auto& sheet : data.sheets)
|
for (const auto& sheet : data.sheets)
|
||||||
{
|
{
|
||||||
GeneratePdfTiledFile(sheet, &painter, &printer, firstSheet);
|
GeneratePdfTiledFile(sheet, data.showTilesScheme, &painter, &printer, firstPage);
|
||||||
firstSheet = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.end();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2502,27 +2468,15 @@ void VPMainWindow::ExportPdfTiledFile(const VPExportData &data)
|
||||||
printer.setDocName(QFileInfo(name).baseName());
|
printer.setDocName(QFileInfo(name).baseName());
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
if (not painter.begin(&printer))
|
bool firstPage = true;
|
||||||
{ // failed to open file
|
GeneratePdfTiledFile(data.sheets.at(i), data.showTilesScheme, &painter, &printer, firstPage);
|
||||||
qCritical() << tr("Failed to open file, is it writable?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
|
|
||||||
Qt::RoundCap, Qt::RoundJoin));
|
|
||||||
painter.setBrush(QBrush(Qt::NoBrush));
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
|
||||||
|
|
||||||
bool firstSheet = true;
|
|
||||||
GeneratePdfTiledFile(data.sheets.at(i), &painter, &printer, firstSheet);
|
|
||||||
|
|
||||||
painter.end();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, QPainter *painter, QPrinter *printer, bool firstSheet)
|
void VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter,
|
||||||
|
QPrinter *printer, bool &firstPage)
|
||||||
{
|
{
|
||||||
SCASSERT(not sheet.isNull())
|
SCASSERT(not sheet.isNull())
|
||||||
SCASSERT(painter != nullptr)
|
SCASSERT(painter != nullptr)
|
||||||
|
@ -2532,12 +2486,143 @@ void VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, QPainter *paint
|
||||||
m_layout->TileFactory()->refreshTileInfos();
|
m_layout->TileFactory()->refreshTileInfos();
|
||||||
sheet->SceneData()->SetTextAsPaths(false);
|
sheet->SceneData()->SetTextAsPaths(false);
|
||||||
|
|
||||||
|
auto SetPageSettings = [this, &printer, sheet](QPageLayout::Orientation orientation, bool forSheet)
|
||||||
|
{
|
||||||
|
QSizeF tileSize = m_layout->LayoutSettings().GetTilesSize(Unit::Mm);
|
||||||
|
QSizeF pageSize;
|
||||||
|
|
||||||
|
if (not forSheet)
|
||||||
|
{
|
||||||
|
pageSize = orientation == QPageLayout::Portrait ? tileSize : tileSize.transposed();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QPageLayout::Orientation tileOrientation = m_layout->LayoutSettings().GetTilesOrientation();
|
||||||
|
QPageLayout::Orientation sheetOrientation = sheet->GetSheetOrientation();
|
||||||
|
|
||||||
|
if (tileOrientation != sheetOrientation)
|
||||||
|
{
|
||||||
|
pageSize = orientation == QPageLayout::Portrait ? tileSize.transposed() : tileSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pageSize = orientation == QPageLayout::Portrait ? tileSize : tileSize.transposed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not printer->setPageSize(QPageSize(pageSize, QPageSize::Millimeter)))
|
||||||
|
{
|
||||||
|
qWarning() << tr("Cannot set printer page size");
|
||||||
|
}
|
||||||
|
|
||||||
|
printer->setPageOrientation(orientation);
|
||||||
|
printer->setFullPage(m_layout->LayoutSettings().IgnoreTilesMargins());
|
||||||
|
|
||||||
|
if (not m_layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
|
{
|
||||||
|
if (not printer->setPageMargins(m_layout->LayoutSettings().GetTilesMargins(Unit::Mm),
|
||||||
|
QPageLayout::Millimeter))
|
||||||
|
{
|
||||||
|
qWarning() << tr("Cannot set printer margins");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (showTilesScheme)
|
||||||
|
{
|
||||||
|
SetPageSettings(sheet->GetSheetOrientation(), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetPageSettings(m_layout->LayoutSettings().GetTilesOrientation(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstPage)
|
||||||
|
{
|
||||||
|
if (not painter->begin(printer))
|
||||||
|
{ // failed to open file
|
||||||
|
qCritical() << tr("Failed to open file, is it writable?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
|
||||||
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
|
painter->setBrush(QBrush(Qt::NoBrush));
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showTilesScheme)
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = sheet->GetLayout();
|
||||||
|
if(layout.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(not firstPage)
|
||||||
|
{
|
||||||
|
SetPageSettings(sheet->GetSheetOrientation(), true);
|
||||||
|
|
||||||
|
if (not printer->newPage())
|
||||||
|
{
|
||||||
|
qWarning("failed in flushing page to disk, disk full?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sheet->SceneData()->PrepareTilesScheme();
|
||||||
|
|
||||||
|
qreal xScale = layout->LayoutSettings().HorizontalScale();
|
||||||
|
qreal yScale = layout->LayoutSettings().VerticalScale();
|
||||||
|
|
||||||
|
qreal width = m_layout->TileFactory()->DrawingAreaWidth();
|
||||||
|
qreal height = m_layout->TileFactory()->DrawingAreaHeight();
|
||||||
|
|
||||||
|
QPageLayout::Orientation tileOrientation = m_layout->LayoutSettings().GetTilesOrientation();
|
||||||
|
QPageLayout::Orientation sheetOrientation = sheet->GetSheetOrientation();
|
||||||
|
|
||||||
|
QRectF sheetRect = sheet->GetMarginsRect();
|
||||||
|
|
||||||
|
const int nbCol = m_layout->TileFactory()->ColNb(sheet);
|
||||||
|
const int nbRow = m_layout->TileFactory()->RowNb(sheet);
|
||||||
|
|
||||||
|
QRectF source = QRectF(sheetRect.topLeft(), QSizeF(nbCol * ((width - VPTileFactory::tileStripeWidth) / xScale),
|
||||||
|
nbRow * ((height - VPTileFactory::tileStripeWidth) / yScale)));
|
||||||
|
QRectF target;
|
||||||
|
|
||||||
|
if (tileOrientation != sheetOrientation)
|
||||||
|
{
|
||||||
|
QMarginsF margins;
|
||||||
|
if (not m_layout->LayoutSettings().IgnoreTilesMargins())
|
||||||
|
{
|
||||||
|
margins = m_layout->LayoutSettings().GetTilesMargins();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSizeF tilesSize = layout->LayoutSettings().GetTilesSize();
|
||||||
|
target = QRectF(0, 0,
|
||||||
|
tilesSize.height() - margins.left() - margins.right(),
|
||||||
|
tilesSize.width() - margins.top() - margins.bottom());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = QRectF(0, 0, width, height);
|
||||||
|
}
|
||||||
|
sheet->SceneData()->Scene()->render(painter, VPrintLayout::SceneTargetRect(printer, target), source,
|
||||||
|
Qt::KeepAspectRatio);
|
||||||
|
|
||||||
|
sheet->SceneData()->ClearTilesScheme();
|
||||||
|
|
||||||
|
firstPage = false;
|
||||||
|
}
|
||||||
|
|
||||||
for(int row=0; row < m_layout->TileFactory()->RowNb(sheet); row++) // for each row of the tiling grid
|
for(int row=0; row < m_layout->TileFactory()->RowNb(sheet); row++) // for each row of the tiling grid
|
||||||
{
|
{
|
||||||
for(int col=0; col < m_layout->TileFactory()->ColNb(sheet); col++) // for each column of tiling grid
|
for(int col=0; col < m_layout->TileFactory()->ColNb(sheet); col++) // for each column of tiling grid
|
||||||
{
|
{
|
||||||
if(not (row == 0 && col == 0) || not firstSheet)
|
if(not firstPage)
|
||||||
{
|
{
|
||||||
|
SetPageSettings(m_layout->LayoutSettings().GetTilesOrientation(), false);
|
||||||
|
|
||||||
if (not printer->newPage())
|
if (not printer->newPage())
|
||||||
{
|
{
|
||||||
qWarning("failed in flushing page to disk, disk full?");
|
qWarning("failed in flushing page to disk, disk full?");
|
||||||
|
@ -2546,6 +2631,8 @@ void VPMainWindow::GeneratePdfTiledFile(const VPSheetPtr &sheet, QPainter *paint
|
||||||
}
|
}
|
||||||
|
|
||||||
m_layout->TileFactory()->drawTile(painter, printer, sheet, row, col);
|
m_layout->TileFactory()->drawTile(painter, printer, sheet, row, col);
|
||||||
|
|
||||||
|
firstPage = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3480,6 +3567,7 @@ void VPMainWindow::on_ExportLayout()
|
||||||
data.isBinaryDXF = dialog.IsBinaryDXFFormat();
|
data.isBinaryDXF = dialog.IsBinaryDXFFormat();
|
||||||
data.textAsPaths = dialog.IsTextAsPaths();
|
data.textAsPaths = dialog.IsTextAsPaths();
|
||||||
data.exportUnified = dialog.IsExportUnified();
|
data.exportUnified = dialog.IsExportUnified();
|
||||||
|
data.showTilesScheme = dialog.IsTilesScheme();
|
||||||
|
|
||||||
ExportData(data);
|
ExportData(data);
|
||||||
}
|
}
|
||||||
|
@ -3574,6 +3662,7 @@ void VPMainWindow::on_ExportSheet()
|
||||||
data.isBinaryDXF = dialog.IsBinaryDXFFormat();
|
data.isBinaryDXF = dialog.IsBinaryDXFFormat();
|
||||||
data.textAsPaths = dialog.IsTextAsPaths();
|
data.textAsPaths = dialog.IsTextAsPaths();
|
||||||
data.exportUnified = dialog.IsExportUnified();
|
data.exportUnified = dialog.IsExportUnified();
|
||||||
|
data.showTilesScheme = dialog.IsTilesScheme();
|
||||||
|
|
||||||
ExportData(data);
|
ExportData(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,8 @@ private:
|
||||||
void ExportUnifiedPdfFile(const VPExportData &data);
|
void ExportUnifiedPdfFile(const VPExportData &data);
|
||||||
void GenerateUnifiedPdfFile(const VPExportData &data, const QString &name);
|
void GenerateUnifiedPdfFile(const VPExportData &data, const QString &name);
|
||||||
void ExportPdfTiledFile(const VPExportData &data);
|
void ExportPdfTiledFile(const VPExportData &data);
|
||||||
void GeneratePdfTiledFile(const VPSheetPtr &sheet, QPainter *painter, QPrinter *printer, bool firstSheet);
|
void GeneratePdfTiledFile(const VPSheetPtr &sheet, bool showTilesScheme, QPainter *painter, QPrinter *printer,
|
||||||
|
bool &firstPage);
|
||||||
|
|
||||||
void UpdateScaleConnection() const;
|
void UpdateScaleConnection() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -322,7 +322,7 @@ auto VPTileFactory::RowNb(const VPSheetPtr &sheet) const -> int
|
||||||
yScale = layout->LayoutSettings().VerticalScale();
|
yScale = layout->LayoutSettings().VerticalScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize();
|
QRectF sheetSize = sheet->GetMarginsRect();
|
||||||
return qCeil(sheetSize.height() * yScale / (m_drawingAreaHeight - tileStripeWidth));
|
return qCeil(sheetSize.height() * yScale / (m_drawingAreaHeight - tileStripeWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ auto VPTileFactory::ColNb(const VPSheetPtr &sheet) const -> int
|
||||||
xScale = layout->LayoutSettings().HorizontalScale();
|
xScale = layout->LayoutSettings().HorizontalScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF sheetSize = sheet->GetSheetSize();
|
QRectF sheetSize = sheet->GetMarginsRect();
|
||||||
return qCeil(sheetSize.width() * xScale / (m_drawingAreaWidth - tileStripeWidth));
|
return qCeil(sheetSize.width() * xScale / (m_drawingAreaWidth - tileStripeWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user