| 597 | } |
| 598 | |
| 599 | DeepLayer DeepShapeStore::create_from_flat (const db::Region ®ion, bool for_netlist, double max_area_ratio, size_t max_vertex_count, const db::ICplxTrans &trans) |
| 600 | { |
| 601 | // reuse existing layer |
| 602 | std::pair<bool, DeepLayer> lff = layer_for_flat (region); |
| 603 | if (lff.first) { |
| 604 | return lff.second; |
| 605 | } |
| 606 | |
| 607 | require_singular (); |
| 608 | |
| 609 | unsigned int layer = init_layer (layout (), region.iter ()); |
| 610 | |
| 611 | // attempt to initialize the layer properties |
| 612 | |
| 613 | if (max_area_ratio == 0.0) { |
| 614 | max_area_ratio = m_state.max_area_ratio (); |
| 615 | } |
| 616 | if (max_vertex_count == 0) { |
| 617 | max_vertex_count = m_state.max_vertex_count (); |
| 618 | } |
| 619 | |
| 620 | db::Shapes *shapes = &initial_cell ().shapes (layer); |
| 621 | db::Box world = db::Box::world (); |
| 622 | |
| 623 | // try to maintain the texts on top level - go through shape iterator |
| 624 | std::pair<db::RecursiveShapeIterator, db::ICplxTrans> ii = region.begin_iter (); |
| 625 | db::ICplxTrans ttop = trans * ii.second; |
| 626 | |
| 627 | // The chain of operators for producing clipped and reduced polygon references |
| 628 | db::PolygonReferenceHierarchyBuilderShapeReceiver refs (&layout (), text_enlargement (), text_property_name ()); |
| 629 | db::ReducingHierarchyBuilderShapeReceiver red (&refs, max_area_ratio, max_vertex_count, m_state.reject_odd_polygons ()); |
| 630 | |
| 631 | while (! ii.first.at_end ()) { |
| 632 | |
| 633 | if (for_netlist && ii.first->is_text () && ii.first.layout () && ii.first.cell () != ii.first.top_cell ()) { |
| 634 | // Skip texts on levels below top cell. For the reasoning see the description of this method. |
| 635 | } else { |
| 636 | red.push (*ii.first, ii.first.prop_id (), ttop * ii.first.trans (), world, 0, shapes); |
| 637 | } |
| 638 | |
| 639 | ++ii.first; |
| 640 | |
| 641 | } |
| 642 | |
| 643 | DeepLayer dl (this, 0 /*singular layout index*/, layer); |
| 644 | m_layers_for_flat [tl::id_of (region.delegate ())] = std::make_pair (dl.layout_index (), dl.layer ()); |
| 645 | m_flat_region_id [std::make_pair (dl.layout_index (), dl.layer ())] = tl::id_of (region.delegate ()); |
| 646 | return dl; |
| 647 | } |
| 648 | |
| 649 | DeepLayer DeepShapeStore::create_from_flat (const db::Edges &edges, const db::ICplxTrans &trans) |
| 650 | { |
no test coverage detected