For maximum efficiency, declare the flag renderer in
the style sheet.
In this example, there is a specific rule to create the
flag if the model object matches a particular state. The Flag
renderer
fetches the graphic property Flag
from
the rule to get the IlvGraphic
object that
will represent the flag, in this case the label “ALARM HERE”.
The following code example shows the style rules needed.
The style rules for the flag
node[state=alarm] {
Flag : @#alarm
}
Subobject#alarm {
class : 'ilog.views.sdm.graphic.IlvGraphicFactories$ZoomableLabel' ;
label : "ALARM HERE" ;
antialiasing : true ;
leftMargin : 5 ;
rightMargin : 5 ;
topMargin : 5 ;
bottomMargin : 5 ;
foreground : red ;
}
node {
Flag : ’’ ;
}
The rules operate as follows:
The first rule sets an indirection to
create the IlvGraphic
object when it is
needed.
The second rule creates the flag as
a simple red label.
The third rule clears the flag when
the node reverts to its normal state. The default value for the flag
is then null.