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

Method reload_layout

src/laybasic/laybasic/layLayoutViewBase.cc:3231–3388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3229#endif
3230
3231void
3232LayoutViewBase::reload_layout (unsigned int cv_index)
3233{
3234 stop ();
3235 cancel_esc ();
3236
3237 // save the current view state
3238 lay::DisplayState state;
3239 save_view (state);
3240
3241 // this is the cellview at the given index (use a copy since the original is overwritten)
3242 CellView cvorg = cellview (cv_index);
3243
3244 // obtain the original filename
3245 std::string filename = cvorg->filename ();
3246 std::string technology = cvorg->tech_name ();
3247 std::string name = cvorg->name ();
3248
3249 // recreate hidden cells by doing a name referencing
3250 std::vector <std::string> hidden_cells;
3251 if (m_hidden_cells.size () > cv_index) {
3252 hidden_cells.reserve (m_hidden_cells [cv_index].size ());
3253 for (std::set <cell_index_type>::const_iterator ci = m_hidden_cells [cv_index].begin (); ci != m_hidden_cells [cv_index].end (); ++ci) {
3254 hidden_cells.push_back (std::string (cvorg->layout ().cell_name (*ci)));
3255 }
3256 }
3257
3258 // Set up a list of present layers
3259 std::set <db::LayerProperties, db::LPLogicalLessFunc> present_layers;
3260 for (LayerPropertiesConstIterator lay_iter = begin_layers (); ! lay_iter.at_end (); ++lay_iter) {
3261 if (! lay_iter->has_children ()) {
3262 present_layers.insert (lay_iter->source (true /*real*/).layer_props ());
3263 }
3264 }
3265
3266 std::map <unsigned int, db::LayerProperties> org_layers;
3267
3268 for (unsigned int i = 0; i < cvorg->layout ().layers (); ++i) {
3269 if (cvorg->layout ().is_valid_layer (i)) {
3270 const db::LayerProperties &p = cvorg->layout ().get_properties (i);
3271 if (! p.log_equal (db::LayerProperties ())) {
3272 org_layers.insert (std::make_pair (i, p));
3273 }
3274 }
3275 }
3276
3277 lay::LayoutHandle *handle;
3278
3279 // reset the layout: create a dummy handle and install this in between
3280 // this will clear the original layout if not further referenced.
3281 // Since the dummy layout will act as a placeholder if something goes wrong
3282 // when reading the file, it must have the layers created as well
3283 lay::CellView cv_empty;
3284
3285 handle = new lay::LayoutHandle (new db::Layout (is_editable (), manager ()), filename);
3286 handle->set_tech_name (technology);
3287 cv_empty.set (handle);
3288

Callers

nothing calls this directly

Calls 15

cancel_escFunction · 0.85
verbosityFunction · 0.85
sortFunction · 0.85
LPLogicalLessFuncClass · 0.85
layer_propsMethod · 0.80
get_propertiesMethod · 0.80
log_equalMethod · 0.80
set_tech_nameMethod · 0.80
printMethod · 0.80
begin_layersFunction · 0.70
LayerPropertiesClass · 0.70
managerFunction · 0.70

Tested by

no test coverage detected