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

Method add_layout

src/laybasic/laybasic/layLayoutViewBase.cc:3409–3520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3407}
3408
3409unsigned int
3410LayoutViewBase::add_layout (lay::LayoutHandle *layout_handle, bool add_cellview, bool initialize_layers)
3411{
3412 unsigned int cv_index = 0;
3413
3414 try {
3415
3416 enable_active_cellview_changed_event (false);
3417
3418 stop_redraw ();
3419
3420 bool set_max_hier = (m_full_hier_new_cell || has_max_hier ());
3421
3422 lay::CellView cv;
3423
3424 if (! add_cellview) {
3425 clear_cellviews ();
3426 }
3427
3428 cv.set (layout_handle);
3429
3430 cv->layout ().update ();
3431
3432 // select the cell with the largest area as the first top cell
3433 db::Layout::top_down_const_iterator top = cv->layout ().begin_top_down ();
3434 for (db::Layout::top_down_const_iterator t = cv->layout ().begin_top_down (); t != cv->layout ().end_top_cells (); ++t) {
3435 if (cv->layout ().cell (*t).bbox ().area () > cv->layout ().cell (*top).bbox ().area ()) {
3436 top = t;
3437 }
3438 }
3439
3440 if (top != cv->layout ().end_top_down ()) {
3441 std::vector <db::cell_index_type> p;
3442 p.push_back (*top);
3443 cv.set_unspecific_path (p);
3444 }
3445
3446 cv_index = cellviews ();
3447 set_layout (cv, cv_index);
3448
3449 if (top != cv->layout ().end_top_cells ()) {
3450 std::vector <db::cell_index_type> p;
3451 p.push_back (*top);
3452 select_cell (p, cv_index);
3453 }
3454
3455 // even if there is no cell, select the cellview item
3456 // to support applications with an active cellview (that is however invalid)
3457 set_active_cellview_index (cv_index);
3458
3459 if (initialize_layers) {
3460
3461 bool add_other_layers = m_add_other_layers;
3462
3463 // Use the "layer-properties-file" meta info from the handle to get the layer properties file.
3464 // If no such file is present, use the default file or the technology specific file.
3465 std::string lyp_file = m_def_lyp_file;
3466 const db::Technology *tech = db::Technologies::instance ()->technology_by_name (layout_handle->tech_name ());

Callers 3

show_layout1Function · 0.45
show_layout2Function · 0.45
show_layout_handleFunction · 0.45

Calls 15

stop_redrawFunction · 0.85
cellviewsFunction · 0.85
select_cellFunction · 0.85
get_lyp_from_meta_infoFunction · 0.85
zoom_fitFunction · 0.85
begin_top_downMethod · 0.80
end_top_cellsMethod · 0.80
end_top_downMethod · 0.80
set_unspecific_pathMethod · 0.80
technology_by_nameMethod · 0.80
set_varMethod · 0.80
instanceFunction · 0.70

Tested by

no test coverage detected