Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-10-07 16:04:07 +03:00
parent 2eaecc747c
commit 576e3bbbf2
5 changed files with 457 additions and 422 deletions

File diff suppressed because it is too large Load Diff

View File

@ -55,70 +55,74 @@ class VDxfEngine final : public QPaintEngine
friend class VDxfPaintDevice; friend class VDxfPaintDevice;
public: public:
VDxfEngine(); VDxfEngine();
virtual ~VDxfEngine(); ~VDxfEngine() override;
virtual bool begin(QPaintDevice *pdev) override; auto type() const -> Type override;
virtual bool end() override;
virtual void updateState(const QPaintEngineState &state) override;
virtual void drawPath(const QPainterPath &path) override;
virtual void drawLines(const QLineF * lines, int lineCount) override;
virtual void drawLines(const QLine * lines, int lineCount) override;
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
virtual void drawEllipse(const QRectF & rect) override;
virtual void drawEllipse(const QRect & rect) override;
virtual void drawTextItem(const QPointF & p, const QTextItem & textItem) override;
virtual Type type() const override;
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
QSize getSize() const; auto begin(QPaintDevice *pdev) -> bool override;
void setSize(const QSize &value); auto end() -> bool override;
double getResolution() const; void updateState(const QPaintEngineState &state) override;
void setResolution(double value);
QString getFileName() const; void drawPath(const QPainterPath &path) override;
void setFileName(const QString &value); void drawLines(const QLineF * lines, int lineCount) override;
void drawLines(const QLine * lines, int lineCount) override;
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
void drawEllipse(const QRectF & rect) override;
void drawEllipse(const QRect & rect) override;
void drawTextItem(const QPointF & p, const QTextItem & textItem) override;
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
DRW::Version GetVersion() const; auto GetSize() const -> QSize;
void SetVersion(DRW::Version version); void SetSize(const QSize &value);
auto GetResolution() const -> double;
void SetResolution(double value);
auto GetFileName() const -> QString;
void SetFileName(const QString &value);
auto GetVersion() const -> DRW::Version;
void SetVersion(DRW::Version version);
void SetBinaryFormat(bool binary); void SetBinaryFormat(bool binary);
bool IsBinaryFormat() const; auto IsBinaryFormat() const -> bool;
std::string getPenStyle(); auto GetPenStyle() -> std::string;
int getPenColor(); auto GetPenColor() -> int;
void setMeasurement(const VarMeasurement &var); void SetMeasurement(const VarMeasurement &var);
void setInsunits(const VarInsunits &var); void SetInsunits(const VarInsunits &var);
qreal GetXScale() const; auto GetXScale() const -> qreal;
void SetXScale(const qreal &xscale); void SetXScale(const qreal &xscale);
qreal GetYScale() const; auto GetYScale() const -> qreal;
void SetYScale(const qreal &yscale); void SetYScale(const qreal &yscale);
QString ErrorString() const; auto ErrorString() const -> QString;
private: private:
Q_DISABLE_COPY_MOVE(VDxfEngine) // NOLINT Q_DISABLE_COPY_MOVE(VDxfEngine) // NOLINT
QSize size;
double resolution; QSize m_size{};
QString fileName; double m_resolution{static_cast<int>(PrintDPI)};
DRW::Version m_version; QString m_fileName{};
bool m_binary; DRW::Version m_version{DRW::AC1014};
QTransform matrix; bool m_binary{false};
QSharedPointer<dx_iface> input; QTransform m_matrix{};
VarMeasurement varMeasurement; QSharedPointer<dx_iface> m_input{};
VarInsunits varInsunits; VarMeasurement m_varMeasurement{VarMeasurement::Metric};
DRW_Text *textBuffer; VarInsunits m_varInsunits{VarInsunits::Millimeters};
DRW_Text *m_textBuffer{nullptr};
qreal m_xscale{1}; qreal m_xscale{1};
qreal m_yscale{1}; qreal m_yscale{1};
Q_REQUIRED_RESULT double FromPixel(double pix, const VarInsunits &unit) const; Q_REQUIRED_RESULT auto FromPixel(double pix, const VarInsunits &unit) const -> double;
Q_REQUIRED_RESULT double ToPixel(double val, const VarInsunits &unit) const; Q_REQUIRED_RESULT auto ToPixel(double val, const VarInsunits &unit) const -> double;
bool ExportToAAMA(const QVector<VLayoutPiece> &details); auto ExportToAAMA(const QVector<VLayoutPiece> &details) -> bool;
void ExportAAMAOutline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportAAMAOutline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
@ -128,7 +132,7 @@ private:
void ExportStyleSystemText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details); void ExportStyleSystemText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details);
void ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
bool ExportToASTM(const QVector<VLayoutPiece> &details); auto ExportToASTM(const QVector<VLayoutPiece> &details) -> bool;
void ExportASTMPieceBoundary(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportASTMPieceBoundary(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMSewLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportASTMSewLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMInternalLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportASTMInternalLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
@ -137,15 +141,17 @@ private:
void ExportASTMDrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportASTMDrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMNotch(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail); void ExportASTMNotch(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
Q_REQUIRED_RESULT DRW_Entity *AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed); Q_REQUIRED_RESULT auto AAMAPolygon(const QVector<QPointF> &polygon, const UTF8STRING &layer,
Q_REQUIRED_RESULT DRW_Entity *AAMALine(const QLineF &line, const QString &layer); bool forceClosed) -> DRW_Entity *;
Q_REQUIRED_RESULT DRW_Entity *AAMAText(const QPointF &pos, const QString &text, const QString &layer); Q_REQUIRED_RESULT auto AAMALine(const QLineF &line, const UTF8STRING &layer) -> DRW_Entity *;
Q_REQUIRED_RESULT auto AAMAText(const QPointF &pos, const QString &text, const UTF8STRING &layer) -> DRW_Entity *;
template<class P, class V> template<class P, class V>
Q_REQUIRED_RESULT P *CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed); Q_REQUIRED_RESULT auto CreateAAMAPolygon(const QVector<QPointF> &polygon, const UTF8STRING &layer,
bool forceClosed) -> P *;
static std::string FromUnicodeToCodec(const QString &str, QTextCodec *codec); static auto FromUnicodeToCodec(const QString &str, QTextCodec *codec) -> std::string;
std::string getFileNameForLocale() const; auto GetFileNameForLocale() const -> std::string;
}; };
#endif // VDXFENGINE_H #endif // VDXFENGINE_H

View File

@ -35,213 +35,212 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VDxfPaintDevice::VDxfPaintDevice() VDxfPaintDevice::VDxfPaintDevice()
:QPaintDevice(), engine(new VDxfEngine()), fileName() :m_engine(new VDxfEngine())
{ {}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VDxfPaintDevice::~VDxfPaintDevice() VDxfPaintDevice::~VDxfPaintDevice()
{ {
delete engine; delete m_engine;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QPaintEngine *VDxfPaintDevice::paintEngine() const auto VDxfPaintDevice::paintEngine() const -> QPaintEngine *
{ {
return engine; return m_engine;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QString VDxfPaintDevice::getFileName() const auto VDxfPaintDevice::GetFileName() const -> QString
{ {
return fileName; return m_fileName;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setFileName(const QString &value) void VDxfPaintDevice::SetFileName(const QString &value)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::setFileName(), cannot set file name while Dxf is being generated"); qWarning("VDxfPaintDevice::setFileName(), cannot set file name while Dxf is being generated");
return; return;
} }
fileName = value; m_fileName = value;
engine->setFileName(fileName); m_engine->SetFileName(m_fileName);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QSize VDxfPaintDevice::getSize() auto VDxfPaintDevice::GetSize() -> QSize
{ {
return engine->getSize(); return m_engine->GetSize();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setSize(const QSize &size) void VDxfPaintDevice::SetSize(const QSize &size)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::setSize(), cannot set size while Dxf is being generated"); qWarning("VDxfPaintDevice::setSize(), cannot set size while Dxf is being generated");
return; return;
} }
engine->setSize(size); m_engine->SetSize(size);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
double VDxfPaintDevice::getResolution() const auto VDxfPaintDevice::GetResolution() const -> double
{ {
return engine->getResolution(); return m_engine->GetResolution();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setResolution(double dpi) void VDxfPaintDevice::SetResolution(double dpi)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::setResolution(), cannot set dpi while Dxf is being generated"); qWarning("VDxfPaintDevice::setResolution(), cannot set dpi while Dxf is being generated");
return; return;
} }
engine->setResolution(dpi); m_engine->SetResolution(dpi);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DRW::Version VDxfPaintDevice::GetVersion() const auto VDxfPaintDevice::GetVersion() const -> DRW::Version
{ {
return engine->GetVersion(); return m_engine->GetVersion();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::SetVersion(DRW::Version version) void VDxfPaintDevice::SetVersion(DRW::Version version)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::SetVersion(), cannot set version while Dxf is being generated"); qWarning("VDxfPaintDevice::SetVersion(), cannot set version while Dxf is being generated");
return; return;
} }
engine->SetVersion(version); m_engine->SetVersion(version);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::SetBinaryFormat(bool binary) void VDxfPaintDevice::SetBinaryFormat(bool binary)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::SetBinaryFormat(), cannot set binary format while Dxf is being generated"); qWarning("VDxfPaintDevice::SetBinaryFormat(), cannot set binary format while Dxf is being generated");
return; return;
} }
engine->SetBinaryFormat(binary); m_engine->SetBinaryFormat(binary);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VDxfPaintDevice::IsBinaryFromat() const auto VDxfPaintDevice::IsBinaryFromat() const -> bool
{ {
return engine->IsBinaryFormat(); return m_engine->IsBinaryFormat();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setMeasurement(const VarMeasurement &var) void VDxfPaintDevice::SetMeasurement(const VarMeasurement &var)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::setMeasurement(), cannot set measurements while Dxf is being generated"); qWarning("VDxfPaintDevice::setMeasurement(), cannot set measurements while Dxf is being generated");
return; return;
} }
engine->setMeasurement(var); m_engine->SetMeasurement(var);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setInsunits(const VarInsunits &var) void VDxfPaintDevice::SetInsunits(const VarInsunits &var)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::setInsunits(), cannot set units while Dxf is being generated"); qWarning("VDxfPaintDevice::setInsunits(), cannot set units while Dxf is being generated");
return; return;
} }
engine->setInsunits(var); m_engine->SetInsunits(var);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VDxfPaintDevice::GetXScale() const auto VDxfPaintDevice::GetXScale() const -> qreal
{ {
return engine->GetYScale(); return m_engine->GetYScale();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::SetXScale(const qreal &xscale) void VDxfPaintDevice::SetXScale(const qreal &xscale)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::SetXScale(), cannot set x scale while Dxf is being generated"); qWarning("VDxfPaintDevice::SetXScale(), cannot set x scale while Dxf is being generated");
return; return;
} }
engine->SetXScale(xscale); m_engine->SetXScale(xscale);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VDxfPaintDevice::GetYScale() const auto VDxfPaintDevice::GetYScale() const -> qreal
{ {
return engine->GetXScale(); return m_engine->GetXScale();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::SetYScale(const qreal &yscale) void VDxfPaintDevice::SetYScale(const qreal &yscale)
{ {
if (engine->isActive()) if (m_engine->isActive())
{ {
qWarning("VDxfPaintDevice::SetYScale(), cannot set y scale while Dxf is being generated"); qWarning("VDxfPaintDevice::SetYScale(), cannot set y scale while Dxf is being generated");
return; return;
} }
engine->SetYScale(yscale); m_engine->SetYScale(yscale);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VDxfPaintDevice::ExportToAAMA(const QVector<VLayoutPiece> &details) const auto VDxfPaintDevice::ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool
{ {
engine->setActive(true); m_engine->setActive(true);
const bool res = engine->ExportToAAMA(details); const bool res = m_engine->ExportToAAMA(details);
engine->setActive(false); m_engine->setActive(false);
return res; return res;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VDxfPaintDevice::ExportToASTM(const QVector<VLayoutPiece> &details) const auto VDxfPaintDevice::ExportToASTM(const QVector<VLayoutPiece> &details) const -> bool
{ {
engine->setActive(true); m_engine->setActive(true);
const bool res = engine->ExportToASTM(details); const bool res = m_engine->ExportToASTM(details);
engine->setActive(false); m_engine->setActive(false);
return res; return res;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VDxfPaintDevice::ErrorString() const auto VDxfPaintDevice::ErrorString() const -> QString
{ {
return engine->ErrorString(); return m_engine->ErrorString();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const auto VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const -> int
{ {
switch (metric) switch (metric)
{ {
case QPaintDevice::PdmDepth: case QPaintDevice::PdmDepth:
return 32; return 32;
case QPaintDevice::PdmWidth: case QPaintDevice::PdmWidth:
return engine->getSize().width(); return m_engine->GetSize().width();
case QPaintDevice::PdmHeight: case QPaintDevice::PdmHeight:
return engine->getSize().height(); return m_engine->GetSize().height();
case QPaintDevice::PdmHeightMM: case QPaintDevice::PdmHeightMM:
return qRound(engine->getSize().height() * 25.4 / engine->getResolution()); return qRound(m_engine->GetSize().height() * 25.4 / m_engine->GetResolution());
case QPaintDevice::PdmWidthMM: case QPaintDevice::PdmWidthMM:
return qRound(engine->getSize().width() * 25.4 / engine->getResolution()); return qRound(m_engine->GetSize().width() * 25.4 / m_engine->GetResolution());
case QPaintDevice::PdmNumColors: case QPaintDevice::PdmNumColors:
return static_cast<int>(0xffffffff); return static_cast<int>(0xffffffff);
case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmPhysicalDpiX:
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
case QPaintDevice::PdmDpiX: case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmDpiY: case QPaintDevice::PdmDpiY:
return static_cast<int>(engine->getResolution()); return static_cast<int>(m_engine->GetResolution());
case QPaintDevice::PdmDevicePixelRatio: case QPaintDevice::PdmDevicePixelRatio:
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
case QPaintDevice::PdmDevicePixelRatioScaled: case QPaintDevice::PdmDevicePixelRatioScaled:

View File

@ -45,45 +45,46 @@ class VDxfPaintDevice : public QPaintDevice
{ {
public: public:
VDxfPaintDevice(); VDxfPaintDevice();
virtual ~VDxfPaintDevice() override; ~VDxfPaintDevice() override;
virtual QPaintEngine *paintEngine() const override;
QString getFileName() const; auto paintEngine() const -> QPaintEngine * override;
void setFileName(const QString &value);
QSize getSize(); auto GetFileName() const -> QString;
void setSize(const QSize &size); void SetFileName(const QString &value);
double getResolution() const; auto GetSize() -> QSize;
void setResolution(double dpi); void SetSize(const QSize &size);
DRW::Version GetVersion() const; auto GetResolution() const -> double;
void SetVersion(DRW::Version version); void SetResolution(double dpi);
auto GetVersion() const -> DRW::Version;
void SetVersion(DRW::Version version);
void SetBinaryFormat(bool binary); void SetBinaryFormat(bool binary);
bool IsBinaryFromat() const; auto IsBinaryFromat() const -> bool;
void setMeasurement(const VarMeasurement &var); void SetMeasurement(const VarMeasurement &var);
void setInsunits(const VarInsunits &var); void SetInsunits(const VarInsunits &var);
qreal GetXScale() const; auto GetXScale() const -> qreal;
void SetXScale(const qreal &xscale); void SetXScale(const qreal &xscale);
qreal GetYScale() const; auto GetYScale() const -> qreal;
void SetYScale(const qreal &yscale); void SetYScale(const qreal &yscale);
bool ExportToAAMA(const QVector<VLayoutPiece> &details) const; auto ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool;
bool ExportToASTM(const QVector<VLayoutPiece> &details) const; auto ExportToASTM(const QVector<VLayoutPiece> &details) const -> bool;
QString ErrorString() const; auto ErrorString() const -> QString;
protected: protected:
virtual int metric(PaintDeviceMetric metric) const override; auto metric(PaintDeviceMetric metric) const -> int override;
private: private:
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(VDxfPaintDevice) // NOLINT Q_DISABLE_COPY_MOVE(VDxfPaintDevice) // NOLINT
VDxfEngine *engine; VDxfEngine *m_engine;
QString fileName; QString m_fileName{};
}; };
#endif // VDXFPAINTDEVICE_H #endif // VDXFPAINTDEVICE_H

View File

@ -251,12 +251,12 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphi
PrepareTextForDXF(endStringPlaceholder, details); PrepareTextForDXF(endStringPlaceholder, details);
VDxfPaintDevice generator; VDxfPaintDevice generator;
generator.setFileName(m_fileName); generator.SetFileName(m_fileName);
generator.setSize(QSize(qFloor(m_imageRect.width() * m_xScale), qFloor(m_imageRect.height() * m_yScale))); generator.SetSize(QSize(qFloor(m_imageRect.width() * m_xScale), qFloor(m_imageRect.height() * m_yScale)));
generator.setResolution(PrintDPI); generator.SetResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion)); generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion));
generator.SetBinaryFormat(m_binaryDxfFormat); generator.SetBinaryFormat(m_binaryDxfFormat);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745 generator.SetInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
QPainter painter; QPainter painter;
if (painter.begin(&generator)) if (painter.begin(&generator))
@ -277,12 +277,12 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QList<QGraphi
void VLayoutExporter::ExportToAAMADXF(const QVector<VLayoutPiece> &details) const void VLayoutExporter::ExportToAAMADXF(const QVector<VLayoutPiece> &details) const
{ {
VDxfPaintDevice generator; VDxfPaintDevice generator;
generator.setFileName(m_fileName); generator.SetFileName(m_fileName);
generator.setSize(QSize(qCeil(m_imageRect.width() * m_xScale), qCeil(m_imageRect.height() * m_yScale))); generator.SetSize(QSize(qCeil(m_imageRect.width() * m_xScale), qCeil(m_imageRect.height() * m_yScale)));
generator.setResolution(PrintDPI); generator.SetResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion)); generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion));
generator.SetBinaryFormat(m_binaryDxfFormat); generator.SetBinaryFormat(m_binaryDxfFormat);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745 generator.SetInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
generator.SetXScale(m_xScale); generator.SetXScale(m_xScale);
generator.SetYScale(m_yScale); generator.SetYScale(m_yScale);
if (not generator.ExportToAAMA(details)) if (not generator.ExportToAAMA(details))
@ -296,12 +296,12 @@ void VLayoutExporter::ExportToAAMADXF(const QVector<VLayoutPiece> &details) cons
void VLayoutExporter::ExportToASTMDXF(const QVector<VLayoutPiece> &details) const void VLayoutExporter::ExportToASTMDXF(const QVector<VLayoutPiece> &details) const
{ {
VDxfPaintDevice generator; VDxfPaintDevice generator;
generator.setFileName(m_fileName); generator.SetFileName(m_fileName);
generator.setSize(QSize(qCeil(m_imageRect.width() * m_xScale), qCeil(m_imageRect.height() * m_yScale))); generator.SetSize(QSize(qCeil(m_imageRect.width() * m_xScale), qCeil(m_imageRect.height() * m_yScale)));
generator.setResolution(PrintDPI); generator.SetResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion)); generator.SetVersion(static_cast<DRW::Version>(m_dxfVersion));
generator.SetBinaryFormat(m_binaryDxfFormat); generator.SetBinaryFormat(m_binaryDxfFormat);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745 generator.SetInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
generator.SetXScale(m_xScale); generator.SetXScale(m_xScale);
generator.SetYScale(m_yScale); generator.SetYScale(m_yScale);
if (not generator.ExportToASTM(details)) if (not generator.ExportToASTM(details))