mirror of https://github.com/KLayout/klayout.git
Issue 1097 (#1148)
* [CONSIDER MERGING] Clarification and typo fixed in DRC doc. * Implemented #1097 (discourage file compression, use CBLOCK) * A warning is printed if file compression is enabled on OASIS * A hint is present in the writer options * CBLOCK is default (with fresh config) and for buddy tools (use --cblock=false to disable it) * Strict mode is default too. * Updated tests
This commit is contained in:
parent
9ebb923d83
commit
390cac87d3
|
|
@ -30,34 +30,43 @@ namespace bd
|
|||
{
|
||||
|
||||
GenericWriterOptions::GenericWriterOptions ()
|
||||
: m_scale_factor (1.0),
|
||||
m_dbu (0.0),
|
||||
m_dont_write_empty_cells (false),
|
||||
m_keep_instances (false),
|
||||
m_write_context_info (true),
|
||||
m_gds2_max_vertex_count (8000),
|
||||
m_gds2_no_zero_length_paths (false),
|
||||
m_gds2_multi_xy_records (false),
|
||||
m_gds2_resolve_skew_arrays (false),
|
||||
m_gds2_max_cellname_length (32000),
|
||||
m_gds2_libname ("LIB"),
|
||||
m_gds2_user_units (1.0),
|
||||
m_gds2_write_timestamps (true),
|
||||
m_gds2_write_cell_properties (false),
|
||||
m_gds2_write_file_properties (false),
|
||||
m_oasis_compression_level (2),
|
||||
m_oasis_write_cblocks (false),
|
||||
m_oasis_strict_mode (false),
|
||||
m_oasis_recompress (false),
|
||||
m_oasis_permissive (false),
|
||||
m_oasis_write_std_properties (1),
|
||||
m_oasis_subst_char ("*"),
|
||||
m_cif_dummy_calls (false),
|
||||
m_cif_blank_separator (false),
|
||||
m_magic_lambda (1.0),
|
||||
m_dxf_polygon_mode (0)
|
||||
: m_scale_factor (1.0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
db::SaveLayoutOptions save_options;
|
||||
|
||||
m_dbu = save_options.get_option_by_name ("dbu").to_double ();
|
||||
|
||||
m_dont_write_empty_cells = save_options.get_option_by_name ("no_empty_cells").to_bool ();
|
||||
m_keep_instances = save_options.get_option_by_name ("keep_instances").to_bool ();
|
||||
m_write_context_info = save_options.get_option_by_name ("write_context_info").to_bool ();
|
||||
|
||||
m_gds2_max_vertex_count = save_options.get_option_by_name ("gds2_max_vertex_count").to_uint ();
|
||||
m_gds2_no_zero_length_paths = save_options.get_option_by_name ("gds2_no_zero_length_paths").to_bool ();
|
||||
m_gds2_multi_xy_records = save_options.get_option_by_name ("gds2_multi_xy_records").to_bool ();
|
||||
m_gds2_resolve_skew_arrays = save_options.get_option_by_name ("gds2_resolve_skew_arrays").to_bool ();
|
||||
m_gds2_max_cellname_length = save_options.get_option_by_name ("gds2_max_cellname_length").to_uint ();
|
||||
m_gds2_libname = save_options.get_option_by_name ("gds2_libname").to_string ();
|
||||
m_gds2_user_units = save_options.get_option_by_name ("gds2_user_units").to_double ();
|
||||
m_gds2_write_timestamps = save_options.get_option_by_name ("gds2_write_timestamps").to_bool ();
|
||||
m_gds2_write_cell_properties = save_options.get_option_by_name ("gds2_write_cell_properties").to_bool ();
|
||||
m_gds2_write_file_properties = save_options.get_option_by_name ("gds2_write_file_properties").to_bool ();
|
||||
|
||||
m_oasis_compression_level = save_options.get_option_by_name ("oasis_compression_level").to_int ();
|
||||
m_oasis_write_cblocks = save_options.get_option_by_name ("oasis_write_cblocks").to_bool ();
|
||||
m_oasis_strict_mode = save_options.get_option_by_name ("oasis_strict_mode").to_bool ();
|
||||
m_oasis_recompress = save_options.get_option_by_name ("oasis_recompress").to_bool ();
|
||||
m_oasis_permissive = save_options.get_option_by_name ("oasis_permissive").to_bool ();
|
||||
m_oasis_write_std_properties = save_options.get_option_by_name ("oasis_write_std_properties").to_int ();
|
||||
m_oasis_subst_char = save_options.get_option_by_name ("oasis_substitution_char").to_string ();
|
||||
|
||||
m_cif_dummy_calls = save_options.get_option_by_name ("cif_dummy_calls").to_bool ();
|
||||
m_cif_blank_separator = save_options.get_option_by_name ("cif_blank_separator").to_bool ();
|
||||
|
||||
// The default options do not specify a lambda, but we prefer having a default here:
|
||||
// m_magic_lambda = save_options.get_option_by_name ("mag_lambda").to_double ();
|
||||
m_magic_lambda = 1.0;
|
||||
|
||||
m_dxf_polygon_mode = save_options.get_option_by_name ("dxf_polygon_mode").to_int ();
|
||||
}
|
||||
|
||||
const std::string GenericWriterOptions::gds2_format_name = "GDS2";
|
||||
|
|
@ -210,10 +219,14 @@ GenericWriterOptions::add_options (tl::CommandLineOptions &cmd, const std::strin
|
|||
"* 2++ - enhanced shape array search algorithm using 2nd and further neighbor distances as well\n"
|
||||
)
|
||||
<< tl::arg (group +
|
||||
"-ob|--cblocks", &m_oasis_write_cblocks, "Uses CBLOCK compression"
|
||||
"-ob|--cblocks", &m_oasis_write_cblocks, "Uses CBLOCK compression",
|
||||
"Please note that since version 0.27.12, CBLOCK compression is enabled by default. If you do not want "
|
||||
"CBLOCK compression, use '--cblocks=false'."
|
||||
)
|
||||
<< tl::arg (group +
|
||||
"-ot|--strict-mode", &m_oasis_strict_mode, "Uses strict mode"
|
||||
"-ot|--strict-mode", &m_oasis_strict_mode, "Uses strict mode",
|
||||
"Please note that since version 0.27.12, strict mode is enabled by default. If you do not want "
|
||||
"strict mode, use '--strict-mode=false'."
|
||||
)
|
||||
<< tl::arg (group +
|
||||
"#--recompress", &m_oasis_recompress, "Compresses shape arrays again",
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ TEST(1)
|
|||
"--write-cell-properties",
|
||||
"--write-file-properties",
|
||||
// OASIS
|
||||
"-ob",
|
||||
"-ob=false",
|
||||
"-ok=9",
|
||||
"-ot",
|
||||
"-ot=false",
|
||||
"--recompress",
|
||||
"--subst-char=XY",
|
||||
"--write-std-properties=2"
|
||||
|
|
@ -85,9 +85,9 @@ TEST(1)
|
|||
EXPECT_EQ (tl::to_string (stream_opt.get_option_by_name ("gds2_user_units").to_double ()), "1");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_write_cell_properties").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_write_file_properties").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_cblocks").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_cblocks").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_compression_level").to_int (), 2);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_strict_mode").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_strict_mode").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_recompress").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_substitution_char").to_string (), "*");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_std_properties_ext").to_int (), 1);
|
||||
|
|
@ -110,9 +110,9 @@ TEST(1)
|
|||
EXPECT_EQ (tl::to_string (stream_opt.get_option_by_name ("gds2_user_units").to_double ()), "2.5");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_write_cell_properties").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("gds2_write_file_properties").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_cblocks").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_cblocks").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_compression_level").to_int (), 9);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_strict_mode").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_strict_mode").to_bool (), false);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_recompress").to_bool (), true);
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_substitution_char").to_string (), "X");
|
||||
EXPECT_EQ (stream_opt.get_option_by_name ("oasis_write_std_properties_ext").to_int (), 2);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
* @brief The constructor
|
||||
*/
|
||||
OASISWriterOptions ()
|
||||
: compression_level (2), write_cblocks (false), strict_mode (false), recompress (false), permissive (false), write_std_properties (1), subst_char ("*")
|
||||
: compression_level (2), write_cblocks (true), strict_mode (true), recompress (false), permissive (false), write_std_properties (1), subst_char ("*")
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1176,6 +1176,11 @@ OASISWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::Save
|
|||
m_options = options.get_options<OASISWriterOptions> ();
|
||||
mp_stream = &stream;
|
||||
|
||||
if (stream.is_compressing ()) {
|
||||
std::string msg = tl::to_string (tr ("File compression is discouraged in OASIS, please use CBLOCK compression"));
|
||||
tl::warn << msg;
|
||||
}
|
||||
|
||||
double dbu = (options.dbu () == 0.0) ? layout.dbu () : options.dbu ();
|
||||
m_sf = options.scale_factor () * (layout.dbu () / dbu);
|
||||
if (fabs (m_sf - 1.0) < 1e-9) {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>590</width>
|
||||
<height>248</height>
|
||||
<width>633</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -74,46 +74,35 @@
|
|||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="4" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="std_prop_mode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No standard properties</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global standard properties</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global + per-cell bounding boxes</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="strict_mode">
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Write strict-mode OASIS files</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Strict mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="3">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Standard properties</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Substitution character</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="3">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
|
|
@ -169,17 +158,86 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Standard properties</string>
|
||||
<string>0 (low)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<item row="7" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="std_prop_mode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No standard properties</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global standard properties</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global + per-cell bounding boxes</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="strict_mode">
|
||||
<property name="text">
|
||||
<string>Substitution character</string>
|
||||
<string>Write strict-mode OASIS files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="write_cblocks">
|
||||
<property name="text">
|
||||
<string>Use CBLOCK compression for each cell (RFC1951)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="permissive">
|
||||
<property name="text">
|
||||
<string>Don't fail on paths with odd width and other odd shapes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compaction level
|
||||
(repetition detection)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Permissive mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -199,17 +257,54 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QFrame" name="cblock_warning_frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0 (low)</string>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../../../lay/lay/layResources.qrc">:/warn.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File compression - i.e. ".gz" - is discouraged in OASIS, please consider using CBLOCK compression</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="3">
|
||||
|
|
@ -234,13 +329,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
|
|
@ -248,30 +336,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compaction level
|
||||
(repetition detection)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="write_cblocks">
|
||||
<property name="text">
|
||||
<string>Use CBLOCK compression for each cell (RFC1951)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -289,17 +353,53 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="permissive">
|
||||
<property name="text">
|
||||
<string>Don't fail on paths with odd width and other odd shapes</string>
|
||||
<widget class="QFrame" name="strict_mode_warning_frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Permissive mode</string>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../../../lay/lay/layResources.qrc">:/warn.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Strict mode is recommended as strict mode OASIS files can be read more efficiently by some readers</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -329,6 +429,8 @@
|
|||
<tabstop>strict_mode</tabstop>
|
||||
<tabstop>subst_char</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../../../lay/lay/layResources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@
|
|||
#include "dbOASIS.h"
|
||||
#include "dbOASISWriter.h"
|
||||
#include "dbSaveLayoutOptions.h"
|
||||
#include "layStream.h"
|
||||
|
||||
#include "ui_OASISWriterOptionPage.h"
|
||||
#include "layOASISWriterPlugin.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
|
|
@ -36,25 +34,14 @@ namespace lay
|
|||
// ---------------------------------------------------------------
|
||||
// OASISWriterOptionPage definition and implementation
|
||||
|
||||
class OASISWriterOptionPage
|
||||
: public StreamWriterOptionsPage
|
||||
{
|
||||
public:
|
||||
OASISWriterOptionPage (QWidget *parent);
|
||||
~OASISWriterOptionPage ();
|
||||
|
||||
void setup (const db::FormatSpecificWriterOptions *options, const db::Technology *tech);
|
||||
void commit (db::FormatSpecificWriterOptions *options, const db::Technology *tech, bool gzip);
|
||||
|
||||
private:
|
||||
Ui::OASISWriterOptionPage *mp_ui;
|
||||
};
|
||||
|
||||
OASISWriterOptionPage::OASISWriterOptionPage (QWidget *parent)
|
||||
: StreamWriterOptionsPage (parent)
|
||||
{
|
||||
mp_ui = new Ui::OASISWriterOptionPage ();
|
||||
mp_ui->setupUi (this);
|
||||
|
||||
connect (mp_ui->write_cblocks, SIGNAL (clicked(bool)), this, SLOT (flags_changed()));
|
||||
connect (mp_ui->strict_mode, SIGNAL (clicked(bool)), this, SLOT (flags_changed()));
|
||||
}
|
||||
|
||||
OASISWriterOptionPage::~OASISWriterOptionPage ()
|
||||
|
|
@ -69,13 +56,22 @@ OASISWriterOptionPage::setup (const db::FormatSpecificWriterOptions *o, const db
|
|||
if (options) {
|
||||
mp_ui->compression_slider->setValue (options->compression_level);
|
||||
mp_ui->write_cblocks->setChecked (options->write_cblocks);
|
||||
mp_ui->cblock_warning_frame->setEnabled (! options->write_cblocks);
|
||||
mp_ui->strict_mode->setChecked (options->strict_mode);
|
||||
mp_ui->strict_mode_warning_frame->setEnabled (! options->strict_mode);
|
||||
mp_ui->std_prop_mode->setCurrentIndex (options->write_std_properties);
|
||||
mp_ui->subst_char->setText (tl::to_qstring (options->subst_char));
|
||||
mp_ui->permissive->setChecked (options->permissive);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OASISWriterOptionPage::flags_changed ()
|
||||
{
|
||||
mp_ui->cblock_warning_frame->setEnabled (! mp_ui->write_cblocks->isChecked ());
|
||||
mp_ui->strict_mode_warning_frame->setEnabled (! mp_ui->strict_mode->isChecked ());
|
||||
}
|
||||
|
||||
void
|
||||
OASISWriterOptionPage::commit (db::FormatSpecificWriterOptions *o, const db::Technology * /*tech*/, bool gzip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,10 +24,30 @@
|
|||
#ifndef HDR_layOASISWriterPlugin_h
|
||||
#define HDR_layOASISWriterPlugin_h
|
||||
|
||||
#include "layStream.h"
|
||||
#include "ui_OASISWriterOptionPage.h"
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
// .. nothing yet (but needed for MOC) ..
|
||||
class OASISWriterOptionPage
|
||||
: public StreamWriterOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OASISWriterOptionPage (QWidget *parent);
|
||||
~OASISWriterOptionPage ();
|
||||
|
||||
void setup (const db::FormatSpecificWriterOptions *options, const db::Technology *tech);
|
||||
void commit (db::FormatSpecificWriterOptions *options, const db::Technology *tech, bool gzip);
|
||||
|
||||
public slots:
|
||||
void flags_changed ();
|
||||
|
||||
private:
|
||||
Ui::OASISWriterOptionPage *mp_ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ void run_test (tl::TestBase *_this, const char *file, bool scaling_test, int com
|
|||
tl::OutputStream stream (tmp_file);
|
||||
db::OASISWriter writer;
|
||||
db::SaveLayoutOptions options;
|
||||
db::OASISWriterOptions oasis_options;
|
||||
oasis_options.write_cblocks = false;
|
||||
oasis_options.strict_mode = false;
|
||||
options.set_options (oasis_options);
|
||||
writer.write (layout, stream, options);
|
||||
}
|
||||
|
||||
|
|
@ -158,6 +162,7 @@ void run_test (tl::TestBase *_this, const char *file, bool scaling_test, int com
|
|||
db::OASISWriter writer;
|
||||
db::SaveLayoutOptions options;
|
||||
db::OASISWriterOptions oasis_options;
|
||||
oasis_options.write_cblocks = false;
|
||||
oasis_options.strict_mode = false;
|
||||
oasis_options.write_std_properties = 2;
|
||||
options.set_options (oasis_options);
|
||||
|
|
@ -557,6 +562,7 @@ TEST(100)
|
|||
{
|
||||
tl::OutputStream out (tmp_file);
|
||||
db::SaveLayoutOptions options;
|
||||
options.set_option_by_name ("oasis_strict_mode", false);
|
||||
options.set_format ("OASIS");
|
||||
db::Writer writer (options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1225,6 +1231,7 @@ TEST(115)
|
|||
{
|
||||
tl::OutputStream out (tmp_file);
|
||||
db::SaveLayoutOptions options;
|
||||
options.set_option_by_name ("oasis_strict_mode", false);
|
||||
options.set_format ("OASIS");
|
||||
db::Writer writer (options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1302,6 +1309,7 @@ TEST(116)
|
|||
{
|
||||
tl::OutputStream out (tmp_file);
|
||||
db::SaveLayoutOptions write_options;
|
||||
write_options.set_option_by_name ("oasis_strict_mode", false);
|
||||
write_options.set_format ("OASIS");
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1354,6 +1362,7 @@ TEST(116)
|
|||
write_options.set_format ("OASIS");
|
||||
db::OASISWriterOptions oas_write_options;
|
||||
oas_write_options.write_std_properties = 0;
|
||||
oas_write_options.strict_mode = false;
|
||||
write_options.set_options (oas_write_options);
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1403,6 +1412,7 @@ TEST(116)
|
|||
write_options.set_format ("OASIS");
|
||||
db::OASISWriterOptions oas_write_options;
|
||||
oas_write_options.write_std_properties = 2;
|
||||
oas_write_options.strict_mode = false;
|
||||
write_options.set_options (oas_write_options);
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1462,6 +1472,7 @@ TEST(116)
|
|||
db::OASISWriterOptions oas_write_options;
|
||||
oas_write_options.write_std_properties = 2;
|
||||
oas_write_options.strict_mode = true;
|
||||
oas_write_options.write_cblocks = false;
|
||||
write_options.set_options (oas_write_options);
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
|
|
@ -1522,6 +1533,7 @@ TEST(116)
|
|||
tl::OutputStream out (tmp_file);
|
||||
db::SaveLayoutOptions write_options;
|
||||
write_options.set_format ("OASIS");
|
||||
write_options.set_option_by_name ("oasis_strict_mode", false);
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
}
|
||||
|
|
@ -1572,6 +1584,7 @@ TEST(116)
|
|||
db::SaveLayoutOptions write_options;
|
||||
write_options.select_cell (c2.cell_index ());
|
||||
write_options.set_format ("OASIS");
|
||||
write_options.set_option_by_name ("oasis_strict_mode", false);
|
||||
db::Writer writer (write_options);
|
||||
writer.write (g, out);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -726,6 +726,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether that stream is compressing
|
||||
*/
|
||||
virtual bool is_compressing () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Rejects the output - for delegates supporting unrolling, this means the original file is restored
|
||||
*/
|
||||
|
|
@ -972,6 +980,11 @@ protected:
|
|||
*/
|
||||
virtual void seek_file (size_t /*s*/) { }
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether this steam is compressing
|
||||
*/
|
||||
virtual bool is_compressing () const { return true; }
|
||||
|
||||
private:
|
||||
// No copying
|
||||
OutputZLibFile (const OutputZLibFile &);
|
||||
|
|
@ -1244,6 +1257,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether that stream is compressing
|
||||
*/
|
||||
bool is_compressing () const
|
||||
{
|
||||
return mp_delegate != 0 && mp_delegate->is_compressing ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether that stream supports seek
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1122,7 +1122,11 @@ class DBLayoutTest(unittest.TestCase):
|
|||
shape.set_property("42", "the answer")
|
||||
|
||||
ly.write(file_gds)
|
||||
ly.write(file_oas)
|
||||
|
||||
opt = pya.SaveLayoutOptions()
|
||||
opt.format = "OASIS"
|
||||
opt.oasis_strict_mode = False
|
||||
ly.write(file_oas, opt)
|
||||
|
||||
ly2 = pya.Layout()
|
||||
ly2.read(file_gds)
|
||||
|
|
|
|||
Loading…
Reference in New Issue