Label Selector List
{ Selector1 | Selector2 | ... SelectorN }
One label selector is chosen for each shape at the rule output (derived shape). More than one may match, but only the first one matching is selected. The last selector SelectorN is expected to be a plain/default selector – otherwise, rule applications fails.
Label Selector
Evaluates to a label, matching condition and optimally additional operations (see below).
A plain selector is simply a label, and it always matches:
Label
Alternatively, if label selection should be limited to a particular condition:
MatchCondition: Label
Additional attribute modifications or shape insertion can be requested before the label:
MatchCondition: SelectorOperatorOperations Label
- Label – label assigned to a derives shape
- MatchCondition – a match condition expression should evaluate to true to match the label
- SelectorOperatorOperations – operations based on selector operators.
Match Conditions
Border Keyword (NEW)
border
Regions that are touching a boundary at an edge are selected (however, regions sharing a vertex with iregion boundary are not!).
Index Match
idx(x_expr, y_expr)
- x_expr, y_expr – integer expression that is either a number or a keyword, optionally prefixed with “!” which negates the meaning. Available keywords:
- odd – all odd indices are selected. Even indices selected with “!odd”
Stochastic Match
percent%
Selector is chosen with a probability of percent value. For instance “50%” would accept the label roughly half of the time.
Default Match Keyword
else
Default match condition always matches (the keyword it can also be omitted).
Selector Operators
Insert Operator
Considered separately.
Set Operator
Creates a new attribute or changes a propagated attribute that is inherited from the rule input shape. For instance type attribute is assigned using set.
set(attribute_name, attribute_value)
- attribute_name – an attribute name, of the same format as shape label.
- attribute_value – a number or a string. The number is stored in double precision floating point format.
Examples
Selects Label2 half of the time, and Label1 and Label3 equally quarter of the time each:
{ 25%: Label1 | 50%: Label2 | else: Label3 }
Checkerboard pattern:
{ idx(odd, odd): LabelWhite |
idx(!odd, !odd): LabelWhite | LabelBlack }
Change path width to a third for any further productions on QuarterLabel:
{ set(path_width, %33.3) QuarterLabel }