mirror of https://github.com/KLayout/klayout.git
Fixed issue #322 by skipping used layer indexes - will also help with DXF and other named-layer formats
This commit is contained in:
parent
e33c2f7b66
commit
aa72d03526
|
|
@ -1236,9 +1236,7 @@ public:
|
|||
bool is_valid_cell_index (cell_index_type ci) const;
|
||||
|
||||
/**
|
||||
* @brief Tell, if a layer index is a valid index
|
||||
*
|
||||
* @return true, if this is so
|
||||
* @brief Returns true, if a layer index is a valid index for a normal layout layer
|
||||
*/
|
||||
bool is_valid_layer (unsigned int n) const
|
||||
{
|
||||
|
|
@ -1246,9 +1244,15 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Tell, if a layer index is a special layer index
|
||||
*
|
||||
* @return true, if this is so
|
||||
* @brief Returns true, if a layer index is a free (unused) layer
|
||||
*/
|
||||
bool is_free_layer (unsigned int n) const
|
||||
{
|
||||
return (n >= layers () || m_layer_states [n] == Free);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns true, if a layer index is a special layer index
|
||||
*/
|
||||
bool is_special_layer (unsigned int n) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -168,7 +168,10 @@ NamedLayerReader::open_layer (db::Layout &layout, const std::string &n)
|
|||
std::map <std::string, unsigned int>::const_iterator nl = m_new_layers.find (n);
|
||||
if (nl == m_new_layers.end ()) {
|
||||
|
||||
unsigned int ll = m_next_layer_index++;
|
||||
unsigned int ll;
|
||||
do {
|
||||
ll = m_next_layer_index++;
|
||||
} while (! layout.is_free_layer (ll));
|
||||
|
||||
layout.insert_layer (ll, db::LayerProperties ());
|
||||
m_new_layers.insert (std::make_pair (n, ll));
|
||||
|
|
|
|||
|
|
@ -1576,11 +1576,19 @@ Class<db::Layout> decl_Layout ("db", "Layout",
|
|||
"This method has been added in version 0.20.\n"
|
||||
) +
|
||||
gsi::method ("is_valid_layer?", &db::Layout::is_valid_layer,
|
||||
"@brief Returns true, if a layer index is a valid index\n"
|
||||
"@brief Returns true, if a layer index is a valid normal layout layer index\n"
|
||||
"@args layer_index\n"
|
||||
"\n"
|
||||
"@return true, if this is the case\n"
|
||||
) +
|
||||
gsi::method ("is_free_layer?", &db::Layout::is_free_layer,
|
||||
"@brief Returns true, if a layer index is a free (unused) layer index\n"
|
||||
"@args layer_index\n"
|
||||
"\n"
|
||||
"@return true, if this is the case\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.26."
|
||||
) +
|
||||
gsi::method ("is_special_layer?", &db::Layout::is_special_layer,
|
||||
"@brief Returns true, if a layer index is a special layer index\n"
|
||||
"@args layer_index\n"
|
||||
|
|
|
|||
Loading…
Reference in New Issue