Section 3.2 Outlining and <group>
s
On occasion, you may want a graphical component, such as the graph of a function or a point, to stand out from the background. This can be accomplished using the
@outline
attribute. In fact, all components of a tactile diagram are automatically outlined.In some sense, this section is about another stroke characteristic. However, the ability to outline informs some PreFigure design features that open up some new possibilities.
Subsection 3.2.1 Outlining
To place an outline behind a component, set the attribute
@outline="yes"
. In Figure 3.2.1, both the graph and the point have been outlined, which produces some white space around each element.<diagram dimensions="(300,300)" margins="5">
<definition>a=1</definition>
<definition>f(x)=exp(x/3)*cos(x)</definition>
<coordinates bbox="(-4,-4,4,4)">
<rectangle center="(0,0)" dimensions="(8,8)"
fill="lightgray"/>
<graph function="f" outline="yes"/>
<point p="(a,f(a))" size="10" outline="yes"/>
</coordinates>
</diagram>
The outlines produced in tactile diagrams, which are added regardless of the value of
@outline
, are \(1/8^{th}\) of an inch, as demonstrated in Figure 3.2.3.Subsection 3.2.2 Groups
When a component is stroked or filled, the paint applied covers up anything that has already been painted in the overlap. For tactile diagrams especially, this can lead to some undesirable behavior, as seen in Figure 3.2.4. Here we see two solutions to a differential equation. Notice how the outline of one solution obscures the second and the fact that these two solutions have the same asymptotic behavior.
PreFigure’s
<group>
element provides an alternative. More specifically, it allows us to group components together and place all their outlines before placing the components themselves. Figure 3.2.5 shows a different version of the previous diagram in which the two solutions have been included in a <group>
element.
Listing 3.2.6 gives the PreFigure source for Figure 3.2.5. Notce how the two solution curves are placed in a
<group>
, which is given the attribute @outline="always"
. This has the effect of drawing all the outlines in the group first and then drawing all the components. The value always
causes this behavior regardless of the output format. Setting @outline="tactile"
requests this behavior only for tactile diagrams.<diagram dimensions="(300,300)" margins="5">
<definition>f(y,t)=t-y</definition>
<coordinates bbox="(-1,-1,4,4)">
<grid-axes/>
<group outline="always">
<plot-de-solution function="f" t0="0" y0="0"
domain="[0,4]" outline="yes"/>
<plot-de-solution function="f" t0="0" y0="2"
domain="[0,4]" outline="yes"/>
</group>
<point p="(0,2)"/>
<point p="(0,0)"/>
</coordinates>
</diagram>
A second reason to group elements together is to facilitate annotations. A
<group>
element can be given a handle and then annotated as in Listing 3.2.7. When the focus goes to this node of the annotation tree, the screen reader will zoom in on the region containing both the line and the label. <group at="line-L1">
<line endpoints="((-2,1),(2,2))"/>
<label p="(2,2)"> <m>L_1</m> </label>
</group>
...
<annotations>
...
<annotation ref="line-L1" text="The first line"/>
...
</annotations>
Groups provide a means of organizing the graphical components in a diagram that reflects the structure of the diagram. Behind the scenes, for instance, a grid is a collection of lines that are placed in a group since we wish to call attention to the collection rather than each individual line.