From c84f7ef828a7767a1ac602687e203edacedb37da Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 17 Jul 2017 17:19:49 +0300 Subject: [PATCH] Up to R12 DXF allows not to define default layer "0". --HG-- branch : feature --- src/libs/vdxf/dxiface.cpp | 3 +-- src/libs/vdxf/dxiface.h | 2 +- src/libs/vdxf/libdxfrw/libdxfrw.cpp | 2 +- src/libs/vdxf/vdxfengine.cpp | 5 +++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libs/vdxf/dxiface.cpp b/src/libs/vdxf/dxiface.cpp index 758c6e379..57eeb9e98 100644 --- a/src/libs/vdxf/dxiface.cpp +++ b/src/libs/vdxf/dxiface.cpp @@ -25,7 +25,6 @@ dx_iface::dx_iface(const std::string &file, DRW::Version v, VarMeasurement varMe version(v) { InitHeader(varMeasurement, varInsunits); - InitDefLayers(); InitTextstyles(); InitAppId(); } @@ -277,7 +276,7 @@ void dx_iface::AddAAMALayers() // cData.layers.push_back(layer); } -void dx_iface::InitDefLayers() +void dx_iface::AddDefLayers() { DRW_Layer defLayer; defLayer.name = "0"; diff --git a/src/libs/vdxf/dxiface.h b/src/libs/vdxf/dxiface.h index daf75c3a0..eb449746a 100644 --- a/src/libs/vdxf/dxiface.h +++ b/src/libs/vdxf/dxiface.h @@ -121,6 +121,7 @@ public: void AddBlock(dx_ifaceBlock* block); void AddQtLTypes(); + void AddDefLayers(); void AddAAMALayers(); private: @@ -130,7 +131,6 @@ private: DRW::Version version; void InitHeader(VarMeasurement varMeasurement, VarInsunits varInsunits); - void InitDefLayers(); void InitTextstyles(); void InitAppId(); diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 41ebfffb2..4fead41c1 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -1478,7 +1478,7 @@ bool dxfRW::writeTables() { writer->writeInt16(70, 1); //end table def wlayer0 =false; iface->writeLayers(); - if (!wlayer0) { + if (!wlayer0 && version > DRW::AC1009) { DRW_Layer lay0; lay0.name = "0"; writeLayer(&lay0); diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 4c2eda949..0b8c67590 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -111,6 +111,7 @@ bool VDxfEngine::begin(QPaintDevice *pdev) input = QSharedPointer(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits)); input->AddQtLTypes(); + input->AddDefLayers(); return true; } @@ -612,6 +613,10 @@ bool VDxfEngine::ExportToAAMA(const QVector &details) } input = QSharedPointer(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits)); + if (m_version > DRW::AC1009) + { + input->AddDefLayers(); + } input->AddAAMALayers(); ExportAAMAGlobalText(input, details);