WIP: finished refactoring to plugins for CIF, DXF & OASIS too.

This commit is contained in:
Matthias Koefferlein 2018-06-13 22:23:27 +02:00
parent 9883ea5679
commit 5421f77e61
38 changed files with 1184 additions and 851 deletions

View File

@ -37,6 +37,9 @@ LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_lib -lklay
PLUGINPATH += \
$$PWD/../../../plugins/streamers/gds2/db_plugin \
$$PWD/../../../plugins/streamers/cif/db_plugin \
$$PWD/../../../plugins/streamers/oasis/db_plugin \
$$PWD/../../../plugins/streamers/dxf/db_plugin \
INCLUDEPATH += $$PLUGINPATH
DEPENDPATH += $$PLUGINPATH

View File

@ -23,6 +23,9 @@ LIBS += -L$$DESTDIR_UT -lklayout_bd -lklayout_db -lklayout_tl -lklayout_gsi
PLUGINPATH += \
$$PWD/../../plugins/streamers/gds2/db_plugin \
$$PWD/../../plugins/streamers/cif/db_plugin \
$$PWD/../../plugins/streamers/oasis/db_plugin \
$$PWD/../../plugins/streamers/dxf/db_plugin \
INCLUDEPATH += $$PLUGINPATH
DEPENDPATH += $$PLUGINPATH

View File

@ -17,15 +17,9 @@ SOURCES = \
dbCellHullGenerator.cc \
dbCellInst.cc \
dbCellMapping.cc \
dbCIF.cc \
dbCIFReader.cc \
dbCIFWriter.cc \
dbClipboard.cc \
dbClipboardData.cc \
dbClip.cc \
dbDXF.cc \
dbDXFReader.cc \
dbDXFWriter.cc \
dbEdge.cc \
dbEdgePair.cc \
dbEdgePairRelations.cc \
@ -33,7 +27,6 @@ SOURCES = \
dbEdgeProcessor.cc \
dbEdges.cc \
dbFillTool.cc \
dbForceLinkStreams.cc \
dbFuzzyCellMapping.cc \
dbGlyphs.cc \
dbHershey.cc \
@ -54,9 +47,6 @@ SOURCES = \
dbManager.cc \
dbMatrix.cc \
dbMemStatistics.cc \
dbOASIS.cc \
dbOASISReader.cc \
dbOASISWriter.cc \
dbObject.cc \
dbPath.cc \
dbPCellDeclaration.cc \
@ -138,15 +128,9 @@ HEADERS = \
dbCellHullGenerator.h \
dbCellInst.h \
dbCellMapping.h \
dbCIF.h \
dbCIFReader.h \
dbCIFWriter.h \
dbClipboardData.h \
dbClipboard.h \
dbClip.h \
dbDXF.h \
dbDXFReader.h \
dbDXFWriter.h \
dbEdge.h \
dbEdgePair.h \
dbEdgePairRelations.h \
@ -177,9 +161,6 @@ HEADERS = \
dbMatrix.h \
dbMemStatistics.h \
dbMetaInfo.h \
dbOASIS.h \
dbOASISReader.h \
dbOASISWriter.h \
dbObject.h \
dbObjectTag.h \
dbObjectWithProperties.h \

View File

@ -1,39 +0,0 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// since the stream readers are provided as plugins, we need to force linking
// of the objects by using the macros provided when we build tools from common.a.
#include "dbOASIS.h"
#include "dbCIF.h"
#include "dbDXF.h"
namespace db
{
FORCE_LINK_OASIS
FORCE_LINK_CIF
FORCE_LINK_DXF
}

View File

@ -25,7 +25,6 @@
#include "dbLayout.h"
#include "tlTimer.h"
#include "tlUnitTest.h"
#include "dbOASISReader.h"
#include "dbStatic.h"

View File

@ -15,9 +15,7 @@ SOURCES = \
dbCellGraphUtils.cc \
dbCellHullGenerator.cc \
dbCellMapping.cc \
dbCIFReader.cc \
dbClip.cc \
dbDXFReader.cc \
dbExpression.cc \
dbEdge.cc \
dbEdgePair.cc \
@ -34,9 +32,6 @@ SOURCES = \
dbLayoutQuery.cc \
dbLibraries.cc \
dbMatrix.cc \
dbOASISReader.cc \
dbOASISWriter2.cc \
dbOASISWriter.cc \
dbObject.cc \
dbPath.cc \
dbPCells.cc \

View File

@ -15,14 +15,10 @@ FORMS = \
BrowserPanel.ui \
BrowseShapesConfigPage.ui \
BrowseShapesForm.ui \
CIFReaderOptionPage.ui \
CIFWriterOptionPage.ui \
CellSelectionForm.ui \
ClearLayerModeDialog.ui \
ConfigurationDialog.ui \
CopyCellModeDialog.ui \
DXFReaderOptionPage.ui \
DXFWriterOptionPage.ui \
DeleteCellModeDialog.ui \
DuplicateLayerDialog.ui \
EditStipplesForm.ui \
@ -56,7 +52,6 @@ FORMS = \
NewCellPropertiesDialog.ui \
NewLayerPropertiesDialog.ui \
NewLayoutPropertiesDialog.ui \
OASISWriterOptionPage.ui \
OpenLayoutModeDialog.ui \
PropertiesDialog.ui \
RenameCellDialog.ui \
@ -101,8 +96,6 @@ SOURCES = \
layCellSelectionForm.cc \
layCellTreeModel.cc \
layCellView.cc \
layCIFReaderPlugin.cc \
layCIFWriterPlugin.cc \
layColorPalette.cc \
layConfigurationDialog.cc \
layConverters.cc \
@ -111,8 +104,6 @@ SOURCES = \
layDisplayState.cc \
layDitherPattern.cc \
layDrawing.cc \
layDXFReaderPlugin.cc \
layDXFWriterPlugin.cc \
layEditable.cc \
layEditStipplesForm.cc \
layEditStippleWidget.cc \
@ -134,7 +125,6 @@ SOURCES = \
layMarker.cc \
layMouseTracker.cc \
layMove.cc \
layOASISWriterPlugin.cc \
layObjectInstPath.cc \
layParsedLayerSource.cc \
layPlugin.cc \
@ -164,7 +154,6 @@ SOURCES = \
rdbMarkerBrowser.cc \
rdbMarkerBrowserDialog.cc \
rdbMarkerBrowserPage.cc \
layOASISReaderPlugin.cc \
layCommonReaderPlugin.cc \
layLineStyles.cc \
laySelectLineStyleForm.cc \
@ -193,8 +182,6 @@ HEADERS = \
layCellSelectionForm.h \
layCellTreeModel.h \
layCellView.h \
layCIFReaderPlugin.h \
layCIFWriterPlugin.h \
layColorPalette.h \
layConfigurationDialog.h \
layConverters.h \
@ -203,8 +190,6 @@ HEADERS = \
layDisplayState.h \
layDitherPattern.h \
layDrawing.h \
layDXFReaderPlugin.h \
layDXFWriterPlugin.h \
layEditable.h \
layEditStipplesForm.h \
layEditStippleWidget.h \
@ -226,7 +211,6 @@ HEADERS = \
layMarker.h \
layMouseTracker.h \
layMove.h \
layOASISWriterPlugin.h \
layObjectInstPath.h \
layParsedLayerSource.h \
layPlugin.h \
@ -256,7 +240,6 @@ HEADERS = \
rdbMarkerBrowserDialog.h \
rdbMarkerBrowser.h \
rdbMarkerBrowserPage.h \
layOASISReaderPlugin.h \
layCommonReaderPlugin.h \
layLineStyles.h \
laySelectLineStyleForm.h \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -0,0 +1,16 @@
TARGET = cif
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
dbCIF.h \
dbCIFReader.h \
dbCIFWriter.h \
SOURCES = \
dbCIF.cc \
dbCIFReader.cc \
dbCIFWriter.cc \
gsiDeclDbCIF.cc \

View File

@ -0,0 +1,233 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "dbCIF.h"
#include "dbCIFReader.h"
#include "dbCIFWriter.h"
#include "dbLoadLayoutOptions.h"
#include "dbSaveLayoutOptions.h"
#include "gsiDecl.h"
namespace gsi
{
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_cif_wire_mode (db::LoadLayoutOptions *options, unsigned int n)
{
options->get_options<db::CIFReaderOptions> ().wire_mode = n;
}
static unsigned int get_cif_wire_mode (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().wire_mode;
}
static void set_cif_dbu (db::LoadLayoutOptions *options, double dbu)
{
options->get_options<db::CIFReaderOptions> ().dbu = dbu;
}
static double get_cif_dbu (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().dbu;
}
static void set_layer_map (db::LoadLayoutOptions *options, const db::LayerMap &lm, bool f)
{
options->get_options<db::CIFReaderOptions> ().layer_map = lm;
options->get_options<db::CIFReaderOptions> ().create_other_layers = f;
}
static db::LayerMap &get_layer_map (db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().layer_map;
}
static void select_all_layers (db::LoadLayoutOptions *options)
{
options->get_options<db::CIFReaderOptions> ().layer_map = db::LayerMap ();
options->get_options<db::CIFReaderOptions> ().create_other_layers = true;
}
static bool create_other_layers (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().create_other_layers;
}
static void set_create_other_layers (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::CIFReaderOptions> ().create_other_layers = l;
}
static bool keep_layer_names (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().keep_layer_names;
}
static void set_keep_layer_names (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::CIFReaderOptions> ().keep_layer_names = l;
}
// extend lay::LoadLayoutOptions with the CIF options
static
gsi::ClassExt<db::LoadLayoutOptions> cif_reader_options (
gsi::method_ext ("cif_set_layer_map", &set_layer_map, gsi::arg ("map"), gsi::arg ("create_other_layers"),
"@brief Sets the layer map\n"
"This sets a layer mapping for the reader. The \"create_other_layers\" specifies whether to create layers that are not "
"in the mapping and automatically assign layers to them.\n"
"@param map The layer map to set."
"@param create_other_layers The flag telling whether other layer should be created also. Set to false if just the layers in the mapping table should be read.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_select_all_layers", &select_all_layers,
"@brief Selects all layers and disables the layer map\n"
"\n"
"This disables any layer map and enables reading of all layers.\n"
"New layers will be created when required.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_layer_map", &get_layer_map,
"@brief Gets the layer map\n"
"@return A reference to the layer map\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_create_other_layers?", &create_other_layers,
"@brief Gets a value indicating whether other layers shall be created\n"
"@return True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_create_other_layers=", &set_create_other_layers, gsi::arg ("create"),
"@brief Specifies whether other layers shall be created\n"
"@param create True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_keep_layer_names?", &keep_layer_names,
"@brief Gets a value indicating whether layer names are kept\n"
"@return True, if layer names are kept.\n"
"\n"
"When set to true, no attempt is made to translate "
"layer names to GDS layer/datatype numbers. If set to false (the default), a layer named \"L2D15\" will be translated "
"to GDS layer 2, datatype 15.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("cif_keep_layer_names=", &set_keep_layer_names, gsi::arg ("keep"),
"@brief Gets a value indicating whether layer names are kept\n"
"@param keep True, if layer names are to be kept.\n"
"\n"
"See \\cif_keep_layer_names? for a description of this property.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("cif_wire_mode=", &set_cif_wire_mode,
"@brief How to read 'W' objects\n"
"\n"
"This property specifies how to read 'W' (wire) objects.\n"
"Allowed values are 0 (as square ended paths), 1 (as flush ended paths), 2 (as round paths)\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("cif_wire_mode", &get_cif_wire_mode,
"@brief Specifies how to read 'W' objects\n"
"See \\cif_wire_mode= method for a description of this mode."
"\nThis property has been added in version 0.21 and was renamed to cif_wire_mode in 0.25.\n"
) +
gsi::method_ext ("cif_dbu=", &set_cif_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("cif_dbu", &get_cif_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"See \\cif_dbu= method for a description of this property."
"\nThis property has been added in version 0.21.\n"
),
""
);
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_cif_dummy_calls (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::CIFWriterOptions> ().dummy_calls = f;
}
static bool get_cif_dummy_calls (const db::SaveLayoutOptions *options)
{
return options->get_options<db::CIFWriterOptions> ().dummy_calls;
}
static void set_cif_blank_separator (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::CIFWriterOptions> ().blank_separator = f;
}
static bool get_cif_blank_separator (const db::SaveLayoutOptions *options)
{
return options->get_options<db::CIFWriterOptions> ().blank_separator;
}
// extend lay::SaveLayoutOptions with the GDS2 options
static
gsi::ClassExt<db::SaveLayoutOptions> cif_writer_options (
gsi::method_ext ("cif_dummy_calls=", &set_cif_dummy_calls,
"@brief Sets a flag indicating whether dummy calls shall be written\n"
"If this property is set to true, dummy calls will be written in the top level entity "
"of the CIF file calling every top cell.\n"
"This option is useful for enhanced compatibility with other tools.\n"
"\nThis property has been added in version 0.23.10.\n"
) +
gsi::method_ext ("cif_dummy_calls?|#cif_dummy_calls", &get_cif_dummy_calls,
"@brief Gets a flag indicating whether dummy calls shall be written\n"
"See \\cif_dummy_calls= method for a description of that property."
"\nThis property has been added in version 0.23.10.\n"
"\nThe predicate version (cif_blank_separator?) has been added in version 0.25.1.\n"
) +
gsi::method_ext ("cif_blank_separator=", &set_cif_blank_separator,
"@brief Sets a flag indicating whether blanks shall be used as x/y separator characters\n"
"If this property is set to true, the x and y coordinates are separated with blank characters "
"rather than comma characters."
"\nThis property has been added in version 0.23.10.\n"
) +
gsi::method_ext ("cif_blank_separator?|#cif_blank_separator", &get_cif_blank_separator,
"@brief Gets a flag indicating whether blanks shall be used as x/y separator characters\n"
"See \\cif_blank_separator= method for a description of that property."
"\nThis property has been added in version 0.23.10.\n"
"\nThe predicate version (cif_blank_separator?) has been added in version 0.25.1.\n"
),
""
);
}

View File

@ -20,8 +20,6 @@
*/
#include "dbCIF.h"
#include "dbCIFReader.h"
#include "dbLoadLayoutOptions.h"
@ -119,151 +117,6 @@ public:
static tl::RegisteredClass<lay::PluginDeclaration> plugin_decl (new lay::CIFReaderPluginDeclaration (), 10000, "CIFReader");
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_cif_wire_mode (db::LoadLayoutOptions *options, unsigned int n)
{
options->get_options<db::CIFReaderOptions> ().wire_mode = n;
}
static unsigned int get_cif_wire_mode (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().wire_mode;
}
static void set_cif_dbu (db::LoadLayoutOptions *options, double dbu)
{
options->get_options<db::CIFReaderOptions> ().dbu = dbu;
}
static double get_cif_dbu (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().dbu;
}
static void set_layer_map (db::LoadLayoutOptions *options, const db::LayerMap &lm, bool f)
{
options->get_options<db::CIFReaderOptions> ().layer_map = lm;
options->get_options<db::CIFReaderOptions> ().create_other_layers = f;
}
static db::LayerMap &get_layer_map (db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().layer_map;
}
static void select_all_layers (db::LoadLayoutOptions *options)
{
options->get_options<db::CIFReaderOptions> ().layer_map = db::LayerMap ();
options->get_options<db::CIFReaderOptions> ().create_other_layers = true;
}
static bool create_other_layers (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().create_other_layers;
}
static void set_create_other_layers (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::CIFReaderOptions> ().create_other_layers = l;
}
static bool keep_layer_names (const db::LoadLayoutOptions *options)
{
return options->get_options<db::CIFReaderOptions> ().keep_layer_names;
}
static void set_keep_layer_names (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::CIFReaderOptions> ().keep_layer_names = l;
}
// extend lay::LoadLayoutOptions with the CIF options
static
gsi::ClassExt<db::LoadLayoutOptions> cif_reader_options (
gsi::method_ext ("cif_set_layer_map", &set_layer_map, gsi::arg ("map"), gsi::arg ("create_other_layers"),
"@brief Sets the layer map\n"
"This sets a layer mapping for the reader. The \"create_other_layers\" specifies whether to create layers that are not "
"in the mapping and automatically assign layers to them.\n"
"@param map The layer map to set."
"@param create_other_layers The flag telling whether other layer should be created also. Set to false if just the layers in the mapping table should be read.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_select_all_layers", &select_all_layers,
"@brief Selects all layers and disables the layer map\n"
"\n"
"This disables any layer map and enables reading of all layers.\n"
"New layers will be created when required.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_layer_map", &get_layer_map,
"@brief Gets the layer map\n"
"@return A reference to the layer map\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_create_other_layers?", &create_other_layers,
"@brief Gets a value indicating whether other layers shall be created\n"
"@return True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_create_other_layers=", &set_create_other_layers, gsi::arg ("create"),
"@brief Specifies whether other layers shall be created\n"
"@param create True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("cif_keep_layer_names?", &keep_layer_names,
"@brief Gets a value indicating whether layer names are kept\n"
"@return True, if layer names are kept.\n"
"\n"
"When set to true, no attempt is made to translate "
"layer names to GDS layer/datatype numbers. If set to false (the default), a layer named \"L2D15\" will be translated "
"to GDS layer 2, datatype 15.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("cif_keep_layer_names=", &set_keep_layer_names, gsi::arg ("keep"),
"@brief Gets a value indicating whether layer names are kept\n"
"@param keep True, if layer names are to be kept.\n"
"\n"
"See \\cif_keep_layer_names? for a description of this property.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("cif_wire_mode=", &set_cif_wire_mode,
"@brief How to read 'W' objects\n"
"\n"
"This property specifies how to read 'W' (wire) objects.\n"
"Allowed values are 0 (as square ended paths), 1 (as flush ended paths), 2 (as round paths)\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("cif_wire_mode", &get_cif_wire_mode,
"@brief Specifies how to read 'W' objects\n"
"See \\cif_wire_mode= method for a description of this mode."
"\nThis property has been added in version 0.21 and was renamed to cif_wire_mode in 0.25.\n"
) +
gsi::method_ext ("cif_dbu=", &set_cif_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("cif_dbu", &get_cif_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"See \\cif_dbu= method for a description of this property."
"\nThis property has been added in version 0.21.\n"
),
""
);
}

View File

@ -26,7 +26,6 @@
#include "dbSaveLayoutOptions.h"
#include "layCIFWriterPlugin.h"
#include "ui_CIFWriterOptionPage.h"
#include "gsiDecl.h"
#include <QFrame>
@ -105,59 +104,5 @@ public:
static tl::RegisteredClass<lay::PluginDeclaration> plugin_decl (new lay::CIFWriterPluginDeclaration (), 10000, "CIFWriter");
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_cif_dummy_calls (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::CIFWriterOptions> ().dummy_calls = f;
}
static bool get_cif_dummy_calls (const db::SaveLayoutOptions *options)
{
return options->get_options<db::CIFWriterOptions> ().dummy_calls;
}
static void set_cif_blank_separator (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::CIFWriterOptions> ().blank_separator = f;
}
static bool get_cif_blank_separator (const db::SaveLayoutOptions *options)
{
return options->get_options<db::CIFWriterOptions> ().blank_separator;
}
// extend lay::SaveLayoutOptions with the GDS2 options
static
gsi::ClassExt<db::SaveLayoutOptions> cif_writer_options (
gsi::method_ext ("cif_dummy_calls=", &set_cif_dummy_calls,
"@brief Sets a flag indicating whether dummy calls shall be written\n"
"If this property is set to true, dummy calls will be written in the top level entity "
"of the CIF file calling every top cell.\n"
"This option is useful for enhanced compatibility with other tools.\n"
"\nThis property has been added in version 0.23.10.\n"
) +
gsi::method_ext ("cif_dummy_calls?|#cif_dummy_calls", &get_cif_dummy_calls,
"@brief Gets a flag indicating whether dummy calls shall be written\n"
"See \\cif_dummy_calls= method for a description of that property."
"\nThis property has been added in version 0.23.10.\n"
"\nThe predicate version (cif_blank_separator?) has been added in version 0.25.1.\n"
) +
gsi::method_ext ("cif_blank_separator=", &set_cif_blank_separator,
"@brief Sets a flag indicating whether blanks shall be used as x/y separator characters\n"
"If this property is set to true, the x and y coordinates are separated with blank characters "
"rather than comma characters."
"\nThis property has been added in version 0.23.10.\n"
) +
gsi::method_ext ("cif_blank_separator?|#cif_blank_separator", &get_cif_blank_separator,
"@brief Gets a flag indicating whether blanks shall be used as x/y separator characters\n"
"See \\cif_blank_separator= method for a description of that property."
"\nThis property has been added in version 0.23.10.\n"
"\nThe predicate version (cif_blank_separator?) has been added in version 0.25.1.\n"
),
""
);
}

View File

@ -0,0 +1,25 @@
TARGET = cif
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -lcif
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
layCIFReaderPlugin.h \
layCIFWriterPlugin.h \
SOURCES = \
layCIFReaderPlugin.cc \
layCIFWriterPlugin.cc \
FORMS = \
CIFWriterOptionPage.ui \
CIFReaderOptionPage.ui \

View File

@ -0,0 +1,20 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = cif_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
dbCIFReader.cc \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -lcif

View File

@ -0,0 +1,17 @@
TARGET = dxf
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
dbDXF.h \
dbDXFReader.h \
dbDXFWriter.h \
SOURCES = \
dbDXF.cc \
dbDXFReader.cc \
dbDXFWriter.cc \
gsiDeclDbDXF.cc \

View File

@ -0,0 +1,380 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "dbDXF.h"
#include "dbDXFReader.h"
#include "dbDXFWriter.h"
#include "dbLoadLayoutOptions.h"
#include "dbSaveLayoutOptions.h"
#include "gsiDecl.h"
namespace gsi
{
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_dxf_dbu (db::LoadLayoutOptions *options, double dbu)
{
options->get_options<db::DXFReaderOptions> ().dbu = dbu;
}
static double get_dxf_dbu (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().dbu;
}
static void set_dxf_text_scaling (db::LoadLayoutOptions *options, double text_scaling)
{
options->get_options<db::DXFReaderOptions> ().text_scaling = text_scaling;
}
static double get_dxf_text_scaling (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().text_scaling;
}
static void set_dxf_unit (db::LoadLayoutOptions *options, double unit)
{
options->get_options<db::DXFReaderOptions> ().unit = unit;
}
static double get_dxf_unit (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().unit;
}
static void set_dxf_render_texts_as_polygons (db::LoadLayoutOptions *options, bool value)
{
options->get_options<db::DXFReaderOptions> ().render_texts_as_polygons = value;
}
static bool get_dxf_render_texts_as_polygons (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().render_texts_as_polygons;
}
static void set_dxf_keep_other_cells (db::LoadLayoutOptions *options, bool value)
{
options->get_options<db::DXFReaderOptions> ().keep_other_cells = value;
}
static bool get_dxf_keep_other_cells (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().keep_other_cells;
}
static void set_dxf_circle_points (db::LoadLayoutOptions *options, int circle_points)
{
options->get_options<db::DXFReaderOptions> ().circle_points = circle_points;
}
static int get_dxf_circle_points (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().circle_points;
}
static void set_dxf_circle_accuracy (db::LoadLayoutOptions *options, double circle_accuracy)
{
options->get_options<db::DXFReaderOptions> ().circle_accuracy = circle_accuracy;
}
static double get_dxf_circle_accuracy (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().circle_accuracy;
}
static void set_dxf_contour_accuracy (db::LoadLayoutOptions *options, double contour_accuracy)
{
options->get_options<db::DXFReaderOptions> ().contour_accuracy = contour_accuracy;
}
static double get_dxf_contour_accuracy (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().contour_accuracy;
}
static void set_dxf_polyline_mode (db::LoadLayoutOptions *options, int mode)
{
if (mode < 0 || mode > 4) {
throw tl::Exception (tl::to_string (QObject::tr ("Invalid polygon mode")));
}
options->get_options<db::DXFReaderOptions> ().polyline_mode = mode;
}
static int get_dxf_polyline_mode (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().polyline_mode;
}
static void set_layer_map (db::LoadLayoutOptions *options, const db::LayerMap &lm, bool f)
{
options->get_options<db::DXFReaderOptions> ().layer_map = lm;
options->get_options<db::DXFReaderOptions> ().create_other_layers = f;
}
static db::LayerMap &get_layer_map (db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().layer_map;
}
static void select_all_layers (db::LoadLayoutOptions *options)
{
options->get_options<db::DXFReaderOptions> ().layer_map = db::LayerMap ();
options->get_options<db::DXFReaderOptions> ().create_other_layers = true;
}
static bool create_other_layers (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().create_other_layers;
}
static void set_create_other_layers (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::DXFReaderOptions> ().create_other_layers = l;
}
static bool keep_layer_names (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().keep_layer_names;
}
static void set_keep_layer_names (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::DXFReaderOptions> ().keep_layer_names = l;
}
// extend lay::LoadLayoutOptions with the DXF options
static
gsi::ClassExt<db::LoadLayoutOptions> dxf_reader_options (
gsi::method_ext ("dxf_set_layer_map", &set_layer_map, gsi::arg ("map"), gsi::arg ("create_other_layers"),
"@brief Sets the layer map\n"
"This sets a layer mapping for the reader. The \"create_other_layers\" specifies whether to create layers that are not "
"in the mapping and automatically assign layers to them.\n"
"@param map The layer map to set."
"@param create_other_layers The flag telling whether other layer should be created also. Set to false if just the layers in the mapping table should be read.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_select_all_layers", &select_all_layers,
"@brief Selects all layers and disables the layer map\n"
"\n"
"This disables any layer map and enables reading of all layers.\n"
"New layers will be created when required.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_layer_map", &get_layer_map,
"@brief Gets the layer map\n"
"@return A reference to the layer map\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_create_other_layers?", &create_other_layers,
"@brief Gets a value indicating whether other layers shall be created\n"
"@return True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_create_other_layers=", &set_create_other_layers, gsi::arg ("create"),
"@brief Specifies whether other layers shall be created\n"
"@param create True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_dbu=", &set_dxf_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"@args dbu\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("dxf_dbu", &get_dxf_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("dxf_text_scaling=", &set_dxf_text_scaling,
"@brief Specifies the text scaling in percent of the default scaling\n"
"@args unit\n"
"\n"
"The default value 100, meaning that the letter pitch is roughly 92 percent of the specified text height. "
"Decrease this value to get smaller fonts and increase it to get larger fonts.\n"
"\nThis property has been added in version 0.21.20.\n"
) +
gsi::method_ext ("dxf_text_scaling", &get_dxf_text_scaling,
"@brief Gets the text scaling factor (see \\dxf_text_scaling=)\n"
"\nThis property has been added in version 0.21.20.\n"
) +
gsi::method_ext ("dxf_unit=", &set_dxf_unit,
"@brief Specifies the unit in which the DXF file is drawn.\n"
"@args unit\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_unit", &get_dxf_unit,
"@brief Specifies the unit in which the DXF file is drawn\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_circle_points=", &set_dxf_circle_points,
"@brief Specifies the number of points used per full circle for arc interpolation\n"
"@args points\n"
"See also \\dxf_circle_accuracy for how to specify the number of points based on "
"an approximation accuracy.\n"
"\n"
"\\dxf_circle_points and \\dxf_circle_accuracy also apply to other \"round\" structures "
"such as arcs, ellipses and splines in the same sense than for circles.\n"
"\n"
"\nThis property has been added in version 0.21.6.\n"
) +
gsi::method_ext ("dxf_circle_points", &get_dxf_circle_points,
"@brief Gets the number of points used per full circle for arc interpolation\n"
"\nThis property has been added in version 0.21.6.\n"
) +
gsi::method_ext ("dxf_circle_accuracy=", &set_dxf_circle_accuracy,
"@brief Specifies the accuracy of the circle approximation\n"
"@args accuracy\n"
"\n"
"In addition to the number of points per circle, the circle accuracy can be specified. "
"If set to a value larger than the database unit, the number of points per circle will "
"be chosen such that the deviation from the ideal circle becomes less than this value.\n"
"\n"
"The actual number of points will not become bigger than the points specified through "
"\\dxf_circle_points=. The accuracy value is given in the DXF file units (see \\dxf_unit) which is usually micrometers.\n"
"\n"
"\\dxf_circle_points and \\dxf_circle_accuracy also apply to other \"round\" structures "
"such as arcs, ellipses and splines in the same sense than for circles.\n"
"\n"
"\nThis property has been added in version 0.24.9.\n"
) +
gsi::method_ext ("dxf_circle_accuracy", &get_dxf_circle_accuracy,
"@brief Gets the accuracy of the circle approximation\n"
"\nThis property has been added in version 0.24.9.\n"
) +
gsi::method_ext ("dxf_contour_accuracy=", &set_dxf_contour_accuracy,
"@brief Specifies the accuracy for contour closing\n"
"@args accuracy\n"
"\n"
"When polylines need to be connected or closed, this\n"
"value is used to indicate the accuracy. This is the value (in DXF units)\n"
"by which points may be separated and still be considered\n"
"connected. The default is 0.0 which implies exact\n"
"(within one DBU) closing.\n"
"\n"
"This value is effective in polyline mode 3 and 4.\n"
"\n"
"\nThis property has been added in version 0.25.3.\n"
) +
gsi::method_ext ("dxf_contour_accuracy", &get_dxf_contour_accuracy,
"@brief Gets the accuracy for contour closing\n"
"\n"
"\nThis property has been added in version 0.25.3.\n"
) +
gsi::method_ext ("dxf_render_texts_as_polygons=", &set_dxf_render_texts_as_polygons,
"@brief If this option is set to true, text objects are rendered as polygons\n"
"@args value\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_render_texts_as_polygons?|#dxf_render_texts_as_polygons", &get_dxf_render_texts_as_polygons,
"@brief If this option is true, text objects are rendered as polygons\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_keep_layer_names?", &keep_layer_names,
"@brief Gets a value indicating whether layer names are kept\n"
"@return True, if layer names are kept.\n"
"\n"
"When set to true, no attempt is made to translate "
"layer names to GDS layer/datatype numbers. If set to false (the default), a layer named \"L2D15\" will be translated "
"to GDS layer 2, datatype 15.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("dxf_keep_layer_names=", &set_keep_layer_names, gsi::arg ("keep"),
"@brief Gets a value indicating whether layer names are kept\n"
"@param keep True, if layer names are to be kept.\n"
"\n"
"See \\cif_keep_layer_names? for a description of this property.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("dxf_keep_other_cells=", &set_dxf_keep_other_cells,
"@brief If this option is set to true, all cells are kept, not only the top cell and it's children\n"
"@args value\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_keep_other_cells?|#dxf_keep_other_cells", &get_dxf_keep_other_cells,
"@brief If this option is true, all cells are kept, not only the top cell and it's children\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_polyline_mode=", &set_dxf_polyline_mode,
"@brief Specifies how to treat POLYLINE/LWPOLYLINE entities.\n"
"@args mode\n"
"The mode is 0 (automatic), 1 (keep lines), 2 (create polygons from closed polylines with width = 0), "
"3 (merge all lines with width = 0 into polygons), 4 (as 3 plus auto-close open contours).\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_polyline_mode", &get_dxf_polyline_mode,
"@brief Specifies whether closed POLYLINE and LWPOLYLINE entities with width 0 are converted to polygons.\n"
"See \\dxf_polyline_mode= for a description of this property.\n"
"\nThis property has been added in version 0.21.3.\n"
),
""
);
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_dxf_polygon_mode (db::SaveLayoutOptions *options, int mode)
{
if (mode < 0 || mode > 3) {
throw tl::Exception (tl::to_string (QObject::tr ("Invalid polygon mode")));
}
options->get_options<db::DXFWriterOptions> ().polygon_mode = mode;
}
static int get_dxf_polygon_mode (const db::SaveLayoutOptions *options)
{
return options->get_options<db::DXFWriterOptions> ().polygon_mode;
}
// extend lay::SaveLayoutOptions with the DXF options
static
gsi::ClassExt<db::SaveLayoutOptions> dxf_writer_options (
gsi::method_ext ("dxf_polygon_mode=", &set_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"
"@args mode\n"
"The mode is 0 (write POLYLINE entities), 1 (write LWPOLYLINE entities), 2 (decompose into SOLID entities) or "
"or 3 (write HATCH entities).\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_polygon_mode", &get_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"
"See \\dxf_polygon_mode= for a description of this property.\n"
"\nThis property has been added in version 0.21.3.\n"
),
""
);
}

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -20,14 +20,11 @@
*/
#include "dbDXF.h"
#include "dbDXFReader.h"
#include "dbLoadLayoutOptions.h"
#include "layDXFReaderPlugin.h"
#include "ui_DXFReaderOptionPage.h"
#include "gsiDecl.h"
#include <QFrame>
@ -149,318 +146,6 @@ public:
static tl::RegisteredClass<lay::PluginDeclaration> plugin_decl (new lay::DXFReaderPluginDeclaration (), 10000, "DXFReader");
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_dxf_dbu (db::LoadLayoutOptions *options, double dbu)
{
options->get_options<db::DXFReaderOptions> ().dbu = dbu;
}
static double get_dxf_dbu (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().dbu;
}
static void set_dxf_text_scaling (db::LoadLayoutOptions *options, double text_scaling)
{
options->get_options<db::DXFReaderOptions> ().text_scaling = text_scaling;
}
static double get_dxf_text_scaling (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().text_scaling;
}
static void set_dxf_unit (db::LoadLayoutOptions *options, double unit)
{
options->get_options<db::DXFReaderOptions> ().unit = unit;
}
static double get_dxf_unit (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().unit;
}
static void set_dxf_render_texts_as_polygons (db::LoadLayoutOptions *options, bool value)
{
options->get_options<db::DXFReaderOptions> ().render_texts_as_polygons = value;
}
static bool get_dxf_render_texts_as_polygons (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().render_texts_as_polygons;
}
static void set_dxf_keep_other_cells (db::LoadLayoutOptions *options, bool value)
{
options->get_options<db::DXFReaderOptions> ().keep_other_cells = value;
}
static bool get_dxf_keep_other_cells (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().keep_other_cells;
}
static void set_dxf_circle_points (db::LoadLayoutOptions *options, int circle_points)
{
options->get_options<db::DXFReaderOptions> ().circle_points = circle_points;
}
static int get_dxf_circle_points (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().circle_points;
}
static void set_dxf_circle_accuracy (db::LoadLayoutOptions *options, double circle_accuracy)
{
options->get_options<db::DXFReaderOptions> ().circle_accuracy = circle_accuracy;
}
static double get_dxf_circle_accuracy (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().circle_accuracy;
}
static void set_dxf_contour_accuracy (db::LoadLayoutOptions *options, double contour_accuracy)
{
options->get_options<db::DXFReaderOptions> ().contour_accuracy = contour_accuracy;
}
static double get_dxf_contour_accuracy (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().contour_accuracy;
}
static void set_dxf_polyline_mode (db::LoadLayoutOptions *options, int mode)
{
if (mode < 0 || mode > 4) {
throw tl::Exception (tl::to_string (QObject::tr ("Invalid polygon mode")));
}
options->get_options<db::DXFReaderOptions> ().polyline_mode = mode;
}
static int get_dxf_polyline_mode (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().polyline_mode;
}
static void set_layer_map (db::LoadLayoutOptions *options, const db::LayerMap &lm, bool f)
{
options->get_options<db::DXFReaderOptions> ().layer_map = lm;
options->get_options<db::DXFReaderOptions> ().create_other_layers = f;
}
static db::LayerMap &get_layer_map (db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().layer_map;
}
static void select_all_layers (db::LoadLayoutOptions *options)
{
options->get_options<db::DXFReaderOptions> ().layer_map = db::LayerMap ();
options->get_options<db::DXFReaderOptions> ().create_other_layers = true;
}
static bool create_other_layers (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().create_other_layers;
}
static void set_create_other_layers (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::DXFReaderOptions> ().create_other_layers = l;
}
static bool keep_layer_names (const db::LoadLayoutOptions *options)
{
return options->get_options<db::DXFReaderOptions> ().keep_layer_names;
}
static void set_keep_layer_names (db::LoadLayoutOptions *options, bool l)
{
options->get_options<db::DXFReaderOptions> ().keep_layer_names = l;
}
// extend lay::LoadLayoutOptions with the DXF options
static
gsi::ClassExt<db::LoadLayoutOptions> dxf_reader_options (
gsi::method_ext ("dxf_set_layer_map", &set_layer_map, gsi::arg ("map"), gsi::arg ("create_other_layers"),
"@brief Sets the layer map\n"
"This sets a layer mapping for the reader. The \"create_other_layers\" specifies whether to create layers that are not "
"in the mapping and automatically assign layers to them.\n"
"@param map The layer map to set."
"@param create_other_layers The flag telling whether other layer should be created also. Set to false if just the layers in the mapping table should be read.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_select_all_layers", &select_all_layers,
"@brief Selects all layers and disables the layer map\n"
"\n"
"This disables any layer map and enables reading of all layers.\n"
"New layers will be created when required.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_layer_map", &get_layer_map,
"@brief Gets the layer map\n"
"@return A reference to the layer map\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_create_other_layers?", &create_other_layers,
"@brief Gets a value indicating whether other layers shall be created\n"
"@return True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_create_other_layers=", &set_create_other_layers, gsi::arg ("create"),
"@brief Specifies whether other layers shall be created\n"
"@param create True, if other layers should be created.\n"
"\n"
"This method has been added in version 0.25 and replaces the respective global option in \\LoadLayoutOptions "
"in a format-specific fashion."
) +
gsi::method_ext ("dxf_dbu=", &set_dxf_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"@args dbu\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("dxf_dbu", &get_dxf_dbu,
"@brief Specifies the database unit which the reader uses and produces\n"
"\nThis property has been added in version 0.21.\n"
) +
gsi::method_ext ("dxf_text_scaling=", &set_dxf_text_scaling,
"@brief Specifies the text scaling in percent of the default scaling\n"
"@args unit\n"
"\n"
"The default value 100, meaning that the letter pitch is roughly 92 percent of the specified text height. "
"Decrease this value to get smaller fonts and increase it to get larger fonts.\n"
"\nThis property has been added in version 0.21.20.\n"
) +
gsi::method_ext ("dxf_text_scaling", &get_dxf_text_scaling,
"@brief Gets the text scaling factor (see \\dxf_text_scaling=)\n"
"\nThis property has been added in version 0.21.20.\n"
) +
gsi::method_ext ("dxf_unit=", &set_dxf_unit,
"@brief Specifies the unit in which the DXF file is drawn.\n"
"@args unit\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_unit", &get_dxf_unit,
"@brief Specifies the unit in which the DXF file is drawn\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_circle_points=", &set_dxf_circle_points,
"@brief Specifies the number of points used per full circle for arc interpolation\n"
"@args points\n"
"See also \\dxf_circle_accuracy for how to specify the number of points based on "
"an approximation accuracy.\n"
"\n"
"\\dxf_circle_points and \\dxf_circle_accuracy also apply to other \"round\" structures "
"such as arcs, ellipses and splines in the same sense than for circles.\n"
"\n"
"\nThis property has been added in version 0.21.6.\n"
) +
gsi::method_ext ("dxf_circle_points", &get_dxf_circle_points,
"@brief Gets the number of points used per full circle for arc interpolation\n"
"\nThis property has been added in version 0.21.6.\n"
) +
gsi::method_ext ("dxf_circle_accuracy=", &set_dxf_circle_accuracy,
"@brief Specifies the accuracy of the circle approximation\n"
"@args accuracy\n"
"\n"
"In addition to the number of points per circle, the circle accuracy can be specified. "
"If set to a value larger than the database unit, the number of points per circle will "
"be chosen such that the deviation from the ideal circle becomes less than this value.\n"
"\n"
"The actual number of points will not become bigger than the points specified through "
"\\dxf_circle_points=. The accuracy value is given in the DXF file units (see \\dxf_unit) which is usually micrometers.\n"
"\n"
"\\dxf_circle_points and \\dxf_circle_accuracy also apply to other \"round\" structures "
"such as arcs, ellipses and splines in the same sense than for circles.\n"
"\n"
"\nThis property has been added in version 0.24.9.\n"
) +
gsi::method_ext ("dxf_circle_accuracy", &get_dxf_circle_accuracy,
"@brief Gets the accuracy of the circle approximation\n"
"\nThis property has been added in version 0.24.9.\n"
) +
gsi::method_ext ("dxf_contour_accuracy=", &set_dxf_contour_accuracy,
"@brief Specifies the accuracy for contour closing\n"
"@args accuracy\n"
"\n"
"When polylines need to be connected or closed, this\n"
"value is used to indicate the accuracy. This is the value (in DXF units)\n"
"by which points may be separated and still be considered\n"
"connected. The default is 0.0 which implies exact\n"
"(within one DBU) closing.\n"
"\n"
"This value is effective in polyline mode 3 and 4.\n"
"\n"
"\nThis property has been added in version 0.25.3.\n"
) +
gsi::method_ext ("dxf_contour_accuracy", &get_dxf_contour_accuracy,
"@brief Gets the accuracy for contour closing\n"
"\n"
"\nThis property has been added in version 0.25.3.\n"
) +
gsi::method_ext ("dxf_render_texts_as_polygons=", &set_dxf_render_texts_as_polygons,
"@brief If this option is set to true, text objects are rendered as polygons\n"
"@args value\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_render_texts_as_polygons?|#dxf_render_texts_as_polygons", &get_dxf_render_texts_as_polygons,
"@brief If this option is true, text objects are rendered as polygons\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_keep_layer_names?", &keep_layer_names,
"@brief Gets a value indicating whether layer names are kept\n"
"@return True, if layer names are kept.\n"
"\n"
"When set to true, no attempt is made to translate "
"layer names to GDS layer/datatype numbers. If set to false (the default), a layer named \"L2D15\" will be translated "
"to GDS layer 2, datatype 15.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("dxf_keep_layer_names=", &set_keep_layer_names, gsi::arg ("keep"),
"@brief Gets a value indicating whether layer names are kept\n"
"@param keep True, if layer names are to be kept.\n"
"\n"
"See \\cif_keep_layer_names? for a description of this property.\n"
"\n"
"This method has been added in version 0.25.3."
) +
gsi::method_ext ("dxf_keep_other_cells=", &set_dxf_keep_other_cells,
"@brief If this option is set to true, all cells are kept, not only the top cell and it's children\n"
"@args value\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_keep_other_cells?|#dxf_keep_other_cells", &get_dxf_keep_other_cells,
"@brief If this option is true, all cells are kept, not only the top cell and it's children\n"
"\nThis property has been added in version 0.21.15.\n"
) +
gsi::method_ext ("dxf_polyline_mode=", &set_dxf_polyline_mode,
"@brief Specifies how to treat POLYLINE/LWPOLYLINE entities.\n"
"@args mode\n"
"The mode is 0 (automatic), 1 (keep lines), 2 (create polygons from closed polylines with width = 0), "
"3 (merge all lines with width = 0 into polygons), 4 (as 3 plus auto-close open contours).\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_polyline_mode", &get_dxf_polyline_mode,
"@brief Specifies whether closed POLYLINE and LWPOLYLINE entities with width 0 are converted to polygons.\n"
"See \\dxf_polyline_mode= for a description of this property.\n"
"\nThis property has been added in version 0.21.3.\n"
),
""
);
}

View File

@ -20,13 +20,11 @@
*/
#include "dbDXF.h"
#include "dbDXFWriter.h"
#include "dbSaveLayoutOptions.h"
#include "layDXFWriterPlugin.h"
#include "ui_DXFWriterOptionPage.h"
#include "gsiDecl.h"
#include <QFrame>
@ -74,7 +72,7 @@ class DXFWriterPluginDeclaration
: public StreamWriterPluginDeclaration
{
public:
DXFWriterPluginDeclaration ()
DXFWriterPluginDeclaration ()
: StreamWriterPluginDeclaration (db::DXFWriterOptions ().format_name ())
{
// .. nothing yet ..
@ -100,44 +98,5 @@ public:
static tl::RegisteredClass<lay::PluginDeclaration> plugin_decl (new lay::DXFWriterPluginDeclaration (), 10000, "DXFWriter");
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_dxf_polygon_mode (db::SaveLayoutOptions *options, int mode)
{
if (mode < 0 || mode > 3) {
throw tl::Exception (tl::to_string (QObject::tr ("Invalid polygon mode")));
}
options->get_options<db::DXFWriterOptions> ().polygon_mode = mode;
}
static int get_dxf_polygon_mode (const db::SaveLayoutOptions *options)
{
return options->get_options<db::DXFWriterOptions> ().polygon_mode;
}
// extend lay::SaveLayoutOptions with the DXF options
static
gsi::ClassExt<db::SaveLayoutOptions> dxf_writer_options (
gsi::method_ext ("dxf_polygon_mode=", &set_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"
"@args mode\n"
"The mode is 0 (write POLYLINE entities), 1 (write LWPOLYLINE entities), 2 (decompose into SOLID entities) or "
"or 3 (write HATCH entities).\n"
"\nThis property has been added in version 0.21.3.\n"
) +
gsi::method_ext ("dxf_polygon_mode", &get_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"
"See \\dxf_polygon_mode= for a description of this property.\n"
"\nThis property has been added in version 0.21.3.\n"
),
""
);
}

View File

@ -0,0 +1,26 @@
TARGET = dxf
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -ldxf
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
layDXFReaderPlugin.h \
layDXFWriterPlugin.h \
SOURCES = \
layDXFReaderPlugin.cc \
layDXFWriterPlugin.cc \
FORMS = \
DXFReaderOptionPage.ui \
DXFWriterOptionPage.ui \

View File

@ -0,0 +1,20 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = dxf_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
dbDXFReader.cc \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -ldxf

View File

@ -0,0 +1,10 @@
TARGET = lefdef
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
SOURCES = \

View File

@ -0,0 +1,19 @@
TARGET = lefdef
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -llefdef
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
SOURCES = \
FORMS = \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -0,0 +1,19 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = lefdef_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -llefdef

View File

@ -0,0 +1,17 @@
TARGET = oasis
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
dbOASIS.h \
dbOASISReader.h \
dbOASISWriter.h \
SOURCES = \
dbOASIS.cc \
dbOASISReader.cc \
dbOASISWriter.cc \
gsiDeclDbOASIS.cc \

View File

@ -0,0 +1,240 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "dbOASIS.h"
#include "dbOASISReader.h"
#include "dbOASISWriter.h"
#include "dbLoadLayoutOptions.h"
#include "dbSaveLayoutOptions.h"
#include "gsiDecl.h"
namespace gsi
{
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_oasis_compression (db::SaveLayoutOptions *options, int comp)
{
options->get_options<db::OASISWriterOptions> ().compression_level = comp;
}
static int get_oasis_compression (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().compression_level;
}
static void set_oasis_recompress (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().recompress = f;
}
static bool get_oasis_recompress (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().recompress;
}
static void set_oasis_permissive (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().permissive = f;
}
static bool get_oasis_permissive (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().permissive;
}
static void set_oasis_write_std_properties (db::SaveLayoutOptions *options, bool f)
{
db::OASISWriterOptions &oasis_options = options->get_options<db::OASISWriterOptions> ();
if (f && oasis_options.write_std_properties == 0) {
oasis_options.write_std_properties = 1;
} else if (!f && oasis_options.write_std_properties != 0) {
oasis_options.write_std_properties = 0;
}
}
static bool get_oasis_write_std_properties (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_std_properties != 0;
}
static void set_oasis_write_cell_bounding_boxes (db::SaveLayoutOptions *options, bool f)
{
db::OASISWriterOptions &oasis_options = options->get_options<db::OASISWriterOptions> ();
if (f && oasis_options.write_std_properties < 2) {
oasis_options.write_std_properties = 2;
} else if (!f && oasis_options.write_std_properties >= 2) {
oasis_options.write_std_properties = 1;
}
}
static bool get_oasis_write_cell_bounding_boxes (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_std_properties >= 2;
}
static void set_oasis_write_cblocks (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().write_cblocks = f;
}
static bool get_oasis_write_cblocks (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_cblocks;
}
static void set_oasis_strict_mode (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().strict_mode = f;
}
static bool get_oasis_strict_mode (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().strict_mode;
}
static void set_oasis_subst_char (db::SaveLayoutOptions *options, const std::string &sc)
{
options->get_options<db::OASISWriterOptions> ().subst_char = sc;
}
static std::string get_oasis_subst_char (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().subst_char;
}
// extend lay::SaveLayoutOptions with the OASIS options
static
gsi::ClassExt<db::SaveLayoutOptions> oasis_writer_options (
gsi::method_ext ("oasis_write_cblocks=", &set_oasis_write_cblocks,
"@brief Sets a value indicating whether to write compressed CBLOCKS per cell\n"
"@args flag\n"
"Setting this property clears all format specific options for other formats such as GDS.\n"
) +
gsi::method_ext ("oasis_write_cblocks?", &get_oasis_write_cblocks,
"@brief Gets a value indicating whether to write compressed CBLOCKS per cell\n"
) +
gsi::method_ext ("oasis_strict_mode=", &set_oasis_strict_mode,
"@brief Sets a value indicating whether to write strict-mode OASIS files\n"
"@args flag\n"
"Setting this property clears all format specific options for other formats such as GDS.\n"
) +
gsi::method_ext ("oasis_strict_mode?", &get_oasis_strict_mode,
"@brief Gets a value indicating whether to write strict-mode OASIS files\n"
) +
gsi::method_ext ("oasis_substitution_char=", &set_oasis_subst_char,
"@brief Sets the substitution character for a-strings and n-strings\n"
"@args char\n"
"The substitution character is used in place of invalid characters. The value of this "
"attribute is a string which is either empty or a single character. If the string is "
"empty, no substitution is made at the risk of producing invalid OASIS files.\n"
"\n"
"This attribute has been introduce in version 0.23.\n"
) +
gsi::method_ext ("oasis_substitution_char", &get_oasis_subst_char,
"@brief Gets the substitution character\n"
"\n"
"See \\oasis_substitution_char for details. This attribute has been introduced in version 0.23.\n"
) +
gsi::method_ext ("oasis_recompress=", &set_oasis_recompress,
"@brief Sets OASIS recompression mode\n"
"@args flag\n"
"If this flag is true, shape arrays already existing will be resolved and compression is applied "
"to the individual shapes again. If this flag is false (the default), shape arrays already existing "
"will be written as such.\n"
"\n"
"This method has been introduced in version 0.23."
) +
gsi::method_ext ("oasis_recompress?", &get_oasis_recompress,
"@brief Gets the OASIS recompression mode\n"
"See \\oasis_recompress= method for a description of this predicate."
"\n"
"This method has been introduced in version 0.23."
) +
gsi::method_ext ("oasis_permissive=", &set_oasis_permissive,
"@brief Sets OASIS permissive mode\n"
"@args flag\n"
"If this flag is true, certain shapes which cannot be written to OASIS are reported as warnings, "
"not as errors. For example, paths with odd width (are rounded) or polygons with less than three points (are skipped).\n"
"\n"
"This method has been introduced in version 0.25.1."
) +
gsi::method_ext ("oasis_permissive?", &get_oasis_permissive,
"@brief Gets the OASIS permissive mode\n"
"See \\oasis_permissive= method for a description of this predicate."
"\n"
"This method has been introduced in version 0.25.1."
) +
gsi::method_ext ("oasis_write_cell_bounding_boxes=", &set_oasis_write_cell_bounding_boxes,
"@brief Sets a value indicating whether cell bounding boxes are written\n"
"@args flag\n"
"If this value is set to true, cell bounding boxes are written (S_BOUNDING_BOX). "
"The S_BOUNDING_BOX properties will be attached to the CELLNAME records.\n"
"\n"
"Setting this value to true will also enable writing of other standard properties like "
"S_TOP_CELL (see \\oasis_write_std_properties=).\n"
"By default, cell bounding boxes are not written, but standard properties are.\n"
"\n"
"This method has been introduced in version 0.24.3."
) +
gsi::method_ext ("oasis_write_cell_bounding_boxes?", &get_oasis_write_cell_bounding_boxes,
"@brief Gets a value indicating whether cell bounding boxes are written\n"
"See \\oasis_write_cell_bounding_boxes= method for a description of this flag."
"\n"
"This method has been introduced in version 0.24.3."
) +
gsi::method_ext ("oasis_write_std_properties=", &set_oasis_write_std_properties,
"@brief Sets a value indicating whether standard properties will be written\n"
"@args flag\n"
"If this value is false, no standard properties are written. If true, S_TOP_CELL and some other global "
"standard properties are written. In addition, \\oasis_write_cell_bounding_boxes= can be used to "
"write cell bounding boxes using S_BOUNDING_BOX.\n"
"\n"
"By default, this flag is true and standard properties are written.\n"
"\n"
"Setting this property to false clears the oasis_write_cell_bounding_boxes flag too.\n"
"\n"
"This method has been introduced in version 0.24."
) +
gsi::method_ext ("oasis_write_std_properties?", &get_oasis_write_std_properties,
"@brief Gets a value indicating whether standard properties will be written\n"
"See \\oasis_write_std_properties= method for a description of this flag."
"\n"
"This method has been introduced in version 0.24."
) +
gsi::method_ext ("oasis_compression_level=", &set_oasis_compression,
"@brief Set the OASIS compression level\n"
"@args level\n"
"The OASIS compression level is an integer number between 0 and 10. 0 basically is no compression, "
"1 produces shape arrays in a simple fashion. 2 and higher compression levels will use a more elaborate "
"algorithm to find shape arrays which uses 2nd and futher neighbor distances. The higher the level, the "
"higher the memory requirements and run times.\n"
) +
gsi::method_ext ("oasis_compression_level", &get_oasis_compression,
"@brief Get the OASIS compression level\n"
"See \\oasis_compression_level= method for a description of the OASIS compression level."
),
""
);
}

View File

@ -21,13 +21,11 @@
*/
#include "dbOASIS.h"
#include "dbOASISReader.h"
#include "dbLoadLayoutOptions.h"
#include "layOASISReaderPlugin.h"
#include "layStream.h"
#include "gsiDecl.h"
#include <QFrame>

View File

@ -25,7 +25,6 @@
#include "dbOASISWriter.h"
#include "dbSaveLayoutOptions.h"
#include "layStream.h"
#include "gsiDecl.h"
#include "ui_OASISWriterOptionPage.h"
@ -137,213 +136,6 @@ public:
static tl::RegisteredClass<lay::PluginDeclaration> plugin_decl (new lay::OASISWriterPluginDeclaration (), 10000, "OASISWriter");
// ---------------------------------------------------------------
// gsi Implementation of specific methods
static void set_oasis_compression (db::SaveLayoutOptions *options, int comp)
{
options->get_options<db::OASISWriterOptions> ().compression_level = comp;
}
static int get_oasis_compression (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().compression_level;
}
static void set_oasis_recompress (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().recompress = f;
}
static bool get_oasis_recompress (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().recompress;
}
static void set_oasis_permissive (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().permissive = f;
}
static bool get_oasis_permissive (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().permissive;
}
static void set_oasis_write_std_properties (db::SaveLayoutOptions *options, bool f)
{
db::OASISWriterOptions &oasis_options = options->get_options<db::OASISWriterOptions> ();
if (f && oasis_options.write_std_properties == 0) {
oasis_options.write_std_properties = 1;
} else if (!f && oasis_options.write_std_properties != 0) {
oasis_options.write_std_properties = 0;
}
}
static bool get_oasis_write_std_properties (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_std_properties != 0;
}
static void set_oasis_write_cell_bounding_boxes (db::SaveLayoutOptions *options, bool f)
{
db::OASISWriterOptions &oasis_options = options->get_options<db::OASISWriterOptions> ();
if (f && oasis_options.write_std_properties < 2) {
oasis_options.write_std_properties = 2;
} else if (!f && oasis_options.write_std_properties >= 2) {
oasis_options.write_std_properties = 1;
}
}
static bool get_oasis_write_cell_bounding_boxes (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_std_properties >= 2;
}
static void set_oasis_write_cblocks (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().write_cblocks = f;
}
static bool get_oasis_write_cblocks (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().write_cblocks;
}
static void set_oasis_strict_mode (db::SaveLayoutOptions *options, bool f)
{
options->get_options<db::OASISWriterOptions> ().strict_mode = f;
}
static bool get_oasis_strict_mode (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().strict_mode;
}
static void set_oasis_subst_char (db::SaveLayoutOptions *options, const std::string &sc)
{
options->get_options<db::OASISWriterOptions> ().subst_char = sc;
}
static std::string get_oasis_subst_char (const db::SaveLayoutOptions *options)
{
return options->get_options<db::OASISWriterOptions> ().subst_char;
}
// extend lay::SaveLayoutOptions with the OASIS options
static
gsi::ClassExt<db::SaveLayoutOptions> oasis_writer_options (
gsi::method_ext ("oasis_write_cblocks=", &set_oasis_write_cblocks,
"@brief Sets a value indicating whether to write compressed CBLOCKS per cell\n"
"@args flag\n"
"Setting this property clears all format specific options for other formats such as GDS.\n"
) +
gsi::method_ext ("oasis_write_cblocks?", &get_oasis_write_cblocks,
"@brief Gets a value indicating whether to write compressed CBLOCKS per cell\n"
) +
gsi::method_ext ("oasis_strict_mode=", &set_oasis_strict_mode,
"@brief Sets a value indicating whether to write strict-mode OASIS files\n"
"@args flag\n"
"Setting this property clears all format specific options for other formats such as GDS.\n"
) +
gsi::method_ext ("oasis_strict_mode?", &get_oasis_strict_mode,
"@brief Gets a value indicating whether to write strict-mode OASIS files\n"
) +
gsi::method_ext ("oasis_substitution_char=", &set_oasis_subst_char,
"@brief Sets the substitution character for a-strings and n-strings\n"
"@args char\n"
"The substitution character is used in place of invalid characters. The value of this "
"attribute is a string which is either empty or a single character. If the string is "
"empty, no substitution is made at the risk of producing invalid OASIS files.\n"
"\n"
"This attribute has been introduce in version 0.23.\n"
) +
gsi::method_ext ("oasis_substitution_char", &get_oasis_subst_char,
"@brief Gets the substitution character\n"
"\n"
"See \\oasis_substitution_char for details. This attribute has been introduced in version 0.23.\n"
) +
gsi::method_ext ("oasis_recompress=", &set_oasis_recompress,
"@brief Sets OASIS recompression mode\n"
"@args flag\n"
"If this flag is true, shape arrays already existing will be resolved and compression is applied "
"to the individual shapes again. If this flag is false (the default), shape arrays already existing "
"will be written as such.\n"
"\n"
"This method has been introduced in version 0.23."
) +
gsi::method_ext ("oasis_recompress?", &get_oasis_recompress,
"@brief Gets the OASIS recompression mode\n"
"See \\oasis_recompress= method for a description of this predicate."
"\n"
"This method has been introduced in version 0.23."
) +
gsi::method_ext ("oasis_permissive=", &set_oasis_permissive,
"@brief Sets OASIS permissive mode\n"
"@args flag\n"
"If this flag is true, certain shapes which cannot be written to OASIS are reported as warnings, "
"not as errors. For example, paths with odd width (are rounded) or polygons with less than three points (are skipped).\n"
"\n"
"This method has been introduced in version 0.25.1."
) +
gsi::method_ext ("oasis_permissive?", &get_oasis_permissive,
"@brief Gets the OASIS permissive mode\n"
"See \\oasis_permissive= method for a description of this predicate."
"\n"
"This method has been introduced in version 0.25.1."
) +
gsi::method_ext ("oasis_write_cell_bounding_boxes=", &set_oasis_write_cell_bounding_boxes,
"@brief Sets a value indicating whether cell bounding boxes are written\n"
"@args flag\n"
"If this value is set to true, cell bounding boxes are written (S_BOUNDING_BOX). "
"The S_BOUNDING_BOX properties will be attached to the CELLNAME records.\n"
"\n"
"Setting this value to true will also enable writing of other standard properties like "
"S_TOP_CELL (see \\oasis_write_std_properties=).\n"
"By default, cell bounding boxes are not written, but standard properties are.\n"
"\n"
"This method has been introduced in version 0.24.3."
) +
gsi::method_ext ("oasis_write_cell_bounding_boxes?", &get_oasis_write_cell_bounding_boxes,
"@brief Gets a value indicating whether cell bounding boxes are written\n"
"See \\oasis_write_cell_bounding_boxes= method for a description of this flag."
"\n"
"This method has been introduced in version 0.24.3."
) +
gsi::method_ext ("oasis_write_std_properties=", &set_oasis_write_std_properties,
"@brief Sets a value indicating whether standard properties will be written\n"
"@args flag\n"
"If this value is false, no standard properties are written. If true, S_TOP_CELL and some other global "
"standard properties are written. In addition, \\oasis_write_cell_bounding_boxes= can be used to "
"write cell bounding boxes using S_BOUNDING_BOX.\n"
"\n"
"By default, this flag is true and standard properties are written.\n"
"\n"
"Setting this property to false clears the oasis_write_cell_bounding_boxes flag too.\n"
"\n"
"This method has been introduced in version 0.24."
) +
gsi::method_ext ("oasis_write_std_properties?", &get_oasis_write_std_properties,
"@brief Gets a value indicating whether standard properties will be written\n"
"See \\oasis_write_std_properties= method for a description of this flag."
"\n"
"This method has been introduced in version 0.24."
) +
gsi::method_ext ("oasis_compression_level=", &set_oasis_compression,
"@brief Set the OASIS compression level\n"
"@args level\n"
"The OASIS compression level is an integer number between 0 and 10. 0 basically is no compression, "
"1 produces shape arrays in a simple fashion. 2 and higher compression levels will use a more elaborate "
"algorithm to find shape arrays which uses 2nd and futher neighbor distances. The higher the level, the "
"higher the memory requirements and run times.\n"
) +
gsi::method_ext ("oasis_compression_level", &get_oasis_compression,
"@brief Get the OASIS compression level\n"
"See \\oasis_compression_level= method for a description of the OASIS compression level."
),
""
);
}

View File

@ -0,0 +1,24 @@
TARGET = oasis
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -loasis
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
layOASISReaderPlugin.h \
layOASISWriterPlugin.h \
SOURCES = \
layOASISReaderPlugin.cc \
layOASISWriterPlugin.cc \
FORMS = \
OASISWriterOptionPage.ui \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -264,7 +264,7 @@ void run_test (tl::TestBase *_this, const char *file, bool scaling_test, int com
{
tl::OutputStream stream (tmp1_file);
db::SaveLayoutOptions gds2_options;
db::SaveLayoutOptions gds2_options = options;
gds2_options.set_format ("GDS2");
db::Writer writer (gds2_options);
writer.write (layout, stream);

View File

@ -0,0 +1,22 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = oasis_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
dbOASISReader.cc \
dbOASISWriter2.cc \
dbOASISWriter.cc \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -loasis

View File

@ -0,0 +1,10 @@
TARGET = pcb
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
SOURCES = \

View File

@ -0,0 +1,19 @@
TARGET = pcb
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -lpcb
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
SOURCES = \
FORMS = \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -0,0 +1,19 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = pcb_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -lpcb