| 524 | } |
| 525 | |
| 526 | static tl::Variant find_layer (db::Layout *l, const db::LayerProperties &lp) |
| 527 | { |
| 528 | if (lp.is_null ()) { |
| 529 | // for a null layer info always return nil |
| 530 | return tl::Variant (); |
| 531 | } else { |
| 532 | // if we have a layer with the requested properties already, return this one. |
| 533 | // first pass: exact match |
| 534 | int index = l->get_layer_maybe (lp); |
| 535 | if (index >= 0) { |
| 536 | return tl::Variant ((unsigned int) index); |
| 537 | } |
| 538 | // second pass: relaxed match |
| 539 | for (db::Layout::layer_iterator li = l->begin_layers (); li != l->end_layers (); ++li) { |
| 540 | if (log_equal_ext ((*li).second, lp)) { |
| 541 | return tl::Variant ((*li).first); |
| 542 | } |
| 543 | } |
| 544 | // otherwise return nil |
| 545 | return tl::Variant (); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | static tl::Variant find_layer1 (db::Layout *l, const std::string &name) |
| 550 | { |
no test coverage detected