Design: 04.01.04/P02

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 2: Appearance of annotation text primitives

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

CHARACTER CONTENT: Two alphabetic annotation text primitives are
displayed successively.  The operator must identify the sequence
of characters in each.

EFFECT OF REFERENCE POINT:  The screen displays six squares, each
containing an annotation text primitive.  All but one of these
should be outlined in a rectangle.  Identify the one not
accurately outlined.

EFFECT OF ANNOTATION OFFSET: same as EFFECT OF REFERENCE POINT,
above.

DESIGN:

default attributes:
font = 1
precision = STROKE
annotation text alignment = CENTER,HALF
annotation text path = RIGHT
annotation text style = 1 (no visual link between reference point and
                           annotation point)
annotation character height = 0.05
polyline stype = solid
polyline color = 3

*** *** *** *** ***  character content  *** *** *** *** ***

TEST: #SR 7
      "A displayed annotation text primitive should contain
       the specified character string."

set annotation character height = 0.08
set text font = 2
chstr = string of 5 randomly chosen upper-case letters.

display <annotation text relative 3> consisting of chstr:
  reference position = 0.5, 0.5, 0.5
  offset = 0., 0., 0.0

OPQA/CHARACTER CONTENT: Enter the displayed character string.

if (operator response not = chstr) then
   fail
   goto end_char
endif

set annotation character height = 0.08
set text font = 1
chstr = string of 5 randomly chosen lower-case letters

display <annotation text relative> consisting of chstr:
   reference point = 0.5, 0.5
   offset = 0., 0.

OPQA/CHARACTER CONTENT: Enter the displayed character string.
pass/fail depending on (operator response = chstr)

end_char:

*** *** *** *** ***  effect of reference point    *** *** *** *** ***

Divide screen up into 6 square labelled areas
ngsq = no-good square containing error = random from 1 to 6
chstr = "ABC"

sider = list of 6 siders from which cube may be viewed =
   front, back, left, right, top, bottom

<inquire text extent> to get width and height of text extent rectangle
   for chstr: xext, yext
   ext = 0.5 * max(xext, yext)

generate  reference point randomly to make the rectangle within the window
   xrefpt = random from (ext, 1-ext)
   yrefpt = random from (ext, 1-ext)
   zrefpt = random from (ext, 1-ext)

annotation offset = (0., 0., 0.)

for ix = 1 to 6
   rotate to view from sider(ix)
   display the <annotation text relative 3>

   calculate transformed position (x0, y0, z0) of (xrefpt,yrefpt,zrefpt)
   set identity matrix as local transform matrix
   if (ix = ngsq)  then
      distort position (x0, y0, z0)
   endif
   draw 2D text extent rectangle centered at (x0, y0)
next ix

TEST: #SR 7 8 9
      "The location of an annotation text primitive should reflect
       its 3D reference point after being transformed."

OPQA/EFFECT OF REFERENCE POINT: In which box is the annotation
  text NOT accurately outlined by the rectangle?
pass/fail depending on (operator identifies square #ngsq)

ngsq = no-good square , random integer from 1 to 6
generate a reference point :
   xrefpt = random from (ext, 1-ext)
   yrefpt = random from (ext, 1-ext)

annotation offset = (0., 0.)

for ix = 1 to 6
   first, move text from Z=0 plane to somewhere in middle
   rotate to view from sider(ix)
   display the 2D annotation text in square #ix

   calculate transformed position (x0, y0, z0) of (xrefpt, yrefpt, 0)
   set identity matrix as local transform matrix
   if (ix = ngsq)  then
      distort position (x0, y0, z0)
   endif
   draw 2D text extent rectangle centered at (x0, y0)
next ix

TEST: #SR 7 8 9
      "The location of an annotation text primitive should reflect
       its 2D reference point after being transformed."

OPQA/EFFECT OF REFERENCE POINT: In which box is the annotation
  text NOT accurately outlined by the rectangle?
pass/fail depending on (operator identifies square #ngsq)

*** *** *** *** ***  effect of annotation offset  *** *** *** *** ***

Divide screen up into 6 squares labelled areas - each with size=xsiz, ysiz
ngsq = no-good square containing error = random from 1 to 6
chstr = "ABC"

for ix = 1 to 6
   xrefpt,yrefpt,zrefpt = 1,1,1
   scale reference point into center of box #ix
     (make sure transformation does not affect offset)
   xannpt,yannpt,zannpt = random offsets (MC converted to NPC),
      so as to keep annotation text within square
   if (ix <= 3) then
      draw <annotation text relative 3> chstr
         reference point = xrefpt, yrefpt, zrefpt
         offset = xannpt, yannpt, zannpt
   else
      draw <annotation text relative> chstr
         reference point = xrefpt, yrefpt
         offset = xannpt, yannpt
   endif

   calculate (x0, y0, z0) = expected annotation point
   if (ix = ngsq)  then
      distort position (x0, y0, z0)
   endif
   draw 2D text extent rectangle centered at (x0, y0)

next ix

TEST: #SR 7 8 9
      "An annotation text primitive should be displaced from the
       reference point as specified by its annotation offset values."

OPQA/EFFECT OF ANNOTATION OFFSET: In which box is the annotation
  text NOT accurately outlined by the rectangle?
pass/fail depending on (operator identifies square #ngsq)

END PROGRAM 2