VLayoutExporter, add support for the RLD format.
This commit is contained in:
parent
a58a783aba
commit
547b6bcdb3
|
@ -66,6 +66,7 @@
|
|||
#include "../vformat/vpatternrecipe.h"
|
||||
#include "watermarkwindow.h"
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#include "../vlayout/vlayoutexporter.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
|
@ -3346,7 +3347,11 @@ void MainWindow::on_actionCreateManualLayout_triggered()
|
|||
return;
|
||||
}
|
||||
|
||||
RLDFile(rldFile.fileName(), listDetails);
|
||||
VLayoutExporter exporter;
|
||||
exporter.SetFileName(rldFile.fileName());
|
||||
// exporter.SetXScale(m_dialogSaveLayout->GetXScale());
|
||||
// exporter.SetYScale(m_dialogSaveLayout->GetYScale());
|
||||
exporter.ExportToRLD(listDetails);
|
||||
|
||||
QStringList arguments {"-r", rldFile.fileName()};
|
||||
if (isNoScaling)
|
||||
|
@ -3424,7 +3429,11 @@ void MainWindow::on_actionUpdateManualLayout_triggered()
|
|||
return;
|
||||
}
|
||||
|
||||
RLDFile(rldFile.fileName(), listDetails);
|
||||
VLayoutExporter exporter;
|
||||
exporter.SetFileName(rldFile.fileName());
|
||||
// exporter.SetXScale(m_dialogSaveLayout->GetXScale());
|
||||
// exporter.SetYScale(m_dialogSaveLayout->GetYScale());
|
||||
exporter.ExportToRLD(listDetails);
|
||||
|
||||
QStringList arguments {filePath, "-r", rldFile.fileName()};
|
||||
if (isNoScaling)
|
||||
|
|
|
@ -753,7 +753,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details,
|
|||
exporter.ExportToAAMADXF(details);
|
||||
break;
|
||||
case LayoutExportFormats::RLD:
|
||||
RLDFile(name, details, m_dialogSaveLayout->GetXScale(), m_dialogSaveLayout->GetYScale());
|
||||
exporter.ExportToRLD(details);
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Can't recognize file type." << Q_FUNC_INFO;
|
||||
|
@ -1096,25 +1096,6 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
|||
m_layoutSettings->PdfTiledFile(name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindowsNoGUI::RLDFile(const QString &name, QVector<VLayoutPiece> details, qreal xScale, qreal yScale) const
|
||||
{
|
||||
for(auto detail : details)
|
||||
{
|
||||
detail.Scale(xScale, yScale);
|
||||
}
|
||||
|
||||
VRawLayoutData layoutDate;
|
||||
layoutDate.pieces = details;
|
||||
|
||||
VRawLayout generator;
|
||||
if (not generator.WriteFile(name, layoutDate))
|
||||
{
|
||||
const QString errorMsg = tr("Export raw layout data failed. %1.").arg(generator.ErrorString());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qCritical() << errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||
const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||
|
|
|
@ -142,7 +142,6 @@ protected:
|
|||
|
||||
void CheckRequiredMeasurements(const VMeasurements *m) const;
|
||||
|
||||
void RLDFile(const QString &name, QVector<VLayoutPiece> details, qreal xScale=1, qreal yScale=1) const;
|
||||
private:
|
||||
Q_DISABLE_COPY(MainWindowsNoGUI)
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "../vobj/vobjpaintdevice.h"
|
||||
#include "../vdxf/vdxfpaintdevice.h"
|
||||
#include "vrawlayout.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../ifc/exception/vexception.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -304,6 +307,25 @@ void VLayoutExporter::ExportToASTMDXF(const QVector<VLayoutPiece> &details) cons
|
|||
generator.ExportToASTM(details);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutExporter::ExportToRLD(const QVector<VLayoutPiece> &details) const
|
||||
{
|
||||
for(auto detail : details)
|
||||
{
|
||||
detail.Scale(m_xScale, m_yScale);
|
||||
}
|
||||
|
||||
VRawLayoutData layoutData;
|
||||
layoutData.pieces = details;
|
||||
|
||||
VRawLayout generator;
|
||||
if (not generator.WriteFile(m_fileName, layoutData))
|
||||
{
|
||||
const QString errorMsg = tr("Export raw layout data failed. %1.").arg(generator.ErrorString());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qCritical() << errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VLayoutExporter::SupportPDFConversion() -> bool
|
||||
{
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
void ExportToFlatDXF(QGraphicsScene *scene, const QList<QList<QGraphicsItem *> > &details) const;
|
||||
void ExportToAAMADXF(const QVector<VLayoutPiece> &details) const;
|
||||
void ExportToASTMDXF(const QVector<VLayoutPiece> &details) const;
|
||||
void ExportToRLD(const QVector<VLayoutPiece> &details) const;
|
||||
|
||||
static auto SupportPDFConversion() -> bool;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user