mirror of https://github.com/KLayout/klayout.git
WIP: fixed some build issues, removed some link dependencies which causes issues on Windows.
This commit is contained in:
parent
54d412cee6
commit
361bc64870
|
|
@ -45,12 +45,6 @@ PLUGINPATH += \
|
|||
INCLUDEPATH += $$PLUGINPATH
|
||||
DEPENDPATH += $$PLUGINPATH
|
||||
|
||||
LIBS += -L$$DESTDIR/db_plugins \
|
||||
-lgds2 \
|
||||
-lcif \
|
||||
-loasis \
|
||||
-ldxf \
|
||||
|
||||
INCLUDEPATH += $$RBA_INC
|
||||
DEPENDPATH += $$RBA_INC
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "bdConverterMain.h"
|
||||
#include "dbLayout.h"
|
||||
#include "dbReader.h"
|
||||
#include "dbCIFWriter.h"
|
||||
#include "tlCommandLineParser.h"
|
||||
|
||||
namespace bd
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "dbGDS2Reader.h"
|
||||
#include "dbOASISReader.h"
|
||||
#include "dbDXFReader.h"
|
||||
#include "dbCIFReader.h"
|
||||
#include "dbCIFFormat.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "dbGDS2WriterBase.h"
|
||||
#include "dbOASISWriter.h"
|
||||
#include "dbDXFWriter.h"
|
||||
#include "dbCIFWriter.h"
|
||||
#include "dbCIFFormat.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "bdConverterMain.h"
|
||||
#include "dbCIFWriter.h"
|
||||
#include "dbCIFFormat.h"
|
||||
|
||||
BD_PUBLIC int strm2cif (int argc, char *argv[])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ equals(HAVE_PYTHON, "1") {
|
|||
LIBS += -lklayout_pyastub
|
||||
}
|
||||
|
||||
|
||||
DEFINES += BD_TARGET=$$TARGET
|
||||
|
||||
LIBS += $$RUBYLIBFILE
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
*/
|
||||
|
||||
#include "bdConverterMain.h"
|
||||
#include "dbCIFReader.h"
|
||||
#include "dbStream.h"
|
||||
#include "dbCIFFormat.h"
|
||||
#include "dbDXFReader.h"
|
||||
#include "dbOASISReader.h"
|
||||
#include "dbGDS2Reader.h"
|
||||
|
|
@ -45,8 +46,11 @@ TEST(1)
|
|||
|
||||
{
|
||||
tl::InputStream stream (output);
|
||||
db::CIFReader reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
db::LoadLayoutOptions options;
|
||||
options.set_options (new db::CIFReaderOptions ());
|
||||
db::Reader reader (stream);
|
||||
reader.read (layout, options);
|
||||
EXPECT_EQ (reader.format (), "CIF");
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, input, db::NoNormalization);
|
||||
|
|
@ -68,8 +72,11 @@ TEST(2)
|
|||
|
||||
{
|
||||
tl::InputStream stream (output);
|
||||
db::DXFReader reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
db::LoadLayoutOptions options;
|
||||
options.set_options (new db::DXFReaderOptions ());
|
||||
db::Reader reader (stream);
|
||||
reader.read (layout, options);
|
||||
EXPECT_EQ (reader.format (), "DXF");
|
||||
}
|
||||
|
||||
// Fix top cell name (which is TOP in DXF, not RINGO as in reference)
|
||||
|
|
@ -97,8 +104,11 @@ TEST(3)
|
|||
|
||||
{
|
||||
tl::InputStream stream (output);
|
||||
db::GDS2Reader reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
db::LoadLayoutOptions options;
|
||||
options.set_options (new db::GDS2ReaderOptions ());
|
||||
db::Reader reader (stream);
|
||||
reader.read (layout, options);
|
||||
EXPECT_EQ (reader.format (), "GDS2");
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, input, db::NoNormalization);
|
||||
|
|
@ -120,8 +130,11 @@ TEST(4)
|
|||
|
||||
{
|
||||
tl::InputStream stream (output);
|
||||
db::GDS2ReaderText reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
db::LoadLayoutOptions options;
|
||||
options.set_options (new db::GDS2ReaderOptions ());
|
||||
db::Reader reader (stream);
|
||||
reader.read (layout, options);
|
||||
EXPECT_EQ (reader.format (), "GDS2Text");
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, input, db::NoNormalization);
|
||||
|
|
@ -143,8 +156,11 @@ TEST(5)
|
|||
|
||||
{
|
||||
tl::InputStream stream (output);
|
||||
db::OASISReader reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
db::LoadLayoutOptions options;
|
||||
options.set_options (new db::OASISReaderOptions ());
|
||||
db::Reader reader (stream);
|
||||
reader.read (layout, options);
|
||||
EXPECT_EQ (reader.format (), "OASIS");
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, input, db::NoNormalization);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
/*
|
||||
|
||||
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 "tlUnitTest.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
|
||||
// Testing the converter main implementation (CIF)
|
||||
TEST(1)
|
||||
{
|
||||
QProcess process;
|
||||
process.setProcessChannelMode (QProcess::MergedChannels);
|
||||
|
||||
QStringList args;
|
||||
|
||||
std::string fp (tl::testsrc ());
|
||||
fp += "/testdata/bd/strmrun.py";
|
||||
args << tl::to_qstring (fp);
|
||||
|
||||
process.start (tl::to_qstring ("./strmrun"), args);
|
||||
bool success = process.waitForFinished (-1);
|
||||
|
||||
QByteArray ba = process.readAll ();
|
||||
EXPECT_EQ (ba.constData (), "Hello, world (0,-42;42,0)!\n");
|
||||
EXPECT_EQ (success, true);
|
||||
}
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ SOURCES = \
|
|||
bdStrmclipTests.cc \
|
||||
bdStrmcmpTests.cc \
|
||||
bdStrmxorTests.cc \
|
||||
bdStrmrunTests.cc \
|
||||
|
||||
|
||||
INCLUDEPATH += $$BD_INC $$DB_INC $$TL_INC $$GSI_INC
|
||||
|
|
@ -30,9 +31,3 @@ PLUGINPATH += \
|
|||
|
||||
INCLUDEPATH += $$PLUGINPATH
|
||||
DEPENDPATH += $$PLUGINPATH
|
||||
|
||||
LIBS += -L$$DESTDIR_UT/db_plugins \
|
||||
-lgds2 \
|
||||
-lcif \
|
||||
-loasis \
|
||||
-ldxf \
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ initialize ()
|
|||
tl::VariantUserClassBase::clear_class_table ();
|
||||
|
||||
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
||||
|
||||
if (! c->is_external ()) {
|
||||
|
||||
// Note: for backward compatibility we use lower case names
|
||||
std::string lc = tl::to_lower_case (c->name ());
|
||||
std::string lc_trans = tl::VariantUserClassBase::translate_class_name (lc);
|
||||
|
|
@ -64,6 +67,9 @@ initialize ()
|
|||
if (lc != lc_trans) {
|
||||
tl::VariantUserClassBase::register_user_class (lc_trans, c->var_cls (false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -435,6 +435,11 @@ ClassBase::merge_declarations ()
|
|||
// Add to the classes the special methods and clean up the method table
|
||||
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_new_classes (); c != gsi::ClassBase::end_new_classes (); ++c) {
|
||||
|
||||
// Skip external classes (i.e. provided by Ruby or Python)
|
||||
if (c->is_external ()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::set<std::pair<std::string, bool> > name_map;
|
||||
for (gsi::ClassBase::method_iterator m = c->begin_methods (); m != c->end_methods (); ++m) {
|
||||
for (gsi::MethodBase::synonym_iterator syn = (*m)->begin_synonyms (); syn != (*m)->end_synonyms (); ++syn) {
|
||||
|
|
@ -525,7 +530,9 @@ ClassBase::merge_declarations ()
|
|||
(const_cast<gsi::ClassBase *> (&*c))->initialize ();
|
||||
|
||||
// there should be only main declarations since we merged
|
||||
tl_assert (c->declaration () == &*c);
|
||||
// (the declaration==0 case covers dummy declarations introduced by
|
||||
// lym::ExternalClass)
|
||||
tl_assert (! c->declaration () || c->declaration () == &*c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -523,6 +523,14 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true, if the class is an external class provided by Python or Ruby code
|
||||
*/
|
||||
virtual bool is_external () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Post-construction initialization
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1079,6 +1079,11 @@ initialize_expressions ()
|
|||
// Go through all classes (maybe again)
|
||||
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
||||
|
||||
// Skip external classes
|
||||
if (c->is_external ()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// install the method table:
|
||||
ExpressionMethodTable::initialize_class (&*c);
|
||||
|
||||
|
|
|
|||
|
|
@ -839,6 +839,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool is_external () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_category;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,169 @@
|
|||
|
||||
/*
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_dbCIFFormat
|
||||
#define HDR_dbCIFFormat
|
||||
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "dbLoadLayoutOptions.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the CIF specific options for the reader
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class CIFReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
CIFReaderOptions ()
|
||||
: wire_mode (0),
|
||||
dbu (0.001),
|
||||
create_other_layers (true),
|
||||
keep_layer_names (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief How to read 'W' objects
|
||||
*
|
||||
* This property specifies how to read 'W' (wire) objects.
|
||||
* Allowed values are 0 (as square ended paths), 1 (as flush ended paths), 2 (as round paths)
|
||||
*/
|
||||
unsigned int wire_mode;
|
||||
|
||||
/**
|
||||
* @brief Specify the database unit to produce
|
||||
*
|
||||
* Specify the database unit which the resulting layout will receive.
|
||||
*/
|
||||
double dbu;
|
||||
|
||||
/**
|
||||
* @brief Specifies a layer mapping
|
||||
*
|
||||
* If a layer mapping is specified, only the given layers are read.
|
||||
* Otherwise, all layers are read.
|
||||
* Setting "create_other_layers" to true will make the reader
|
||||
* create other layers for all layers not given in the layer map.
|
||||
* Setting an empty layer map and create_other_layers to true effectively
|
||||
* enables all layers for reading.
|
||||
*/
|
||||
db::LayerMap layer_map;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating that a new layers shall be created
|
||||
*
|
||||
* If this flag is set to true, layers not listed in the layer map a created
|
||||
* too.
|
||||
*/
|
||||
bool create_other_layers;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether the names of layers shall be kept as such
|
||||
*
|
||||
* If this flag is set to false (the default), layer name translation happens.
|
||||
* If set to true, translation will not happen.
|
||||
* Name translation will try to extract GDS layer/datatype numbers from the
|
||||
* layer names. If this value is set to true, no name translation happens.
|
||||
*/
|
||||
bool keep_layer_names;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new CIFReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("CIF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the CIF specific options for the Writer
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class CIFWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
CIFWriterOptions ()
|
||||
: dummy_calls (false), blank_separator (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether dummy calls shall be written
|
||||
* If this flag is true, the writer will produce dummy cell calls on global
|
||||
* level for all top cells.
|
||||
*/
|
||||
bool dummy_calls;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether to use blanks as x/y separators
|
||||
* If this flag is true, blank characters will be used to separate x and y values.
|
||||
* Otherwise comma characters will be used.
|
||||
*/
|
||||
bool blank_separator;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new CIFWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("CIF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "dbNamedLayerReader.h"
|
||||
#include "dbLayout.h"
|
||||
#include "dbCIF.h"
|
||||
#include "dbCIFFormat.h"
|
||||
#include "dbStreamLayers.h"
|
||||
#include "dbPropertiesRepository.h"
|
||||
|
||||
|
|
@ -44,88 +45,6 @@
|
|||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the CIF specific options for the reader
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC CIFReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
CIFReaderOptions ()
|
||||
: wire_mode (0),
|
||||
dbu (0.001),
|
||||
create_other_layers (true),
|
||||
keep_layer_names (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief How to read 'W' objects
|
||||
*
|
||||
* This property specifies how to read 'W' (wire) objects.
|
||||
* Allowed values are 0 (as square ended paths), 1 (as flush ended paths), 2 (as round paths)
|
||||
*/
|
||||
unsigned int wire_mode;
|
||||
|
||||
/**
|
||||
* @brief Specify the database unit to produce
|
||||
*
|
||||
* Specify the database unit which the resulting layout will receive.
|
||||
*/
|
||||
double dbu;
|
||||
|
||||
/**
|
||||
* @brief Specifies a layer mapping
|
||||
*
|
||||
* If a layer mapping is specified, only the given layers are read.
|
||||
* Otherwise, all layers are read.
|
||||
* Setting "create_other_layers" to true will make the reader
|
||||
* create other layers for all layers not given in the layer map.
|
||||
* Setting an empty layer map and create_other_layers to true effectively
|
||||
* enables all layers for reading.
|
||||
*/
|
||||
db::LayerMap layer_map;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating that a new layers shall be created
|
||||
*
|
||||
* If this flag is set to true, layers not listed in the layer map a created
|
||||
* too.
|
||||
*/
|
||||
bool create_other_layers;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether the names of layers shall be kept as such
|
||||
*
|
||||
* If this flag is set to false (the default), layer name translation happens.
|
||||
* If set to true, translation will not happen.
|
||||
* Name translation will try to extract GDS layer/datatype numbers from the
|
||||
* layer names. If this value is set to true, no name translation happens.
|
||||
*/
|
||||
bool keep_layer_names;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new CIFReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("CIF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generic base class of CIF reader exceptions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "dbPluginCommon.h"
|
||||
#include "dbWriter.h"
|
||||
#include "dbCIF.h"
|
||||
#include "dbCIFFormat.h"
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "tlProgress.h"
|
||||
|
||||
|
|
@ -42,54 +43,6 @@ namespace db
|
|||
class Layout;
|
||||
class SaveLayoutOptions;
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the CIF specific options for the Writer
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC CIFWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
CIFWriterOptions ()
|
||||
: dummy_calls (false), blank_separator (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether dummy calls shall be written
|
||||
* If this flag is true, the writer will produce dummy cell calls on global
|
||||
* level for all top cells.
|
||||
*/
|
||||
bool dummy_calls;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether to use blanks as x/y separators
|
||||
* If this flag is true, blank characters will be used to separate x and y values.
|
||||
* Otherwise comma characters will be used.
|
||||
*/
|
||||
bool blank_separator;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new CIFWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("CIF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A CIF writer abstraction
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ HEADERS = \
|
|||
dbCIF.h \
|
||||
dbCIFReader.h \
|
||||
dbCIFWriter.h \
|
||||
dbCIFFormat.h \
|
||||
|
||||
SOURCES = \
|
||||
dbCIF.cc \
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ include($$PWD/../../../lay_plugin.pri)
|
|||
|
||||
INCLUDEPATH += $$PWD/../db_plugin
|
||||
DEPENDPATH += $$PWD/../db_plugin
|
||||
LIBS += -L$$DESTDIR/../db_plugins -lcif
|
||||
LIBS += -L$$DESTDIR/../db_plugins
|
||||
|
||||
!isEmpty(RPATH) {
|
||||
QMAKE_RPATHDIR += $$RPATH/db_plugins
|
||||
|
|
|
|||
|
|
@ -0,0 +1,239 @@
|
|||
|
||||
/*
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_dbDXFFormat
|
||||
#define HDR_dbDXFFormat
|
||||
|
||||
#include "dbLoadLayoutOptions.h"
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the DXF specific options for the reader
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class DXFReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
DXFReaderOptions ()
|
||||
: dbu (0.001),
|
||||
unit (1.0),
|
||||
text_scaling (100.0),
|
||||
polyline_mode (0),
|
||||
circle_points (100),
|
||||
circle_accuracy (0.0),
|
||||
contour_accuracy (0.0),
|
||||
render_texts_as_polygons (false),
|
||||
keep_other_cells (false),
|
||||
create_other_layers (true),
|
||||
keep_layer_names (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specify the database unit to produce
|
||||
*
|
||||
* Specify the database unit which the resulting layout will receive.
|
||||
*/
|
||||
double dbu;
|
||||
|
||||
/**
|
||||
* @brief Specify the unit of the DXF file
|
||||
*
|
||||
* Since DXF is unitless, this value allows to specify the units of the DXF file given as input.
|
||||
*/
|
||||
double unit;
|
||||
|
||||
/**
|
||||
* @brief Text scaling factor
|
||||
*
|
||||
* This value specifies text scaling in percent. A value of 100 roughly means that the letter
|
||||
* pitch of the font will be 92% of the specified text height. That value applies for ROMANS fonts.
|
||||
* When generating GDS texts, a value of 100 generates TEXT objects with
|
||||
* the specified size. Smaller values generate smaller sizes.
|
||||
*/
|
||||
double text_scaling;
|
||||
|
||||
/**
|
||||
* @brief POLYLINE/LWPOLYLINE mode
|
||||
*
|
||||
* 0: automatic mode
|
||||
* 1: keep lines
|
||||
* 2: create polygons from closed POLYLINE/LWPOLYLINE with width == 0
|
||||
* 3: merge all lines (width width 0)
|
||||
* 4: as 3 and auto-close contours
|
||||
*/
|
||||
int polyline_mode;
|
||||
|
||||
/**
|
||||
* @brief Number of points for a full circle for arc interpolation
|
||||
*
|
||||
* See circle_accuracy for another way of specifying the number of
|
||||
* points per circle.
|
||||
*/
|
||||
int circle_points;
|
||||
|
||||
/**
|
||||
* @brief Accuracy of circle approximation
|
||||
*
|
||||
* This value specifies the approximation accuracy of the circle and other
|
||||
* "round" structures. If this value is a positive number bigger than the
|
||||
* database unit (see dbu), it will control the number of points the
|
||||
* circle is resolved into. The number of points will be chosen such that
|
||||
* the deviation from the ideal curve is less than this value.
|
||||
*
|
||||
* The actual number of points used for the circle approximation is
|
||||
* not larger than circle_points.
|
||||
*
|
||||
* The value is given in the units of the DXF file.
|
||||
*/
|
||||
double circle_accuracy;
|
||||
|
||||
/**
|
||||
* @brief Accuracy for closing polylines
|
||||
*
|
||||
* When polylines need to be connected or closed, this
|
||||
* value is used to indicate the accuracy. This is the value (in DXF units)
|
||||
* by which points may be separated and still be considered
|
||||
* connected. The default is 0.0 which implies exact
|
||||
* (within one DBU) closing.
|
||||
*/
|
||||
double contour_accuracy;
|
||||
|
||||
/**
|
||||
* @brief If set to true, converts texts to polygons on read
|
||||
*
|
||||
* Converting texts avoids problems with UTF-8 character sets.
|
||||
*/
|
||||
bool render_texts_as_polygons;
|
||||
|
||||
/**
|
||||
* @brief If set to true, cells other than the top cell are kept instead of removed
|
||||
*/
|
||||
bool keep_other_cells;
|
||||
|
||||
/**
|
||||
* @brief Specifies a layer mapping
|
||||
*
|
||||
* If a layer mapping is specified, only the given layers are read.
|
||||
* Otherwise, all layers are read.
|
||||
* Setting "create_other_layers" to true will make the reader
|
||||
* create other layers for all layers not given in the layer map.
|
||||
* Setting an empty layer map and create_other_layers to true effectively
|
||||
* enables all layers for reading.
|
||||
*/
|
||||
db::LayerMap layer_map;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating that a new layers shall be created
|
||||
*
|
||||
* If this flag is set to true, layers not listed in the layer map a created
|
||||
* too.
|
||||
*/
|
||||
bool create_other_layers;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether the names of layers shall be kept as such
|
||||
*
|
||||
* If this flag is set to false (the default), layer name translation happens.
|
||||
* If set to true, translation will not happen.
|
||||
* Name translation will try to extract GDS layer/datatype numbers from the
|
||||
* layer names. If this value is set to true, no name translation happens.
|
||||
*/
|
||||
bool keep_layer_names;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new DXFReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("DXF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the DXF specific options for the Writer
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class DXFWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
DXFWriterOptions ()
|
||||
: polygon_mode (0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Polygon mode
|
||||
*
|
||||
* 0: create POLYLINE
|
||||
* 1: create LWPOLYLINE
|
||||
* 2: decompose into SOLID
|
||||
* 3: create HATCH
|
||||
*/
|
||||
int polygon_mode;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new DXFWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("DXF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace db
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef HDR_dbDXFReader
|
||||
#define HDR_dbDXFReader
|
||||
|
||||
|
|
@ -29,6 +27,7 @@
|
|||
#include "dbLayout.h"
|
||||
#include "dbNamedLayerReader.h"
|
||||
#include "dbDXF.h"
|
||||
#include "dbDXFFormat.h"
|
||||
#include "dbStreamLayers.h"
|
||||
#include "dbPropertiesRepository.h"
|
||||
|
||||
|
|
@ -46,162 +45,6 @@ namespace db
|
|||
|
||||
class Matrix3d;
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the DXF specific options for the reader
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC DXFReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
DXFReaderOptions ()
|
||||
: dbu (0.001),
|
||||
unit (1.0),
|
||||
text_scaling (100.0),
|
||||
polyline_mode (0),
|
||||
circle_points (100),
|
||||
circle_accuracy (0.0),
|
||||
contour_accuracy (0.0),
|
||||
render_texts_as_polygons (false),
|
||||
keep_other_cells (false),
|
||||
create_other_layers (true),
|
||||
keep_layer_names (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specify the database unit to produce
|
||||
*
|
||||
* Specify the database unit which the resulting layout will receive.
|
||||
*/
|
||||
double dbu;
|
||||
|
||||
/**
|
||||
* @brief Specify the unit of the DXF file
|
||||
*
|
||||
* Since DXF is unitless, this value allows to specify the units of the DXF file given as input.
|
||||
*/
|
||||
double unit;
|
||||
|
||||
/**
|
||||
* @brief Text scaling factor
|
||||
*
|
||||
* This value specifies text scaling in percent. A value of 100 roughly means that the letter
|
||||
* pitch of the font will be 92% of the specified text height. That value applies for ROMANS fonts.
|
||||
* When generating GDS texts, a value of 100 generates TEXT objects with
|
||||
* the specified size. Smaller values generate smaller sizes.
|
||||
*/
|
||||
double text_scaling;
|
||||
|
||||
/**
|
||||
* @brief POLYLINE/LWPOLYLINE mode
|
||||
*
|
||||
* 0: automatic mode
|
||||
* 1: keep lines
|
||||
* 2: create polygons from closed POLYLINE/LWPOLYLINE with width == 0
|
||||
* 3: merge all lines (width width 0)
|
||||
* 4: as 3 and auto-close contours
|
||||
*/
|
||||
int polyline_mode;
|
||||
|
||||
/**
|
||||
* @brief Number of points for a full circle for arc interpolation
|
||||
*
|
||||
* See circle_accuracy for another way of specifying the number of
|
||||
* points per circle.
|
||||
*/
|
||||
int circle_points;
|
||||
|
||||
/**
|
||||
* @brief Accuracy of circle approximation
|
||||
*
|
||||
* This value specifies the approximation accuracy of the circle and other
|
||||
* "round" structures. If this value is a positive number bigger than the
|
||||
* database unit (see dbu), it will control the number of points the
|
||||
* circle is resolved into. The number of points will be chosen such that
|
||||
* the deviation from the ideal curve is less than this value.
|
||||
*
|
||||
* The actual number of points used for the circle approximation is
|
||||
* not larger than circle_points.
|
||||
*
|
||||
* The value is given in the units of the DXF file.
|
||||
*/
|
||||
double circle_accuracy;
|
||||
|
||||
/**
|
||||
* @brief Accuracy for closing polylines
|
||||
*
|
||||
* When polylines need to be connected or closed, this
|
||||
* value is used to indicate the accuracy. This is the value (in DXF units)
|
||||
* by which points may be separated and still be considered
|
||||
* connected. The default is 0.0 which implies exact
|
||||
* (within one DBU) closing.
|
||||
*/
|
||||
double contour_accuracy;
|
||||
|
||||
/**
|
||||
* @brief If set to true, converts texts to polygons on read
|
||||
*
|
||||
* Converting texts avoids problems with UTF-8 character sets.
|
||||
*/
|
||||
bool render_texts_as_polygons;
|
||||
|
||||
/**
|
||||
* @brief If set to true, cells other than the top cell are kept instead of removed
|
||||
*/
|
||||
bool keep_other_cells;
|
||||
|
||||
/**
|
||||
* @brief Specifies a layer mapping
|
||||
*
|
||||
* If a layer mapping is specified, only the given layers are read.
|
||||
* Otherwise, all layers are read.
|
||||
* Setting "create_other_layers" to true will make the reader
|
||||
* create other layers for all layers not given in the layer map.
|
||||
* Setting an empty layer map and create_other_layers to true effectively
|
||||
* enables all layers for reading.
|
||||
*/
|
||||
db::LayerMap layer_map;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating that a new layers shall be created
|
||||
*
|
||||
* If this flag is set to true, layers not listed in the layer map a created
|
||||
* too.
|
||||
*/
|
||||
bool create_other_layers;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether the names of layers shall be kept as such
|
||||
*
|
||||
* If this flag is set to false (the default), layer name translation happens.
|
||||
* If set to true, translation will not happen.
|
||||
* Name translation will try to extract GDS layer/datatype numbers from the
|
||||
* layer names. If this value is set to true, no name translation happens.
|
||||
*/
|
||||
bool keep_layer_names;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new DXFReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("DXF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generic base class of DXF reader exceptions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,15 +20,13 @@
|
|||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef HDR_dbDXFWriter
|
||||
#define HDR_dbDXFWriter
|
||||
|
||||
#include "dbPluginCommon.h"
|
||||
#include "dbWriter.h"
|
||||
#include "dbDXF.h"
|
||||
#include "dbDXFFormat.h"
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "tlProgress.h"
|
||||
|
||||
|
|
@ -43,50 +41,6 @@ namespace db
|
|||
class Layout;
|
||||
class SaveLayoutOptions;
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the DXF specific options for the Writer
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC DXFWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
DXFWriterOptions ()
|
||||
: polygon_mode (0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Polygon mode
|
||||
*
|
||||
* 0: create POLYLINE
|
||||
* 1: create LWPOLYLINE
|
||||
* 2: decompose into SOLID
|
||||
* 3: create HATCH
|
||||
*/
|
||||
int polygon_mode;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new DXFWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("DXF");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A DXF writer abstraction
|
||||
*/
|
||||
|
|
@ -108,7 +62,7 @@ private:
|
|||
struct endl_tag { };
|
||||
|
||||
tl::OutputStream *mp_stream;
|
||||
DXFWriterOptions m_options;
|
||||
db::DXFWriterOptions m_options;
|
||||
tl::AbsoluteProgress m_progress;
|
||||
endl_tag endl;
|
||||
db::LayerProperties m_layer;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ include($$PWD/../../../db_plugin.pri)
|
|||
|
||||
HEADERS = \
|
||||
dbDXF.h \
|
||||
dbDXFFormat.h \
|
||||
dbDXFReader.h \
|
||||
dbDXFWriter.h \
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
/*
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_dbGDS2Format
|
||||
#define HDR_dbGDS2Format
|
||||
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "dbLoadLayoutOptions.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the GDS2 specific options for the reader
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class GDS2ReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
GDS2ReaderOptions ()
|
||||
: box_mode (1),
|
||||
allow_big_records (true),
|
||||
allow_multi_xy_records (true)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief How to treat BOX records
|
||||
*
|
||||
* This property specifies how to treat BOX records.
|
||||
* Allowed values are 0 (ignore), 1 (treat as rectangles), 2 (treat as boundaries) or 3 (treat as errors).
|
||||
*/
|
||||
unsigned int box_mode;
|
||||
|
||||
/**
|
||||
* @brief Allow multiple big records
|
||||
*
|
||||
* Setting this property to true allows to use up to 65535 bytes (instead of 32767) per record
|
||||
* by treating the record length as unsigned short rather than signed short.
|
||||
* This allows bigger polygons (up to ~8000 points) without having to use multiple XY records.
|
||||
*/
|
||||
bool allow_big_records;
|
||||
|
||||
/**
|
||||
* @brief Allow multiple XY records in BOUNDARY elements for unlimited large polygons
|
||||
*
|
||||
* Setting this property to true allows to unlimited polygons
|
||||
* by using multiple XY records.
|
||||
*/
|
||||
bool allow_multi_xy_records;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new GDS2ReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("GDS2");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace db
|
||||
|
||||
#endif
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "dbPluginCommon.h"
|
||||
#include "dbLayout.h"
|
||||
#include "dbGDS2Format.h"
|
||||
#include "dbGDS2ReaderBase.h"
|
||||
#include "dbCommonReader.h"
|
||||
#include "dbStreamLayers.h"
|
||||
|
|
@ -40,67 +41,6 @@
|
|||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the GDS2 specific options for the reader
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC GDS2ReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
GDS2ReaderOptions ()
|
||||
: box_mode (1),
|
||||
allow_big_records (true),
|
||||
allow_multi_xy_records (true)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief How to treat BOX records
|
||||
*
|
||||
* This property specifies how to treat BOX records.
|
||||
* Allowed values are 0 (ignore), 1 (treat as rectangles), 2 (treat as boundaries) or 3 (treat as errors).
|
||||
*/
|
||||
unsigned int box_mode;
|
||||
|
||||
/**
|
||||
* @brief Allow multiple big records
|
||||
*
|
||||
* Setting this property to true allows to use up to 65535 bytes (instead of 32767) per record
|
||||
* by treating the record length as unsigned short rather than signed short.
|
||||
* This allows bigger polygons (up to ~8000 points) without having to use multiple XY records.
|
||||
*/
|
||||
bool allow_big_records;
|
||||
|
||||
/**
|
||||
* @brief Allow multiple XY records in BOUNDARY elements for unlimited large polygons
|
||||
*
|
||||
* Setting this property to true allows to unlimited polygons
|
||||
* by using multiple XY records.
|
||||
*/
|
||||
bool allow_multi_xy_records;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new GDS2ReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("GDS2");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generic base class of GDS2 reader exceptions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ HEADERS = \
|
|||
contrib/dbGDS2Converter.h \
|
||||
contrib/dbGDS2TextReader.h \
|
||||
contrib/dbGDS2TextWriter.h \
|
||||
dbGDS2Format.h \
|
||||
dbGDS2.h \
|
||||
dbGDS2ReaderBase.h \
|
||||
dbGDS2Reader.h \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,188 @@
|
|||
|
||||
/*
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_dbOASISFormat
|
||||
#define HDR_dbOASISFormat
|
||||
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "dbLoadLayoutOptions.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the OASIS specific options for the reader
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class OASISReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
OASISReaderOptions ()
|
||||
: read_all_properties (false), expect_strict_mode (-1)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether to read all properties
|
||||
*
|
||||
* If this flag is set, all properties, including the special properties are read.
|
||||
* This mode is only provided for testing and writing such a layout will probably
|
||||
* result in duplicate entries.
|
||||
*/
|
||||
bool read_all_properties;
|
||||
|
||||
/**
|
||||
* @brief Indicates that the reader expects strict mode or note
|
||||
*
|
||||
* This is mainly a debugging an testing option but it may be used to verifiy
|
||||
* the compliance of a file with string or non-strict mode.
|
||||
*
|
||||
* The values are:
|
||||
* -1: don't care (default)
|
||||
* 0: expect non-strict
|
||||
* 1: expect strict
|
||||
*/
|
||||
int expect_strict_mode;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new OASISReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("OASIS");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the OASIS specific options for the Writer
|
||||
* NOTE: this structure is non-public linkage by intention. This way it's instantiated
|
||||
* in all compile units and the shared object does not need to be linked.
|
||||
*/
|
||||
class OASISWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
OASISWriterOptions ()
|
||||
: compression_level (2), write_cblocks (false), strict_mode (false), recompress (false), permissive (false), write_std_properties (1), subst_char ("*")
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief OASIS writer compression level
|
||||
*
|
||||
* This level describes how hard the OASIS writer will try to compress the shapes
|
||||
* using shape arrays. Building shape arrays may take some time and requires some memory.
|
||||
* 0 - no shape array building
|
||||
* 1 - nearest neighbor shape array formation
|
||||
* 2++ - enhanced shape array search algorithm using 2nd and further neighbor distances as well
|
||||
*/
|
||||
int compression_level;
|
||||
|
||||
/**
|
||||
* @brief CBLOCK compression
|
||||
*
|
||||
* If this flag is set, every cell is CBLOCK-compressed.
|
||||
*/
|
||||
bool write_cblocks;
|
||||
|
||||
/**
|
||||
* @brief Strict mode
|
||||
*
|
||||
* If this flag is set, a strict-mode file will be produced
|
||||
*/
|
||||
bool strict_mode;
|
||||
|
||||
/**
|
||||
* @brief Recompressions
|
||||
*
|
||||
* If the recompression flag is true, existing shape arrays will be resolved and
|
||||
* put into the compressor again (may take longer).
|
||||
*/
|
||||
bool recompress;
|
||||
|
||||
/**
|
||||
* @brief Permissive mode
|
||||
*
|
||||
* In permissive mode, a warning is issued for certain cases rather than
|
||||
* an error:
|
||||
* - Polygons with less than three points (omitted)
|
||||
* - Paths/circles with odd diameter (rounded)
|
||||
*/
|
||||
bool permissive;
|
||||
|
||||
/**
|
||||
* @brief Write global standard properties
|
||||
*
|
||||
* If this value is 0, no standard properties are written. If it's 1, global
|
||||
* standard properties such as S_TOP_CELL are written. If 2, bounding box
|
||||
* standard properties are written for every cell too.
|
||||
*/
|
||||
int write_std_properties;
|
||||
|
||||
/**
|
||||
* @brief Substitution character
|
||||
*
|
||||
* If non-empty, this string (first character) will be used for
|
||||
* substituting invalid characters in a-strings and n-strings.
|
||||
*/
|
||||
std::string subst_char;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new OASISWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("OASIS");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace db
|
||||
|
||||
#endif
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
#include "dbReader.h"
|
||||
#include "dbTypes.h"
|
||||
#include "dbOASIS.h"
|
||||
#include "dbOASISFormat.h"
|
||||
#include "dbStreamLayers.h"
|
||||
#include "dbPropertiesRepository.h"
|
||||
|
||||
|
|
@ -57,62 +58,6 @@ public:
|
|||
{ }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the OASIS specific options for the reader
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC OASISReaderOptions
|
||||
: public FormatSpecificReaderOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
OASISReaderOptions ()
|
||||
: read_all_properties (false), expect_strict_mode (-1)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether to read all properties
|
||||
*
|
||||
* If this flag is set, all properties, including the special properties are read.
|
||||
* This mode is only provided for testing and writing such a layout will probably
|
||||
* result in duplicate entries.
|
||||
*/
|
||||
bool read_all_properties;
|
||||
|
||||
/**
|
||||
* @brief Indicates that the reader expects strict mode or note
|
||||
*
|
||||
* This is mainly a debugging an testing option but it may be used to verifiy
|
||||
* the compliance of a file with string or non-strict mode.
|
||||
*
|
||||
* The values are:
|
||||
* -1: don't care (default)
|
||||
* 0: expect non-strict
|
||||
* 1: expect strict
|
||||
*/
|
||||
int expect_strict_mode;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual FormatSpecificReaderOptions *clone () const
|
||||
{
|
||||
return new OASISReaderOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificReaderOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static const std::string n ("OASIS");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The OASIS format stream reader
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "dbPluginCommon.h"
|
||||
#include "dbWriter.h"
|
||||
#include "dbOASIS.h"
|
||||
#include "dbOASISFormat.h"
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "dbObjectWithProperties.h"
|
||||
#include "dbHash.h"
|
||||
|
|
@ -47,100 +48,6 @@ class Layout;
|
|||
class SaveLayoutOptions;
|
||||
class OASISWriter;
|
||||
|
||||
/**
|
||||
* @brief Structure that holds the OASIS specific options for the Writer
|
||||
*/
|
||||
class DB_PLUGIN_PUBLIC OASISWriterOptions
|
||||
: public FormatSpecificWriterOptions
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
OASISWriterOptions ()
|
||||
: compression_level (2), write_cblocks (false), strict_mode (false), recompress (false), permissive (false), write_std_properties (1), subst_char ("*")
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief OASIS writer compression level
|
||||
*
|
||||
* This level describes how hard the OASIS writer will try to compress the shapes
|
||||
* using shape arrays. Building shape arrays may take some time and requires some memory.
|
||||
* 0 - no shape array building
|
||||
* 1 - nearest neighbor shape array formation
|
||||
* 2++ - enhanced shape array search algorithm using 2nd and further neighbor distances as well
|
||||
*/
|
||||
int compression_level;
|
||||
|
||||
/**
|
||||
* @brief CBLOCK compression
|
||||
*
|
||||
* If this flag is set, every cell is CBLOCK-compressed.
|
||||
*/
|
||||
bool write_cblocks;
|
||||
|
||||
/**
|
||||
* @brief Strict mode
|
||||
*
|
||||
* If this flag is set, a strict-mode file will be produced
|
||||
*/
|
||||
bool strict_mode;
|
||||
|
||||
/**
|
||||
* @brief Recompressions
|
||||
*
|
||||
* If the recompression flag is true, existing shape arrays will be resolved and
|
||||
* put into the compressor again (may take longer).
|
||||
*/
|
||||
bool recompress;
|
||||
|
||||
/**
|
||||
* @brief Permissive mode
|
||||
*
|
||||
* In permissive mode, a warning is issued for certain cases rather than
|
||||
* an error:
|
||||
* - Polygons with less than three points (omitted)
|
||||
* - Paths/circles with odd diameter (rounded)
|
||||
*/
|
||||
bool permissive;
|
||||
|
||||
/**
|
||||
* @brief Write global standard properties
|
||||
*
|
||||
* If this value is 0, no standard properties are written. If it's 1, global
|
||||
* standard properties such as S_TOP_CELL are written. If 2, bounding box
|
||||
* standard properties are written for every cell too.
|
||||
*/
|
||||
int write_std_properties;
|
||||
|
||||
/**
|
||||
* @brief Substitution character
|
||||
*
|
||||
* If non-empty, this string (first character) will be used for
|
||||
* substituting invalid characters in a-strings and n-strings.
|
||||
*/
|
||||
std::string subst_char;
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual FormatSpecificWriterOptions *clone () const
|
||||
{
|
||||
return new OASISWriterOptions (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implementation of FormatSpecificWriterOptions
|
||||
*/
|
||||
virtual const std::string &format_name () const
|
||||
{
|
||||
static std::string n ("OASIS");
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A displacement list compactor
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ include($$PWD/../../../db_plugin.pri)
|
|||
|
||||
HEADERS = \
|
||||
dbOASIS.h \
|
||||
dbOASISFormat.h \
|
||||
dbOASISReader.h \
|
||||
dbOASISWriter.h \
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
import pya
|
||||
print("Hello, world " + str(pya.DBox(0, 0, 42, -42)) + "!")
|
||||
Loading…
Reference in New Issue