Design: 04.02.01.01/P04

This is an abstract, language-independent design. Grim details may be found in the corresponding source code. You may return to the documentation for the module containing this program design, or to the entire hierarchical table of topics covered by the PVT.


PROGRAM 4: Network inheritance and initialization

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

STRUCTURE NETWORK INHERITANCE FOR LINESTYLE AND LINEWIDTH: This
screen displays several left-right pairs of polylines.  Make sure
that all pairs except one have matching linestyles and linewidths.
Identify the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR POLYLINE COLOR INDEX: This
screen displays several left-right pairs of polylines.  Make sure
that all pairs except one have matching colors.  For monochrome
workstations, both the background and foreground colors must be
used, and so several lines will be drawn in the background color.
Identify the non-matching pair.

DESIGN:

*** *** ***   inheritance for linestyle and linewidth   *** *** ***

from dialog common:
qvis  = minimum distinguishable length in DC-units

get alternative linewidth values:

altlw1 should not exceed .05 to avoid overlap - distance between
  lines will be 1/15 = .06666
altlw1 = min(max scale factor, factor equivalent to .05 in WC)
altlw2 = min scale factor

if default (1.0) is near altlw1 or altlw2, set alternate so as to
maximize the smallest gap among altlw1, altlw2, and 1.0:

avg1 = (altlw1 + 1) / 2
avg2 = (altlw2 + 1) / 2
if (abs(altlw1-1) .lt. abs(avg2-1)) then
   altlw1 = avg2
elseif (abs(altlw2-1) .lt. abs(avg1-1)) then
   altlw2 = avg1
endif

set up PERM to randomize position of polylines

set up CSS:

Structure network #101 draws actual results in random order on
left side of picture.  Structure #105 draws expected results in
same random order on right side of picture, except for polyline
14 which is deliberately drawn with incorrect attributes. This
should be the only non-matching pair in the picture.

structure #101
polyline 1 (order within traversal)
execute 102
polyline 9
change-attributes: linestyle=2, linewidth=altlw1
polyline 10
set local transformation to make lines 11,12 distinguishable
  from 5,6
execute 104
re-set local transformation to identity
polyline 13
polyline 14
execute 105

structure #102
polyline 2
change-attributes: linestyle=3, linewidth=altlw2
execute 103
polyline 8

structure #103
polyline 3
change-attributes: linestyle=4, linewidth=altlw1
polyline 4
execute 104
polyline 7

structure #104
polyline 5 / 11
change-attributes: linestyle=2, linewidth=altlw2
polyline 6 / 12

Expected attributes (except #14, whose actual linestyle should be 2):

structure #105
polyline   linestyle   linewidth-scale
--------   ---------   ---------------
01         1           1.0
02         1           1.0
03         3           altlw2
04         4           altlw1
05         4           altlw1
06         2           altlw2
07         4           altlw1
08         3           altlw2
09         1           1.0
10         2           altlw1
11         2           altlw1
12         2           altlw2
13         2           altlw1
14         4           altlw1

TEST: #SR 3 5 6 11 12 14 15 17 18
      "The linestyle and linewidth attributes for the polyline
       primitive should be saved and restored by <execute
       structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR LINESTYLE AND LINEWIDTH:
  which pair of lines does NOT match?
pass/fail depending on response = position of polyline 14

*** *** ***   inheritance for polyline color index   *** *** ***

call DISCOL to try to get 5 distinct foreground colors,
  returning fcol = actual number of foreground colors
if fcol = 1 (monochrome) then
   fcol = 2
   colind[0..1] = circular list of indices = [1,0]
else
   colind[0..fcol-1] = circular list of indices = [1,..,fcol]
endif
set up PERM to randomize position of polylines
cbase = 0

set up CSS:

Structure network #101 draws actual results in random order on
left side of picture.  Structure #105 draws expected results in
same random order on right side of picture, except for polyline
14 which is deliberately drawn with incorrect attributes. This
should be the only non-matching pair in the picture.

structure #101
set linetype = 1
set linewidth = .05 in WC
polyline 1 (order within traversal)
execute 102
polyline 9
increment cbase
change-attributes: use colind(cbase mod fcol) for next color index
polyline 10
set local transformation to make lines 11,12 distinguishable
  from 5,6
execute 104
re-set local transformation to identity
polyline 13
polyline 14
execute 105

structure #102
polyline 2
increment cbase
change-attributes: use colind(cbase mod fcol) for next color index
execute 103
polyline 8

structure #103
polyline 3
increment cbase
change-attributes: use colind(cbase mod fcol) for next color index
polyline 4
execute 104
polyline 7

structure #104
polyline 5 / 11
increment cbase
change-attributes: use colind(cbase mod fcol) for next color index
polyline 6 / 12

Expected attributes (except #14, whose actual color should be
same as #13):
color index = colind(cbase mod fcol)

structure #105
polyline    cbase
--------    -----
01          0
02          0
03          2
04          3
05          3
06          4
07          3
08          2
09          0
10          1
11          1
12          4
13          1
14          2

TEST: #SR 3 20 21 23 24
      "The polyline color index attribute for the polyline
       primitive should be saved and restored by <execute
       structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR POLYLINE COLOR INDEX:
  which pair of lines does NOT match?
pass/fail depending on response = position of polyline 14

END PROGRAM 4