9

Click here to load reader

Proposal for GKS Output Level 3 Segment Hierarchy and Editing

Embed Size (px)

Citation preview

Page 1: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

289

Proposal for CKS Output Level 3 Segment Hierarchy and Editing

Jonathan E. Steinhart’

AbSbret

This proposal describes a set of compatible exten- sions to CIS. These extensions allow for hierarchi- cal segment organization. The ability to edit exist- ing segments is included. The paper is an excerpt from: IS0 TC97/SC5/WG2/”9 / ANSI X3H3/8447R 1

1. IaboQction ANSI committee X3H31 has proposed a new stan- dard, PHICS, which supports a hierarchical segment model. WIGS also includes some additional output primitives and attributes, and three-dimensional graphics support. There are few diaerenccs between PMCS and CKS other than these exten- sions.

The proposal presented here is based on the assertion that the graphics user community is better served by a compatible extension to an existing standard than by a completely new stan- dard. This document describes a set of extensions to CIS for segment hierarchy and editing. Three- dimensional graphics support is deliberately omit- ted as &om are currently underway to extend CIS inthisarea.

This proposal deals only with output func- tions and their side effects on the existing input functions. These functions are collectively referred to as CKS output level 3. This is a poor choice of names as most of the CKS output level 3 functions could exist without CKS output level 2.

Fill area sets, and circles and arcs are not included here, although their standardization would be valuable. Functions such as these may be accesscd via the current escopc and generalized &mingprimirive functions. An attempt has been made to keep this proposal focused by not includ- ing unrelated issues in with the segment model.

‘Counterpoint Computers, Inc. 155 MoBett Park Drive. Suite B-1 Sunnyvnk.CaliIornia 94086

2. Segment Model Comparison

2.1. mcKs Modd A CKS segment is a collection of primitives and attributes. The only relationship between segments is a priority that determines the order in which the segments are drawn. The visibility of segment primitives depends only on the segment visibility attribute setting. Highlighting a segment affects

The only attributes that are local to a seg- ment are the visibility, highlighting, transforma- tion, and detectability. Only one set of global primitive attributes exists. Primitive attribute set- tings that are modified by a segment remain in effect.

Attributes are bound to primitives in a seg- ment. Thus, if the polyline colour is red and a polyline primitive is issued, a red polyline is stored.

the entire segment.

2.2. Tbe PMCS Model PWCS calls segments srwrures.

Segments (or structures) in are also collections of primitives and attributes. However, a segment may invoke the execution of other seg- ments. The state of the primitive attributes is saved before an invocation and restored afterward. Thus a segment inherits attributes from its ances- tors, and may make local changes in its lifetime. Segments may not be called recursively.

Segments are not displayed unless posted. Thus segments may exist that are not displayed at all, independent of the visibility attributes.

PHICS has added the ability to label and edit the contents of existing segments.

Segment attributes have been eliminated. As a result, visibility, highlighting, and detectabil- ity are primitive attributes in PHICS.

Attributes are not bound to primitives in segments. The current attributes are used to render each primitive.

North-Holland Cornpurer Graphics Foruni. 3 (1984) 289-297

Page 2: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

2.3. ' h c ~ s O u t p l t L w d 3 M o d e l cys output level 3 lets a segment invoke other seg- ments. Attributes arc pushed on call and popped on return, as with PHIGS. Posting control is pro- vided via a global visibility attribute for each seg- ment network. Segment transformations are con- catenated upon segment invocation.

Editing of segment contents is supported in

be reopened for editing. Elements may be inserted and deleted. The editing position or cwrent ele- ment number may be set.

The contents of segment elements may be inquired. A function exists to retrieve the element data. It is possible to store undisplayable informa- tion in a segment to facilitate database manage- ment.

Segment networks may be stored in metofiles.

the same style as ma. An existing segment may

3. Detrile!dDcscription

3.1. The Environment CKS maintains the Current value of each of the primitive attributes. These values are collectively referred to as the primitive environment. The a standard requires that the values of the primitive attributes are bound to the output primitives upon their creation. and cannot be changed afterwards.' Output primitives inherit their attributes from the environment upon creation.

Note that in CKS levels 2 and below, seg- ments do not contain references to other segments.

for which the above mentioned binding mechanism is not Sufticient. cm level 3 must be compatible with prior practice while also providing a new attribute binding mechanism. This mechanism is realized by considering the segment to represent the binding of attributcs to primitives. Since seg- ments may not be modified once closed in GKS lev- els 2 and below, compatibility is pmcrved.

With a single level of segmentation, a seg- ment appears only once and therefore nctds only one set of segment attributes. This madel of seg- ment attributes is extended for segment hierarchy to allow each instance of a segment to have its

CKS level 3 allows hierarchical segment S~CtUrC

' The crs Control Baud has determind that this bmding does not apply 10 primitim stored in m e t a h . For primitives outxi& of sepenu this is- sue is moot.

own set of attributes.

3.2 Segments A segment is a collection of graphical information that can be manipulated. This information may include output primitives, attribute settings, invo- cations of other segments, and/or private data. A unique identifier is associated with each segment. Effectively, a segment is a callable picture subrou- tine.

A segment may be thought of as a record- ing. Information stored in a segment may be played back at a later time. The actual rendition of a segment is partially governed by the environ- ment at the time it is played back. A segment has the ability to manipulate its environment since attribute settings may be stored in segments. There are also some attribute settings that globally af€ect the contents of a segment, such as the visibil- ity and highlighting. These global attributes may not be set from inside of a segment.

33. !hgment Components A segment conceptually consists of a header and a monotonically numbered list of elements. The header is defined by cys to contain the following global attribute settihgs: transformation, visibility, highlighting, priority, and detectability.

Each element normally corresponds to exactly one CKS function invocation. These ele- ments in fact usually correspond to primitives or primitive attributes. A list of all such elements can be found in Appendix A. The sample segment shown below draws a car body using polylines. The line will be red because the po@Iine colour in&x element causes the environment to change. The polyline primitive inherits the linetype and the linewidth scale factor from the environment.

segment header polyline colour index I red

3.4. Segment Creation A new segment is generated by the create segment function. The segment idcntijier is associated with the segment at this time. The segment is created on all active workstations.

When segments are created with the create segment function, 25 elements are automatically appended to the new segment. These elements, which we refer to as creation eIements2, behave

Page 3: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

exactly as elements explicitly placed in segments, in that they may be edited, deleted, etc.

The presence of the creution eletnenis causes any primitives in the segment to behave as if their attributes were bound at creation. During segment traversal, the creution elements reset the environ- ment to the state that existed at creation time.

1 2 3

Effect of the create segment Function Element Number Contents

aspectsourceflags character expansion factor character height

I 4 I character spacine 1 I 5 I character UD vector I

6 I clipping rectangle 7 I fillareacolourindcx

I 8 I 6llarcaindex I I 9 I fill area interior style I I 10 I fill area style index I

1 6 patternsize I I 17 I polyline colour index I

35. Creation of Empty §egments When segments are Created with the creute segment function, attributes are bound to primitives exactly as in prior practice: the attributes in effect when a primitive is created arc bound by the segment to

ing the contents of the segment, which is not possi- ble in CYS below level 3. When segment hierarchy

the primitive, a d m o t be altered without edit-

The ovahad of the ~ r e ~ t i o ~ ckments W O U I ~ be d- iminatcd if cI(S would have required that attributes be explicitly written into segments.

is possible, it is desirable to allow a more general mechanism for binding attributes to primitives.

The creure empy segment of cys level 3 allows creation of segments without the creution elemenfs that are automatically generated when- ever create segment is called. primitives in seg- ments created with the creufe segment call are always preceded by elements setting each attribute, either creution elements created by default, or explicit elements added by the application pro- gram. HOWWW, primitives in segments created by creute empty segment are not ncceSSBfily preceded by elements setting attribute values, and thus there are may be no attribute values explicitly bound to the primitive. This allows a segment to inherit the current state of the environment.

Segments created by creufe segment have the visibility attribute in the header initialized to VISI- BLE. For rcasons which will be clear later, seg- ments created by creufe empty segment have their visibility attribute initialized to m'vurnu.

3.6. Segment orgrnkption cys output levels 1 and 2 do not allow segments to contain references to other segments. The only external control of the segment organization is front-to-back ordering, or priority. Segments are displayed in order from low priority to high prior- ity. This c~lsurcs that higher priority segments obscure those of lower priority when a conflict exists. Figure 1 depicts the order in which 4- ments of Merent priorities are displayed.

cys output level 3 allows segments to refer- ence other segments. This is known as invoking or culling the segment. Execution of the calling seg- ment is rcsumed after the called segment returns. Calling segments arc known aspurents, called seg- ments as children. The tcnns uncesiors and &scen- dents are often used when the linage may include more than one generation. Segment calls allow data to be organized in a hierarchical fashion. Figure 2 depicts a simple segment hierarchy.

Note that a segment may be called more than once.

Segment cur in the above diagram is known as the root. There are no restrictions on the complexity of a segment tree with the ex-

Fig. 1.

Page 4: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

292 J. E. Sreinhurr 1 Propii.~aI, f i r G K S Ourpur Level 3

Fig. 2.

tion that rccufsioll is prohibited. Recursion is checked when the segment is traversed. A recur- sive call to a segment is treated as a call to a nonexistent segment. A segment network must be an acyclic directed graph.

CKS output level 3 allows multiple segment trces to exist. -ent priority no longer applies to individual segments but to the roots. Note that compatibility with cws output level 1 and 2 appli- cations may be maintained by making every seg- ment a root.

CIS output levels 1 and 2 do not allow a

for making it invisible). This functionality becoma naxssary in output level 3 to prevent all child segments from also becoming parents. A segment docs not get displayed unless it is VISIBIZ, or at least one of its ancestors is VISIBLE.

An existing w e n t organization may be detamined by using the inquire segment parh function. A segment path consists of a list of all segments traversed from the root to the supplied segment. Pick idenrifirs are also given in the paths. The inquire segmenrputht function makes it convenient to determine the topology of an exist- ing segment structure. It is easy to detamiae a segment’s children by scanning a segment using the editing functions. A list of roots can be obtained by scanning the ser of segment nuws in we for VISIBLE segments.

segment to exist without being displayed (except

3.7. crruhg segme!nts

A segment may be invoked by another segment with the call segment function. This function is treated as a NOP and returns with no error if the called segment does not exist. This allows freedom in the order in which complex segment networks are generated.

The current environment is saved when a segment is called. This environment is restored upon return from the called segment. Thus, chil- dren inhait the current environment from their

parents. A child may modify its however, these modifications are

environment; local to the

child’s lifetime. The parent’s attribute set is never afTected by the actions of its children. A complete list of the attributes that comprise the environment may be found in Appendix A.

Segment hierarchy imposes some structure on the data organization. !%pent calls may be thought of as control points. The control of transformations, visibility, highlighting, and detec- tability is concentrated at these points.

3.8. !kgment Transformations Each segment has a transformation in its header. A current transformarion is also maintained in the environment. This transformation is initialized to the values contained in the segment transformation of the root segment of each segment network before traversal. One of the arguments to the call segment function is an instance transformation. When a call segment is executed. the current transformarion is saved as part of the environment. Then, a new merit transformarion is computed as the concatenation of the cwrent tramformation, the instance transformarion, and the child segment’s segment rransformarion. [ current Ix[ instance ]x[childscgment]

transformation transformation transformation

3.9. Segment ViibUity Each segment header contains a visibility attribute. A current visibility is also maintained in the environment. The call segment function has an instance visibility as an argument.

When a call segmenr is executed, the w e n t visibility is saved as part of ‘the environment. Then, a ncw current visibility value is computed as the logical and of the current visibility and the instance visibility. Since visibility is an inherited attribute, a segment cannot make itself vlslb~~ if any of its ancestors are MVISIBLE.

Page 5: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

293

Fig. 3.

Note that the segment visibiliry is not used in the computation of the current visibility. The segment visibility plays a special role. Any segment that has a value of VISIBLE for its segment visibility is a root. This implies that the current visibility is set to VISIBLE before traversal of each segment net- work.

3.10. Segment Highlighting

Each segment header contains a highlighting attri- bute. A current highlighting is also maintained in the environment. The call segment function has an instance highlighting argument.

When a call segment is executed, the current highlighting is saved as part of the environment. Then, a new current highlighting value is computed as the logical or of the current highlighting and the instance highlighting. Since highlighting is an inherited attribute, a segment cannot make itself

The current highlighting is set to the value of the root segment highlighting attribute before traversal of each segment network.

NORMAL if any Of its anceStOrS We HICHLICH'IED.

3.11. !kgment Detectability Each segment header contains a detectability attri- bute. A current dcrcctubility is also maintained in the environment. The call segment function has an instance detectability argument.

When a call segment is executed, the current detectability is saved as part of the environment. Then, a new current detectability value is computed as the logicd and of the current detectability and the instance detectubility. Since detectability is an inherited attribute, a segment cannot make itself DETECTABLE if any Of its BnCCStOrS are U N D m - ABLE.

The current aktectability is set to the value of the root segment detectability attribute before traversal of each segment network.

unicycle 0 3.1% Clipping Rectangles One of the segment elements is the clipping rectan- gle, which &responds transformation viewport. ignored in child segments.

3.13. Delete Segment, Workstation

to the normalization Clipping rectangla are

The existing cu delete segment and delete segment from workstotion functions wil l ddete the entire segment network rooted by the supplied segment identitier. However. the children uc sot deleted if they are referend by other segment networks.

Two segment networks are depicted in figure 3. Only the CIU body Would be delettd by PQ- forming a:

delete WP-t I= body1

The two insranccs of the wheel that were called by the cur body are no longer visible. The unicycle, the wheel, and the car body would be deleted by the following:

delete segment [car body]

delete segment [unicycle]

The wheel itself is deleted by:

delete segment lrrbeell

This causes the wheels to disappear from both the car and the unicycle. The segment calls to the wheel in the car body and unicycle become unresolved references and are subquently treated as NOR.

3.14. Associate !3egment with WorLst.tion

The exisling CIS associate segment with workstotion function will associate the segment network that is rooted by the supplied segment identifir with the

dents are associated with the workstation. speafied workstation. All of the segment's descen-

Page 6: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

294 1. E. Sieinhuri / Prvp~saI,/iir CKS Oicrpiir LWQI 3

... ~

’+ element 1 I polyline index red element2 [ polyline (=

3.15. Copy Segment to Workstation The existing CKS copy segment to workrtution func- tion copies the contents of the entire segment net- work which is rooted by the supplied segment identifir to the spadied workstation.

3.16. lwrt segment The existing CKS insert segmenr function inserts the contents of the entire segment network which is rooted by the supplied segment idcntrjkr into either the open segment or the stream of primitives outside of segments. The contents of the segment network are reduced to linear form; all calls are expanded.

3.17. segment Editing

segment to be modified. Modification may be done only on the open segment. A segment which has been closed may be reopened by the reqm segment function.

A segment consists of a numbered, linear sequence of elements. The cafl segment function is treated as an element. Editing operations are per- formed relative to a current element number that wrists for the open segment. The current element number is set to the number of the last ekment in the segment when the segment is reopened or created. This number is incremented as new ele- ments are entered into the segment.

A segment containing two elements is shown

CKS Output l d 3 d O W S the COlltUIts Of the open

in the following figure. The + indicates the cwrent element number. MI + element2 polyline (= body)

The current element number may be obtained using the inquire element number func- tion. A number obtained in this fashion may be used for subsequent operations. Care must be exercised, as the insertion and deletion of elements may invalidate previously inquired numbers. In particular, the elements are always renumbered (if ncctssBIy) after insertion or deletion to prevent overlap or to close gaps.

The current element number may be set to a value by the set element nwnbcr function. The current element number may be moved by using integer arithmetic on the element number before passing it to the set function. The following figure shows the result of either a:

set dement number [I]

which sets the current element number to that of first element, or

set element number [inquire dement number 1 - 11

which sets the cwent element n u d e r to the preceding element.

I header I

If the current element number is set to a greater value than the number of the last ekment. it defaults to the number of the last element in the segment. If the current dement number is set to a value less than 0, it defaults to 0. Element number 0 has special meaning. It is not possible to have a real element number 0. In orda to insert data before element number 1, one would insert data after element number 0.

ment between the current element and the follow- ing element. The next figure shows the result of a:

New e l ~ m ~ n t s are k t e d into the OF SCg-

set 151 being issued on the above segment.

Elements may be deleted from the open seg- ment with the &&te elemenrs function. This func- tion takes two element numbers as arguments. All elements between and including the arguments are deleted. A single element may be deleted by pass- ing two identical numbers. If the current element number is set to one of the deleted elements, it is set to the element immediately preceding the first element deleted. The following shows the result of performing a:

delete dements [ 1,2]

on our sample segment:

header + element 1 I polyline I (carbody)

Two of the entries in the workstation description table for @namic mdfiarion of seg- ment attributes have been given additional meaning

Page 7: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

295

+ element3

element 4 element 5 element6

in order to support the editing functions. The entry for odding primitives to open segment overlap- ping segment of higher priority applies to any addi- tion of elements to such a segment. The entry for delete segment applies to the deletion of elements from a segment.

callsegment wheel, transformation, visible, normal, detectable

label front right wheel label rear left wheel label rear right wheel

3.18 Labels CYS output level 3 introduces a new type of ele- ment called a lubel. A label allows segment ele- ments to be referenced symbolically. Labels must be unique within a segment. The inquire element number from label function provides the element number of a label element. Labels may be used as placeholders to allow information to be edited in later. Let's add a few to our sample segment.

set label [front left wheel)

set label [fiont right wheel]

set I a M [rear left wheel]

set label [rear right wheel]

would yield:

1 header I element 1 I polyline I (car body) element 2 I label 1 front left wheel

I dement 3 I label I front right Wheel I I element 4 I label I rear left wheel I I+ element 5 I label I rearrightwheel I

Now we could fill in one of the wheel definitions as follows:

set element number [inquire element number from [front left WIW~I]]

dl segment Inheel, transformation, VISIBLE, NORMAL, DEl'EtXMLE]

This would yield:

I header I .~.

element 1 I poIyhe I (carbody) element 2 I label I front left wheel

3.19. Element Content Inquiries Two functions are provided to allow the interroga- tion of elements. Ger elemenr type returns the type and size of the current element.

The element data may be retrieved using the interpret element function, which returns the ele- ment contents in a data record so that it is possi- ble to reconstruct the equivalent GXS function call that created the on@ element.

3.20. Private Data The user can write private non displayed data into a segment using the write irem function. Private data wil l be ignored at traversal time.

Private data lets the application develop an efficient relationship between displayed informa- tion and a database. For instance, the car designer from our ongoing example may wish to include information regarding the allowable tire sizes in the definition of the wheel.

3.21. Input

The request pick, sample pick, and get pick func- tions return the segment i&nrtfir of the root of the picked segment network along with the pick idenrijier of the terminal nodd. The inquire pick path function will return a list of segment identijiers andpick &nt$ers for all segments from the root to the picked segment.

4. Function Summary

4.1. Call segment(intifier, transformation, visibil- ity, highlighting, detectability) A call to the named segment is inserted into the open segment if the operating state is SCOP. The named segment is travmed if the operating state is

During traversal, the attributes listed in Appendix A are saved, then the named segment is executed. The saved attributes are restored when the called segment returns. The transformation, visibility, highltghting, and detectability parameters are combined with the values in the current environment to yield the values that are used for the instance of the segment. Call segment is ignored during traversal if the called segment does not exist. Calls that would result in recursion are

WSAC.

This is somewhat arbitrary. It is based w the as- sumption that applications may convert to GKS out- put kvel 3 by changhg insert segtnrnt functions to call segment functions.

Page 8: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

2% J. E. Sttinhart 1 Propt)sul,br GKS Ourput Level 3

also ignored. In both cases, the call is treated as a NOP.

4.2 Create empty segment(segment identiller)

A new segment, With no creation elements, is created. With the exception that the visibility atui- bute is set to m-, the segment is initialized as if it were created by the create segment function.

43. Delete elements(lnt dement number, second element number) All elements between and including the two num- bered elements are deleted. If the current element number was set at a deleted element it is set to the number of the element immediately proceding the fist element number.

4.4. Ekment type = get dement type0

The current element type is returned. The element type includes the size in bytes of the memory space ncccSSary to interpret the element.

4.5. Number = i m p h element nuher()

The current element number is returned.

4.6. Number = inquire dement number from W(l.bd) The element number of the specified label element is returned.

4.7. Pick path - inquiipickp.th()

The path of the most recently reported pick is returned. The path consists of pairs of the form segment identifir, pick identtfir.

4.8 !k!gment ptk4 = inquire segment paW=@-t k - i k ) A list containing each path to the supplied seg- ment is returned. Each path begins at the root. A segment path consists of the number of segments in the path followed by segment i&nt$er, pick ihntijer pairs.

49. Ekwot data record = interpet element(ekmentnumber) The clement data for the specified element is r e turned. The output data is returned in a format similar to that used to create the element. For ex- ample, the interpretation of a polyline element would yield the number of points and the points.

4.10. Rcopcn segment(segment identik)

The specified segment is reopened for editing. The current element number is set to the last dement in the segment. The operating state is set to stop.

4.11. Set dcnent'numkr(valw) The current element n p h r is set to the supplied value. The number is set to 0 if the supplied value is less. The number is set to the number of the last clement in the segment if the supplied value is greater.

4.12 sctIrbd(labd) A label element is inserted into the open segment.

characters 210 through 7/ 14'. The label string is limited to the Is0 644

4.13. Write mer item(item size, item data record)

The specified user item is inserted in to the open segment and/or the stream of output primitives. This item is ignored during traversal.

' Charactas outside of h i s range may be permitted on I workstation dependent basis. However, the resulting meta&s will be non-standard and have impaired portnbility.

Page 9: Proposal for GKS Output Level 3 Segment Hierarchy and Editing

J. &. Sivinhart / Proposo/$~r GKS Output L.rvel3

6 7 8 9

10 11 12 13 14 15

116 17 18 19 20 21 22 23 24 2s 26 27 28 29 30

291

clipping rectangle detectabilitfl -pe fillareacolourindex fillareaindex fdl area interior style fill area style index highlighting5 linetype linewidth scale factor mxrker size scale factor markertype pattern reference point pattern size polylinc d o u r index polylincinduc polymarker d o u r index polymarker index segment transformation5

text d o u r index text font and precision text index visibility5 text path

tart alignment

Appendix A - Elements, Attributes

23 24 25

6

17

19

patternsize pick identifier polyline polymarker

' character spacing character up vector clipping rectangle

fill area fill area d o u r index fill area index fill area interior style fill area style index generalized drawing primitive label

linewidth scale factor marker size scale factor marker type pattern reference point

-?=I

linetype

26 27 28 29 30

polyline d o u r index polyline index polymarker d o u r index polymarker index text

t The numbers in this table are intended as a reference only. $ Not all escape functions are valid here.

t The numbers in this table are intended as a reference only. 5 These attributes arc computed during traversal. Any attributes set by escape functions may be

pushed and popped.