Contact us Heritage collections Image license terms
HOME ACL ACD ICF SUS DCS G&A STARLINK Literature
Further reading □ OverviewContentsPrefaceNotation1. Introduction2. Graphical output3. Coordinates4. Segments and Attributes5. Input devices6. Interaction styles7. Workstations8. Environment9. Input control10. Segment storage11. Metafiles12. Further facilities13. Individual attributesA. AbbreviationsB. Language bindingC. Complete programIndex
C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACDLiteratureBooksGKS
ACDLiteratureBooksGKS
ACL ACD C&A INF CCD CISD Archives
Further reading

OverviewContentsPrefaceNotation1. Introduction2. Graphical output3. Coordinates4. Segments and Attributes5. Input devices6. Interaction styles7. Workstations8. Environment9. Input control10. Segment storage11. Metafiles12. Further facilities13. Individual attributesA. AbbreviationsB. Language bindingC. Complete programIndex

Chapter 10: Segment Storage

10.1 INTRODUCTION

The segment concept in GKS has been described in Chapter 4 and its relation to the workstation concept in Chapter 7.

As described in Chapter 7, GKS allows more than one workstation to be active simultaneously. Let us consider now how multiple workstations might be used in practice, by extending the simple animation program developed in Chapter 4. A common requirement for this type of program is the ability to construct a picture on an interactive workstation and to take a snap shot of that picture using some other device. For example the operator may use a colour refresh display to compose each frame of a film; when each frame is satisfactory, he may then wish to make a hardcopy on a plotter. With our present knowledge of GKS, the only way to do this is to have the refresh display and plotter workstations active simultaneously, so all segments created will be created on both workstations. The snag with this technique is that not only are all segments created on both workstations, but also all changes to these segments are also reproduced on both workstations. For example, SET SEGMENT TRANSFORMATION applies to instances of the segment on all workstations on which the segment is stored. We really want to be selective and not output any but the final version of each frame on the plotter workstation. The problem would be overcome if we could move segments from one workstation to another. GKS provides a mechanism for this through a special type of segment storage known as Workstation Independent Segment Storage (abbreviated to WISS). The segment storage with which we are already familiar from Chapter 4 and Chapter 7 is known as Workstation Dependent Segment Storage (abbreviated to WDSS).

10.2 WORKSTATION INDEPENDENT SEGMENT STORAGE

A GKS implementation can provide at most one workstation independent segment storage. It is, as the name implies, a system wide segment store to which all workstations have access. Segments stored in WISS have exactly the same segment attributes as segments stored in workstation dependent segment storage, and are manipulated by the same GKS functions. How for example are segments created in WISS?

WISS is treated by GKS as a workstation. If WISS is active when a segment is created, then the segment will be stored in WISS as well as in the WOSS of each of the other active workstations. Suppose the WISS for a particular implementation of GKS is a workstation of type 11. Then, using the workstation types defined in Chapter 7, consider the following program:

      OPEN WORKSTATION(1, 5, 11) 
      OPEN WORKSTATION(2, 6, 4) 
      ACTIVATE WORKSTATION(1) 
      ACTIVATE WORKSTATION(2) 
      CREATE SEGMENT(DK) 
      DUCK 
      CLOSE SEGMENT

This will create instances of segment DK, the duck, on both the WISS (workstation 1), and the refresh display (workstation 2).

In other respects also, the segments stored on WISS behave like segments on other workstations. For example, the segment created in the last example may be deleted from WISS by:

      DELETE SEGMENT FROM WORKSTATION(1, DK)

The functions for manipulating segment attributes apply to all copies of the specified segment within GKS. Thus:

      SET SEGMENT TRANSFORMATION(DK, MAT)

sets the transformation of segment DK to be the matrix MAT and this applies to all workstations on which segment DK is stored, including WISS.

10.3 WISS FUNCTIONS

We have seen how segments may be stored in WISS, deleted from WISS and how their segment attributes may be changed. We will now see the particular manipulations that are possible for segments in WISS, but not for segments in WDSS. These are the manipulations that make WISS useful. GKS provides three functions to manipulate segments in WISS: ASSOCIATE SEGMENT WITH WORKSTATION, COPY SEGMENT TO WORKSTATION and INSERT SEGMENT. The simplest to describe is:

ASSOCIATE SEGMENT WITH WORKSTATION(WS, ID)

This function copies the segment ID from the WISS to the WDSS of the workstation WS. The effect is as if workstation WS had been active when the segment was created. This function cannot be invoked if a segment is open.

With this function, we can allow the operator to compose the background of a picture on an interactive workstation (workstation DISPLAY below). When satisfactory, the segment containing the background is associated with the plotter workstation. This is only possible because all changes on the interactive workstation are made in parallel in WISS (workstation SS in the example). In this example and the succeeding ones in this chapter, the workstations and the segments are referred to by variables preset with the appropriate integer values.

      OPEN WORKSTATION(SS, 5, 11) 
      OPEN WORKSTATION(DISPLAY, 6, 4) 
      OPEN WORKSTATION(PLOTTER, 7, 5) 
      ACTIVATE WORKSTATION(SS) 
      ACTIVATE WORKSTATION(DISPLAY)
      compose background interactively in segment BKGND
      ASSOCIATE SEGMENT WITH WORKSTATION(PLOTTER, BKGND)

The invocation of ASSOCIATE SEGMENT WITH WORKSTATION causes the segment containing the background (segment BKGND) to be stored in the WDSS of the plotter. After the association takes place, the background will appear on every frame on the plotter, until the segment is changed in some way. This function may cause an implicit regeneration (see Section 7.11).

The next function has two parameters:

COPY SEGMENT TO WORKSTATION(WS, ID)

The primitives in the segment ID (stored in the WISS) are sent to the workstation WS after the segment transformation and clipping have been applied. Workstation WS must not be the WISS. This function cannot be invoked when a segment is open. The major difference between this function and ASSOCIATE SEGMENT WITH WORKSTATION is that as a result of the COPY function, segment ID does not exist as a segment on workstation WS. The primitives contained in the segment can no longer be manipulated as a segment on the workstation. It is as if the output primitives in the segment had been called directly. The example above could be continued using the COPY SEGMENT TO WORKSTATION function. Successive frames are output, consisting of the duck in various locations chosen interactively, drawn against the background that we have already constructed. To force a change to a new frame, we need the GKS function REDRAW ALL SEGMENTS ON WORKSTATION Chapter 7. In this program, the LOGICAL variable HC is set if a hardcopy is required; how this variable is set is not shown. The example is as follows:

      CREATE SEGMENT(DK) 
      DUCK 
      CLOSE SEGMENT
 100  CONTINUE 
      position the duck (segment DK) interactively 
      IF(HC) THEN COPY SEGMENT TO WORKSTATION(PLOTTER, DK) 
      REDRAW ALL SEGMENTS ON WORKSTATION(PLOTTER) 
      ENDIF 
      GOTO 100

One effect of the REDRAW ALL SEGMENTS ON WORKSTATION function in this instance is to clear the display surface and then redraw segment BKGND, the background. In a real example in which segment priority is important, care may be necessary to achieve the desired results.

The third function provided to manipulate segments in the WISS is:

INSERT SEGMENT(ID, MAT)

The segment ID must exist in the WISS. Unlike the ASSOCIATE and COPY functions, this function may be invoked when a segment is open, but segment ID cannot be the open segment. The function copies the primitives in segment ID to all the active workstations. If a segment is open, the primitives will become part of that segment, on all workstations that are active (the WISS could be one of them). If there is no segment open, the primitives are copied to all the active workstations, but are not a part of any segment on those workstations.

The transformation specified by the matrix MAT is applied to the contents of segment ID after the segment transformation of segment ID itself. This function may cause an implicit regeneration (see Section 7.11).

To illustrate the differences between the three WISS functions, consider the following example:

      OPEN WORKSTATION(SS, 5, 11) 
      OPEN WORKSTATION(DISPLAY, 6, 4)
      SET WINDOW(1, 0, 70, 0, 70) 
      SET VIEWPORT(1, 0, 0.5, 0,5, 1) 
      SET WINDOW(2, 0, 30, 0, 30) 
      SET VIEWPORT(2, 0, 0,5, 0, 0.5)
      ACTIVATE WORKSTATION(SS) 
      CREATE SEGMENT(TR) 
      SELECT NORMALIZATION TRANSFORMATION(1) 
      TREE 
      CLOSE SEGMENT 
      CREATE SEGMENT(DK) 
      SELECT NORMALIZATION TRANSFORMATION(2) 
      DUCK 
      CLOSE SEGMENT

WISS (workstation SS) contains two segments, the tree and duck, Consider the effect of:

      ASSOCIATE SEGMENT WITH WORKSTATION(DISPLAY, TR) 
      ASSOCIATE SEGMENT WITH WORKSTATION(DISPLAY, DK)

Segments TR and DK will now be stored on workstation DISPLAY. The effect is as if workstation DISPLAY had been active when the segments were created, If, instead of invoking ASSOCIATE SEGMENT WITH WORKSTATION, the following statements had been executed:

      COPY SEGMENT TO WORKSTATION(DISPLAY, TR) 
      COPY SEGMENT TO WORKSTATION(DISPLAY, DK)

the picture displayed on workstation DISPLAY would be superficially the same, except that the tree and duck are not stored in segment storage.

To show how INSERT SEGMENT differs, consider the statements:

      ACTIVATE WORKSTATION(DISPLAY) 
      EVALUATE TRANSFORMATION MATRIX(0, 0, 0, 0, 0, 1, 1, WC, MATI) 
      CREATE SEGMENT(NEW) 
      INSERT SEGMENT(TR, MATI) 
      INSERT SEGMENT(DK, MATI) 
      CLOSE SEGMENT

The transformation matrix defined by EVALUATE TRANSFORMATION MATRIX is the identity transformation, which leaves all points unchanged. The segment store of workstation DISPLAY will now contain a single segment, NEW, which contains both tree and duck. This segment will also, as it happens, be stored on workstation SS since that workstation is also active.

Now let us extend the example to illustrate clipping. In each segment we introduce a shift of 0.25 in the Y direction as follows:

      SET CLIPPING INDICATOR(CLIP) 
      EVALUATE TRANSFORMATION MATRIX(0, 0, 0, 0.25, 0, 1, 1, NDC, MAT)
      ACTIVATE WORKSTATION(SS) 
      CREATE SEGMENT(TR) 
      SET SEGMENT TRANSFORMATION(TR, MAT) 
      SELECT NORMALIZATION TRANSFORMATION(1) 
      TREE 
      CLOSE SEGMENT 
      CREATE SEGMENT(DK) 
      SET SEGMENT TRANSFORMATION(DK, MAT) 
      SELECT NORMALIZATION TRANSFORMATION(2) 
      DUCK 
      CLOSE SEGMENT

WISS contains the segments represented by:

Segment TR 
     Clipping Rectangle [0,0.5]×[0.5,1] 
     Tree
Segment DK
     Clipping Rectangle [0,0.5]×[0,0.5] 
     Duck

Now let us consider the effects of:

      ASSOCIATE SEGMENT WITH WORKSTATION(DISPLAY, TR) 
      ASSOCIATE SEGMENT WITH WORKSTATION(DISPLAY, DK)

The segment store of workstation DISPLAY will contain the same segments as WISS, retaining the same clipping rectangles. The appearance of these two segments on workstation DISPLAY is shown in Figure 10-1.

Consider instead:

      COPY SEGMENT TO WORKSTATION(DISPLAY, TR) 
      COPY SEGMENT TO WORKSTATION(DISPLAY, DK)

This example does not cause the segments to be stored on workstation DISPLAY, but causes the primitives in the segments to be output there. As with ASSOCIATE SEGMENT WITH WORKSTATION, the primitives in the segments are clipped against the clipping rectangles stored with them, before being output on workstation DISPLAY. The appearance of the resulting display is therefore also as shown in Figure 10-1.

Figure 10-1

For INSERT SEGMENT, consider:

      ACTIVATE WORKSTATION(DISPLAY) 
      SET VIEWPORT(3, 0, 0.5, 0, 1) 
      EVALUATE TRANSFORMATION MATRIX(0, 0, 0, 0, 0, 1, 1, WC, MATI)
      CREATE SEGMENT(NEW) 
      SELECT NORMALIZATION TRANSFORMATION(3) 
      INSERT SEGMENT(TR, MATI) 
      INSERT SEGMENT(DK, MATI) 
      CLOSE SEGMENT

Segment NEW contains primitives corresponding to the picture shown in Figure 10-2. Note that the polyline representing the tree goes outside the [0,1] × [0,1] region of NDC space, but the segment storage in GKS can handle data in at least the region [-7,7] × [-7.7]. The clipping rectangles associated with the primitives in segments TR and DK are discarded by INSERT SEGMENT. The primitives are reassigned the clipping rectangle [0,0.5] × [0,1], the viewport of the currently selected normalization transformation (number 3). The appearance of the segment as displayed on workstation DISPLAY is shown in Figure 10-3. This should be contrasted with the appearance of segments TR and DK in Figure 10-1.

Figure 10-2

Figure 10-3
⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site