Design: 04.02.05.01/P05

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 5: Network inheritance and initialization

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

STRUCTURE NETWORK INHERITANCE FOR INTERIOR STYLE: Fourteen pairs
of rectangles with various interior styles are displayed.
Identify the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR HATCH INDEX: Fourteen pairs of
rectangles with various hatch styles are displayed.  Identify the
non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR PATTERN INDEX: Fourteen pairs
of rectangles with various patterns are displayed.  Identify the
non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR EDGE FLAG: Fourteen pairs of
triangles with edge flag eith ON or OFF are displayed.  Identify
the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR EDGETYPE AND EDGEWIDTH:
Fourteen pairs of triangles with various edgetypes and edgewidths
are displayed.  Identify the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR PATTERN SIZE: Fourteen pairs of
rectangles with various pattern sizes are displayed.  Identify
the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR PATTERN REFERENCE POINT AND
VECTORS: Fourteen pairs of rectangles with various pattern
reference point and vectors are displayed.  Identify the
non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR INTERIOR COLOUR INDEX: Fourteen
pairs of rectangles with various interior colors are displayed.
Identify the non-matching pair.

STRUCTURE NETWORK INHERITANCE FOR EDGE COLOUR INDEX: Fourteen
pairs of triangles with various edge colors are displayed.
Identify the non-matching pair.


DESIGN:

use <inquire interior facilities> to determine:
  numsty = number of available interior styles
use <inquire edge facilities> to determine:
  numet = number of available edgetypes
  numew = number of available edgewidths
  nomew = nominal edgewidth
  minew, maxew = minimum, maximum edgewidth

All test cases use same basic structure network for testing
inheritance.  Five (distinct if possible) values for the
attribute to be tested are set up and propagated throughout the
network.  The first value is the system default from the PDT.
Note that structure #104 is executed by both #103 and #101.
Actual results are displayed on the left, expected results
on the right, with the 14th deliberately made incorrect.

default = val#1
  |                  102
  |                 /  prim 2
  |               /    attr = val#3   val#3
  V        val#1/      exec 103---------------103
101           /        prim 8                   prim 3
  prim 1    /                                   attr = val#4
  exec 102/                                     prim 4
  prim 9                                        exec 104\
  attr = val#2                                  prim 7    \ val#4
  prim 10                                                   \
  transform             val#2                                 \
  exec 104-----------------------------------------------------104
  un-transform                                                   prim 5/11
  prim 13                                                        attr = val#5
  prim 14                                                        prim 6/12
  exec 105---------->105
                       expected values


*** *** *** ***   interior style   *** *** *** ***

lstyle = list of 5 (possibly repeated) available interior styles,
  with HOLLOW (default) in 1st position.
if (HOLLOW not available) then
   message: skipping test of interior style
   goto end_int_style
endif

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF
  and pattern size to reasonable value
display 14 pairs of rectangles, with interior styles from lstyle

TEST: #SR 3 4 7 8 16 17
      "The interior style attribute for the fill area and fill
       area set primitives should be saved and restored by
       <execute structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR INTERIOR STYLE: Which pair
  of rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

end_int_style:

*** *** *** ***   hatch index   *** *** *** ***

if (hatch style unavailable) then
   message: skipping test of hatch index.
   goto end_hatch
endif

use <inquire interior facilities> to determine:
  lhatch = list of 5 (possibly repeated) randomly chosen hatch
           indexes, with #1 in 1st position

if (hatch style #1 unavailable) then
   message: skipping test of hatch index.
   goto end_hatch
endif

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF
  and interior style = HATCH
display 14 pairs of rectangles, with hatch indexes from lhatch

TEST: #SR 3 4 19 20 24 25
      "The hatch index attribute for the fill area and fill area
       set primitives should be saved and restored by <execute
       structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR HATCH INDEX: Which pair of
  rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

end_hatch:

*** *** *** ***   pattern index   *** *** *** ***

if (pattern style unavailable) then
   message: skipping test of pattern index.
   goto end_pat_index
endif

set up 5 distinct patterns in pattern table, with indexes
  from 1 to 5

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF,
  interior style = PATTERN and pattern size = reasonable value
display 14 pairs of rectangles, with pattern indexes from 1 to 5

TEST: #SR 3 4 19 20 24 25
      "The pattern index attribute for the fill area and fill
       area set primitives should be saved and restored by
       <execute structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR PATTERN INDEX: Which pair
  of rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

end_pat_index:

*** *** *** ***   edge flag   *** *** *** ***

set up 5 edge flags in table - 1st must be default (OFF), and
  make 2nd <> 4th, since these are both inherited by #104:
  edgflg = [OFF,ON,ON,OFF,ON]

randomize location of triangles
set up CSS as described above; throughout, use interior style =
  EMPTY, and edgewidth = moderately thick
display 14 pairs of rectangles, with edge flags from edgflg

TEST: #SR 3 4 34 35 36 38 39
      "The edge flag attribute for the fill area set primitive
       should be saved and restored by <execute structure>
       during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR EDGE FLAG: Which pair of
  triangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

*** *** *** ***   edgetype and width   *** *** *** ***

if (only one edgetype and edgewidth available) then
   message: skipping test of edgetype and edgewidth.
   goto end_edgetype
endif

ledtyp = list of 5 (possibly repeated) randomly selected
  edgetypes, with #1 in 1st position

if (edgetype #1 unavailable) then
   message: skipping test of edgetype and edgewidth.
   goto end_edgetype
endif

try to set up 5 distinct edgewidth scale factors:
maxsc = scale factor equivalent to 0.6 * height of rectangle
minsc = scale factor equivalent to minew
for ix = 1,5
   ewvals(ix) = minsc + ((maxsc-minsc) * (ix-1)) / 4
next ix

set interior style to EMPTY and edge flag ON
      CALL PSIS   (PISEMP)
      CALL PSEDFG (PON)

randomize location of triangles
set up CSS as described above; throughout, use edge flag = ON
  and interior style = EMPTY
display 14 pairs of rectangles, with edgetypes from ledtyp
  and edgewidth scale factors from ewvals

TEST: #SR 3 4 41 42 47 48 50 51 52 53 54
      "The edgetype and edgewidth scale factor attributes for the
       fill area set primitive should be saved and restored by
       <execute structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR EDGETYPE AND EDGEWIDTH:
  Which pair of triangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

end_edgetype:

*** *** *** ***   pattern size   *** *** *** ***

if (pattern style unavailable) then
   message: skipping tests of pattern size, reference point, and
            vectors.
   goto end_pat_geom
endif

set up simple checkerboard pattern as entry #1 in pattern table

set up 5 distinguishable pattern sizes:

        patszx  patszy
        ------  ------
  1:       1.0     1.0
  2:       1.2     0.8
  3:       0.8     1.2
  4:       1.4     1.4
  5:       0.6     0.6

Because default pattern size of 1,1 would fill whole screen,
display must be scaled such that 1,1 is part of a rectangle,
whose height = recht = 0.045 - so map 1.2 to recht; scale down
by recht/1.2

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF,
  interior style = PATTERN and pattern index = 1
display 14 pairs of rectangles, with pattern sizes from
  patszx,patszy

TEST: #SR 3 4 62 64 65 73 74
      "The pattern size attribute for the fill area and fill area
       set primitives should be saved and restored by <execute
       structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR PATTERN SIZE: Which pair
  of rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

*** *** ***   pattern reference point and vectors   *** *** ***

set up simple stripe pattern as entry #1 in pattern table

set up distinguishable pattern reference point and vectors:

for reference point, vary x-component by 1/5 of rectangle height,
  y,z components = 0

for vectors, vary 1st within x-y plane, rotating counterclockwise
  by 36 degrees from horizontal; keep 2nd perpendicular to 1st
  (+ 90 degrees).  Effect is to rotate pattern, but not shear it.

        xrefpt:            xyzvec:
        x-component of     angle equivalent (in
        reference point    degrees) of vector
        ---------------    --------------------
   1:     0.0 * recht             0
   2:     0.2 * recht            36
   3:     0.4 * recht            72
   4:     0.6 * recht           108
   5:     0.8 * recht           144

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF,
  interior style = PATTERN, pattern index = 1, and pattern size =
  reasonable value
display 14 pairs of rectangles, with reference point from xrefpt
  and vectors from xyzvec

TEST: #SR 3 4 68 71 72 73 74 75 76 77 80 81 82 83
      "The pattern reference point and vectors attributes for the
       fill area and fill area set primitives should be saved and
       restored by <execute structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR PATTERN REFERENCE POINT
  AND VECTORS: Which pair of rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

end_pat_geom:

save color tests for last, since they may change the color table

*** *** *** *** ***   interior color index   *** *** *** *** ***

call DISCOL to try to get 5 distinct foreground colors,
  returning fcol = actual number of foreground colors

set up colind = list of distinguishable color indexes
if (fcol <= 1) then
   colind = selection from background and foreground colors
          = [1,0,1,1,0]
else
   colind = circular list of indices = [1,..,fcol, 1,..]
endif

randomize location of rectangles
set up CSS as described above; throughout, use edge flag = OFF
  and requested interior style = SOLID (HOLLOW if unavailable)
display 14 pairs of rectangles, with interior colour indexes from
  colind

TEST: #SR 3 4 27 28 30 31
      "The interior colour index attribute for the fill area and
       fill area set primitives should be saved and restored by
       <execute structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR INTERIOR COLOUR INDEX:
  Which pair of rectangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

*** *** *** *** ***   edge color index   *** *** *** *** ***

use fcol and colind as set from interior colour index test

randomize location of triangles
set up CSS as described above; throughout, use edge flag = ON,
  interior style = EMPTY, and edgewidth = moderately thick
display 14 pairs of triangles, with edge colour indexes from
  colind

TEST: #SR 3 4 56 57 59 60
      "The edge colour index attribute for the fill area set
       primitive should be saved and restored by <execute
       structure> during traversal."

OPQA/STRUCTURE NETWORK INHERITANCE FOR EDGE COLOUR INDEX: Which
  pair of triangles does NOT match?
pass/fail depending on (location of 14th primitive selected)

END PROGRAM 5