MCPcopy Create free account
hub / github.com/KLayout/klayout / create_from_flat

Method create_from_flat

src/db/db/dbDeepShapeStore.cc:599–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599DeepLayer DeepShapeStore::create_from_flat (const db::Region &region, 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
649DeepLayer DeepShapeStore::create_from_flat (const db::Edges &edges, const db::ICplxTrans &trans)
650{

Callers 5

DeepRegionMethod · 0.80
dss_create_from_flatFunction · 0.80
DeepEdgesMethod · 0.80
DeepTextsMethod · 0.80

Calls 15

init_layerFunction · 0.85
initial_cellFunction · 0.85
worldFunction · 0.85
id_ofFunction · 0.85
reject_odd_polygonsMethod · 0.80
delegateMethod · 0.80
layout_indexMethod · 0.80
layoutFunction · 0.70
iterMethod · 0.45
max_area_ratioMethod · 0.45
max_vertex_countMethod · 0.45
begin_iterMethod · 0.45

Tested by

no test coverage detected