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

Method update

src/db/db/dbPCellVariant.cc:159–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void
160PCellVariant::update (ImportLayerMapping *layer_mapping)
161{
162 tl_assert (layout () != 0);
163
164 clear_shapes ();
165 clear_insts ();
166
167 PCellHeader *header = pcell_header ();
168 if (header && header->declaration ()) {
169
170 tl::Variant pn ("name");
171 tl::Variant dn ("description");
172
173 std::vector<unsigned int> layer_ids;
174 try {
175
176 layer_ids = header->get_layer_indices (*layout (), m_parameters, layer_mapping);
177
178 // call coerce prior to produce to make sure we have a validated parameter set
179 // (note that we cannot persist parameters from here)
180 db::pcell_parameters_type plist = m_parameters;
181 header->declaration ()->coerce_parameters (*layout (), plist);
182
183 header->declaration ()->produce (*layout (), layer_ids, plist, *this);
184
185 m_display_name = header->declaration ()->get_display_name (plist);
186 m_variant_name = header->declaration ()->get_cell_name (plist);
187
188 } catch (tl::Exception &ex) {
189
190 tl::error << ex.msg ();
191
192 // put error messages into layout as text objects on error layer
193 shapes (layout ()->error_layer ()).insert (db::Text (ex.msg (), db::Trans ()));
194
195 }
196
197 // produce the shape parameters on the guiding shape layer so they can be edited
198 size_t i = 0;
199 const std::vector<db::PCellParameterDeclaration> &pcp = header->declaration ()->parameter_declarations ();
200 for (std::vector<db::PCellParameterDeclaration>::const_iterator p = pcp.begin (); p != pcp.end (); ++p, ++i) {
201
202 if (i < m_parameters.size () && p->get_type () == db::PCellParameterDeclaration::t_shape && ! p->is_hidden ()) {
203
204 // use property with name "name" to indicate the parameter name
205 db::PropertiesSet props;
206 props.insert (pn, tl::Variant (p->get_name ()));
207
208 if (! p->get_description ().empty ()) {
209 props.insert (dn, tl::Variant (p->get_description ()));
210 }
211
212 if (m_parameters[i].is_user<db::DBox> ()) {
213
214 shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties (db::Box (m_parameters[i].to_user<db::DBox> () * (1.0 / layout ()->dbu ())), db::properties_id (props)));
215
216 } else if (m_parameters[i].is_user<db::Box> ()) {

Callers

nothing calls this directly

Calls 15

clear_instsFunction · 0.85
pcell_headerFunction · 0.85
properties_idFunction · 0.85
declarationMethod · 0.80
msgMethod · 0.80
error_layerMethod · 0.80
get_descriptionMethod · 0.80
guiding_shape_layerMethod · 0.80
layoutFunction · 0.70
shapesFunction · 0.70
VariantClass · 0.70
EdgeClass · 0.70

Tested by

no test coverage detected