-+-+-+-+-+-+-+-+ START OF PART 268 -+-+-+-+-+-+-+-+ X Phalfspacelst3 modelclipvolume; X Pclip modelclipindicator; X#endif X`7D ptkstsl; X Xtypedef struct ptkstslstack`20 X`7B X ptkstsl tsl; X struct ptkstslstack *next; X`7D ptkstslstack; X Xtypedef struct ptkstslpos`20 X`7B X Pint stid; X Pint elemid; X struct ptkstslpos *next; X`7D ptkstslpos; X Xtypedef struct ptkstslbox`20 X`7B X Plimit3 box; X struct ptkstslbox *next; X`7D ptkstslbox; X Xstatic ptkstslstack *tslstack = NULL; Xstatic ptkstslpos *tslpos = NULL; Xstatic ptkstslbox *tslbox = NULL; Xstatic ptkstsl tsl; Xstatic Plimit3 boundbox; Xstatic Pint curstid, curelemid; Xstatic Pint firststid, firstelemid; X X/*-------------------------------------------------------------------------- V*/ X Xstatic void stackpos() X/* X** \blurb`7BSaves the name and status of the currently open structure, X** so it can be restored again by 'unstackstruct'.`7D X*/ X`7B X ptkstslpos *positem; X X positem = (ptkstslpos *)malloc(sizeof(ptkstslpos)); X positem->next = tslpos; X tslpos = positem; X positem->stid = curstid; X positem->elemid = curelemid; X`7D /* stackpos */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void unstackpos() X/* X** \blurb`7BRemove the structure from the top of the stack and X** restore the open structure and element pointer.`7D X*/ X`7B X ptkstslpos *positem; X X if (tslpos != NULL) X `7B X curstid = tslpos->stid; X curelemid = tslpos->elemid; X positem = tslpos->next; X free(tslpos); X tslpos = positem; X `7D X`7D /* unstackpos */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void testpoint(C(Ppoint3 *) p, C(Plimit3 *) box) XPreANSI(Ppoint3 *p) XPreANSI(Plimit3 *box) X/* X** \param`7BPpoint3 *`7D`7Bp`7D`7Bpoint.`7D X** \param`7BPlimit3 *`7D`7Bboxptr`7D`7Bbounding box structure`7D X** \blurb`7BTests if point `60p' is outside bounding box and X** if so adjusts bounding box to include it.`7D X*/ X`7B X if (p->x < box->xmin) X box->xmin = p->x; X if (p->y < box->ymin) X box->ymin = p->y; X if (p->z < box->zmin) X box->zmin = p->z; X if (p->x > box->xmax) X box->xmax = p->x; X if (p->y > box->ymax) X box->ymax = p->y; X if (p->z > box->zmax) X box->zmax = p->z; X X`7D X X/*-------------------------------------------------------------------------- V*/ X Xstatic void addnameset(C(Pintlst *) addnames, C(Pintlst *) nameset) XPreANSI(Pintlst *addnames) XPreANSI(Pintlst *nameset) X`7B X Pint i; X X for (i = 0; i < addnames->number; i++) X `7B X if (inintlst(addnames->integers`5Bi`5D, nameset) == -1) X `7B X nameset->integers`5Bnameset->number`5D = addnames->integers`5Bi`5D; X nameset->number++; X `7D X `7D X`7D /* addnameset */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void removenameset(C(Pintlst *) removenames, C(Pintlst *) nameset) XPreANSI(Pintlst *removenames) XPreANSI(Pintlst *nameset) X`7B X Pint i, j, findex; X X for (i = 0; i < removenames->number; i++) X `7B X if ((findex = inintlst(removenames->integers`5Bi`5D, nameset)) != -1) X `7B X for (j = findex; j < nameset->number - 1; j++) X `7B X nameset->integers`5Bj`5D = nameset->integers`5Bj + 1`5D; X `7D X nameset->number--; X `7D X `7D X`7D /* removenameset */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic ptkboolean tsltraverseelement(C(Pint *) execid, C(Plimit3 *) boundbox V) XPreANSI(Pint *execid) XPreANSI(Plimit3 *boundbox) X`7B X Pint i, j, k; X Pmatrix3 compxform; X Pint error; X Pchar *buffer; X ptkselcontent elcont; X ptkboolean result; X Pattrid attrid; X Pasf asf; X Ppoint3 pt; X X result = FALSE; X *execid = 0; X X /* find out type and contents of element */ X ptk_inqcurelemtypesizecontent(&error, &buffer, &elcont); X if (error == 0)`20 X `7B X /* not all cases have been implemented yet */ X switch (elcont.eltype)`20 X `7B X X case PEL_POLYLINE3: X case PEL_POLYMARKER3: X case PEL_FILL_AREA3: X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X#ifdef VMS X`09for (j = 0; j < elcont.size; j++)`20 X `7B X pt = ptk_transform3(compxform, &elcont.eldata.pts3`5Bj`5D); X`09 testpoint(&pt, boundbox); X`09`7D X#endif X#ifdef SUN X for (j = 0; j < elcont.eldata.pts3.number; j++)`20 X `7B X pt = ptk_transform3(compxform, &elcont.eldata.pts3.points`5Bj`5D); X`09 testpoint(&pt, boundbox); X`09`7D X#endif X`09break; X X case PEL_POLYLINE: X case PEL_POLYMARKER: X case PEL_FILL_AREA: X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X#ifdef VMS X`09for (j = 0; j < elcont.size; j++)`20 X `7B X pt = ptk_point3(elcont.eldata.pts`5Bj`5D.x, elcont.eldata.pts`5Bj` V5D.y,`20 X 0.0); X pt = ptk_transform3(compxform, &pt); X`09 testpoint(&pt, boundbox); X`09`7D X#endif X#ifdef SUN X for (j = 0; j < elcont.eldata.pts.number; j++)`20 X `7B X pt = ptk_point3(elcont.eldata.pts.points`5Bj`5D.x,`20 X elcont.eldata.pts.points`5Bj`5D.y, 0.0); X pt = ptk_transform3(compxform, &pt); X`09 testpoint(&pt, boundbox); X`09`7D X#endif X`09break; X X case PEL_TEXT3: /* do nothing */ X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X /* inquire text extent assuming text font 1, stroke precision */ X `7B X Pint err; X Pchar *str; X Prect rect; X Ppoint offset; X Pwstype wstype; X Pmatrix3 charupmat, txdirmat, txmat; X Ppoint3 txpt; X Pfloat angle; X X#ifdef SUN X str = elcont.eldata.text3.str; X wstype = phigs_ws_type_create(phigs_ws_type_sun_tool, 0);`20 X#endif X#ifdef VMS X str = elcont.eldata.text3.string; X wstype = 0; X#endif X ptk_inqtextextent(wstype, 1, tsl.txbundl.exp, tsl.txbundl.space,`2 V0 X tsl.charheight, tsl.textpath, tsl.textalign.hor,`20 X tsl.textalign.ver, str, &err, &rect, &offset); X /* make 2 matrices, one for character up vector X ** and one for text position and direction vectors. X */ X ptk_unitmatrix3(charupmat); X ptk_unitmatrix3(txdirmat); X X /* rotate text extent rectangle about z axis to account for the X ** character up vector. X */ X angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y); X angle *= -180.0/3.1412; X ptk_rotate3(angle, PTKEZAXIS, PREPLACE, charupmat); X X txdirmat`5B0`5D`5B0`5D = elcont.eldata.text3.dir`5B0`5D.x; X txdirmat`5B1`5D`5B0`5D = elcont.eldata.text3.dir`5B0`5D.y; X txdirmat`5B2`5D`5B0`5D = elcont.eldata.text3.dir`5B0`5D.z; X txdirmat`5B0`5D`5B1`5D = elcont.eldata.text3.dir`5B1`5D.x; X txdirmat`5B1`5D`5B1`5D = elcont.eldata.text3.dir`5B1`5D.y; X txdirmat`5B2`5D`5B1`5D = elcont.eldata.text3.dir`5B1`5D.z; X txdirmat`5B0`5D`5B3`5D = elcont.eldata.text3.pt.x; X txdirmat`5B1`5D`5B3`5D = elcont.eldata.text3.pt.y; X txdirmat`5B2`5D`5B3`5D = elcont.eldata.text3.pt.z; X `20 X ptk_concatenatematrix3(PPOSTCONCATENATE, txdirmat, charupmat,`20 X txmat); X txpt = ptk_point3(rect.ll.x, rect.ll.y, 0.0); X txpt = ptk_transform3(txmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ur.y, 0.0); X txpt = ptk_transform3(txmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&pt, boundbox); X txpt = ptk_point3(rect.ll.x, rect.ur.y, 0.0); X txpt = ptk_transform3(txmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&pt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ll.y, 0.0); X txpt = ptk_transform3(txmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&pt, boundbox); X `7D `20 X`09break; X X case PEL_TEXT: /* do nothing */ X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X /* inquire text extent assuming text font 1, stroke precision */ X `7B X Pint err; X Pchar *str; X Prect rect; X Ppoint offset; X Pwstype wstype; X Pmatrix3 charupmat; X Ppoint3 txpt; X Pfloat angle; X X#ifdef SUN X str = elcont.eldata.tx.str; X wstype = phigs_ws_type_create(phigs_ws_type_sun_tool, 0);`20 X#endif X#ifdef VMS X str = elcont.eldata.text.string; X wstype = 0; X#endif X ptk_inqtextextent(wstype, 1, tsl.txbundl.exp, tsl.txbundl.space,`2 V0 X tsl.charheight, tsl.textpath, tsl.textalign.hor,`20 X tsl.textalign.ver, str, &err, &rect, &offset); X /* make 1 matrix for character up vector X ** and text position. X */ X ptk_unitmatrix3(charupmat); X angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y); X angle *= -180.0/3.1412; X ptk_rotate3(angle, PTKEZAXIS, PREPLACE, charupmat); X X#ifdef SUN X charupmat`5B0`5D`5B3`5D = elcont.eldata.tx.pt.x; X charupmat`5B1`5D`5B3`5D = elcont.eldata.tx.pt.y; X#endif X#ifdef VMS X charupmat`5B0`5D`5B3`5D = elcont.eldata.text.pt.x; X charupmat`5B1`5D`5B3`5D = elcont.eldata.text.pt.y; X#endif X charupmat`5B2`5D`5B3`5D = 0.0; X `20 X txpt = ptk_point3(rect.ll.x, rect.ll.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ur.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ll.x, rect.ur.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ll.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X `7D `20 X`09break; X X case PEL_ANNOTATION_TEXT_RELATIVE3: X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X /* inquire text extent assuming text font 1, stroke precision */ X `7B X Pint err; X Pchar *str; X Prect rect; X Ppoint offset; X Pwstype wstype; X Pmatrix3 charupmat; X Ppoint3 txpt; X Pfloat angle; X X#ifdef SUN X str = elcont.eldata.atx3.str; X wstype = phigs_ws_type_create(phigs_ws_type_sun_tool, 0);`20 X#endif X#ifdef VMS X str = elcont.eldata.atext3.string; X wstype = 0; X#endif X ptk_inqtextextent(wstype, 1, tsl.txbundl.exp, tsl.txbundl.space,`2 V0 X tsl.annocharheight, tsl.annotextpath,`20 X tsl.annotextalign.hor, tsl.annotextalign.ver, X str, &err, &rect, &offset); X /* make 2 matrices, one for character up vector X ** and text position, and one for direction vectors. X */ X ptk_unitmatrix3(charupmat); X angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y); X angle *= -180.0/3.1412; X ptk_rotate3(angle, PTKEZAXIS, PREPLACE, charupmat); X X /* lead line - annotation style, include ref_pt */ X#ifdef SUN X charupmat`5B0`5D`5B3`5D = elcont.eldata.atx3.ref_pt.x +`20 X elcont.eldata.atx3.anno.x; X charupmat`5B1`5D`5B3`5D = elcont.eldata.atx3.ref_pt.y +`20 X elcont.eldata.atx3.anno.y; X charupmat`5B2`5D`5B3`5D = elcont.eldata.atx3.ref_pt.z +`20 X elcont.eldata.atx3.anno.z; X#endif X#ifdef VMS X charupmat`5B0`5D`5B3`5D = elcont.eldata.atext3.ref_pt.x +`20 X elcont.eldata.atext3.anno.x; X charupmat`5B1`5D`5B3`5D = elcont.eldata.atext3.ref_pt.y +`20 X elcont.eldata.atext3.anno.y; X charupmat`5B2`5D`5B3`5D = elcont.eldata.atext3.ref_pt.z +`20 X elcont.eldata.atext3.anno.z; X#endif `20 X txpt = ptk_point3(rect.ll.x, rect.ll.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ur.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ll.x, rect.ur.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt),`20 X testpoint(&txpt, boundbox); X txpt = ptk_point3(rect.ur.x, rect.ll.y, 0.0); X txpt = ptk_transform3(charupmat, &txpt); X txpt = ptk_transform3(compxform, &txpt); X testpoint(&txpt, boundbox); X `7D `20 X`09break; X X case PEL_ANNOTATION_TEXT_RELATIVE: /* do nothing */ X`09ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform); X /* inquire text extent assuming text font 1, stroke precision */ X `7B X Pint err; X Pchar *str; X Prect rect; X Ppoint offset; X Pwstype wstype; X Pmatrix3 charupmat; X Ppoint3 txpt; X Pfloat angle; X X#ifdef SUN X str = elcont.eldata.atx.str; X wstype = phigs_ws_type_create(phigs_ws_type_sun_tool, 0);`20 X#endif X#ifdef VMS X str = elcont.eldata.atext.string; X wstype = 0; X#endif X ptk_inqtextextent(wstype, 1, tsl.txbundl.exp, tsl.txbundl.space,`2 V0 X tsl.annocharheight, tsl.annotextpath,`20 X tsl.annotextalign.hor, tsl.annotextalign.ver, +-+-+-+-+-+-+-+- END OF PART 268 +-+-+-+-+-+-+-+-