WIP: moved PCB and LEF/DEF import from ext to db/lay namespace

This commit is contained in:
Matthias Koefferlein 2018-06-13 23:59:39 +02:00
parent 4f63f5102b
commit 8045989fa3
30 changed files with 266 additions and 260 deletions

View File

@ -21,13 +21,13 @@
*/ */
#include "extDEFImporter.h" #include "dbDEFImporter.h"
#include "dbPolygonTools.h" #include "dbPolygonTools.h"
#include "tlGlobPattern.h" #include "tlGlobPattern.h"
#include <cmath> #include <cmath>
namespace ext namespace db
{ {
DEFImporter::DEFImporter () DEFImporter::DEFImporter ()

View File

@ -22,18 +22,18 @@
#ifndef HDR_extDEFImporter #ifndef HDR_dbDEFImporter
#define HDR_extDEFImporter #define HDR_dbDEFImporter
#include "dbCommon.h" #include "dbCommon.h"
#include "dbLayout.h" #include "dbLayout.h"
#include "tlStream.h" #include "tlStream.h"
#include "extLEFImporter.h" #include "dbLEFImporter.h"
#include <vector> #include <vector>
#include <string> #include <string>
namespace ext namespace db
{ {
/** /**

View File

@ -21,7 +21,7 @@
*/ */
#include "extLEFDEFImporter.h" #include "dbLEFDEFImporter.h"
#include "tlStream.h" #include "tlStream.h"
#include "tlProgress.h" #include "tlProgress.h"
@ -30,7 +30,7 @@
#include <QFileInfo> #include <QFileInfo>
namespace ext namespace db
{ {
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extLEFDEFImporter #ifndef HDR_dbLEFDEFImporter
#define HDR_extLEFDEFImporter #define HDR_dbLEFDEFImporter
#include "dbCommon.h" #include "dbCommon.h"
#include "dbLayout.h" #include "dbLayout.h"
@ -40,7 +40,7 @@ namespace tl
class AbsoluteProgress; class AbsoluteProgress;
} }
namespace ext namespace db
{ {
/** /**

View File

@ -21,13 +21,13 @@
*/ */
#include "extLEFImporter.h" #include "dbLEFImporter.h"
#include "tlStream.h" #include "tlStream.h"
#include <cctype> #include <cctype>
namespace ext namespace db
{ {
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------

View File

@ -22,10 +22,10 @@
#ifndef HDR_extLEFImporter #ifndef HDR_dbLEFImporter
#define HDR_extLEFImporter #define HDR_dbLEFImporter
#include "extLEFDEFImporter.h" #include "dbLEFDEFImporter.h"
#include "dbCommon.h" #include "dbCommon.h"
#include "dbLayout.h" #include "dbLayout.h"
@ -37,7 +37,7 @@
#include <string> #include <string>
#include <map> #include <map>
namespace ext namespace db
{ {
/** /**

View File

@ -5,12 +5,12 @@ DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri) include($$PWD/../../../db_plugin.pri)
HEADERS = \ HEADERS = \
extDEFImporter.h \ dbDEFImporter.h \
extLEFImporter.h \ dbLEFDEFImporter.h \
extLEFDEFImporter.h \ dbLEFImporter.h
SOURCES = \ SOURCES = \
extDEFImporter.cc \
extLEFDEFImporter.cc \
extLEFImporter.cc \
gsiDeclDbLEFDEF.cc \ gsiDeclDbLEFDEF.cc \
dbDEFImporter.cc \
dbLEFDEFImporter.cc \
dbLEFImporter.cc

View File

@ -23,9 +23,9 @@
#include "gsiDecl.h" #include "gsiDecl.h"
#include "extLEFImporter.h" #include "dbLEFImporter.h"
#include "extDEFImporter.h" #include "dbDEFImporter.h"
#include "extLEFDEFImporter.h" #include "dbLEFDEFImporter.h"
namespace gsi namespace gsi
{ {
@ -33,12 +33,12 @@ namespace gsi
// --------------------------------------------------------------- // ---------------------------------------------------------------
// gsi Implementation of specific methods // gsi Implementation of specific methods
static ext::LEFDEFReaderOptions &get_lefdef_config (db::LoadLayoutOptions *options) static db::LEFDEFReaderOptions &get_lefdef_config (db::LoadLayoutOptions *options)
{ {
return options->get_options<ext::LEFDEFReaderOptions> (); return options->get_options<db::LEFDEFReaderOptions> ();
} }
static void set_lefdef_config (db::LoadLayoutOptions *options, const ext::LEFDEFReaderOptions &config) static void set_lefdef_config (db::LoadLayoutOptions *options, const db::LEFDEFReaderOptions &config)
{ {
options->set_options (config); options->set_options (config);
} }
@ -61,7 +61,7 @@ gsi::ClassExt<db::LoadLayoutOptions> decl_ext_lefdef_reader_options (
) )
); );
static tl::Variant get_net_property_name (const ext::LEFDEFReaderOptions *config) static tl::Variant get_net_property_name (const db::LEFDEFReaderOptions *config)
{ {
if (config->produce_net_names ()) { if (config->produce_net_names ()) {
return config->net_property_name (); return config->net_property_name ();
@ -70,15 +70,15 @@ static tl::Variant get_net_property_name (const ext::LEFDEFReaderOptions *config
} }
} }
static void set_net_property_name (ext::LEFDEFReaderOptions *config, const tl::Variant &name) static void set_net_property_name (db::LEFDEFReaderOptions *config, const tl::Variant &name)
{ {
config->set_produce_net_names (! name.is_nil ()); config->set_produce_net_names (! name.is_nil ());
config->set_net_property_name (name); config->set_net_property_name (name);
} }
static static
gsi::Class<ext::LEFDEFReaderOptions> decl_lefdef_config ("lay", "LEFDEFReaderConfiguration", gsi::Class<db::LEFDEFReaderOptions> decl_lefdef_config ("lay", "LEFDEFReaderConfiguration",
gsi::method ("layer_map", (db::LayerMap &(ext::LEFDEFReaderOptions::*) ()) &ext::LEFDEFReaderOptions::layer_map, gsi::method ("layer_map", (db::LayerMap &(db::LEFDEFReaderOptions::*) ()) &db::LEFDEFReaderOptions::layer_map,
"@brief Gets the layer map to be used for the LEF/DEF reader\n" "@brief Gets the layer map to be used for the LEF/DEF reader\n"
"@return A reference to the layer map\n" "@return A reference to the layer map\n"
"Because LEF/DEF layer mapping is substantially different than for normal layout files, the LEF/DEF reader " "Because LEF/DEF layer mapping is substantially different than for normal layout files, the LEF/DEF reader "
@ -89,24 +89,24 @@ gsi::Class<ext::LEFDEFReaderOptions> decl_lefdef_config ("lay", "LEFDEFReaderCon
"The setter is \\layer_map=. \\create_other_layers= is available to control whether layers " "The setter is \\layer_map=. \\create_other_layers= is available to control whether layers "
"not specified in the layer mapping table shall be created automatically." "not specified in the layer mapping table shall be created automatically."
) + ) +
gsi::method ("layer_map=", &ext::LEFDEFReaderOptions::set_layer_map, gsi::method ("layer_map=", &db::LEFDEFReaderOptions::set_layer_map,
"@brief Sets the layer map to be used for the LEF/DEF reader\n" "@brief Sets the layer map to be used for the LEF/DEF reader\n"
"See \\layer_map for details." "See \\layer_map for details."
) + ) +
gsi::method ("create_other_layers", &ext::LEFDEFReaderOptions::read_all_layers, gsi::method ("create_other_layers", &db::LEFDEFReaderOptions::read_all_layers,
"@brief Gets a value indicating whether layers not mapped in the layer map shall be created too\n" "@brief Gets a value indicating whether layers not mapped in the layer map shall be created too\n"
"See \\layer_map for details." "See \\layer_map for details."
) + ) +
gsi::method ("create_other_layers=", &ext::LEFDEFReaderOptions::set_read_all_layers, gsi::method ("create_other_layers=", &db::LEFDEFReaderOptions::set_read_all_layers,
"@brief Sets a value indicating whether layers not mapped in the layer map shall be created too\n" "@brief Sets a value indicating whether layers not mapped in the layer map shall be created too\n"
"See \\layer_map for details." "See \\layer_map for details."
) + ) +
gsi::method ("dbu", &ext::LEFDEFReaderOptions::dbu, gsi::method ("dbu", &db::LEFDEFReaderOptions::dbu,
"@brief Gets the database unit to use for producing the layout.\n" "@brief Gets the database unit to use for producing the layout.\n"
"This value specifies the database to be used for the layout that is read. When a DEF file is specified with " "This value specifies the database to be used for the layout that is read. When a DEF file is specified with "
"a different database unit, the layout is translated into this database unit.\n" "a different database unit, the layout is translated into this database unit.\n"
) + ) +
gsi::method ("dbu=", &ext::LEFDEFReaderOptions::set_dbu, gsi::arg ("dbu"), gsi::method ("dbu=", &db::LEFDEFReaderOptions::set_dbu, gsi::arg ("dbu"),
"@brief Sets the database unit to use for producing the layout.\n" "@brief Sets the database unit to use for producing the layout.\n"
"See \\dbu for details." "See \\dbu for details."
) + ) +
@ -122,43 +122,43 @@ gsi::Class<ext::LEFDEFReaderOptions> decl_lefdef_config ("lay", "LEFDEFReaderCon
"@brief Sets a value indicating whether and how to produce net names as properties.\n" "@brief Sets a value indicating whether and how to produce net names as properties.\n"
"See \\net_property_name for details." "See \\net_property_name for details."
) + ) +
gsi::method ("produce_cell_outlines", &ext::LEFDEFReaderOptions::produce_cell_outlines, gsi::method ("produce_cell_outlines", &db::LEFDEFReaderOptions::produce_cell_outlines,
"@brief Gets a value indicating whether to produce cell outlines.\n" "@brief Gets a value indicating whether to produce cell outlines.\n"
"If set to true, cell outlines will be produced on the layer given by \\cell_outline_layer. " "If set to true, cell outlines will be produced on the layer given by \\cell_outline_layer. "
) + ) +
gsi::method ("produce_cell_outlines=", &ext::LEFDEFReaderOptions::set_produce_cell_outlines, gsi::arg ("produce"), gsi::method ("produce_cell_outlines=", &db::LEFDEFReaderOptions::set_produce_cell_outlines, gsi::arg ("produce"),
"@brief Sets a value indicating whether to produce cell outlines.\n" "@brief Sets a value indicating whether to produce cell outlines.\n"
"See \\produce_cell_outlines for details.\n" "See \\produce_cell_outlines for details.\n"
) + ) +
gsi::method ("cell_outline_layer", &ext::LEFDEFReaderOptions::cell_outline_layer, gsi::method ("cell_outline_layer", &db::LEFDEFReaderOptions::cell_outline_layer,
"@brief Gets the layer on which to produce the cell outline.\n" "@brief Gets the layer on which to produce the cell outline.\n"
"This attribute is a string correspondig to the string representation of \\LayerInfo. " "This attribute is a string correspondig to the string representation of \\LayerInfo. "
"This string can be either a layer number, a layer/datatype pair, a name or a combination of both. See \\LayerInfo for details.\n" "This string can be either a layer number, a layer/datatype pair, a name or a combination of both. See \\LayerInfo for details.\n"
"The setter for this attribute is \\cell_outline_layer=. See also \\produce_cell_outlines." "The setter for this attribute is \\cell_outline_layer=. See also \\produce_cell_outlines."
) + ) +
gsi::method ("cell_outline_layer=", &ext::LEFDEFReaderOptions::set_cell_outline_layer, gsi::arg ("spec"), gsi::method ("cell_outline_layer=", &db::LEFDEFReaderOptions::set_cell_outline_layer, gsi::arg ("spec"),
"@brief Sets the layer on which to produce the cell outline.\n" "@brief Sets the layer on which to produce the cell outline.\n"
"See \\cell_outline_layer for details.\n" "See \\cell_outline_layer for details.\n"
) + ) +
gsi::method ("produce_placement_blockages", &ext::LEFDEFReaderOptions::produce_placement_blockages, gsi::method ("produce_placement_blockages", &db::LEFDEFReaderOptions::produce_placement_blockages,
"@brief Gets a value indicating whether to produce placement blockage regions.\n" "@brief Gets a value indicating whether to produce placement blockage regions.\n"
"If set to true, polygons will be produced representing the placement blockage region on the layer given by \\placement_blockage_layer. " "If set to true, polygons will be produced representing the placement blockage region on the layer given by \\placement_blockage_layer. "
) + ) +
gsi::method ("produce_placement_blockages=", &ext::LEFDEFReaderOptions::set_produce_placement_blockages, gsi::arg ("produce"), gsi::method ("produce_placement_blockages=", &db::LEFDEFReaderOptions::set_produce_placement_blockages, gsi::arg ("produce"),
"@brief Sets a value indicating whether to produce placement blockage regions.\n" "@brief Sets a value indicating whether to produce placement blockage regions.\n"
"See \\produce_placement_blockages for details.\n" "See \\produce_placement_blockages for details.\n"
) + ) +
gsi::method ("placement_blockage_layer", &ext::LEFDEFReaderOptions::placement_blockage_layer, gsi::method ("placement_blockage_layer", &db::LEFDEFReaderOptions::placement_blockage_layer,
"@brief Gets the layer on which to produce the placement blockage.\n" "@brief Gets the layer on which to produce the placement blockage.\n"
"This attribute is a string correspondig to the string representation of \\LayerInfo. " "This attribute is a string correspondig to the string representation of \\LayerInfo. "
"This string can be either a layer number, a layer/datatype pair, a name or a combination of both. See \\LayerInfo for details." "This string can be either a layer number, a layer/datatype pair, a name or a combination of both. See \\LayerInfo for details."
"The setter for this attribute is \\placement_blockage_layer=. See also \\produce_placement_blockages." "The setter for this attribute is \\placement_blockage_layer=. See also \\produce_placement_blockages."
) + ) +
gsi::method ("placement_blockage_layer=", &ext::LEFDEFReaderOptions::set_placement_blockage_layer, gsi::method ("placement_blockage_layer=", &db::LEFDEFReaderOptions::set_placement_blockage_layer,
"@brief Sets the layer on which to produce the placement blockage.\n" "@brief Sets the layer on which to produce the placement blockage.\n"
"See \\placement_blockage_layer for details.\n" "See \\placement_blockage_layer for details.\n"
) + ) +
gsi::method ("produce_via_geometry", &ext::LEFDEFReaderOptions::produce_via_geometry, gsi::method ("produce_via_geometry", &db::LEFDEFReaderOptions::produce_via_geometry,
"@brief Sets a value indicating whether via geometries shall be produced.\n" "@brief Sets a value indicating whether via geometries shall be produced.\n"
"\n" "\n"
"If set to true, shapes will be produced for each via. The layer to be produced will be determined from the " "If set to true, shapes will be produced for each via. The layer to be produced will be determined from the "
@ -178,154 +178,154 @@ gsi::Class<ext::LEFDEFReaderOptions> decl_lefdef_config ("lay", "LEFDEFReaderCon
" and the layer name will be 'V1.GEO'. @/ul" " and the layer name will be 'V1.GEO'. @/ul"
"@/li\n" "@/li\n"
) + ) +
gsi::method ("produce_via_geometry=", &ext::LEFDEFReaderOptions::set_produce_via_geometry, gsi::arg ("produce"), gsi::method ("produce_via_geometry=", &db::LEFDEFReaderOptions::set_produce_via_geometry, gsi::arg ("produce"),
"@brief Sets a value indicating whether via geometries shall be produced.\n" "@brief Sets a value indicating whether via geometries shall be produced.\n"
"See \\produce_via_geometry for details.\n" "See \\produce_via_geometry for details.\n"
) + ) +
gsi::method ("via_geometry_suffix", &ext::LEFDEFReaderOptions::via_geometry_suffix, gsi::method ("via_geometry_suffix", &db::LEFDEFReaderOptions::via_geometry_suffix,
"@brief Gets the via geometry layer name suffix.\n" "@brief Gets the via geometry layer name suffix.\n"
"See \\produce_via_geometry for details about this property.\n" "See \\produce_via_geometry for details about this property.\n"
) + ) +
gsi::method ("via_geometry_suffix=", &ext::LEFDEFReaderOptions::set_via_geometry_suffix, gsi::arg ("suffix"), gsi::method ("via_geometry_suffix=", &db::LEFDEFReaderOptions::set_via_geometry_suffix, gsi::arg ("suffix"),
"@brief Sets the via geometry layer name suffix.\n" "@brief Sets the via geometry layer name suffix.\n"
"See \\produce_via_geometry for details about this property.\n" "See \\produce_via_geometry for details about this property.\n"
) + ) +
gsi::method ("via_geometry_datatype", &ext::LEFDEFReaderOptions::via_geometry_datatype, gsi::method ("via_geometry_datatype", &db::LEFDEFReaderOptions::via_geometry_datatype,
"@brief Gets the via geometry layer datatype value.\n" "@brief Gets the via geometry layer datatype value.\n"
"See \\produce_via_geometry for details about this property.\n" "See \\produce_via_geometry for details about this property.\n"
) + ) +
gsi::method ("via_geometry_datatype=", &ext::LEFDEFReaderOptions::set_via_geometry_datatype, gsi::arg ("datatype"), gsi::method ("via_geometry_datatype=", &db::LEFDEFReaderOptions::set_via_geometry_datatype, gsi::arg ("datatype"),
"@brief Sets the via geometry layer datatype value.\n" "@brief Sets the via geometry layer datatype value.\n"
"See \\produce_via_geometry for details about this property.\n" "See \\produce_via_geometry for details about this property.\n"
) + ) +
gsi::method ("produce_pins", &ext::LEFDEFReaderOptions::produce_pins, gsi::method ("produce_pins", &db::LEFDEFReaderOptions::produce_pins,
"@brief Gets a value indicating whether pin geometries shall be produced.\n" "@brief Gets a value indicating whether pin geometries shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_pins=", &ext::LEFDEFReaderOptions::set_produce_pins, gsi::arg ("produce"), gsi::method ("produce_pins=", &db::LEFDEFReaderOptions::set_produce_pins, gsi::arg ("produce"),
"@brief Sets a value indicating whether pin geometries shall be produced.\n" "@brief Sets a value indicating whether pin geometries shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("pins_suffix", &ext::LEFDEFReaderOptions::pins_suffix, gsi::method ("pins_suffix", &db::LEFDEFReaderOptions::pins_suffix,
"@brief Gets the pin geometry layer name suffix.\n" "@brief Gets the pin geometry layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("pins_suffix=", &ext::LEFDEFReaderOptions::set_pins_suffix, gsi::arg ("suffix"), gsi::method ("pins_suffix=", &db::LEFDEFReaderOptions::set_pins_suffix, gsi::arg ("suffix"),
"@brief Sets the pin geometry layer name suffix.\n" "@brief Sets the pin geometry layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("pins_datatype", &ext::LEFDEFReaderOptions::pins_datatype, gsi::method ("pins_datatype", &db::LEFDEFReaderOptions::pins_datatype,
"@brief Gets the pin geometry layer datatype value.\n" "@brief Gets the pin geometry layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("pins_datatype=", &ext::LEFDEFReaderOptions::set_pins_datatype, gsi::arg ("datatype"), gsi::method ("pins_datatype=", &db::LEFDEFReaderOptions::set_pins_datatype, gsi::arg ("datatype"),
"@brief Sets the pin geometry layer datatype value.\n" "@brief Sets the pin geometry layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_obstructions", &ext::LEFDEFReaderOptions::produce_obstructions, gsi::method ("produce_obstructions", &db::LEFDEFReaderOptions::produce_obstructions,
"@brief Gets a value indicating whether obstruction markers shall be produced.\n" "@brief Gets a value indicating whether obstruction markers shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_obstructions=", &ext::LEFDEFReaderOptions::set_produce_obstructions, gsi::arg ("produce"), gsi::method ("produce_obstructions=", &db::LEFDEFReaderOptions::set_produce_obstructions, gsi::arg ("produce"),
"@brief Sets a value indicating whether obstruction markers shall be produced.\n" "@brief Sets a value indicating whether obstruction markers shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("obstructions_suffix", &ext::LEFDEFReaderOptions::obstructions_suffix, gsi::method ("obstructions_suffix", &db::LEFDEFReaderOptions::obstructions_suffix,
"@brief Gets the obstruction marker layer name suffix.\n" "@brief Gets the obstruction marker layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("obstructions_suffix=", &ext::LEFDEFReaderOptions::set_obstructions_suffix, gsi::arg ("suffix"), gsi::method ("obstructions_suffix=", &db::LEFDEFReaderOptions::set_obstructions_suffix, gsi::arg ("suffix"),
"@brief Sets the obstruction marker layer name suffix.\n" "@brief Sets the obstruction marker layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("obstructions_datatype", &ext::LEFDEFReaderOptions::obstructions_datatype, gsi::method ("obstructions_datatype", &db::LEFDEFReaderOptions::obstructions_datatype,
"@brief Gets the obstruction marker layer datatype value.\n" "@brief Gets the obstruction marker layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("obstructions_datatype=", &ext::LEFDEFReaderOptions::set_obstructions_datatype, gsi::arg ("datatype"), gsi::method ("obstructions_datatype=", &db::LEFDEFReaderOptions::set_obstructions_datatype, gsi::arg ("datatype"),
"@brief Sets the obstruction marker layer datatype value.\n" "@brief Sets the obstruction marker layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_blockages", &ext::LEFDEFReaderOptions::produce_blockages, gsi::method ("produce_blockages", &db::LEFDEFReaderOptions::produce_blockages,
"@brief Gets a value indicating whether routing blockage markers shall be produced.\n" "@brief Gets a value indicating whether routing blockage markers shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_blockages=", &ext::LEFDEFReaderOptions::set_produce_blockages, gsi::arg ("produce"), gsi::method ("produce_blockages=", &db::LEFDEFReaderOptions::set_produce_blockages, gsi::arg ("produce"),
"@brief Sets a value indicating whether routing blockage markers shall be produced.\n" "@brief Sets a value indicating whether routing blockage markers shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("blockages_suffix", &ext::LEFDEFReaderOptions::blockages_suffix, gsi::method ("blockages_suffix", &db::LEFDEFReaderOptions::blockages_suffix,
"@brief Gets the blockage marker layer name suffix.\n" "@brief Gets the blockage marker layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("blockages_suffix=", &ext::LEFDEFReaderOptions::set_blockages_suffix, gsi::arg ("suffix"), gsi::method ("blockages_suffix=", &db::LEFDEFReaderOptions::set_blockages_suffix, gsi::arg ("suffix"),
"@brief Sets the blockage marker layer name suffix.\n" "@brief Sets the blockage marker layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("blockages_datatype", &ext::LEFDEFReaderOptions::blockages_datatype, gsi::method ("blockages_datatype", &db::LEFDEFReaderOptions::blockages_datatype,
"@brief Gets the blockage marker layer datatype value.\n" "@brief Gets the blockage marker layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("blockages_datatype=", &ext::LEFDEFReaderOptions::set_blockages_datatype, gsi::arg ("datatype"), gsi::method ("blockages_datatype=", &db::LEFDEFReaderOptions::set_blockages_datatype, gsi::arg ("datatype"),
"@brief Sets the blockage marker layer datatype value.\n" "@brief Sets the blockage marker layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_labels", &ext::LEFDEFReaderOptions::produce_labels, gsi::method ("produce_labels", &db::LEFDEFReaderOptions::produce_labels,
"@brief Gets a value indicating whether labels shall be produced.\n" "@brief Gets a value indicating whether labels shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_labels=", &ext::LEFDEFReaderOptions::set_produce_labels, gsi::arg ("produce"), gsi::method ("produce_labels=", &db::LEFDEFReaderOptions::set_produce_labels, gsi::arg ("produce"),
"@brief Sets a value indicating whether labels shall be produced.\n" "@brief Sets a value indicating whether labels shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("labels_suffix", &ext::LEFDEFReaderOptions::labels_suffix, gsi::method ("labels_suffix", &db::LEFDEFReaderOptions::labels_suffix,
"@brief Gets the label layer name suffix.\n" "@brief Gets the label layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("labels_suffix=", &ext::LEFDEFReaderOptions::set_labels_suffix, gsi::arg ("suffix"), gsi::method ("labels_suffix=", &db::LEFDEFReaderOptions::set_labels_suffix, gsi::arg ("suffix"),
"@brief Sets the label layer name suffix.\n" "@brief Sets the label layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("labels_datatype", &ext::LEFDEFReaderOptions::labels_datatype, gsi::method ("labels_datatype", &db::LEFDEFReaderOptions::labels_datatype,
"@brief Gets the labels layer datatype value.\n" "@brief Gets the labels layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("labels_datatype=", &ext::LEFDEFReaderOptions::set_labels_datatype, gsi::arg ("datatype"), gsi::method ("labels_datatype=", &db::LEFDEFReaderOptions::set_labels_datatype, gsi::arg ("datatype"),
"@brief Sets the labels layer datatype value.\n" "@brief Sets the labels layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_routing", &ext::LEFDEFReaderOptions::produce_routing, gsi::method ("produce_routing", &db::LEFDEFReaderOptions::produce_routing,
"@brief Gets a value indicating whether routing geometry shall be produced.\n" "@brief Gets a value indicating whether routing geometry shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("produce_routing=", &ext::LEFDEFReaderOptions::set_produce_routing, gsi::arg ("produce"), gsi::method ("produce_routing=", &db::LEFDEFReaderOptions::set_produce_routing, gsi::arg ("produce"),
"@brief Sets a value indicating whether routing geometry shall be produced.\n" "@brief Sets a value indicating whether routing geometry shall be produced.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("routing_suffix", &ext::LEFDEFReaderOptions::routing_suffix, gsi::method ("routing_suffix", &db::LEFDEFReaderOptions::routing_suffix,
"@brief Gets the routing layer name suffix.\n" "@brief Gets the routing layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("routing_suffix=", &ext::LEFDEFReaderOptions::set_routing_suffix, gsi::arg ("suffix"), gsi::method ("routing_suffix=", &db::LEFDEFReaderOptions::set_routing_suffix, gsi::arg ("suffix"),
"@brief Sets the routing layer name suffix.\n" "@brief Sets the routing layer name suffix.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("routing_datatype", &ext::LEFDEFReaderOptions::routing_datatype, gsi::method ("routing_datatype", &db::LEFDEFReaderOptions::routing_datatype,
"@brief Gets the routing layer datatype value.\n" "@brief Gets the routing layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("routing_datatype=", &ext::LEFDEFReaderOptions::set_routing_datatype, gsi::arg ("datatype"), gsi::method ("routing_datatype=", &db::LEFDEFReaderOptions::set_routing_datatype, gsi::arg ("datatype"),
"@brief Sets the routing layer datatype value.\n" "@brief Sets the routing layer datatype value.\n"
"See \\produce_via_geometry for details about the layer production rules." "See \\produce_via_geometry for details about the layer production rules."
) + ) +
gsi::method ("lef_files", &ext::LEFDEFReaderOptions::lef_files, gsi::method ("lef_files", &db::LEFDEFReaderOptions::lef_files,
"@brief Gets the list technology LEF files to additionally import\n" "@brief Gets the list technology LEF files to additionally import\n"
"Returns a list of path names for technology LEF files to read in addition to the primary file. " "Returns a list of path names for technology LEF files to read in addition to the primary file. "
"Relative paths are resolved relative to the file to read.\n" "Relative paths are resolved relative to the file to read.\n"
"\n" "\n"
"The setter for this property is \\lef_files=." "The setter for this property is \\lef_files=."
) + ) +
gsi::method ("lef_files=", &ext::LEFDEFReaderOptions::set_lef_files, gsi::method ("lef_files=", &db::LEFDEFReaderOptions::set_lef_files,
"@brief Sets the list technology LEF files to additionally import\n" "@brief Sets the list technology LEF files to additionally import\n"
"See \\lef_files for details." "See \\lef_files for details."
), ),

View File

@ -21,10 +21,10 @@
*/ */
#include "extLEFImporter.h" #include "dbLEFImporter.h"
#include "extDEFImporter.h" #include "dbDEFImporter.h"
#include "extLEFDEFImportDialogs.h"
#include "layLEFDEFImportDialogs.h"
#include "layPlugin.h" #include "layPlugin.h"
#include "layMainWindow.h" #include "layMainWindow.h"
#include "layFileDialog.h" #include "layFileDialog.h"
@ -36,7 +36,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QApplication> #include <QApplication>
namespace ext namespace lay
{ {
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
@ -69,8 +69,8 @@ public:
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{ {
lay::PluginDeclaration::get_menu_entries (menu_entries); lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::MenuEntry ("ext::import_lef", "import_lef:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("LEF")))); menu_entries.push_back (lay::MenuEntry ("db::import_lef", "import_lef:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("LEF"))));
menu_entries.push_back (lay::MenuEntry ("ext::import_def", "import_def:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("DEF/LEF")))); menu_entries.push_back (lay::MenuEntry ("db::import_def", "import_def:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("DEF/LEF"))));
} }
virtual bool configure (const std::string &name, const std::string &value) virtual bool configure (const std::string &name, const std::string &value)
@ -93,9 +93,9 @@ public:
virtual bool menu_activated (const std::string &symbol) const virtual bool menu_activated (const std::string &symbol) const
{ {
if (symbol == "ext::import_lef" || symbol == "ext::import_def") { if (symbol == "db::import_lef" || symbol == "db::import_def") {
bool import_lef = (symbol == "ext::import_lef"); bool import_lef = (symbol == "db::import_lef");
LEFDEFImportData data; LEFDEFImportData data;
try { try {
@ -132,15 +132,15 @@ public:
tech_name.clear (); // use default technology tech_name.clear (); // use default technology
} }
const lay::Technology *tech = lay::Technologies::instance ()->technology_by_name (tech_name); const lay::Technology *tech = lay::Technologies::instance ()->technology_by_name (tech_name);
ext::LEFDEFReaderOptions options; db::LEFDEFReaderOptions options;
if (tech) { if (tech) {
const ext::LEFDEFReaderOptions *tech_options = dynamic_cast<const ext::LEFDEFReaderOptions *>(tech->load_layout_options ().get_options ("LEFDEF")); const db::LEFDEFReaderOptions *tech_options = dynamic_cast<const db::LEFDEFReaderOptions *>(tech->load_layout_options ().get_options ("LEFDEF"));
if (tech_options) { if (tech_options) {
options = *tech_options; options = *tech_options;
} }
} }
ext::LEFDEFLayerDelegate layers (&options); db::LEFDEFLayerDelegate layers (&options);
layers.prepare (*layout); layers.prepare (*layout);
layout->dbu (options.dbu ()); layout->dbu (options.dbu ());
@ -148,7 +148,7 @@ public:
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading LEF file"))); tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading LEF file")));
ext::LEFImporter importer; db::LEFImporter importer;
for (std::vector<std::string>::const_iterator l = options.begin_lef_files (); l != options.end_lef_files (); ++l) { for (std::vector<std::string>::const_iterator l = options.begin_lef_files (); l != options.end_lef_files (); ++l) {
tl::InputStream lef_stream (*l); tl::InputStream lef_stream (*l);
@ -163,7 +163,7 @@ public:
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading DEF file"))); tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading DEF file")));
DEFImporter importer; db::DEFImporter importer;
QFileInfo def_fi (tl::to_qstring (data.file)); QFileInfo def_fi (tl::to_qstring (data.file));
@ -219,7 +219,7 @@ private:
std::string m_def_spec; std::string m_def_spec;
}; };
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new ext::LEFDEFImportPluginDeclaration (), 1400, "ext::LEFDEFImportPlugin"); static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new lay::LEFDEFImportPluginDeclaration (), 1400, "db::LEFDEFImportPlugin");
} }

View File

@ -21,10 +21,11 @@
*/ */
#include "extLEFDEFImportDialogs.h" #include "dbLEFDEFImporter.h"
#include "extLEFDEFImporter.h"
#include "tlExceptions.h" #include "tlExceptions.h"
#include "layLEFDEFImportDialogs.h"
#include "layLoadLayoutOptionsDialog.h" #include "layLoadLayoutOptionsDialog.h"
#include "layQtTools.h" #include "layQtTools.h"
#include "layMainWindow.h" #include "layMainWindow.h"
@ -32,7 +33,7 @@
#include <QFileDialog> #include <QFileDialog>
namespace ext namespace lay
{ {
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
@ -366,7 +367,7 @@ LEFDEFReaderOptionsEditor::LEFDEFReaderOptionsEditor (QWidget *parent)
void void
LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, const lay::Technology * /*tech*/) LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, const lay::Technology * /*tech*/)
{ {
LEFDEFReaderOptions *data = dynamic_cast<LEFDEFReaderOptions *> (options); db::LEFDEFReaderOptions *data = dynamic_cast<db::LEFDEFReaderOptions *> (options);
if (! data) { if (! data) {
return; return;
} }
@ -437,8 +438,8 @@ LEFDEFReaderOptionsEditor::commit (db::FormatSpecificReaderOptions *options, con
void void
LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options, const lay::Technology *tech) LEFDEFReaderOptionsEditor::setup (const db::FormatSpecificReaderOptions *options, const lay::Technology *tech)
{ {
static LEFDEFReaderOptions empty; static db::LEFDEFReaderOptions empty;
const LEFDEFReaderOptions *data = dynamic_cast<const LEFDEFReaderOptions *> (options); const db::LEFDEFReaderOptions *data = dynamic_cast<const db::LEFDEFReaderOptions *> (options);
if (! data) { if (! data) {
data = &empty; data = &empty;
} }

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extLEFImportDialog #ifndef HDR_dbLEFImportDialog
#define HDR_extLEFImportDialog #define HDR_dbLEFImportDialog
#include "layCommon.h" #include "layCommon.h"
#include "layTechnology.h" #include "layTechnology.h"
@ -33,7 +33,7 @@
#include <QDialog> #include <QDialog>
namespace ext namespace lay
{ {
/** /**

View File

@ -23,21 +23,23 @@
#include "tlTimer.h" #include "tlTimer.h"
#include "tlStream.h" #include "tlStream.h"
#include "dbReader.h" #include "dbReader.h"
#include "dbStream.h" #include "dbStream.h"
#include "dbLEFImporter.h"
#include "dbDEFImporter.h"
#include "dbLEFDEFImporter.h"
#include "layPlugin.h" #include "layPlugin.h"
#include "layStream.h" #include "layStream.h"
#include "gsiDecl.h" #include "layLEFDEFImportDialogs.h"
#include "extLEFDEFImportDialogs.h" #include "gsiDecl.h"
#include "extLEFImporter.h"
#include "extDEFImporter.h"
#include "extLEFDEFImporter.h"
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
namespace ext namespace db
{ {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@ -125,14 +127,14 @@ private:
const db::LayerMap &read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &options, bool import_lef) throw (tl::Exception) const db::LayerMap &read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &options, bool import_lef) throw (tl::Exception)
{ {
const ext::LEFDEFReaderOptions *lefdef_options = dynamic_cast<const ext::LEFDEFReaderOptions *> (options.get_options (format ())); const db::LEFDEFReaderOptions *lefdef_options = dynamic_cast<const db::LEFDEFReaderOptions *> (options.get_options (format ()));
static ext::LEFDEFReaderOptions default_options; static db::LEFDEFReaderOptions default_options;
if (! lefdef_options) { if (! lefdef_options) {
lefdef_options = &default_options; lefdef_options = &default_options;
} }
// Take the layer map and the "read all layers" flag from the reader options - hence we override the // Take the layer map and the "read all layers" flag from the reader options - hence we override the
ext::LEFDEFLayerDelegate layers (lefdef_options); db::LEFDEFLayerDelegate layers (lefdef_options);
layers.prepare (layout); layers.prepare (layout);
layout.dbu (lefdef_options->dbu ()); layout.dbu (lefdef_options->dbu ());
@ -140,7 +142,7 @@ private:
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading LEF file"))); tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Reading LEF file")));
ext::LEFImporter importer; db::LEFImporter importer;
for (std::vector<std::string>::const_iterator l = lefdef_options->begin_lef_files (); l != lefdef_options->end_lef_files (); ++l) { for (std::vector<std::string>::const_iterator l = lefdef_options->begin_lef_files (); l != lefdef_options->end_lef_files (); ++l) {
@ -255,7 +257,7 @@ public:
lay::StreamReaderOptionsPage *format_specific_options_page (QWidget *parent) const lay::StreamReaderOptionsPage *format_specific_options_page (QWidget *parent) const
{ {
return new LEFDEFReaderOptionsEditor (parent); return new lay::LEFDEFReaderOptionsEditor (parent);
} }
db::FormatSpecificReaderOptions *create_specific_options () const db::FormatSpecificReaderOptions *create_specific_options () const

View File

@ -13,12 +13,12 @@ LIBS += -L$$DESTDIR/../db_plugins -llefdef
} }
HEADERS = \ HEADERS = \
extLEFDEFImportDialogs.h \ layLEFDEFImportDialogs.h
SOURCES = \ SOURCES = \
extLEFDEFImport.cc \ layLEFDEFPlugin.cc \
extLEFDEFImportDialogs.cc \ layLEFDEFImportDialogs.cc \
extLEFDEFPlugin.cc \ layLEFDEFImport.cc
FORMS = \ FORMS = \
LEFDEFImportOptionsDialog.ui \ LEFDEFImportOptionsDialog.ui \

View File

@ -23,8 +23,8 @@
#include "dbLayoutDiff.h" #include "dbLayoutDiff.h"
#include "dbWriter.h" #include "dbWriter.h"
#include "extDEFImporter.h" #include "dbDEFImporter.h"
#include "extLEFImporter.h" #include "dbLEFImporter.h"
#include "tlUnitTest.h" #include "tlUnitTest.h"
@ -33,7 +33,7 @@
static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au) static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au)
{ {
ext::LEFDEFReaderOptions tc; db::LEFDEFReaderOptions tc;
tc.set_via_geometry_datatype (0); tc.set_via_geometry_datatype (0);
tc.set_via_geometry_suffix (""); tc.set_via_geometry_suffix ("");
tc.set_pins_datatype (2); tc.set_pins_datatype (2);
@ -46,7 +46,7 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
tc.set_labels_suffix (".LABEL"); tc.set_labels_suffix (".LABEL");
tc.set_blockages_datatype (4); tc.set_blockages_datatype (4);
tc.set_blockages_suffix (".BLK"); tc.set_blockages_suffix (".BLK");
ext::LEFDEFLayerDelegate ld (&tc); db::LEFDEFLayerDelegate ld (&tc);
db::Manager m; db::Manager m;
db::Layout layout (&m), layout2 (&m), layout_au (&m); db::Layout layout (&m), layout2 (&m), layout_au (&m);
@ -55,7 +55,7 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
ld.prepare (layout); ld.prepare (layout);
ext::DEFImporter imp; db::DEFImporter imp;
while (! ex.at_end ()) { while (! ex.at_end ()) {

View File

@ -6,7 +6,7 @@ TARGET = lefdef_tests
include($$PWD/../../../../lib_ut.pri) include($$PWD/../../../../lib_ut.pri)
SOURCES = \ SOURCES = \
extLEFDEFImport.cc \ dbLEFDEFImport.cc
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin

View File

@ -21,9 +21,9 @@
*/ */
#include "extGerberDrillFileReader.h" #include "dbGerberDrillFileReader.h"
namespace ext namespace db
{ {
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extGerberDrillFileReader #ifndef HDR_dbGerberDrillFileReader
#define HDR_extGerberDrillFileReader #define HDR_dbGerberDrillFileReader
#include "tlStream.h" #include "tlStream.h"
#include "tlString.h" #include "tlString.h"
@ -30,13 +30,13 @@
#include "dbTrans.h" #include "dbTrans.h"
#include "dbPolygon.h" #include "dbPolygon.h"
#include "dbEdgeProcessor.h" #include "dbEdgeProcessor.h"
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
namespace ext namespace db
{ {
struct DrillHoleDescriptor struct DrillHoleDescriptor

View File

@ -21,9 +21,9 @@
*/ */
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include "extGerberDrillFileReader.h" #include "dbGerberDrillFileReader.h"
#include "extRS274XReader.h" #include "dbRS274XReader.h"
#include "tlStream.h" #include "tlStream.h"
#include "tlString.h" #include "tlString.h"
#include "tlString.h" #include "tlString.h"
@ -35,7 +35,7 @@
#include <cmath> #include <cmath>
#include <cctype> #include <cctype>
namespace ext namespace db
{ {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -517,11 +517,11 @@ GerberFile::layers_string () const
// Implementation of GerberImporter // Implementation of GerberImporter
// TODO: generalize this: // TODO: generalize this:
std::vector <tl::shared_ptr<ext::GerberFileReader> > get_readers () std::vector <tl::shared_ptr<db::GerberFileReader> > get_readers ()
{ {
std::vector <tl::shared_ptr<ext::GerberFileReader> > readers; std::vector <tl::shared_ptr<db::GerberFileReader> > readers;
readers.push_back (new ext::GerberDrillFileReader ()); readers.push_back (new db::GerberDrillFileReader ());
readers.push_back (new ext::RS274XReader ()); readers.push_back (new db::RS274XReader ());
return readers; return readers;
} }
@ -570,10 +570,10 @@ GerberImporter::scan (tl::TextInputStream &stream)
{ {
try { try {
std::vector <tl::shared_ptr<ext::GerberFileReader> > readers = get_readers (); std::vector <tl::shared_ptr<db::GerberFileReader> > readers = get_readers ();
// determine the reader to use: // determine the reader to use:
for (std::vector <tl::shared_ptr<ext::GerberFileReader> >::iterator r = readers.begin (); r != readers.end (); ++r) { for (std::vector <tl::shared_ptr<db::GerberFileReader> >::iterator r = readers.begin (); r != readers.end (); ++r) {
stream.reset (); stream.reset ();
if ((*r)->accepts (stream)) { if ((*r)->accepts (stream)) {
return (*r)->scan (stream); return (*r)->scan (stream);
@ -746,7 +746,7 @@ GerberImporter::do_load_project (tl::TextInputStream &stream)
l.test ("file"); l.test ("file");
ext::GerberFile file; db::GerberFile file;
std::string fn; std::string fn;
l.read_word_or_quoted (fn, "%!.:/\\+-,=_$"); l.read_word_or_quoted (fn, "%!.:/\\+-,=_$");
@ -840,7 +840,7 @@ GerberImporter::save_project (std::ostream &stream)
stream << "layer-styles=" << tl::to_quoted_string (m_layer_styles) << std::endl; stream << "layer-styles=" << tl::to_quoted_string (m_layer_styles) << std::endl;
} }
for (std::vector<ext::GerberFile>::iterator file = m_files.begin (); file != m_files.end (); ++file) { for (std::vector<db::GerberFile>::iterator file = m_files.begin (); file != m_files.end (); ++file) {
stream << "file " << tl::to_quoted_string (file->filename ()); stream << "file " << tl::to_quoted_string (file->filename ());
for (std::vector <db::LayerProperties>::const_iterator ls = file->layer_specs ().begin (); ls != file->layer_specs ().end (); ++ls) { for (std::vector <db::LayerProperties>::const_iterator ls = file->layer_specs ().begin (); ls != file->layer_specs ().end (); ++ls) {
@ -959,7 +959,7 @@ GerberImporter::do_read (db::Layout &layout, db::cell_index_type cell_index)
std::string format (m_format_string); std::string format (m_format_string);
for (std::vector<ext::GerberFile>::iterator file = m_files.begin (); file != m_files.end (); ++file) { for (std::vector<db::GerberFile>::iterator file = m_files.begin (); file != m_files.end (); ++file) {
++progress; ++progress;
@ -987,11 +987,11 @@ GerberImporter::do_read (db::Layout &layout, db::cell_index_type cell_index)
tl::InputStream input_file (tl::to_string (fi.absoluteFilePath ())); tl::InputStream input_file (tl::to_string (fi.absoluteFilePath ()));
tl::TextInputStream stream (input_file); tl::TextInputStream stream (input_file);
std::vector <tl::shared_ptr<ext::GerberFileReader> > readers = get_readers (); std::vector <tl::shared_ptr<db::GerberFileReader> > readers = get_readers ();
// determine the reader to use: // determine the reader to use:
ext::GerberFileReader *reader = 0; db::GerberFileReader *reader = 0;
for (std::vector <tl::shared_ptr<ext::GerberFileReader> >::iterator r = readers.begin (); r != readers.end (); ++r) { for (std::vector <tl::shared_ptr<db::GerberFileReader> >::iterator r = readers.begin (); r != readers.end (); ++r) {
stream.reset (); stream.reset ();
if ((*r)->accepts (stream)) { if ((*r)->accepts (stream)) {
reader = r->operator-> (); reader = r->operator-> ();

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extGerberImporter #ifndef HDR_dbGerberImporter
#define HDR_extGerberImporter #define HDR_dbGerberImporter
#include "dbCommon.h" #include "dbCommon.h"
@ -45,7 +45,7 @@ namespace lay
class LayoutView; class LayoutView;
} }
namespace ext namespace db
{ {
/** /**
@ -1016,7 +1016,7 @@ public:
/** /**
* @brief Add a file specification * @brief Add a file specification
*/ */
void add_file (const ext::GerberFile &file) void add_file (const db::GerberFile &file)
{ {
m_files.push_back (file); m_files.push_back (file);
} }
@ -1024,7 +1024,7 @@ public:
/** /**
* @brief Get the files: begin iterator * @brief Get the files: begin iterator
*/ */
std::vector<ext::GerberFile>::const_iterator begin_files () const std::vector<db::GerberFile>::const_iterator begin_files () const
{ {
return m_files.begin (); return m_files.begin ();
} }
@ -1032,7 +1032,7 @@ public:
/** /**
* @brief Get the files: end iterator * @brief Get the files: end iterator
*/ */
std::vector<ext::GerberFile>::const_iterator end_files () const std::vector<db::GerberFile>::const_iterator end_files () const
{ {
return m_files.end (); return m_files.end ();
} }
@ -1049,7 +1049,7 @@ private:
std::string m_dir; std::string m_dir;
db::DCplxTrans m_global_trans; db::DCplxTrans m_global_trans;
std::vector <std::pair <db::DPoint, db::DPoint> > m_reference_points; std::vector <std::pair <db::DPoint, db::DPoint> > m_reference_points;
std::vector <ext::GerberFile> m_files; std::vector <db::GerberFile> m_files;
void do_read (db::Layout &layout, db::cell_index_type cell_index); void do_read (db::Layout &layout, db::cell_index_type cell_index);
void do_load_project (tl::TextInputStream &stream); void do_load_project (tl::TextInputStream &stream);

View File

@ -21,11 +21,11 @@
*/ */
#include "extRS274XApertures.h" #include "dbRS274XApertures.h"
#include "extRS274XReader.h" #include "dbRS274XReader.h"
#include "dbPolygonTools.h" #include "dbPolygonTools.h"
namespace ext namespace db
{ {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -320,7 +320,7 @@ RS274XCircleAperture::do_produce_linear (const db::DPoint &from, const db::DPoin
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// RS274XRectAperture implementation // RS274XRectAperture implementation
RS274XRectAperture::RS274XRectAperture (ext::RS274XReader &reader, tl::Extractor &ex) RS274XRectAperture::RS274XRectAperture (db::RS274XReader &reader, tl::Extractor &ex)
: m_dx (0.0), m_dy (0.0), m_hx (0.0), m_hy (0.0) : m_dx (0.0), m_dy (0.0), m_hx (0.0), m_hy (0.0)
{ {
ex.expect(","); ex.expect(",");
@ -378,7 +378,7 @@ RS274XRectAperture::do_produce_linear (const db::DPoint & /*from*/, const db::DP
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// RS274XOvalAperture implementation // RS274XOvalAperture implementation
RS274XOvalAperture::RS274XOvalAperture (ext::RS274XReader &reader, tl::Extractor &ex) RS274XOvalAperture::RS274XOvalAperture (db::RS274XReader &reader, tl::Extractor &ex)
: m_dx (0.0), m_dy (0.0), m_hx (0.0), m_hy (0.0) : m_dx (0.0), m_dy (0.0), m_hx (0.0), m_hy (0.0)
{ {
ex.expect(","); ex.expect(",");
@ -479,7 +479,7 @@ RS274XOvalAperture::do_produce_linear (const db::DPoint & /*from*/, const db::DP
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// RS274XRegularAperture implementation // RS274XRegularAperture implementation
RS274XRegularAperture::RS274XRegularAperture (ext::RS274XReader &reader, tl::Extractor &ex) RS274XRegularAperture::RS274XRegularAperture (db::RS274XReader &reader, tl::Extractor &ex)
: m_d (0.0), m_a (0.0), m_nsides (0), m_hx (0.0), m_hy (0.0) : m_d (0.0), m_a (0.0), m_nsides (0), m_hx (0.0), m_hy (0.0)
{ {
ex.expect(","); ex.expect(",");
@ -581,7 +581,7 @@ RS274XRegionAperture::do_produce_linear (const db::DPoint & /*from*/, const db::
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// RS274XMacroAperture implementation // RS274XMacroAperture implementation
RS274XMacroAperture::RS274XMacroAperture (ext::RS274XReader &reader, const std::string &name, const std::string &def, tl::Extractor &ex) RS274XMacroAperture::RS274XMacroAperture (db::RS274XReader &reader, const std::string &name, const std::string &def, tl::Extractor &ex)
: m_name (name), m_def (def), m_unit (1.0) : m_name (name), m_def (def), m_unit (1.0)
{ {
// use the unit at definition time, not at execution time // use the unit at definition time, not at execution time

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extRS274XApertures #ifndef HDR_dbRS274XApertures
#define HDR_extRS274XApertures #define HDR_dbRS274XApertures
#include "dbPoint.h" #include "dbPoint.h"
#include "dbPath.h" #include "dbPath.h"
@ -38,7 +38,7 @@ namespace db
class EdgeProcessor; class EdgeProcessor;
} }
namespace ext namespace db
{ {
class RS274XReader; class RS274XReader;

View File

@ -21,10 +21,10 @@
*/ */
#include "extRS274XReader.h" #include "dbRS274XReader.h"
#include "extRS274XApertures.h" #include "dbRS274XApertures.h"
namespace ext namespace db
{ {
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extRS274XReader #ifndef HDR_dbRS274XReader
#define HDR_extRS274XReader #define HDR_dbRS274XReader
#include "tlStream.h" #include "tlStream.h"
#include "tlString.h" #include "tlString.h"
@ -30,13 +30,13 @@
#include "dbTrans.h" #include "dbTrans.h"
#include "dbPolygon.h" #include "dbPolygon.h"
#include "dbEdgeProcessor.h" #include "dbEdgeProcessor.h"
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
namespace ext namespace db
{ {
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------

View File

@ -5,13 +5,13 @@ DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri) include($$PWD/../../../db_plugin.pri)
HEADERS = \ HEADERS = \
extGerberDrillFileReader.h \ dbGerberDrillFileReader.h \
extGerberImporter.h \ dbGerberImporter.h \
extRS274XApertures.h \ dbRS274XApertures.h \
extRS274XReader.h \ dbRS274XReader.h
SOURCES = \ SOURCES = \
extGerberDrillFileReader.cc \ dbGerberDrillFileReader.cc \
extGerberImporter.cc \ dbGerberImporter.cc \
extRS274XApertures.cc \ dbRS274XApertures.cc \
extRS274XReader.cc \ dbRS274XReader.cc

View File

@ -21,12 +21,12 @@
*/ */
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include "extGerberImportDialog.h" #include "dbRS274XReader.h"
#include "extRS274XReader.h"
#include "dbStream.h" #include "dbStream.h"
#include "layGerberImportDialog.h"
#include "layPlugin.h" #include "layPlugin.h"
#include "layFileDialog.h" #include "layFileDialog.h"
#include "layMainWindow.h" #include "layMainWindow.h"
@ -35,7 +35,7 @@
#include <QApplication> #include <QApplication>
namespace ext namespace lay
{ {
static const std::string cfg_pcb_import_spec ("pcb-import-spec"); static const std::string cfg_pcb_import_spec ("pcb-import-spec");
@ -63,11 +63,11 @@ public:
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{ {
lay::PluginDeclaration::get_menu_entries (menu_entries); lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::MenuEntry ("ext::import_gerber", "import_gerber_menu:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("Gerber PCB")), true)); menu_entries.push_back (lay::MenuEntry ("db::import_gerber", "import_gerber_menu:edit", "file_menu.import_menu.end", tl::to_string (QObject::tr ("Gerber PCB")), true));
menu_entries.push_back (lay::MenuEntry ("ext::import_gerber_new", "import_gerber_new:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("New Project")))); menu_entries.push_back (lay::MenuEntry ("db::import_gerber_new", "import_gerber_new:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("New Project"))));
menu_entries.push_back (lay::MenuEntry ("ext::import_gerber_new_free", "import_gerber_new_free:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("New Project - Free Layer Mapping")))); menu_entries.push_back (lay::MenuEntry ("db::import_gerber_new_free", "import_gerber_new_free:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("New Project - Free Layer Mapping"))));
menu_entries.push_back (lay::MenuEntry ("ext::import_gerber_open", "import_gerber_open:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("Open Project")))); menu_entries.push_back (lay::MenuEntry ("db::import_gerber_open", "import_gerber_open:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("Open Project"))));
menu_entries.push_back (lay::MenuEntry ("ext::import_gerber_recent", "import_gerber_recent:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("Recent Project")))); menu_entries.push_back (lay::MenuEntry ("db::import_gerber_recent", "import_gerber_recent:edit", "file_menu.import_menu.import_gerber_menu.end", tl::to_string (QObject::tr ("Recent Project"))));
} }
virtual bool configure (const std::string &name, const std::string &value) virtual bool configure (const std::string &name, const std::string &value)
@ -87,10 +87,10 @@ public:
virtual bool menu_activated (const std::string &symbol) const virtual bool menu_activated (const std::string &symbol) const
{ {
if (symbol == "ext::import_gerber_recent" || if (symbol == "db::import_gerber_recent" ||
symbol == "ext::import_gerber_new_free" || symbol == "db::import_gerber_new_free" ||
symbol == "ext::import_gerber_new" || symbol == "db::import_gerber_new" ||
symbol == "ext::import_gerber_open") { symbol == "db::import_gerber_open") {
GerberImportData data; GerberImportData data;
try { try {
@ -99,17 +99,17 @@ public:
data = GerberImportData (); data = GerberImportData ();
} }
if (symbol == "ext::import_gerber_new_free") { if (symbol == "db::import_gerber_new_free") {
data.reset (); data.reset ();
data.free_layer_mapping = true; data.free_layer_mapping = true;
} else if (symbol == "ext::import_gerber_new") { } else if (symbol == "db::import_gerber_new") {
data.reset (); data.reset ();
data.free_layer_mapping = false; data.free_layer_mapping = false;
} else if (symbol == "ext::import_gerber_open") { } else if (symbol == "db::import_gerber_open") {
// Get the name of the file to open // Get the name of the file to open
lay::FileDialog open_dialog (QApplication::activeWindow (), tl::to_string (QObject::tr ("Gerber Import Project File")), tl::to_string (QObject::tr ("PCB project file (*.pcb);;All files (*)"))); lay::FileDialog open_dialog (QApplication::activeWindow (), tl::to_string (QObject::tr ("Gerber Import Project File")), tl::to_string (QObject::tr ("PCB project file (*.pcb);;All files (*)")));
@ -128,7 +128,7 @@ public:
lay::PluginRoot *config_root = lay::PluginRoot::instance (); lay::PluginRoot *config_root = lay::PluginRoot::instance ();
GerberImportDialog dialog (QApplication::activeWindow (), &data); GerberImportDialog dialog (QApplication::activeWindow (), &data);
ext::GerberImporter importer; db::GerberImporter importer;
bool ok = false; bool ok = false;
while (! ok && dialog.exec ()) { while (! ok && dialog.exec ()) {
@ -146,8 +146,8 @@ public:
config_root->config_end (); config_root->config_end ();
// TODO: discard layout when an error occurs // TODO: discard layout when an error occurs
if (data.mode != ext::GerberImportData::ModeIntoLayout) { if (data.mode != lay::GerberImportData::ModeIntoLayout) {
lay::MainWindow::instance ()->create_layout (data.mode == ext::GerberImportData::ModeSamePanel ? 2 : 1); lay::MainWindow::instance ()->create_layout (data.mode == lay::GerberImportData::ModeSamePanel ? 2 : 1);
} }
lay::LayoutView *view = lay::LayoutView::current (); lay::LayoutView *view = lay::LayoutView::current ();
@ -156,7 +156,7 @@ public:
std::string lyp_file = data.get_layer_properties_file (); std::string lyp_file = data.get_layer_properties_file ();
if (data.mode == ext::GerberImportData::ModeIntoLayout) { if (data.mode == lay::GerberImportData::ModeIntoLayout) {
importer.read (cv->layout (), cv.cell_index ()); importer.read (cv->layout (), cv.cell_index ());
view->create_initial_layer_props (cv_index, lyp_file, true /*add missing*/); view->create_initial_layer_props (cv_index, lyp_file, true /*add missing*/);
@ -189,7 +189,7 @@ private:
std::string m_import_spec; std::string m_import_spec;
}; };
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new ext::GerberImportPluginDeclaration (), 1200, "ext::GerberImportPlugin"); static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new lay::GerberImportPluginDeclaration (), 1200, "db::GerberImportPlugin");
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Plugin for the stream reader // Plugin for the stream reader
@ -229,7 +229,7 @@ public:
data.load (m_stream); data.load (m_stream);
ext::GerberImporter importer; db::GerberImporter importer;
data.setup_importer (&importer); data.setup_importer (&importer);
importer.read (layout); importer.read (layout);

View File

@ -22,12 +22,12 @@
#include "ui_GerberImportDialog.h" #include "ui_GerberImportDialog.h"
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include "extGerberImportDialog.h"
#include "layFileDialog.h" #include "layFileDialog.h"
#include "layDialogs.h" #include "layDialogs.h"
#include "layConverters.h" #include "layConverters.h"
#include "layGerberImportDialog.h"
#include "tlExceptions.h" #include "tlExceptions.h"
#include "tlXMLParser.h" #include "tlXMLParser.h"
@ -39,7 +39,7 @@
#include <fstream> #include <fstream>
namespace ext namespace lay
{ {
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
@ -86,7 +86,7 @@ GerberImportData::get_layer_properties_file () const
} }
void void
GerberImportData::setup_importer (GerberImporter *importer) GerberImportData::setup_importer (db::GerberImporter *importer)
{ {
if (num_circle_points >= 4) { if (num_circle_points >= 4) {
importer->set_circle_points (num_circle_points); importer->set_circle_points (num_circle_points);
@ -107,7 +107,7 @@ GerberImportData::setup_importer (GerberImporter *importer)
if (! file->filename.empty ()) { if (! file->filename.empty ()) {
GerberFile file_spec; db::GerberFile file_spec;
file_spec.set_filename (file->filename); file_spec.set_filename (file->filename);
for (std::vector <int>::const_iterator i = file->layout_layers.begin (); i != file->layout_layers.end (); ++i) { for (std::vector <int>::const_iterator i = file->layout_layers.begin (); i != file->layout_layers.end (); ++i) {
@ -136,7 +136,7 @@ GerberImportData::setup_importer (GerberImporter *importer)
} }
if (n * 2 < layout_layers.size ()) { if (n * 2 < layout_layers.size ()) {
GerberFile file_spec; db::GerberFile file_spec;
file_spec.set_filename (file->filename); file_spec.set_filename (file->filename);
file_spec.add_layer_spec (layout_layers [n * 2]); file_spec.add_layer_spec (layout_layers [n * 2]);
importer->add_file (file_spec); importer->add_file (file_spec);
@ -159,7 +159,7 @@ GerberImportData::setup_importer (GerberImporter *importer)
nstart = std::distance (artwork_files.begin () + file->stop, artwork_files.end ()) - 1; nstart = std::distance (artwork_files.begin () + file->stop, artwork_files.end ()) - 1;
} }
GerberFile file_spec; db::GerberFile file_spec;
file_spec.set_filename (file->filename); file_spec.set_filename (file->filename);
for (size_t n = nstart; n < nstop; ++n) { for (size_t n = nstart; n < nstop; ++n) {
@ -343,7 +343,7 @@ GerberImportData::from_string (const std::string &s)
artwork_files.clear (); artwork_files.clear ();
while (! ex.test (";") && ! ex.at_end ()) { while (! ex.test (";") && ! ex.at_end ()) {
ex.test ("("); ex.test ("(");
artwork_files.push_back (ext::GerberArtworkFileDescriptor ()); artwork_files.push_back (lay::GerberArtworkFileDescriptor ());
ex.read_word_or_quoted (artwork_files.back ().filename); ex.read_word_or_quoted (artwork_files.back ().filename);
ex.test (")"); ex.test (")");
ex.test (","); ex.test (",");
@ -356,7 +356,7 @@ GerberImportData::from_string (const std::string &s)
drill_files.clear (); drill_files.clear ();
while (! ex.test (";") && ! ex.at_end ()) { while (! ex.test (";") && ! ex.at_end ()) {
ex.test ("("); ex.test ("(");
drill_files.push_back (ext::GerberDrillFileDescriptor ()); drill_files.push_back (lay::GerberDrillFileDescriptor ());
ex.read (drill_files.back ().start); ex.read (drill_files.back ().start);
ex.test (","); ex.test (",");
ex.read (drill_files.back ().stop); ex.read (drill_files.back ().stop);
@ -373,7 +373,7 @@ GerberImportData::from_string (const std::string &s)
free_files.clear (); free_files.clear ();
while (! ex.test (";") && ! ex.at_end ()) { while (! ex.test (";") && ! ex.at_end ()) {
ex.test ("("); ex.test ("(");
free_files.push_back (ext::GerberFreeFileDescriptor ()); free_files.push_back (lay::GerberFreeFileDescriptor ());
ex.read_word_or_quoted (free_files.back ().filename); ex.read_word_or_quoted (free_files.back ().filename);
ex.test (","); ex.test (",");
while (! ex.test (")") && ! ex.at_end ()) { while (! ex.test (")") && ! ex.at_end ()) {
@ -1343,7 +1343,7 @@ GerberImportDialog::layout_layer_double_clicked (QTreeWidgetItem *, int)
struct FilePositionCompare struct FilePositionCompare
{ {
bool operator() (const std::pair<ext::GerberMetaData, std::string> &a, const std::pair<ext::GerberMetaData, std::string> &b) bool operator() (const std::pair<db::GerberMetaData, std::string> &a, const std::pair<db::GerberMetaData, std::string> &b)
{ {
if ((a.first.cu_layer_number == 0) != (b.first.cu_layer_number == 0)) { if ((a.first.cu_layer_number == 0) != (b.first.cu_layer_number == 0)) {
return (a.first.cu_layer_number == 0) < (b.first.cu_layer_number == 0); return (a.first.cu_layer_number == 0) < (b.first.cu_layer_number == 0);
@ -1381,11 +1381,11 @@ GerberImportDialog::enter_page ()
filters << tl::to_qstring ("*.gbr"); filters << tl::to_qstring ("*.gbr");
filters << tl::to_qstring ("*.GBR"); filters << tl::to_qstring ("*.GBR");
std::vector<std::pair<ext::GerberMetaData, std::string> > files; std::vector<std::pair<db::GerberMetaData, std::string> > files;
QStringList entries = dir.entryList (filters); QStringList entries = dir.entryList (filters);
for (QStringList::const_iterator e = entries.begin (); e != entries.end (); ++e) { for (QStringList::const_iterator e = entries.begin (); e != entries.end (); ++e) {
ext::GerberMetaData data = ext::GerberImporter::scan (tl::to_string (dir.filePath (*e))); db::GerberMetaData data = db::GerberImporter::scan (tl::to_string (dir.filePath (*e)));
files.push_back (std::make_pair (data, tl::to_string (*e))); files.push_back (std::make_pair (data, tl::to_string (*e)));
} }
@ -1401,7 +1401,7 @@ GerberImportDialog::enter_page ()
mp_data->layout_layers.clear (); mp_data->layout_layers.clear ();
int min_layer = 0, max_layer = 0; int min_layer = 0, max_layer = 0;
for (std::vector<std::pair<ext::GerberMetaData, std::string> >::const_iterator f = files.begin (); f != files.end (); ++f) { for (std::vector<std::pair<db::GerberMetaData, std::string> >::const_iterator f = files.begin (); f != files.end (); ++f) {
if (f->first.cu_layer_number > 0) { if (f->first.cu_layer_number > 0) {
if (min_layer == 0 || min_layer > f->first.cu_layer_number) { if (min_layer == 0 || min_layer > f->first.cu_layer_number) {
min_layer = f->first.cu_layer_number; min_layer = f->first.cu_layer_number;
@ -1429,33 +1429,33 @@ GerberImportDialog::enter_page ()
int next_layer = max_layer * 2; int next_layer = max_layer * 2;
int hole_num = 0, profile_num = 0, legend_num = 0, solder_num = 0; int hole_num = 0, profile_num = 0, legend_num = 0, solder_num = 0;
for (std::vector<std::pair<ext::GerberMetaData, std::string> >::const_iterator f = files.begin (); f != files.end (); ++f) { for (std::vector<std::pair<db::GerberMetaData, std::string> >::const_iterator f = files.begin (); f != files.end (); ++f) {
mp_data->free_files.push_back (GerberFreeFileDescriptor ()); mp_data->free_files.push_back (GerberFreeFileDescriptor ());
mp_data->free_files.back ().filename = tl::to_string (f->second); mp_data->free_files.back ().filename = tl::to_string (f->second);
std::vector<int> layers; std::vector<int> layers;
if (f->first.function == ext::GerberMetaData::Copper) { if (f->first.function == db::GerberMetaData::Copper) {
if (l2l.find (f->first.cu_layer_number) != l2l.end ()) { if (l2l.find (f->first.cu_layer_number) != l2l.end ()) {
layers.push_back (l2l [f->first.cu_layer_number]); layers.push_back (l2l [f->first.cu_layer_number]);
} }
} else if (f->first.function == ext::GerberMetaData::PlatedHole) { } else if (f->first.function == db::GerberMetaData::PlatedHole) {
for (int l = std::min (f->first.from_cu, f->first.to_cu); l < std::max (f->first.from_cu, f->first.to_cu); ++l) { for (int l = std::min (f->first.from_cu, f->first.to_cu); l < std::max (f->first.from_cu, f->first.to_cu); ++l) {
if (l2v.find (l) != l2v.end ()) { if (l2v.find (l) != l2v.end ()) {
layers.push_back (l2v [l]); layers.push_back (l2v [l]);
} }
} }
} else if (f->first.function == ext::GerberMetaData::NonPlatedHole || f->first.function == ext::GerberMetaData::NonPlatedHole) { } else if (f->first.function == db::GerberMetaData::NonPlatedHole || f->first.function == db::GerberMetaData::NonPlatedHole) {
layers.push_back (int (mp_data->layout_layers.size ())); layers.push_back (int (mp_data->layout_layers.size ()));
mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Hole" + tl::to_string (++hole_num))); mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Hole" + tl::to_string (++hole_num)));
} else if (f->first.function == ext::GerberMetaData::Profile) { } else if (f->first.function == db::GerberMetaData::Profile) {
layers.push_back (int (mp_data->layout_layers.size ())); layers.push_back (int (mp_data->layout_layers.size ()));
mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Profile" + tl::to_string (++profile_num))); mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Profile" + tl::to_string (++profile_num)));
} else if (f->first.function == ext::GerberMetaData::Legend) { } else if (f->first.function == db::GerberMetaData::Legend) {
layers.push_back (int (mp_data->layout_layers.size ())); layers.push_back (int (mp_data->layout_layers.size ()));
mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Legend" + tl::to_string (++legend_num))); mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "Legend" + tl::to_string (++legend_num)));
} else if (f->first.function == ext::GerberMetaData::SolderMask) { } else if (f->first.function == db::GerberMetaData::SolderMask) {
layers.push_back (int (mp_data->layout_layers.size ())); layers.push_back (int (mp_data->layout_layers.size ()));
mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "SolderMask" + tl::to_string (++solder_num))); mp_data->layout_layers.push_back (db::LayerProperties (++next_layer, 0, "SolderMask" + tl::to_string (++solder_num)));
} }

View File

@ -21,8 +21,8 @@
*/ */
#ifndef HDR_extGerberImportDialog #ifndef HDR_dbGerberImportDialog
#define HDR_extGerberImportDialog #define HDR_dbGerberImportDialog
#include <QDialog> #include <QDialog>
#include <QAction> #include <QAction>
@ -52,10 +52,13 @@ namespace tl
class InputStream; class InputStream;
} }
namespace ext namespace db
{ {
class GerberImporter;
}
class GerberImporter; namespace lay
{
struct GerberArtworkFileDescriptor struct GerberArtworkFileDescriptor
{ {
@ -107,7 +110,7 @@ public:
std::string topcell_name; std::string topcell_name;
std::string get_layer_properties_file () const; std::string get_layer_properties_file () const;
void setup_importer (GerberImporter *importer); void setup_importer (db::GerberImporter *importer);
void reset (); void reset ();
void load (tl::InputStream &stream); void load (tl::InputStream &stream);
void load (const std::string &file); void load (const std::string &file);

View File

@ -13,11 +13,11 @@ LIBS += -L$$DESTDIR/../db_plugins -lpcb
} }
HEADERS = \ HEADERS = \
extGerberImportDialog.h \ layGerberImportDialog.h
SOURCES = \ SOURCES = \
extGerberImport.cc \ layGerberImport.cc \
extGerberImportDialog.cc \ layGerberImportDialog.cc
FORMS = \ FORMS = \
GerberImportDialog.ui \ GerberImportDialog.ui \

View File

@ -26,7 +26,7 @@
#include "dbLoadLayoutOptions.h" #include "dbLoadLayoutOptions.h"
#include "dbReader.h" #include "dbReader.h"
#include "dbTestSupport.h" #include "dbTestSupport.h"
#include "extGerberImporter.h" #include "dbGerberImporter.h"
#include "tlUnitTest.h" #include "tlUnitTest.h"
@ -53,102 +53,102 @@ static void run_test (tl::TestBase *_this, const char *dir)
TEST(0_Metadata) TEST(0_Metadata)
{ {
ext::GerberMetaData data; db::GerberMetaData data;
std::string fn; std::string fn;
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/1.gbr"; fn += "/testdata/pcb/metadata/1.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::Copper); EXPECT_EQ (data.function, db::GerberMetaData::Copper);
EXPECT_EQ (data.position, ext::GerberMetaData::Top); EXPECT_EQ (data.position, db::GerberMetaData::Top);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 1); EXPECT_EQ (data.cu_layer_number, 1);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/2.gbr"; fn += "/testdata/pcb/metadata/2.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::Copper); EXPECT_EQ (data.function, db::GerberMetaData::Copper);
EXPECT_EQ (data.position, ext::GerberMetaData::Bottom); EXPECT_EQ (data.position, db::GerberMetaData::Bottom);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 4); EXPECT_EQ (data.cu_layer_number, 4);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/3.gbr"; fn += "/testdata/pcb/metadata/3.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::Copper); EXPECT_EQ (data.function, db::GerberMetaData::Copper);
EXPECT_EQ (data.position, ext::GerberMetaData::Inner); EXPECT_EQ (data.position, db::GerberMetaData::Inner);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 2); EXPECT_EQ (data.cu_layer_number, 2);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/10.gbr"; fn += "/testdata/pcb/metadata/10.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::Legend); EXPECT_EQ (data.function, db::GerberMetaData::Legend);
EXPECT_EQ (data.position, ext::GerberMetaData::Top); EXPECT_EQ (data.position, db::GerberMetaData::Top);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 0); EXPECT_EQ (data.cu_layer_number, 0);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/11.gbr"; fn += "/testdata/pcb/metadata/11.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::SolderMask); EXPECT_EQ (data.function, db::GerberMetaData::SolderMask);
EXPECT_EQ (data.position, ext::GerberMetaData::Top); EXPECT_EQ (data.position, db::GerberMetaData::Top);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 0); EXPECT_EQ (data.cu_layer_number, 0);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/12.gbr"; fn += "/testdata/pcb/metadata/12.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::PlatedHole); EXPECT_EQ (data.function, db::GerberMetaData::PlatedHole);
EXPECT_EQ (data.position, ext::GerberMetaData::NoPosition); EXPECT_EQ (data.position, db::GerberMetaData::NoPosition);
EXPECT_EQ (data.from_cu, 1); EXPECT_EQ (data.from_cu, 1);
EXPECT_EQ (data.to_cu, 4); EXPECT_EQ (data.to_cu, 4);
EXPECT_EQ (data.cu_layer_number, 0); EXPECT_EQ (data.cu_layer_number, 0);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/13.gbr"; fn += "/testdata/pcb/metadata/13.gbr";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00"); EXPECT_EQ (data.creation_date, "2017-09-07T21:37;00+01:00");
EXPECT_EQ (data.generation_software, "KLayout,0.25"); EXPECT_EQ (data.generation_software, "KLayout,0.25");
EXPECT_EQ (data.function, ext::GerberMetaData::NonPlatedHole); EXPECT_EQ (data.function, db::GerberMetaData::NonPlatedHole);
EXPECT_EQ (data.position, ext::GerberMetaData::NoPosition); EXPECT_EQ (data.position, db::GerberMetaData::NoPosition);
EXPECT_EQ (data.from_cu, 1); EXPECT_EQ (data.from_cu, 1);
EXPECT_EQ (data.to_cu, 4); EXPECT_EQ (data.to_cu, 4);
EXPECT_EQ (data.cu_layer_number, 0); EXPECT_EQ (data.cu_layer_number, 0);
fn = tl::testsrc_private (); fn = tl::testsrc_private ();
fn += "/testdata/pcb/metadata/20.drl"; fn += "/testdata/pcb/metadata/20.drl";
data = ext::GerberImporter::scan (fn); data = db::GerberImporter::scan (fn);
EXPECT_EQ (data.creation_date, ""); EXPECT_EQ (data.creation_date, "");
EXPECT_EQ (data.generation_software, ""); EXPECT_EQ (data.generation_software, "");
EXPECT_EQ (data.function, ext::GerberMetaData::Hole); EXPECT_EQ (data.function, db::GerberMetaData::Hole);
EXPECT_EQ (data.position, ext::GerberMetaData::NoPosition); EXPECT_EQ (data.position, db::GerberMetaData::NoPosition);
EXPECT_EQ (data.from_cu, 0); EXPECT_EQ (data.from_cu, 0);
EXPECT_EQ (data.to_cu, 0); EXPECT_EQ (data.to_cu, 0);
EXPECT_EQ (data.cu_layer_number, 0); EXPECT_EQ (data.cu_layer_number, 0);

View File

@ -6,7 +6,7 @@ TARGET = pcb_tests
include($$PWD/../../../../lib_ut.pri) include($$PWD/../../../../lib_ut.pri)
SOURCES = \ SOURCES = \
extGerberImport.cc \ dbGerberImport.cc
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin