-+-+-+-+-+-+-+-+ START OF PART 270 -+-+-+-+-+-+-+-+ X tsl.interattr.style = asf; X break; X X case PINTERIOR_COLOUR_INDEX: X tsl.interattr.colour = asf; X break; X X case PEDGE_FLAG: X tsl.edgeattr.flag = asf; X break; X X case PEDGETYPE: X tsl.edgetypeasf = asf; X break; X X case PEDGEWIDTH_SCALE_FACTOR: X tsl.edgeattr.width = asf; X break; X X case PEDGE_COLOUR_INDEX: X tsl.edgeattr.colour = asf; X break; X `7D X break; X X case PEL_HLHSR_IDENTIFIER: X tsl.hlhsrid = elcont.eldata.idata; X break; X X case PEL_MODELLING_CLIPPING_VOLUME3: X break; X X case PEL_MODELLING_CLIPPING_VOLUME: X break; X X case PEL_MODELLING_CLIPPING_INDICATOR: X break; X X case PEL_RESTORE_MODELLING_CLIPPING_VOLUME: X break; X X case PEL_VIEW_INDEX: X tsl.viewindex = elcont.eldata.idata; X break; X X case PEL_GSE: X break; X X case PEL_PICK_ID: X tsl.pickid = elcont.eldata.idata; X break; X X default: X break;`20 X X `7D/* of case */ X `7D X X free(buffer); X return result; X`7D /* tsltraverseelement */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void tsltraversepath(C(Pint *) sno, C(Pint) structid,`20 X C(Pexecreflst *) reflst) XPreANSI(Pint *sno) XPreANSI(Pint structid) XPreANSI(Pexecreflst *reflst) X/* X** input params: X** output params: X** return value: X*/ X`7B X Pint i, numelts, execid, err; X ptkboolean finished; X X finished = FALSE; X ptk_unitmatrix3(tsl.localtran); X numelts = ptk_elemcount(structid); X X i = 1; X do`20 X `7B X psetelemptr(i); X if ((*sno == reflst->number) &&`20 X (reflst->ers`5Breflst->number-1`5D.elem_num == i-1)) X finished = TRUE; X else X if (tsltraverseelement(&execid, &boundbox)) X `7B X if (((*sno < reflst->number) &&`20 X (reflst->ers`5B*sno - 1`5D.elem_num == i) && X (reflst->ers`5B*sno - 1`5D.struct_id == structid)) `7C`7C X ((*sno >= reflst->number) &&`20 X (reflst->ers`5Breflst->number - 1`5D.elem_num < 0))) `20 X `7B X ptk_stacktsl(); X ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, tsl.globaltran); X ptk_openstruct(execid); X (*sno)++; X tsltraversepath(sno, execid, reflst); X ptk_closestruct(); X ptk_unstacktsl(); X pinqelemptr(&err, &i); X `7D X else X if (i < reflst->ers`5B*sno - 1`5D.elem_num) X `7B X ptk_tsltraverserange(execid, 1, execid, -1, TRUE); X `7D X `7D X i++; X `7D while ((i <= numelts) && (!finished)); X`7D /* tsltraversepath */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void tsltraverserange(C(Pint) startstid, C(Pint) startelemid, X C(Pint) stopstid, C(Pint) stopelemid,`20 X C(ptkboolean) descend) XPreANSI(Pint startstid) XPreANSI(Pint startelemid) XPreANSI(Pint stopstid) XPreANSI(Pint stopelemid) XPreANSI(ptkboolean descend) X/* X** input params: X** output params: X** return value: X*/ X`7B X Pint i, numelts, execid, err; X ptkboolean finished; X X finished = FALSE; X ptk_unitmatrix3(tsl.localtran); X numelts = ptk_elemcount(startstid); X X i = startelemid; X do`20 X `7B X psetelemptr(i); X if ((startstid == stopstid) && (i == stopelemid)) X finished = TRUE; X if (tsltraverseelement(&execid, &boundbox) && descend) X `7B X ptk_stacktsl(); X ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, tsl.globaltran); X ptk_openstruct(execid); X tsltraverserange(execid, 1, stopstid, stopelemid, descend); X ptk_closestruct(); X ptk_unstacktsl(); X pinqelemptr(&err, &i); X `7D X i++; X `7D while ((i <= numelts) && (!finished)); X`7D /* tsltraverserange */ X X/*-------------------------------------------------------------------------* V/ X X/*function:external*/ Xextern void ptk_stackbbox(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function puts the current bounding box value on the X** TSL bounding box stack.`7D X*/ X`7B X ptkstslbox *boxitem; X X boxitem = (ptkstslbox *)malloc(sizeof(ptkstslbox)); X boxitem->next = tslbox; X tslbox = boxitem; X boxitem->box = boundbox; X`7D /* ptk_stackbbox */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_unstackbbox(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function gets the topmost bounding box value from the`20 X** TSL bounding box stack.`7D X*/ X`7B X ptkstslbox *boxitem; X X if (tslbox != NULL) X `7B X boundbox = tslbox->box; X boxitem = tslbox->next; X free(tslbox); X tslbox = boxitem; X `7D X`7D /* ptk_unstackbbox */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_stacktsl(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function puts the current TSL value on the TSL stack.`7D X*/ X`7B X ptkstslstack *stackitem; X X stackitem = (ptkstslstack *)malloc(sizeof(ptkstslstack)); X stackitem->next = tslstack; X tslstack = stackitem; X stackitem->tsl = tsl; X`7D /* ptk_stacktsl */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_unstacktsl(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function gets the topmost TSL value from the TSL stack.`7D X*/ X`7B X ptkstslstack *stackitem; X X if (tslstack != NULL) X `7B X tsl = tslstack->tsl; X stackitem = tslstack->next; X free(tslstack); X tslstack = stackitem; X `7D X`7D /* ptk_unstacktsl */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_boundingbox(C(Pint) structid, C(Plimit3 *) wcbounds,`2 V0 X C(ptkboolean) descend) XPreANSI(Pint structid) XPreANSI(Plimit3 *wcbounds) XPreANSI(ptkboolean descend) X/* X** \parambegin X** \param`7BPint`7D`7Bstructid`7D`7Bstructure network identifier`7D`7BIN`7D X** \param`7BPlimit3 *`7D`7Bwcbounds`7D`7Bbounding box in world coordinates`7 VD`7BOUT`7D X** \param`7Bptkboolean`7D`7Bdescend`7D`7Bflag to indicate traversal`7D`7BIN` V7D X** \paramend X** \blurb`7BThis function evaluates the bounding box for a structure or X** structure network. If `7B\tt descend`7D`20 X** is set to TRUE then the bounding box for the complete structure X** network is returned, otherwise just for a single structure. X** The function returns TRUE if the resulting bounding box is valid,`20 X** otherwise FALSE. A structure with no output primitives returns an X** invalid bounding box.`7D X*/ X`7B X ptk_stacktsl(); `20 X ptk_stackbbox(); X ptk_inittsl(); X ptk_openstruct(structid); X tsltraverserange(structid, 1, structid, -1, descend); X *wcbounds = boundbox; X ptk_closestruct(); X ptk_unstackbbox(); X ptk_unstacktsl(); X X if (wcbounds->xmin == 1000.0) X `7B X *wcbounds = ptk_limit3(0.0, 1.0, 0.0, 1.0, 0.0, 1.0); X return FALSE; X `7D X else X return TRUE; X`7D /* ptk_boundingbox */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inittsl(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function initialises the current TSL values to the X** default values from the PHIGS description table. X** The default ASF value for each attribute is assumed to be INDIVIDUAL.`7D X*/ X`7B X /* polyline */ X tsl.lnattr.index = 1; X tsl.lnattr.bundl.type = 1; X tsl.lnattr.bundl.width = 1.0; X tsl.lnattr.bundl.colour = 1; X tsl.lnattr.type = PINDIVIDUAL; X tsl.lnattr.width = PINDIVIDUAL; X tsl.lnattr.colour = PINDIVIDUAL; X /* marker */ X tsl.mkattr.index = 1; X tsl.mkattr.bundl.type = 3; X tsl.mkattr.bundl.size = 1.0; X tsl.mkattr.bundl.colour = 1; X tsl.mkattr.type = PINDIVIDUAL; X#ifdef SUN X tsl.mkattr.style = PINDIVIDUAL; X#endif X#ifdef VMS X tsl.mkattr.size = PINDIVIDUAL; X#endif X tsl.mkattr.colour = PINDIVIDUAL; X /* interior */ X tsl.interattr.index = 1; X tsl.interattr.bundl.style = PHOLLOW; X tsl.interattr.bundl.index = 1; X tsl.interattr.bundl.colour = 1; X tsl.interattr.interior = PINDIVIDUAL; X tsl.interattr.style = PINDIVIDUAL; X tsl.interattr.colour = PINDIVIDUAL; X /* edge */ X tsl.edgeattr.index = 1; X tsl.edgeattr.bundl.flag = PEDGE_OFF; X tsl.edgeattr.bundl.type = 1; X tsl.edgeattr.bundl.scale = 1.0; X tsl.edgeattr.bundl.colour = 1; X tsl.edgeattr.flag = PINDIVIDUAL; X tsl.edgeattr.width = PINDIVIDUAL; X tsl.edgeattr.colour = PINDIVIDUAL; X tsl.edgetypeasf = PINDIVIDUAL; X /* text */ X tsl.txbundl.font = 1; X tsl.txbundl.precision = PPSTRING; X tsl.txbundl.exp = 1.0; X tsl.txbundl.space = 0.0; X tsl.txbundl.colour = 1; X tsl.textindex = 1; X tsl.textfontasf = PINDIVIDUAL; X tsl.textprecasf = PINDIVIDUAL; X tsl.charexpanasf = PINDIVIDUAL; X tsl.charspaceasf = PINDIVIDUAL; X tsl.textcolourasf = PINDIVIDUAL; X tsl.charheight = 0.01; X tsl.charup= ptk_point(0.0, 1.0); X tsl.textpath = PTP_RIGHT; X tsl.textalign.hor = PAH_NORMAL; X tsl.textalign.ver = PAV_NORMAL; X tsl.annocharheight = 0.01; X tsl.annocharup = ptk_point(0.0, 1.0); X tsl.annotextpath = PTP_RIGHT; X tsl.annotextalign.hor = PAH_NORMAL; X tsl.annotextalign.ver = PAV_NORMAL; X tsl.annostyle = 1; X /* pattern */ X tsl.patsize = ptk_point(1.0, 1.0); X tsl.patrefpt = ptk_point3(0.0, 0.0, 0.0); X tsl.patvec`5B0`5D = ptk_point3(1.0, 0.0, 0.0); X tsl.patvec`5B1`5D = ptk_point3(0.0, 1.0, 0.0); X /* pick identifier */ X tsl.pickid = 0; X /* view index */ X tsl.viewindex = 0; X /* HLHSR identifier */ X tsl.hlhsrid = 0; X /* name set */ X tsl.nameset.number = 0; X tsl.nameset.integers = tsl.names; X /* global modelling transformation */ X ptk_unitmatrix3(tsl.globaltran); X /* local modelling transformation */ X ptk_unitmatrix3(tsl.localtran); X /* modelling clip */ X#ifdef SUN X tsl.modelclipoperator = PMC_REPLACE; X tsl.modelclipvolume.number = 0; X tsl.modelclipindicator = PNOCLIP; X#endif `20 X boundbox = ptk_limit3(1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0); X`7D /* ptk_inittsl */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_initbbox(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function initialises the current TSL bounding box value X** to be (1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0). This enables X** the real bounding box to be set when an output primitive is reached.`7D X*/ X`7B X boundbox = ptk_limit3(1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0); X`7D /* ptk_initbbox */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_tsltraversepath(C(Pexecreflst *) reflst) XPreANSI(Pexecreflst *reflst) X/* X** \parambegin X** \param`7BPexecreflst *`7D`7Breflst`7D`7Bstructure-element path`7D`7BIN`7D X** \paramend X** \blurb`7BThis function makes TSL traverse a structure path X** and updates the current TSL values appropriately.`7D X*/ X`7B X Pint stid, sno; X Plimit3 bbox; X X ptk_stacktsl(); X stid = reflst->ers`5B0`5D.struct_id; X ptk_openstruct(stid); X sno = 1; X tsltraversepath(&sno, stid, reflst); X ptk_closestruct(); X`7D /* ptk_tsltraversepath */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_tsltraverserange(C(Pint) startstid, C(Pint) startelemid, X C(Pint) stopstid, C(Pint) stopelemid, C(ptkboolean) des Vcend) XPreANSI(Pint startstid) XPreANSI(Pint startelemid) XPreANSI(Pint stopstid) XPreANSI(Pint stopelemid) XPreANSI(ptkboolean descend) X/* X** \parambegin X** \param`7BPint`7D`7Bstartstid`7D`7Bstart structure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bstartelemid`7D`7Bstart element number`7D`7BIN`7D X** \param`7BPint`7D`7Bstopstid`7D`7Bstop structure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bstopelemid`7D`7Bstop element number`7D`7BIN`7D X** \param`7Bptkboolean`7D`7Bdescend`7D`7Bflag to indicate traversal`7D`7BIN` V7D X** \paramend X** \blurb`7BThis function makes TSL traverse between two points in a structu Vre X** network. If `7B\tt descend`7D is set to TRUE then any X** EXECUTE STRUCTURE elements which occur between the two points X** are followed, otherwise they are ignored.`7D X*/ X`7B X ptk_openstruct(startstid); X tsltraverserange(startstid, startelemid, stopstid, stopelemid, descend); X ptk_closestruct(); X`7D /* ptk_tsltraverserange */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_settslstart(C(Pint) startstid, C(Pint) startelemid) XPreANSI(Pint startstid) XPreANSI(Pint startelemid) X/* X** \parambegin X** \param`7BPint`7D`7Bstartstid`7D`7Bstart structure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bstartelemid`7D`7Bstart element number`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the TSL traversal to start at a certain point X** in a structure network. This structure is referred to as the TSL structur Ve X** network.`7D X*/ X`7B X ptk_inittsl(); X curstid = firststid = startstid; X curelemid = firstelemid = startelemid; X`7D /* ptk_settslstart */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_tsltraversenext(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function makes TSL traverse the next element in the current X** TSL structure network. If it is an EXECUTE STRUCTURE element X** TSL will follow the execute path.`7D X*/ X`7B X Pint i, numelts, execid, err; X X numelts = ptk_elemcount(curstid); X if (curelemid > numelts) X `7B X if (curstid == firststid) X `7B X ptk_inittsl(); X curelemid = firstelemid; X `7D X else X `7B X do X `7B +-+-+-+-+-+-+-+- END OF PART 270 +-+-+-+-+-+-+-+-