mirror of https://github.com/KLayout/klayout.git
Small refactoring, added persisted flag for meta info
This commit is contained in:
parent
1a0542f155
commit
541f9a377f
|
|
@ -1753,7 +1753,7 @@ Layout::do_update ()
|
||||||
delete pr;
|
delete pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Layout::meta_info s_empty_meta;
|
static Layout::meta_info_map s_empty_meta;
|
||||||
|
|
||||||
Layout::meta_info_iterator
|
Layout::meta_info_iterator
|
||||||
Layout::begin_meta (db::cell_index_type ci) const
|
Layout::begin_meta (db::cell_index_type ci) const
|
||||||
|
|
@ -1823,12 +1823,12 @@ Layout::remove_meta_info (meta_info_name_id_type name_id)
|
||||||
m_meta_info.erase (name_id);
|
m_meta_info.erase (name_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tl::Variant &
|
const MetaInfo &
|
||||||
Layout::meta_info_value (meta_info_name_id_type name_id) const
|
Layout::meta_info (meta_info_name_id_type name_id) const
|
||||||
{
|
{
|
||||||
auto n = m_meta_info.find (name_id);
|
auto n = m_meta_info.find (name_id);
|
||||||
static tl::Variant null_value;
|
static MetaInfo null_value;
|
||||||
return n != m_meta_info.end () ? n->second.value : null_value;
|
return n != m_meta_info.end () ? n->second : null_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1852,18 +1852,18 @@ Layout::remove_meta_info (db::cell_index_type ci, meta_info_name_id_type name_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tl::Variant &
|
const MetaInfo &
|
||||||
Layout::meta_info_value (db::cell_index_type ci, meta_info_name_id_type name_id) const
|
Layout::meta_info (db::cell_index_type ci, meta_info_name_id_type name_id) const
|
||||||
{
|
{
|
||||||
auto c = m_meta_info_by_cell.find (ci);
|
auto c = m_meta_info_by_cell.find (ci);
|
||||||
if (c != m_meta_info_by_cell.end ()) {
|
if (c != m_meta_info_by_cell.end ()) {
|
||||||
auto i = c->second.find (name_id);
|
auto i = c->second.find (name_id);
|
||||||
if (i != c->second.end ()) {
|
if (i != c->second.end ()) {
|
||||||
return i->second.value;
|
return i->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static tl::Variant null_value;
|
static MetaInfo null_value;
|
||||||
return null_value;
|
return null_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -466,8 +466,8 @@ public:
|
||||||
typedef std::map<std::pair<lib_id_type, cell_index_type>, cell_index_type> lib_proxy_map;
|
typedef std::map<std::pair<lib_id_type, cell_index_type>, cell_index_type> lib_proxy_map;
|
||||||
typedef LayerIterator layer_iterator;
|
typedef LayerIterator layer_iterator;
|
||||||
typedef size_t meta_info_name_id_type;
|
typedef size_t meta_info_name_id_type;
|
||||||
typedef std::map<meta_info_name_id_type, MetaInfo> meta_info;
|
typedef std::map<meta_info_name_id_type, MetaInfo> meta_info_map;
|
||||||
typedef meta_info::const_iterator meta_info_iterator;
|
typedef meta_info_map::const_iterator meta_info_iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A helper functor to compare "const char *" by the content
|
* @brief A helper functor to compare "const char *" by the content
|
||||||
|
|
@ -1876,15 +1876,15 @@ public:
|
||||||
* @brief Gets the meta info value for a meta info object with the given name
|
* @brief Gets the meta info value for a meta info object with the given name
|
||||||
* If no object with that name exists, an empty string is returned
|
* If no object with that name exists, an empty string is returned
|
||||||
*/
|
*/
|
||||||
const tl::Variant &meta_info_value (const std::string &name) const
|
const MetaInfo &meta_info (const std::string &name) const
|
||||||
{
|
{
|
||||||
return meta_info_value (meta_info_name_id (name));
|
return meta_info (meta_info_name_id (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the meta info value for a meta info object with the given name ID
|
* @brief Gets the meta info value for a meta info object with the given name ID
|
||||||
*/
|
*/
|
||||||
const tl::Variant &meta_info_value (meta_info_name_id_type name_id) const;
|
const MetaInfo &meta_info (meta_info_name_id_type name_id) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clears the meta information for a specific cell
|
* @brief Clears the meta information for a specific cell
|
||||||
|
|
@ -1927,16 +1927,16 @@ public:
|
||||||
* @brief Gets the meta info value for a meta info object with the given name for the given cell
|
* @brief Gets the meta info value for a meta info object with the given name for the given cell
|
||||||
* If no object with that name exists, an empty string is returned
|
* If no object with that name exists, an empty string is returned
|
||||||
*/
|
*/
|
||||||
const tl::Variant &meta_info_value (db::cell_index_type ci, const std::string &name) const
|
const MetaInfo &meta_info (db::cell_index_type ci, const std::string &name) const
|
||||||
{
|
{
|
||||||
return meta_info_value (ci, meta_info_name_id (name));
|
return meta_info (ci, meta_info_name_id (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the meta info value for a meta info object with the given name ID for the given cell
|
* @brief Gets the meta info value for a meta info object with the given name ID for the given cell
|
||||||
* If no object with that name exists, an empty string is returned
|
* If no object with that name exists, an empty string is returned
|
||||||
*/
|
*/
|
||||||
const tl::Variant &meta_info_value (db::cell_index_type ci, meta_info_name_id_type name_id) const;
|
const MetaInfo &meta_info (db::cell_index_type ci, meta_info_name_id_type name_id) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This event is triggered when the technology changes
|
* @brief This event is triggered when the technology changes
|
||||||
|
|
@ -1980,8 +1980,8 @@ private:
|
||||||
bool m_editable;
|
bool m_editable;
|
||||||
std::map<std::string, meta_info_name_id_type> m_meta_info_name_map;
|
std::map<std::string, meta_info_name_id_type> m_meta_info_name_map;
|
||||||
std::vector<std::string> m_meta_info_names;
|
std::vector<std::string> m_meta_info_names;
|
||||||
meta_info m_meta_info;
|
meta_info_map m_meta_info;
|
||||||
std::map<db::cell_index_type, meta_info> m_meta_info_by_cell;
|
std::map<db::cell_index_type, meta_info_map> m_meta_info_by_cell;
|
||||||
|
|
||||||
std::string m_tech_name;
|
std::string m_tech_name;
|
||||||
tl::Mutex m_lock;
|
tl::Mutex m_lock;
|
||||||
|
|
|
||||||
|
|
@ -41,19 +41,21 @@ namespace db
|
||||||
*/
|
*/
|
||||||
struct DB_PUBLIC MetaInfo
|
struct DB_PUBLIC MetaInfo
|
||||||
{
|
{
|
||||||
MetaInfo (const std::string &d, const tl::Variant &v)
|
MetaInfo (const std::string &d, const tl::Variant &v, bool p = false)
|
||||||
: description (d), value (v)
|
: description (d), value (v), persisted (p)
|
||||||
{
|
{
|
||||||
// .. nothing else ..
|
// .. nothing else ..
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaInfo ()
|
MetaInfo ()
|
||||||
|
: persisted (false)
|
||||||
{
|
{
|
||||||
// .. nothing else ..
|
// .. nothing else ..
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string description;
|
std::string description;
|
||||||
tl::Variant value;
|
tl::Variant value;
|
||||||
|
bool persisted;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1010,7 +1010,18 @@ static const tl::Variant &cell_meta_info_value (db::Cell *cell, const std::strin
|
||||||
static tl::Variant null_value;
|
static tl::Variant null_value;
|
||||||
return null_value;
|
return null_value;
|
||||||
} else {
|
} else {
|
||||||
return cell->layout ()->meta_info_value (cell->cell_index (), name);
|
return cell->layout ()->meta_info (cell->cell_index (), name).value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static MetaInfo cell_meta_info (db::Cell *cell, const std::string &name)
|
||||||
|
{
|
||||||
|
if (! cell->layout ()) {
|
||||||
|
static MetaInfo null_value;
|
||||||
|
return null_value;
|
||||||
|
} else {
|
||||||
|
const db::MetaInfo &value = cell->layout ()->meta_info (cell->cell_index (), name);
|
||||||
|
return MetaInfo (name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1841,7 +1852,16 @@ Class<db::Cell> decl_Cell ("db", "Cell",
|
||||||
"@brief Gets the meta information value for a given name\n"
|
"@brief Gets the meta information value for a given name\n"
|
||||||
"See \\LayoutMetaInfo for details about cells and meta information.\n"
|
"See \\LayoutMetaInfo for details about cells and meta information.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"If no meta information with the given name exists, an nil value will be returned.\n"
|
"If no meta information with the given name exists, a nil value will be returned.\n"
|
||||||
|
"A more generic version that delivers all fields of the meta information is \\meta_info.\n"
|
||||||
|
"\n"
|
||||||
|
"This method has been introduced in version 0.28.7."
|
||||||
|
) +
|
||||||
|
gsi::method_ext ("meta_info", &cell_meta_info, gsi::arg ("name"),
|
||||||
|
"@brief Gets the meta information for a given name\n"
|
||||||
|
"See \\LayoutMetaInfo for details about cells and meta information.\n"
|
||||||
|
"\n"
|
||||||
|
"If no meta information with the given name exists, a default object with empty fields will be returned.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"This method has been introduced in version 0.28.7."
|
"This method has been introduced in version 0.28.7."
|
||||||
) +
|
) +
|
||||||
|
|
|
||||||
|
|
@ -908,6 +908,18 @@ static void layout_add_meta_info (db::Layout *layout, const MetaInfo &mi)
|
||||||
layout->add_meta_info (mi.name, db::MetaInfo (mi.description, mi.value));
|
layout->add_meta_info (mi.name, db::MetaInfo (mi.description, mi.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MetaInfo layout_get_meta_info (db::Layout *layout, const std::string &name)
|
||||||
|
{
|
||||||
|
const db::MetaInfo &value = layout->meta_info (name);
|
||||||
|
return MetaInfo (name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const tl::Variant &layout_get_meta_info_value (db::Layout *layout, const std::string &name)
|
||||||
|
{
|
||||||
|
const db::MetaInfo &value = layout->meta_info (name);
|
||||||
|
return value.value;
|
||||||
|
}
|
||||||
|
|
||||||
static MetaInfoIterator layout_each_meta_info (const db::Layout *layout)
|
static MetaInfoIterator layout_each_meta_info (const db::Layout *layout)
|
||||||
{
|
{
|
||||||
return MetaInfoIterator (layout, layout->begin_meta (), layout->end_meta ());
|
return MetaInfoIterator (layout, layout->begin_meta (), layout->end_meta ());
|
||||||
|
|
@ -1052,14 +1064,23 @@ Class<db::Layout> decl_Layout ("db", "Layout",
|
||||||
"\n"
|
"\n"
|
||||||
"This method has been introduced in version 0.25."
|
"This method has been introduced in version 0.25."
|
||||||
) +
|
) +
|
||||||
gsi::method ("meta_info_value", static_cast<const tl::Variant &(db::Layout::*) (const std::string &name) const> (&db::Layout::meta_info_value), gsi::arg ("name"),
|
gsi::method_ext ("meta_info_value", &layout_get_meta_info_value, gsi::arg ("name"),
|
||||||
"@brief Gets the meta information value for a given name\n"
|
"@brief Gets the meta information value for a given name\n"
|
||||||
"See \\LayoutMetaInfo for details about layouts and meta information.\n"
|
"See \\LayoutMetaInfo for details about layouts and meta information.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"If no meta information with the given name exists, an nil value will be returned.\n"
|
"If no meta information with the given name exists, a nil value will be returned.\n"
|
||||||
|
"A more generic version that delivers all fields of the meta information is \\meta_info.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"This method has been introduced in version 0.25. Starting with version 0.28.7, the value is of variant type instead of string only.\n"
|
"This method has been introduced in version 0.25. Starting with version 0.28.7, the value is of variant type instead of string only.\n"
|
||||||
) +
|
) +
|
||||||
|
gsi::method_ext ("meta_info", &layout_get_meta_info, gsi::arg ("name"),
|
||||||
|
"@brief Gets the meta information for a given name\n"
|
||||||
|
"See \\LayoutMetaInfo for details about layouts and meta information.\n"
|
||||||
|
"\n"
|
||||||
|
"If no meta information with the given name exists, a default object with empty fields will be returned.\n"
|
||||||
|
"\n"
|
||||||
|
"This method has been introduced in version 0.28.7.\n"
|
||||||
|
) +
|
||||||
gsi::iterator_ext ("each_meta_info", &layout_each_meta_info,
|
gsi::iterator_ext ("each_meta_info", &layout_each_meta_info,
|
||||||
"@brief Iterates over the meta information of the layout\n"
|
"@brief Iterates over the meta information of the layout\n"
|
||||||
"See \\LayoutMetaInfo for details about layouts and meta information.\n"
|
"See \\LayoutMetaInfo for details about layouts and meta information.\n"
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@
|
||||||
namespace gsi
|
namespace gsi
|
||||||
{
|
{
|
||||||
|
|
||||||
static MetaInfo *layout_meta_info_ctor (const std::string &name, const std::string &value, const std::string &description)
|
static MetaInfo *layout_meta_info_ctor (const std::string &name, const std::string &value, const std::string &description, bool persisted)
|
||||||
{
|
{
|
||||||
return new MetaInfo (name, description, value);
|
return new MetaInfo (name, description, value, persisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layout_meta_set_name (MetaInfo *mi, const std::string &n)
|
static void layout_meta_set_name (MetaInfo *mi, const std::string &n)
|
||||||
|
|
@ -62,13 +62,26 @@ static const std::string &layout_meta_get_description (const MetaInfo *mi)
|
||||||
return mi->description;
|
return mi->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void layout_meta_set_persisted (MetaInfo *mi, bool f)
|
||||||
|
{
|
||||||
|
mi->persisted = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool layout_meta_get_persisted (const MetaInfo *mi)
|
||||||
|
{
|
||||||
|
return mi->persisted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Class<MetaInfo> decl_LayoutMetaInfo ("db", "LayoutMetaInfo",
|
Class<MetaInfo> decl_LayoutMetaInfo ("db", "LayoutMetaInfo",
|
||||||
gsi::constructor ("new", &layout_meta_info_ctor, gsi::arg ("name"), gsi::arg ("value"), gsi::arg ("description", std::string ()),
|
gsi::constructor ("new", &layout_meta_info_ctor, gsi::arg ("name"), gsi::arg ("value"), gsi::arg ("description", std::string ()), gsi::arg ("persisted", false),
|
||||||
"@brief Creates a layout meta info object\n"
|
"@brief Creates a layout meta info object\n"
|
||||||
"@param name The name\n"
|
"@param name The name\n"
|
||||||
"@param value The value\n"
|
"@param value The value\n"
|
||||||
"@param description An optional description text\n"
|
"@param description An optional description text\n"
|
||||||
|
"@param persisted If true, the meta information will be persisted in some file formats, like GDS2\n"
|
||||||
|
"\n"
|
||||||
|
"The 'persisted' attribute has been introduced in version 0.28.7.\n"
|
||||||
) +
|
) +
|
||||||
gsi::method_ext ("name", &layout_meta_get_name,
|
gsi::method_ext ("name", &layout_meta_get_name,
|
||||||
"@brief Gets the name of the layout meta info object\n"
|
"@brief Gets the name of the layout meta info object\n"
|
||||||
|
|
@ -87,6 +100,14 @@ Class<MetaInfo> decl_LayoutMetaInfo ("db", "LayoutMetaInfo",
|
||||||
) +
|
) +
|
||||||
gsi::method_ext ("description=", &layout_meta_set_description,
|
gsi::method_ext ("description=", &layout_meta_set_description,
|
||||||
"@brief Sets the description of the layout meta info object\n"
|
"@brief Sets the description of the layout meta info object\n"
|
||||||
|
) +
|
||||||
|
gsi::method_ext ("persisted", &layout_meta_get_persisted,
|
||||||
|
"@brief Gets a value indicating whether the meta information will be persisted\n"
|
||||||
|
"This predicate was introduced in version 0.28.7.\n"
|
||||||
|
) +
|
||||||
|
gsi::method_ext ("persisted=", &layout_meta_set_persisted,
|
||||||
|
"@brief Sets a value indicating whether the meta information will be persisted\n"
|
||||||
|
"This predicate was introduced in version 0.28.7.\n"
|
||||||
),
|
),
|
||||||
"@brief A piece of layout meta information\n"
|
"@brief A piece of layout meta information\n"
|
||||||
"Layout meta information is basically additional data that can be attached to a layout. "
|
"Layout meta information is basically additional data that can be attached to a layout. "
|
||||||
|
|
@ -97,9 +118,10 @@ Class<MetaInfo> decl_LayoutMetaInfo ("db", "LayoutMetaInfo",
|
||||||
"Meta information is identified by a unique name and carries a string value plus an optional description string. "
|
"Meta information is identified by a unique name and carries a string value plus an optional description string. "
|
||||||
"The description string is for information only and is not evaluated by code.\n"
|
"The description string is for information only and is not evaluated by code.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"See also \\Layout#each_meta_info and \\Layout#meta_info_value and \\Layout#remove_meta_info"
|
"See also \\Layout#each_meta_info, \\Layout#meta_info_value, \\Layout#meta_info and \\Layout#remove_meta_info as "
|
||||||
|
"well as the corresponding \\Cell methods.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"This class has been introduced in version 0.25."
|
"This class has been introduced in version 0.25 and was extended in version 0.28.7."
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,22 @@ namespace gsi
|
||||||
|
|
||||||
struct MetaInfo
|
struct MetaInfo
|
||||||
{
|
{
|
||||||
MetaInfo (const std::string &n, const std::string &d, const tl::Variant &v)
|
MetaInfo (const std::string &n, const std::string &d, const tl::Variant &v, bool p)
|
||||||
: name (n), description (d), value (v)
|
: name (n), description (d), value (v), persisted (p)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
MetaInfo (const std::string &n, const db::MetaInfo &mi)
|
||||||
|
: name (n), description (mi.description), value (mi.value), persisted (mi.persisted)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
MetaInfo ()
|
MetaInfo ()
|
||||||
: name (), description (), value ()
|
: name (), description (), value (), persisted (false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
tl::Variant value;
|
tl::Variant value;
|
||||||
|
bool persisted;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MetaInfoIterator
|
struct MetaInfoIterator
|
||||||
|
|
@ -79,7 +84,7 @@ struct MetaInfoIterator
|
||||||
MetaInfo operator* () const
|
MetaInfo operator* () const
|
||||||
{
|
{
|
||||||
if (mp_layout) {
|
if (mp_layout) {
|
||||||
return MetaInfo (mp_layout->meta_info_name (m_b->first), m_b->second.description, m_b->second.value);
|
return MetaInfo (mp_layout->meta_info_name (m_b->first), m_b->second);
|
||||||
} else {
|
} else {
|
||||||
return MetaInfo ();
|
return MetaInfo ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,9 +200,10 @@ LibraryController::sync_files ()
|
||||||
reader.read (lib->layout ());
|
reader.read (lib->layout ());
|
||||||
|
|
||||||
// Use the libname if there is one
|
// Use the libname if there is one
|
||||||
|
db::Layout::meta_info_name_id_type libname_name_id = lib->layout ().meta_info_name_id ("libname");
|
||||||
for (db::Layout::meta_info_iterator m = lib->layout ().begin_meta (); m != lib->layout ().end_meta (); ++m) {
|
for (db::Layout::meta_info_iterator m = lib->layout ().begin_meta (); m != lib->layout ().end_meta (); ++m) {
|
||||||
if (m->name == "libname" && ! m->value.empty ()) {
|
if (m->first == libname_name_id && ! m->second.value.is_nil ()) {
|
||||||
lib->set_name (m->value);
|
lib->set_name (m->second.value.to_string ());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3202,6 +3202,25 @@ LayoutViewBase::reload_layout (unsigned int cv_index)
|
||||||
goto_view (state);
|
goto_view (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_lyp_from_meta_info (const db::Layout &layout, std::string &lyp_file, bool &add_other_layers)
|
||||||
|
{
|
||||||
|
db::Layout::meta_info_name_id_type layer_properties_file_name_id = layout.meta_info_name_id ("layer-properties-file");
|
||||||
|
db::Layout::meta_info_name_id_type layer_properties_add_other_layers_name_id = layout.meta_info_name_id ("layer-properties-add-other-layers");
|
||||||
|
|
||||||
|
for (db::Layout::meta_info_iterator meta = layout.begin_meta (); meta != layout.end_meta (); ++meta) {
|
||||||
|
if (meta->first == layer_properties_file_name_id) {
|
||||||
|
lyp_file = meta->second.value.to_string ();
|
||||||
|
}
|
||||||
|
if (meta->first == layer_properties_add_other_layers_name_id) {
|
||||||
|
try {
|
||||||
|
add_other_layers = meta->second.value.to_bool ();
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview, bool initialize_layers)
|
LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview, bool initialize_layers)
|
||||||
{
|
{
|
||||||
|
|
@ -3266,17 +3285,7 @@ LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give the layout object a chance to specify a certain layer property file
|
// Give the layout object a chance to specify a certain layer property file
|
||||||
for (db::Layout::meta_info_iterator meta = cv->layout ().begin_meta (); meta != cv->layout ().end_meta (); ++meta) {
|
get_lyp_from_meta_info (cv->layout (), lyp_file, add_other_layers);
|
||||||
if (meta->name == "layer-properties-file") {
|
|
||||||
lyp_file = meta->value;
|
|
||||||
}
|
|
||||||
if (meta->name == "layer-properties-add-other-layers") {
|
|
||||||
try {
|
|
||||||
tl::from_string (meta->value, add_other_layers);
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// interpolate the layout properties file name
|
// interpolate the layout properties file name
|
||||||
tl::Eval expr;
|
tl::Eval expr;
|
||||||
|
|
@ -3438,17 +3447,7 @@ LayoutViewBase::load_layout (const std::string &filename, const db::LoadLayoutOp
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give the layout object a chance to specify a certain layer property file
|
// Give the layout object a chance to specify a certain layer property file
|
||||||
for (db::Layout::meta_info_iterator meta = cv->layout().begin_meta (); meta != cv->layout().end_meta (); ++meta) {
|
get_lyp_from_meta_info (cv->layout (), lyp_file, add_other_layers);
|
||||||
if (meta->name == "layer-properties-file") {
|
|
||||||
lyp_file = meta->value;
|
|
||||||
}
|
|
||||||
if (meta->name == "layer-properties-add-other-layers") {
|
|
||||||
try {
|
|
||||||
tl::from_string (meta->value, add_other_layers);
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// interpolate the layout properties file name
|
// interpolate the layout properties file name
|
||||||
tl::Eval expr;
|
tl::Eval expr;
|
||||||
|
|
|
||||||
|
|
@ -612,7 +612,7 @@ StatisticsSource::get (const std::string &url)
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "<tr>" << std::endl
|
os << "<tr>" << std::endl
|
||||||
<< "<td>" << layout.get_properties (*l).to_string () << "</td>" << std::endl
|
<< "<td>" << tl::escaped_to_html (layout.get_properties (*l).to_string (), true) << "</td>" << std::endl
|
||||||
// Boxes (total, single, array)
|
// Boxes (total, single, array)
|
||||||
<< "<td>" << st_hier.box_total () << "<br></br>" << st_flat.box_total () << "</td>" << std::endl
|
<< "<td>" << st_hier.box_total () << "<br></br>" << st_flat.box_total () << "</td>" << std::endl
|
||||||
<< "<td>" << st_hier.box_single () << "<br></br>" << st_flat.box_single () << "</td>" << std::endl
|
<< "<td>" << st_hier.box_single () << "<br></br>" << st_flat.box_single () << "</td>" << std::endl
|
||||||
|
|
@ -678,19 +678,19 @@ StatisticsSource::get (const std::string &url)
|
||||||
|
|
||||||
os << "<html>" << std::endl
|
os << "<html>" << std::endl
|
||||||
<< "<body>" << std::endl
|
<< "<body>" << std::endl
|
||||||
<< "<h2>" << tl::to_string (QObject::tr ("Common Statistics For '")) << m_h->name () << "'</h2>" << std::endl
|
<< "<h2>" << tl::to_string (QObject::tr ("Common Statistics For '")) << tl::escaped_to_html (m_h->name (), true) << "'</h2>" << std::endl
|
||||||
<< "<p>" << std::endl
|
<< "<p>" << std::endl
|
||||||
<< "<table>" << std::endl
|
<< "<table>" << std::endl
|
||||||
<< "<tr>"
|
<< "<tr>"
|
||||||
<< "<td>" << tl::to_string (QObject::tr ("Path")) << ": </td><td>" << m_h->filename () << "</td>"
|
<< "<td>" << tl::to_string (QObject::tr ("Path")) << ": </td><td>" << tl::escaped_to_html (m_h->filename (), true) << "</td>"
|
||||||
<< "</tr>" << std::endl;
|
<< "</tr>" << std::endl;
|
||||||
if (! m_h->save_options ().format ().empty ()) {
|
if (! m_h->save_options ().format ().empty ()) {
|
||||||
os << "<tr>"
|
os << "<tr>"
|
||||||
<< "<td>" << tl::to_string (QObject::tr ("Format")) << ": </td><td>" << m_h->save_options ().format () << "</td>"
|
<< "<td>" << tl::to_string (QObject::tr ("Format")) << ": </td><td>" << tl::escaped_to_html (m_h->save_options ().format (), true) << "</td>"
|
||||||
<< "</tr>" << std::endl;
|
<< "</tr>" << std::endl;
|
||||||
}
|
}
|
||||||
os << "<tr>"
|
os << "<tr>"
|
||||||
<< "<td>" << tl::to_string (QObject::tr ("Technology")) << ": </td><td>" << m_h->technology ()->description () << format_tech_name (m_h->tech_name ()) << "</td>"
|
<< "<td>" << tl::to_string (QObject::tr ("Technology")) << ": </td><td>" << tl::escaped_to_html (m_h->technology ()->description (), true) << tl::escaped_to_html (format_tech_name (m_h->tech_name ()), true) << "</td>"
|
||||||
<< "</tr>" << std::endl
|
<< "</tr>" << std::endl
|
||||||
<< "<tr>"
|
<< "<tr>"
|
||||||
<< "<td>" << tl::to_string (QObject::tr ("Database unit")) << ": </td><td>" << tl::sprintf ("%.12g ", layout.dbu ()) << tl::to_string (QObject::tr ("micron")) << "</td>"
|
<< "<td>" << tl::to_string (QObject::tr ("Database unit")) << ": </td><td>" << tl::sprintf ("%.12g ", layout.dbu ()) << tl::to_string (QObject::tr ("micron")) << "</td>"
|
||||||
|
|
@ -702,13 +702,17 @@ StatisticsSource::get (const std::string &url)
|
||||||
<< "<td>" << tl::to_string (QObject::tr ("Number of layers")) << ": </td><td>" << num_layers << "</td>"
|
<< "<td>" << tl::to_string (QObject::tr ("Number of layers")) << ": </td><td>" << num_layers << "</td>"
|
||||||
<< "</tr>" << std::endl;
|
<< "</tr>" << std::endl;
|
||||||
for (db::Layout::meta_info_iterator meta = layout.begin_meta (); meta != layout.end_meta (); ++meta) {
|
for (db::Layout::meta_info_iterator meta = layout.begin_meta (); meta != layout.end_meta (); ++meta) {
|
||||||
os << "<tr><td>" << meta->description << "</td><td>" << meta->value << "</td></tr>" << std::endl;
|
std::string d = meta->second.description;
|
||||||
|
if (!d.empty ()) {
|
||||||
|
d = layout.meta_info_name (meta->first);
|
||||||
|
}
|
||||||
|
os << "<tr><td>" << tl::escaped_to_html (d, true) << "</td><td>" << tl::escaped_to_html (meta->second.value.to_string (), true) << "</td></tr>" << std::endl;
|
||||||
}
|
}
|
||||||
os << "</table>" << std::endl
|
os << "</table>" << std::endl
|
||||||
<< "<h2>" << tl::to_string (QObject::tr ("Top Cells")) << "</h2>" << std::endl
|
<< "<h2>" << tl::to_string (QObject::tr ("Top Cells")) << "</h2>" << std::endl
|
||||||
<< "<table>" << std::endl;
|
<< "<table>" << std::endl;
|
||||||
for (db::Layout::top_down_const_iterator tc = layout.begin_top_down (); tc != layout.end_top_cells (); ++tc) {
|
for (db::Layout::top_down_const_iterator tc = layout.begin_top_down (); tc != layout.end_top_cells (); ++tc) {
|
||||||
os << "<tr><td>" << layout.cell_name (*tc) << "</td></tr>" << std::endl;
|
os << "<tr><td>" << tl::escaped_to_html (layout.cell_name (*tc), true) << "</td></tr>" << std::endl;
|
||||||
}
|
}
|
||||||
os << "</table>" << std::endl;
|
os << "</table>" << std::endl;
|
||||||
os << "</p>" << std::endl;
|
os << "</p>" << std::endl;
|
||||||
|
|
@ -733,7 +737,7 @@ StatisticsSource::get (const std::string &url)
|
||||||
if (! layers_sorted_by_ld.empty ()) {
|
if (! layers_sorted_by_ld.empty ()) {
|
||||||
|
|
||||||
os << "<h2>" << tl::to_string (QObject::tr ("Layers (sorted by layer and datatype)")) << "</h2>" << std::endl
|
os << "<h2>" << tl::to_string (QObject::tr ("Layers (sorted by layer and datatype)")) << "</h2>" << std::endl
|
||||||
<< "<p><a href=\"" << tl::to_string (s_per_layer_stat_path_ld) << "\">Detailed layer statistics</a></p>" << std::endl
|
<< "<p><a href=\"" << tl::escaped_to_html (tl::to_string (s_per_layer_stat_path_ld), true) << "\">Detailed layer statistics</a></p>" << std::endl
|
||||||
<< "<p>" << std::endl
|
<< "<p>" << std::endl
|
||||||
<< "<table>" << std::endl
|
<< "<table>" << std::endl
|
||||||
<< "<tr><td><b>" << tl::to_string (QObject::tr ("Layer/Datatype")) << "</b> </td>";
|
<< "<tr><td><b>" << tl::to_string (QObject::tr ("Layer/Datatype")) << "</b> </td>";
|
||||||
|
|
@ -748,7 +752,7 @@ StatisticsSource::get (const std::string &url)
|
||||||
os << "<tr>"
|
os << "<tr>"
|
||||||
<< "<td>" << tl::sprintf ("%d/%d", lp.layer, lp.datatype) << "</td>";
|
<< "<td>" << tl::sprintf ("%d/%d", lp.layer, lp.datatype) << "</td>";
|
||||||
if (! layers_with_oasis_names.empty ()) {
|
if (! layers_with_oasis_names.empty ()) {
|
||||||
os << "<td>" << lp.name << "</td>";
|
os << "<td>" << tl::escaped_to_html (lp.name, true) << "</td>";
|
||||||
}
|
}
|
||||||
os << "</tr>" << std::endl;
|
os << "</tr>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
@ -762,7 +766,7 @@ StatisticsSource::get (const std::string &url)
|
||||||
if (! layers_with_oasis_names.empty ()) {
|
if (! layers_with_oasis_names.empty ()) {
|
||||||
|
|
||||||
os << "<h2>" << tl::to_string (QObject::tr ("Layers (sorted by layer names)")) << "</h2>" << std::endl
|
os << "<h2>" << tl::to_string (QObject::tr ("Layers (sorted by layer names)")) << "</h2>" << std::endl
|
||||||
<< "<p><a href=\"" << tl::to_string (s_per_layer_stat_path_name) << "\">Detailed layer statistics</a></p>" << std::endl
|
<< "<p><a href=\"" << tl::escaped_to_html (tl::to_string (s_per_layer_stat_path_name), true) << "\">Detailed layer statistics</a></p>" << std::endl
|
||||||
<< "<p>" << std::endl
|
<< "<p>" << std::endl
|
||||||
<< "<table>" << std::endl
|
<< "<table>" << std::endl
|
||||||
<< "<tr><td><b>" << tl::to_string (QObject::tr ("Layer name")) << "</b> </td><td><b>" << tl::to_string (QObject::tr ("Layer/Datatype")) << "</b></td></tr>" << std::endl;
|
<< "<tr><td><b>" << tl::to_string (QObject::tr ("Layer name")) << "</b> </td><td><b>" << tl::to_string (QObject::tr ("Layer/Datatype")) << "</b></td></tr>" << std::endl;
|
||||||
|
|
@ -772,7 +776,7 @@ StatisticsSource::get (const std::string &url)
|
||||||
const db::LayerProperties &lp = layout.get_properties (*i);
|
const db::LayerProperties &lp = layout.get_properties (*i);
|
||||||
if (! lp.name.empty ()) {
|
if (! lp.name.empty ()) {
|
||||||
os << "<tr>"
|
os << "<tr>"
|
||||||
<< "<td>" << lp.name << "</td>"
|
<< "<td>" << tl::escaped_to_html (lp.name, true) << "</td>"
|
||||||
<< "<td>" << tl::sprintf ("%d/%d", lp.layer, lp.datatype) << "</td>"
|
<< "<td>" << tl::sprintf ("%d/%d", lp.layer, lp.datatype) << "</td>"
|
||||||
<< "</tr>" << std::endl;
|
<< "</tr>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,8 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||||
unsigned int mod_time[6] = { 0, 0, 0, 0, 0, 0 };
|
unsigned int mod_time[6] = { 0, 0, 0, 0, 0, 0 };
|
||||||
unsigned int access_time[6] = { 0, 0, 0, 0, 0, 0 };
|
unsigned int access_time[6] = { 0, 0, 0, 0, 0, 0 };
|
||||||
get_time (mod_time, access_time);
|
get_time (mod_time, access_time);
|
||||||
layout.add_meta_info (MetaInfo ("mod_time", tl::to_string (tr ("Modification Time")), tl::sprintf ("%d/%d/%d %d:%02d:%02d", mod_time[1], mod_time[2], mod_time[0], mod_time[3], mod_time[4], mod_time[5])));
|
layout.add_meta_info ("mod_time", MetaInfo (tl::to_string (tr ("Modification Time")), tl::sprintf ("%d/%d/%d %d:%02d:%02d", mod_time[1], mod_time[2], mod_time[0], mod_time[3], mod_time[4], mod_time[5])));
|
||||||
layout.add_meta_info (MetaInfo ("access_time", tl::to_string (tr ("Access Time")), tl::sprintf ("%d/%d/%d %d:%02d:%02d", access_time[1], access_time[2], access_time[0], access_time[3], access_time[4], access_time[5])));
|
layout.add_meta_info ("access_time", MetaInfo (tl::to_string (tr ("Access Time")), tl::sprintf ("%d/%d/%d %d:%02d:%02d", access_time[1], access_time[2], access_time[0], access_time[3], access_time[4], access_time[5])));
|
||||||
|
|
||||||
long attr = 0;
|
long attr = 0;
|
||||||
db::PropertiesRepository::properties_set layout_properties;
|
db::PropertiesRepository::properties_set layout_properties;
|
||||||
|
|
@ -234,9 +234,9 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||||
double dbuu = get_double ();
|
double dbuu = get_double ();
|
||||||
double dbum = get_double ();
|
double dbum = get_double ();
|
||||||
|
|
||||||
layout.add_meta_info (MetaInfo ("dbuu", tl::to_string (tr ("Database unit in user units")), tl::to_string (dbuu)));
|
layout.add_meta_info ("dbuu", MetaInfo (tl::to_string (tr ("Database unit in user units")), tl::to_string (dbuu)));
|
||||||
layout.add_meta_info (MetaInfo ("dbum", tl::to_string (tr ("Database unit in meter")), tl::to_string (dbum)));
|
layout.add_meta_info ("dbum", MetaInfo (tl::to_string (tr ("Database unit in meter")), tl::to_string (dbum)));
|
||||||
layout.add_meta_info (MetaInfo ("libname", tl::to_string (tr ("Library name")), m_libname));
|
layout.add_meta_info ("libname", MetaInfo (tl::to_string (tr ("Library name")), m_libname));
|
||||||
|
|
||||||
m_dbuu = dbuu;
|
m_dbuu = dbuu;
|
||||||
m_dbu = dbum * 1e6; /*in micron*/
|
m_dbu = dbum * 1e6; /*in micron*/
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,9 @@ GDS2WriterBase::write (db::Layout &layout, tl::OutputStream &stream, const db::S
|
||||||
|
|
||||||
db::GDS2WriterOptions gds2_options = options.get_options<db::GDS2WriterOptions> ();
|
db::GDS2WriterOptions gds2_options = options.get_options<db::GDS2WriterOptions> ();
|
||||||
|
|
||||||
layout.add_meta_info (MetaInfo ("dbuu", tl::to_string (tr ("Database unit in user units")), tl::to_string (dbu / std::max (1e-9, gds2_options.user_units))));
|
layout.add_meta_info ("dbuu", MetaInfo (tl::to_string (tr ("Database unit in user units")), tl::to_string (dbu / std::max (1e-9, gds2_options.user_units))));
|
||||||
layout.add_meta_info (MetaInfo ("dbum", tl::to_string (tr ("Database unit in meter")), tl::to_string (dbu * 1e-6)));
|
layout.add_meta_info ("dbum", MetaInfo (tl::to_string (tr ("Database unit in meter")), tl::to_string (dbu * 1e-6)));
|
||||||
layout.add_meta_info (MetaInfo ("libname", tl::to_string (tr ("Library name")), gds2_options.libname));
|
layout.add_meta_info ("libname", MetaInfo (tl::to_string (tr ("Library name")), gds2_options.libname));
|
||||||
|
|
||||||
std::vector <std::pair <unsigned int, db::LayerProperties> > layers;
|
std::vector <std::pair <unsigned int, db::LayerProperties> > layers;
|
||||||
options.get_valid_layers (layout, layers, db::SaveLayoutOptions::LP_AssignNumber);
|
options.get_valid_layers (layout, layers, db::SaveLayoutOptions::LP_AssignNumber);
|
||||||
|
|
@ -123,8 +123,8 @@ GDS2WriterBase::write (db::Layout &layout, tl::OutputStream &stream, const db::S
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string str_time = tl::sprintf ("%d/%d/%d %d:%02d:%02d", time_data[1], time_data[2], time_data[0], time_data[3], time_data[4], time_data[5]);
|
std::string str_time = tl::sprintf ("%d/%d/%d %d:%02d:%02d", time_data[1], time_data[2], time_data[0], time_data[3], time_data[4], time_data[5]);
|
||||||
layout.add_meta_info (MetaInfo ("mod_time", tl::to_string (tr ("Modification Time")), str_time));
|
layout.add_meta_info ("mod_time", MetaInfo (tl::to_string (tr ("Modification Time")), str_time));
|
||||||
layout.add_meta_info (MetaInfo ("access_time", tl::to_string (tr ("Access Time")), str_time));
|
layout.add_meta_info ("access_time", MetaInfo (tl::to_string (tr ("Access Time")), str_time));
|
||||||
|
|
||||||
bool multi_xy = gds2_options.multi_xy_records;
|
bool multi_xy = gds2_options.multi_xy_records;
|
||||||
size_t max_cellname_length = std::max (gds2_options.max_cellname_length, (unsigned int)8);
|
size_t max_cellname_length = std::max (gds2_options.max_cellname_length, (unsigned int)8);
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,10 @@ public:
|
||||||
// Initialize the libname property from meta data with key "libname".
|
// Initialize the libname property from meta data with key "libname".
|
||||||
db::GDS2WriterOptions *options = dynamic_cast<db::GDS2WriterOptions *> (o);
|
db::GDS2WriterOptions *options = dynamic_cast<db::GDS2WriterOptions *> (o);
|
||||||
if (options) {
|
if (options) {
|
||||||
|
db::Layout::meta_info_name_id_type libname_name_id = lh.layout().meta_info_name_id ("libname");
|
||||||
for (db::Layout::meta_info_iterator meta = lh.layout().begin_meta (); meta != lh.layout().end_meta (); ++meta) {
|
for (db::Layout::meta_info_iterator meta = lh.layout().begin_meta (); meta != lh.layout().end_meta (); ++meta) {
|
||||||
if (meta->name == "libname" && !meta->value.empty ()) {
|
if (meta->first == libname_name_id && !meta->second.value.is_nil ()) {
|
||||||
options->libname = meta->value;
|
options->libname = meta->second.value.to_string ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ TEST(1)
|
||||||
db::LayerMap map = reader.read (layout);
|
db::LayerMap map = reader.read (layout);
|
||||||
|
|
||||||
EXPECT_EQ (fabs (layout.dbu () / 0.001 - 1.0) < 1e-6, true);
|
EXPECT_EQ (fabs (layout.dbu () / 0.001 - 1.0) < 1e-6, true);
|
||||||
EXPECT_EQ (layout.meta_info_value ("libname"), "LIB.DB");
|
EXPECT_EQ (layout.meta_info ("libname").value.to_string (), "LIB.DB");
|
||||||
|
|
||||||
EXPECT_EQ (layout.layers (), size_t (11));
|
EXPECT_EQ (layout.layers (), size_t (11));
|
||||||
EXPECT_EQ (map.mapping_str (0), "2/0 : 2/0");
|
EXPECT_EQ (map.mapping_str (0), "2/0 : 2/0");
|
||||||
|
|
@ -289,7 +289,7 @@ TEST(2)
|
||||||
db::Reader reader (file);
|
db::Reader reader (file);
|
||||||
map = reader.read (layout_none, options);
|
map = reader.read (layout_none, options);
|
||||||
EXPECT_EQ (fabs (layout_none.dbu () / 0.001 - 1.0) < 1e-6, true);
|
EXPECT_EQ (fabs (layout_none.dbu () / 0.001 - 1.0) < 1e-6, true);
|
||||||
EXPECT_EQ (layout.meta_info_value ("libname"), "LIB.DB");
|
EXPECT_EQ (layout.meta_info ("libname").value.to_string (), "LIB.DB");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ (layout_none.layers (), size_t (0));
|
EXPECT_EQ (layout_none.layers (), size_t (0));
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ MAGReader::do_read_part (db::Layout &layout, db::cell_index_type cell_index, tl:
|
||||||
error (tl::to_string (tr ("Could not find 'magic' header line - is this a MAGIC file?")));
|
error (tl::to_string (tr ("Could not find 'magic' header line - is this a MAGIC file?")));
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.add_meta_info (db::MetaInfo ("lambda", "lambda value (tech scaling)", tl::to_string (m_lambda)));
|
layout.add_meta_info ("lambda", db::MetaInfo ("lambda value (tech scaling)", tl::to_string (m_lambda)));
|
||||||
|
|
||||||
bool valid_layer = false;
|
bool valid_layer = false;
|
||||||
unsigned int current_layer = 0;
|
unsigned int current_layer = 0;
|
||||||
|
|
@ -339,11 +339,11 @@ MAGReader::do_read_part (db::Layout &layout, db::cell_index_type cell_index, tl:
|
||||||
if (&m_stream == &stream) {
|
if (&m_stream == &stream) {
|
||||||
|
|
||||||
// initial file - store technology
|
// initial file - store technology
|
||||||
layout.add_meta_info (db::MetaInfo ("magic_technology", tl::to_string (tr ("MAGIC technology string")), m_tech));
|
layout.add_meta_info ("magic_technology", db::MetaInfo (tl::to_string (tr ("MAGIC technology string")), m_tech));
|
||||||
|
|
||||||
// propose this is the KLayout technology unless a good one is given
|
// propose this is the KLayout technology unless a good one is given
|
||||||
if (! mp_klayout_tech) {
|
if (! mp_klayout_tech) {
|
||||||
layout.add_meta_info (db::MetaInfo ("technology", tl::to_string (tr ("Technology name")), m_tech));
|
layout.add_meta_info ("technology", db::MetaInfo (tl::to_string (tr ("Technology name")), m_tech));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -357,7 +357,7 @@ MAGReader::do_read_part (db::Layout &layout, db::cell_index_type cell_index, tl:
|
||||||
|
|
||||||
if (&m_stream == &stream) {
|
if (&m_stream == &stream) {
|
||||||
// initial file - store timestamp
|
// initial file - store timestamp
|
||||||
layout.add_meta_info (db::MetaInfo ("magic_timestamp", "MAGIC main file timestamp", tl::to_string (ts)));
|
layout.add_meta_info ("magic_timestamp", db::MetaInfo ("MAGIC main file timestamp", tl::to_string (ts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ex.expect_end ();
|
ex.expect_end ();
|
||||||
|
|
|
||||||
|
|
@ -82,11 +82,14 @@ MAGWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLa
|
||||||
|
|
||||||
double lambda = m_options.lambda;
|
double lambda = m_options.lambda;
|
||||||
if (lambda <= 0.0) {
|
if (lambda <= 0.0) {
|
||||||
const std::string &lv = layout.meta_info_value ("lambda");
|
const tl::Variant &lv = layout.meta_info ("lambda").value;
|
||||||
if (lv.empty ()) {
|
if (lv.is_nil ()) {
|
||||||
throw tl::Exception (tl::to_string (tr ("No lambda value configured for MAG writer and no 'lambda' metadata present in layout.")));
|
throw tl::Exception (tl::to_string (tr ("No lambda value configured for MAG writer and no 'lambda' metadata present in layout.")));
|
||||||
|
} else if (lv.is_a_string ()) {
|
||||||
|
tl::from_string (lv.to_string (), lambda);
|
||||||
|
} else if (lv.can_convert_to_double ()) {
|
||||||
|
lambda = lv.to_double ();
|
||||||
}
|
}
|
||||||
tl::from_string (lv, lambda);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sf = layout.dbu () / lambda;
|
m_sf = layout.dbu () / lambda;
|
||||||
|
|
|
||||||
|
|
@ -1146,7 +1146,7 @@ public:
|
||||||
|
|
||||||
std::string lyr_file = data.get_layer_properties_file ();
|
std::string lyr_file = data.get_layer_properties_file ();
|
||||||
if (! lyr_file.empty ()) {
|
if (! lyr_file.empty ()) {
|
||||||
layout.add_meta_info (db::MetaInfo ("layer-properties-file", "Layer Properties File", lyr_file));
|
layout.add_meta_info ("layer-properties-file", db::MetaInfo ("Layer Properties File", lyr_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_layers;
|
return m_layers;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue