Some debugging, skipping clusters without shapes on primary layer for example

This commit is contained in:
Matthias Koefferlein 2025-08-02 21:28:48 +02:00
parent d001f7fa04
commit 8151feac56
10 changed files with 54 additions and 39 deletions

View File

@ -2085,6 +2085,7 @@ LayoutToNetlist::measure_net (const db::Region &primary, const std::map<std::str
eval.parse (compiled_expr, ex);
db::DeepLayer dl (&dss (), m_layout_index, ly.insert_layer ());
unsigned int primary_layer = layer_of (primary);
for (db::Layout::bottom_up_const_iterator cid = ly.begin_bottom_up (); cid != ly.end_bottom_up (); ++cid) {
@ -2099,12 +2100,17 @@ LayoutToNetlist::measure_net (const db::Region &primary, const std::map<std::str
continue;
}
// skip nets without shapes on primary layer
if (db::recursive_cluster_shape_iterator<db::NetShape> (m_net_clusters, primary_layer, *cid, *c).at_end ()) {
continue;
}
eval.reset (*cid, *c);
compiled_expr.execute ();
if (! eval.skip ()) {
db::Shapes &shapes = ly.cell (*cid).shapes (dl.layer ());
get_merged_shapes_of_net (*cid, *c, layer_of (primary), shapes, db::properties_id (eval.prop_set_out ()));
get_merged_shapes_of_net (*cid, *c, primary_layer, shapes, db::properties_id (eval.prop_set_out ()));
}
}

View File

@ -90,7 +90,7 @@ static gsi::EdgePairFilterBase *make_pg (const tl::Variant &name, const std::str
return new EdgePairPropertiesFilter (name, pattern, inverse);
}
static gsi::EdgePairFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map<std::string, tl::Variant> &variables)
static gsi::EdgePairFilterBase *make_pe (const std::string &expression, bool inverse, const std::map<std::string, tl::Variant> &variables, double dbu)
{
return new gsi::expression_filter<gsi::EdgePairFilterBase, db::EdgePairs> (expression, inverse, dbu, variables);
}
@ -136,7 +136,7 @@ Class<gsi::EdgePairFilterBase> decl_EdgePairFilterBase ("db", "EdgePairFilterBas
"\n"
"This feature has been introduced in version 0.30."
) +
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates an expression-based filter\n"
"@param expression The expression to evaluate.\n"
"@param inverse If true, inverts the selection - i.e. all edge pairs without a property with the given name and value range are selected.\n"
@ -257,14 +257,14 @@ Class<shape_processor_impl<db::EdgePairProcessorBase> > decl_EdgePairProcessor (
static
property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs> *
new_pcp (const db::EdgePairs *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcp (const db::EdgePairs *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
return new property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs> (container, expressions, copy_properties, dbu, variables);
}
static
property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs> *
new_pcps (const db::EdgePairs *container, const std::string &expression, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcps (const db::EdgePairs *container, const std::string &expression, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
std::map<tl::Variant, std::string> expressions;
expressions.insert (std::make_pair (tl::Variant (), expression));
@ -273,7 +273,7 @@ new_pcps (const db::EdgePairs *container, const std::string &expression, bool co
Class<property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs> > decl_EdgePairPropertiesExpressions (decl_EdgePairProcessorBase, "db", "EdgePairPropertiesExpressions",
property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs>::method_decls (true) +
gsi::constructor ("new", &new_pcp, gsi::arg ("edge_pairs"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcp, gsi::arg ("edge_pairs"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param edge_pairs The edge pair collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"
@ -282,7 +282,7 @@ Class<property_computation_processor<db::EdgePairProcessorBase, db::EdgePairs> >
"@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n"
"@param variables Arbitrary values that are available as variables inside the expressions.\n"
) +
gsi::constructor ("new", &new_pcps, gsi::arg ("edge_pairs"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcps, gsi::arg ("edge_pairs"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param edge_pairs The edge pair collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"

View File

@ -91,7 +91,7 @@ static gsi::EdgeFilterBase *make_pg (const tl::Variant &name, const std::string
return new EdgePropertiesFilter (name, pattern, inverse);
}
static gsi::EdgeFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map<std::string, tl::Variant> &variables)
static gsi::EdgeFilterBase *make_pe (const std::string &expression, bool inverse, const std::map<std::string, tl::Variant> &variables, double dbu)
{
return new gsi::expression_filter<gsi::EdgeFilterBase, db::Edges> (expression, inverse, dbu, variables);
}
@ -137,7 +137,7 @@ Class<gsi::EdgeFilterBase> decl_EdgeFilterBase ("db", "EdgeFilterBase",
"\n"
"This feature has been introduced in version 0.30."
) +
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates an expression-based filter\n"
"@param expression The expression to evaluate.\n"
"@param inverse If true, inverts the selection - i.e. all edges without a property with the given name and value range are selected.\n"
@ -262,14 +262,14 @@ Class<shape_processor_impl<db::EdgeProcessorBase> > decl_EdgeOperator (decl_Edge
static
property_computation_processor<db::EdgeProcessorBase, db::Edges> *
new_pcp (const db::Edges *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcp (const db::Edges *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
return new property_computation_processor<db::EdgeProcessorBase, db::Edges> (container, expressions, copy_properties, dbu, variables);
}
static
property_computation_processor<db::EdgeProcessorBase, db::Edges> *
new_pcps (const db::Edges *container, const std::string &expression, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcps (const db::Edges *container, const std::string &expression, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
std::map<tl::Variant, std::string> expressions;
expressions.insert (std::make_pair (tl::Variant (), expression));
@ -278,7 +278,7 @@ new_pcps (const db::Edges *container, const std::string &expression, bool copy_p
Class<property_computation_processor<db::EdgeProcessorBase, db::Edges> > decl_EdgePropertiesExpressions (decl_EdgeProcessorBase, "db", "EdgePropertiesExpressions",
property_computation_processor<db::EdgeProcessorBase, db::Edges>::method_decls (true) +
gsi::constructor ("new", &new_pcp, gsi::arg ("edges"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcp, gsi::arg ("edges"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param edges The edge collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"
@ -287,7 +287,7 @@ Class<property_computation_processor<db::EdgeProcessorBase, db::Edges> > decl_Ed
"@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n"
"@param variables Arbitrary values that are available as variables inside the expressions.\n"
) +
gsi::constructor ("new", &new_pcps, gsi::arg ("edges"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcps, gsi::arg ("edges"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param edges The edge collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"

View File

@ -216,9 +216,18 @@ static db::Region antenna_check (db::LayoutToNetlist *l2n, const db::Region &pol
return antenna_check3 (l2n, poly, 1, 0, metal, 1, 0, ratio, diodes, texts);
}
static db::Region measure_net (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const std::map<std::string, tl::Variant> &variables)
static db::Region measure_net (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const tl::Variant &variables)
{
return l2n->measure_net (primary, secondary, expression, variables);
if (! variables.is_array ()) {
throw tl::Exception (tl::to_string (tr ("'variables' argument needs to a hash")));
}
std::map<std::string, tl::Variant> variables_map;
for (auto v = variables.begin_array (); v != variables.end_array (); ++v) {
variables_map [v->first.to_string ()] = v->second;
}
return l2n->measure_net (primary, secondary, expression, variables_map);
}
static void join_net_names (db::LayoutToNetlist *l2n, const std::string &s)

View File

@ -109,7 +109,7 @@ static gsi::PolygonFilterBase *make_pg (const tl::Variant &name, const std::stri
return new PolygonPropertiesFilter (name, pattern, inverse);
}
static gsi::PolygonFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map<std::string, tl::Variant> &variables)
static gsi::PolygonFilterBase *make_pe (const std::string &expression, bool inverse, const std::map<std::string, tl::Variant> &variables, double dbu)
{
return new gsi::expression_filter<gsi::PolygonFilterBase, db::Region> (expression, inverse, dbu, variables);
}
@ -155,7 +155,7 @@ Class<gsi::PolygonFilterBase> decl_PolygonFilterBase ("db", "PolygonFilterBase",
"\n"
"This feature has been introduced in version 0.30."
) +
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates an expression-based filter\n"
"@param expression The expression to evaluate.\n"
"@param inverse If true, inverts the selection - i.e. all polygons without a property with the given name and value range are selected.\n"
@ -278,13 +278,13 @@ Class<shape_processor_impl<db::PolygonProcessorBase> > decl_PolygonOperator (dec
static
property_computation_processor<db::PolygonProcessorBase, db::Region> *
new_pcp (const db::Region *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcp (const db::Region *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
return new property_computation_processor<db::PolygonProcessorBase, db::Region> (container, expressions, copy_properties, dbu, variables);
}
property_computation_processor<db::PolygonProcessorBase, db::Region> *
new_pcps (const db::Region *container, const std::string &expression, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcps (const db::Region *container, const std::string &expression, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
std::map<tl::Variant, std::string> expressions;
expressions.insert (std::make_pair (tl::Variant (), expression));
@ -293,7 +293,7 @@ new_pcps (const db::Region *container, const std::string &expression, bool copy_
Class<property_computation_processor<db::PolygonProcessorBase, db::Region> > decl_PolygonPropertiesExpressions (decl_PolygonProcessorBase, "db", "PolygonPropertiesExpressions",
property_computation_processor<db::PolygonProcessorBase, db::Region>::method_decls (true) +
gsi::constructor ("new", &new_pcp, gsi::arg ("region"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcp, gsi::arg ("region"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param region The region, the processor will be used on. Can be nil, but if given, allows some optimization.\n"
@ -302,7 +302,7 @@ Class<property_computation_processor<db::PolygonProcessorBase, db::Region> > dec
"@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n"
"@param variables Arbitrary values that are available as variables inside the expressions.\n"
) +
gsi::constructor ("new", &new_pcps, gsi::arg ("region"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcps, gsi::arg ("region"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param region The region, the processor will be used on. Can be nil, but if given, allows some optimization.\n"

View File

@ -87,7 +87,7 @@ static gsi::TextFilterBase *make_pg (const tl::Variant &name, const std::string
return new TextPropertiesFilter (name, pattern, inverse);
}
static gsi::TextFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map<std::string, tl::Variant> &variables)
static gsi::TextFilterBase *make_pe (const std::string &expression, bool inverse, const std::map<std::string, tl::Variant> &variables, double dbu)
{
return new gsi::expression_filter<gsi::TextFilterBase, db::Texts> (expression, inverse, dbu, variables);
}
@ -133,7 +133,7 @@ Class<gsi::TextFilterBase> decl_TextFilterBase ("db", "TextFilterBase",
"\n"
"This feature has been introduced in version 0.30."
) +
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates an expression-based filter\n"
"@param expression The expression to evaluate.\n"
"@param inverse If true, inverts the selection - i.e. all texts without a property with the given name and value range are selected.\n"
@ -257,13 +257,13 @@ Class<shape_processor_impl<db::TextProcessorBase> > decl_TextProcessor (decl_Tex
static
property_computation_processor<db::TextProcessorBase, db::Texts> *
new_pcp (const db::Texts *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcp (const db::Texts *container, const std::map<tl::Variant, std::string> &expressions, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
return new property_computation_processor<db::TextProcessorBase, db::Texts> (container, expressions, copy_properties, dbu, variables);
}
property_computation_processor<db::TextProcessorBase, db::Texts> *
new_pcps (const db::Texts *container, const std::string &expression, bool copy_properties, double dbu, const std::map <std::string, tl::Variant> &variables)
new_pcps (const db::Texts *container, const std::string &expression, bool copy_properties, const std::map <std::string, tl::Variant> &variables, double dbu)
{
std::map<tl::Variant, std::string> expressions;
expressions.insert (std::make_pair (tl::Variant (), expression));
@ -272,7 +272,7 @@ new_pcps (const db::Texts *container, const std::string &expression, bool copy_p
Class<property_computation_processor<db::TextProcessorBase, db::Texts> > decl_TextPropertiesExpressions (decl_TextProcessorBase, "db", "TextPropertiesExpressions",
property_computation_processor<db::TextProcessorBase, db::Texts>::method_decls (true) +
gsi::constructor ("new", &new_pcp, gsi::arg ("texts"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcp, gsi::arg ("texts"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param texts The text collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"
@ -281,7 +281,7 @@ Class<property_computation_processor<db::TextProcessorBase, db::Texts> > decl_Te
"@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n"
"@param variables Arbitrary values that are available as variables inside the expressions.\n"
) +
gsi::constructor ("new", &new_pcps, gsi::arg ("texts"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
gsi::constructor ("new", &new_pcps, gsi::arg ("texts"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", 0.0),
"@brief Creates a new properties expressions operator\n"
"\n"
"@param texts The text collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n"

View File

@ -704,11 +704,11 @@ class DBEdgePairs_TestClass < TestBase
assert_equal(r.to_s, "(0,0;1000,2000)/(-100,200;900,2200){1=>42,PropA=>17}")
# replace
pr = RBA::EdgePairPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.distance", "Z" => "value(1)+1" })
pr = RBA::EdgePairPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.distance", "Z" => "value(1)+one" }, variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;1000,2000)/(-100,200;900,2200){X=>18,Y=>179,Z=>43}")
# replace (with 'put')
pr = RBA::EdgePairPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.distance); put('Z', value(1)+1)")
pr = RBA::EdgePairPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.distance); put('Z', value(1)+one)", variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;1000,2000)/(-100,200;900,2200){X=>18,Y=>179,Z=>43}")
# substitutions
@ -722,7 +722,7 @@ class DBEdgePairs_TestClass < TestBase
ef = RBA::EdgePairFilterBase::expression_filter("PropX==18")
assert_equal(r.filtered(ef).to_s, "")
ef = RBA::EdgePairFilterBase::expression_filter("PropA==17")
ef = RBA::EdgePairFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 })
assert_equal(r.filtered(ef).to_s, "(0,0;1000,2000)/(-100,200;900,2200){1=>42,PropA=>17}")
ef = RBA::EdgePairFilterBase::expression_filter("value(1)>=40")

View File

@ -1112,11 +1112,11 @@ class DBEdges_TestClass < TestBase
assert_equal(r.to_s, "(0,0;1000,2000){1=>42,PropA=>17}")
# replace
pr = RBA::EdgePropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.length", "Z" => "value(1)+1" })
pr = RBA::EdgePropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.length", "Z" => "value(1)+one" }, variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;1000,2000){X=>18,Y=>2236,Z=>43}")
# replace (with 'put')
pr = RBA::EdgePropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.length); put('Z', value(1)+1)")
pr = RBA::EdgePropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.length); put('Z', value(1)+one)", variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;1000,2000){X=>18,Y=>2236,Z=>43}")
# substitutions
@ -1130,7 +1130,7 @@ class DBEdges_TestClass < TestBase
ef = RBA::EdgeFilterBase::expression_filter("PropX==18")
assert_equal(r.filtered(ef).to_s, "")
ef = RBA::EdgeFilterBase::expression_filter("PropA==17")
ef = RBA::EdgeFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 })
assert_equal(r.filtered(ef).to_s, "(0,0;1000,2000){1=>42,PropA=>17}")
ef = RBA::EdgeFilterBase::expression_filter("value(1)>=40")

View File

@ -1730,11 +1730,11 @@ class DBRegion_TestClass < TestBase
assert_equal(r.to_s, "(0,0;0,2000;1000,2000;1000,0){1=>42,PropA=>17}")
# replace
pr = RBA::PolygonPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.area", "Z" => "value(1)+1" })
pr = RBA::PolygonPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.area", "Z" => "value(1)+one" }, variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;0,2000;1000,2000;1000,0){X=>18,Y=>2000000,Z=>43}")
# replace (with 'put')
pr = RBA::PolygonPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.area); put('Z', value(1)+1)")
pr = RBA::PolygonPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.area); put('Z', value(1)+one)", variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "(0,0;0,2000;1000,2000;1000,0){X=>18,Y=>2000000,Z=>43}")
# substitutions
@ -1748,7 +1748,7 @@ class DBRegion_TestClass < TestBase
ef = RBA::PolygonFilterBase::expression_filter("PropX==18")
assert_equal(r.filtered(ef).to_s, "")
ef = RBA::PolygonFilterBase::expression_filter("PropA==17")
ef = RBA::PolygonFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 })
assert_equal(r.filtered(ef).to_s, "(0,0;0,2000;1000,2000;1000,0){1=>42,PropA=>17}")
ef = RBA::PolygonFilterBase::expression_filter("value(1)>=40")

View File

@ -554,11 +554,11 @@ class DBTexts_TestClass < TestBase
assert_equal(r.to_s, "('T',r0 100,200){1=>42,PropA=>17}")
# replace
pr = RBA::TextPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.bbox.center.x", "Z" => "value(1)+1" })
pr = RBA::TextPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.bbox.center.x", "Z" => "value(1)+one" }, variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "('T',r0 100,200){X=>18,Y=>100,Z=>43}")
# replace (with 'put')
pr = RBA::TextPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.bbox.center.x); put('Z', value(1)+1)")
pr = RBA::TextPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.bbox.center.x); put('Z', value(1)+one)", variables: { "one" => 1 })
assert_equal(r.processed(pr).to_s, "('T',r0 100,200){X=>18,Y=>100,Z=>43}")
# substitutions
@ -572,7 +572,7 @@ class DBTexts_TestClass < TestBase
ef = RBA::TextFilterBase::expression_filter("PropX==18")
assert_equal(r.filtered(ef).to_s, "")
ef = RBA::TextFilterBase::expression_filter("PropA==17")
ef = RBA::TextFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 })
assert_equal(r.filtered(ef).to_s, "('T',r0 100,200){1=>42,PropA=>17}")
ef = RBA::TextFilterBase::expression_filter("value(1)>=40")