WIP: Fixed DXF reader

This commit is contained in:
Matthias Koefferlein
2020-12-19 23:37:37 +01:00
parent 72c933ed47
commit b6f710a9fe
6 changed files with 39 additions and 24 deletions
@@ -364,16 +364,6 @@ DXFReader::warn (const std::string &msg)
}
}
std::pair <bool, unsigned int>
DXFReader::open_layer (db::Layout &layout, const std::string &n)
{
if (n == zero_layer_name) {
return std::make_pair (true, m_zero_layer);
} else {
return NamedLayerReader::open_layer (layout, n);
}
}
void
DXFReader::do_read (db::Layout &layout, db::cell_index_type top)
{
@@ -381,21 +371,24 @@ DXFReader::do_read (db::Layout &layout, db::cell_index_type top)
// create the zero layer - this is not mapped to GDS but can be specified in the layer mapping as
// a layer named "0".
std::pair<bool, unsigned int> ll = open_layer (layout, zero_layer_name);
if (ll.first) {
// layer exists
m_zero_layer = ll.second;
std::pair<bool, unsigned int> li = NamedLayerReader::open_layer (layout, zero_layer_name, true /*keep layer name*/, false /*don't create a new layer*/);
if (li.first) {
// we got one from the layer mapping
m_zero_layer = li.second;
} else {
// or explicitly create the layer:
m_zero_layer = layout.insert_layer (db::LayerProperties (0, 0, zero_layer_name));
// or we explicitly create the layer
db::LayerProperties lp_zero (0, 0, zero_layer_name);
m_zero_layer = layout.insert_layer (lp_zero);
map_layer (zero_layer_name, m_zero_layer);
}
// Read sections
// Read sections
int g;
while (true) {
@@ -193,7 +193,6 @@ private:
void do_read (db::Layout &layout, db::cell_index_type top);
std::pair <bool, unsigned int> open_layer (db::Layout &layout, const std::string &n);
db::cell_index_type make_layer_variant (db::Layout &layout, const std::string &cellname, db::cell_index_type template_cell, unsigned int layer, double sx, double sy);
void cleanup (db::Layout &layout, db::cell_index_type top);
@@ -6,7 +6,7 @@ TARGET = dxf_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
dbDXFReader.cc \
dbDXFReaderTests.cc
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin $$PWD/../../../common
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin $$PWD/../../../common