Up to R12 DXF allows not to define default layer "0".

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-07-17 17:19:49 +03:00
parent 2dd8519433
commit c84f7ef828
4 changed files with 8 additions and 4 deletions

View File

@ -25,7 +25,6 @@ dx_iface::dx_iface(const std::string &file, DRW::Version v, VarMeasurement varMe
version(v) version(v)
{ {
InitHeader(varMeasurement, varInsunits); InitHeader(varMeasurement, varInsunits);
InitDefLayers();
InitTextstyles(); InitTextstyles();
InitAppId(); InitAppId();
} }
@ -277,7 +276,7 @@ void dx_iface::AddAAMALayers()
// cData.layers.push_back(layer); // cData.layers.push_back(layer);
} }
void dx_iface::InitDefLayers() void dx_iface::AddDefLayers()
{ {
DRW_Layer defLayer; DRW_Layer defLayer;
defLayer.name = "0"; defLayer.name = "0";

View File

@ -121,6 +121,7 @@ public:
void AddBlock(dx_ifaceBlock* block); void AddBlock(dx_ifaceBlock* block);
void AddQtLTypes(); void AddQtLTypes();
void AddDefLayers();
void AddAAMALayers(); void AddAAMALayers();
private: private:
@ -130,7 +131,6 @@ private:
DRW::Version version; DRW::Version version;
void InitHeader(VarMeasurement varMeasurement, VarInsunits varInsunits); void InitHeader(VarMeasurement varMeasurement, VarInsunits varInsunits);
void InitDefLayers();
void InitTextstyles(); void InitTextstyles();
void InitAppId(); void InitAppId();

View File

@ -1478,7 +1478,7 @@ bool dxfRW::writeTables() {
writer->writeInt16(70, 1); //end table def writer->writeInt16(70, 1); //end table def
wlayer0 =false; wlayer0 =false;
iface->writeLayers(); iface->writeLayers();
if (!wlayer0) { if (!wlayer0 && version > DRW::AC1009) {
DRW_Layer lay0; DRW_Layer lay0;
lay0.name = "0"; lay0.name = "0";
writeLayer(&lay0); writeLayer(&lay0);

View File

@ -111,6 +111,7 @@ bool VDxfEngine::begin(QPaintDevice *pdev)
input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits)); input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits));
input->AddQtLTypes(); input->AddQtLTypes();
input->AddDefLayers();
return true; return true;
} }
@ -612,6 +613,10 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
} }
input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits)); input = QSharedPointer<dx_iface>(new dx_iface(fileName.toStdString(), m_version, varMeasurement, varInsunits));
if (m_version > DRW::AC1009)
{
input->AddDefLayers();
}
input->AddAAMALayers(); input->AddAAMALayers();
ExportAAMAGlobalText(input, details); ExportAAMAGlobalText(input, details);