-+-+-+-+-+-+-+-+ START OF PART 259 -+-+-+-+-+-+-+-+ X** \param`7BPint`7D`7Bhtedgecol`7D`7Bhighlight edge colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bhtintcol`7D`7Bhighlight interior colour index`7D`7BIN` V7D X** \paramend X** \blurb`7BThis function sets the text font and colour attribute values`20 X** of a topology diagram. The text font applies to the structure X** names which are extracted from the \"structureid\" hashtable. X** The highlight colour indicies are used to highlight a single X** topology node in the function `7B\tt ptk\_settopologyhighlightnode`7D.`7D X*/ X`7B X settop(topid); X if (topptr != NULL) X `7B `20 X topptr->txfont = txfont; X topptr->textcolour = textcol; X topptr->linecolour = linecol; X topptr->edgecolour = edgecol; X topptr->intcolour = intcol; X topptr->highlightedge = htedgecol; X topptr->highlightint = htintcol; X redrawtopology(); X `7D X`7D /* ptk_settopologyattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologyattrs(C(Pint) topid, C(Pint *) txfont, X C(Pint *) linecol, C(Pint *) textcol, C(Pint *) edgecol, X C(Pint *) intcol, C(Pint *) htedgecol, C(Pint *) htintcol, X C(Pint *) err) XPreANSI(Pint topid) XPreANSI(Pint *txfont) XPreANSI(Pint *linecol) XPreANSI(Pint *textcol) XPreANSI(Pint *edgecol) XPreANSI(Pint *intcol) XPreANSI(Pint *htedgecol) XPreANSI(Pint *htintcol) XPreANSI(Pint *err) X/*`20 X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Btxfont`7D`7Blabel text font`7D`7BOUT`7D X** \param`7BPint *`7D`7Blinecol`7D`7Bpolyline colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Btextcol`7D`7Btext colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bedgecol`7D`7Bedge colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bintcol`7D`7Binterior colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bhtedgecol`7D`7Bhighlight edge colour index`7D`7BOUT` V7D X** \param`7BPint *`7D`7Bhtintcol`7D`7Bhighlight interior colour index`7D`7BO VUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the text font and X** colour attribute values of a topology diagram. The error code = 1 X** if `7B\tt topid`7D doesn't exist.`7D X*/ X`7B X *err = 0; X settop(topid); X if (topptr != NULL) X `7B `20 X *txfont = topptr->txfont; X *textcol = topptr->textcolour; X *linecol = topptr->linecolour; X *edgecol = topptr->edgecolour; X *intcol = topptr->intcolour; X *htedgecol = topptr->highlightedge; X *htintcol = topptr->highlightint; X redrawtopology(); X `7D X else X *err = 1; X`7D /* ptk_inqtopologyattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_createtopologypaths(C(Pint) topid, C(Pexecreflstlst *) paths V,`20 X C(Pint *) error) XPreANSI(Pint topid) XPreANSI(Pexecreflstlst *paths) XPreANSI(Pint *error) X/*`20 X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPexecreflstlst *`7D`7Bpaths`7D`7Bstructure-element paths`7D`7BIN V`7D X** \param`7BPint *`7D`7Berror`7D`7Berror code`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function creates a topology diagram using the structure X** path list `7B\tt paths`7D. This enables a topology diagram to be built X** of a non-existent structure network or of a subset of an actual X** structure network. The error code = 1 if `7B\tt topid`7D already exists. X** This function requires hashtables "structureid", "label", "name".`7D`20 X*/ X`7B X Pint curname; X Pchar stname`5B255`5D; X Pintlst nameset; X Pint name; X X *error = 0; X settop(topid); X if (topptr == NULL) X `7B X if (lasttop == NULL) X `7B X firsttop = lasttop = topptr = X (ptkstopdraw *)malloc(sizeof(ptkstopdraw)); X topptr->next = NULL; X `7D X else X `7B X lasttop->next = topptr = (ptkstopdraw *)malloc(sizeof(ptkstopdraw)); X topptr->next = NULL; X lasttop = lasttop->next; X `7D X X topologycount++; `20 X topptr->topologyid = topid; X topptr->posted.number = 0; X topptr->posted.integers = (Pint *)calloc(10, sizeof(Pint)); X sprintf(stname, "struct$topology%d", topid); X topptr->topologystid = ptk_stringtoint("structureid", stname); X sprintf(stname, "name$topology%d", topid); X topptr->topologyname = ptk_stringtoint("name", stname); X topptr->topologytype = PTKEBOXTOPOLOGY; X topptr->txfont = 1; X topptr->textcolour = 1; X topptr->linecolour = 1; X topptr->edgecolour = 1; X topptr->intcolour = 0; X topptr->highlightnode = -1; X topptr->highlightedge = 0; X topptr->highlightint = 1; X `20 X if (paths->number > 0) X `7B X topptr->root = paths->erls`5B0`5D.ers`5B0`5D.struct_id; X `20 X ptk_openstruct(topptr->topologystid); `20 X initialise(); X topptr->pathlist = *paths; X buildlists(); X `20 X ptk_seteditmode(PEDIT_INSERT); /* We want to insert elements */ X nameset.integers = &name; X nameset.number = 1; X name = topptr->topologyname; X paddnameset(&nameset); `20 X plabel(ptk_stringtoint("label", "globaltran")); X X plabel(ptk_stringtoint("label", "highlightattrs")); X psetedgecolourind(topptr->highlightedge); X psetintcolourind(topptr->highlightint); `20 X psetintstyle(PSOLID); X psetedgeflag(PEDGE_ON); X plabel(ptk_stringtoint("label", "highlightnode")); X plabel(ptk_stringtoint("label", "attrs")); X psetlinecolourind(topptr->linecolour); X psetintcolourind(topptr->intcolour); X psetedgecolourind(topptr->edgecolour); X psettextfont(topptr->txfont); X psettextcolourind(topptr->textcolour); X plabel(ptk_stringtoint("label", "starttopology")); X `20 X placenodes(); X drawnodes(); X premovenameset(&nameset); X drawconnections(); X drawnames(); X `20 X /* In case any nodes were labelled with keys because there was no room X for proper annotation, draw the keytable. */ X drawkeys(); X plabel(ptk_stringtoint("label", "endtopology")); X X /* now we've drawn it all, so we find the appropriate scale to put it V all X in `5B0,1`5D */ X setscaling(); X `20 X ptk_unseteditmode(); X ptk_closestruct(); X `7D X `7D X else X *error = 1; X`7D /* ptk_createtopologypaths */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_settopologytype(C(Pint) topid, C(ptketopologytype) toptype) XPreANSI(Pint topid) XPreANSI(ptketopologytype toptype) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7Bptketopologytype`7D`7Btoptype`7D`7Btopology type`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the type of a topology diagram to`20 X** BOX, STRUCT or STRUCTNET. The BOX topology type is the default and X** the STRUCT and STRUCTNET types insert parts of the actual structures X** into the nodes. As a result these topology types do not work well X** for networks containing SET VIEW INDEX and SET GLOBAL TRANSFORMATION X** elements.`7D X*/ X`7B X settop(topid); X if (topptr != NULL) X `7B X if (topptr->topologytype != toptype) X `7B X if (topptr->topologytype == PTKESTRUCTTOPOLOGY) X delstructnodes(); X topptr->topologytype = toptype; X redrawtopology(); X `7D X `7D X`7D /* ptk_settopologytype */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologytype(C(Pint) topid, C(ptketopologytype *) toptype V, X C(Pint *) err) XPreANSI(Pint topid) XPreANSI(ptketopologytype *toptype) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7Bptketopologytype *`7D`7Btoptype`7D`7Btopology type`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the type of a topology X** diagram. The possible types are BOX, STRUCT and STRUCTNET, with BOX X** as the default. The error code = 1 if `7B\tt topid`7D doesn't exist.`7D X*/ X`7B X *err = 0; X settop(topid); X if (topptr != NULL) X `7B X *toptype = topptr->topologytype; X `7D X else X *err = 1; X`7D /* ptk_inqtopologytype */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setnodeposition(C(Pint) topid, C(Pint) structid,`20 X C(Ppoint *) nodept, C(ptkenodetype) nodetype) XPreANSI(Pint topid) XPreANSI(Pint structid) XPreANSI(Ppoint *nodept) XPreANSI(ptkenodetype nodetype) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bstructid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bnodept`7D`7Bnode position`7D`7BIN`7D X** \param`7Bptkenodetype`7D`7Bnodetype`7D`7Btype of node`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the position of a topology node or group X** of nodes. The position is given in the range `5B0, 1`5D. X** The node is specified using the structure identifier of the structure X** that it represents. If nodetype is set to GROUP then all descendent X** nodes of `7B\tt structid`7D are moved relative to it.`7D X*/ X`7B X ptksstruct *structptr; X Pint nodeid; X ptkboolean found; X X nodeid = 0; X settop(topid); X if (topptr != NULL) X `7B X structptr = topptr->structlist; X found = FALSE; X while ((!found) && (structptr != NULL)) X `7B X if (structptr->name == structid) X found = TRUE; X else X nodeid++; X structptr = structptr->next; X `7D X if (found) X setnodeposition(topid, nodeid, nodept, nodetype); X `7D X`7D /* ptk_setnodeposition */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqnodeposition(C(Pint) topid, C(Pint) structid,`20 X C(Ppoint *) nodept, C(Pint *) err) XPreANSI(Pint topid) XPreANSI(Pint structid) XPreANSI(Ppoint *nodept) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bstructid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bnodept`7D`7Bnode position`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the position of a topology`2 V0 X** node in a topology diagram. The position is returned in the range `5B0, 1 V`5D.`20 X** The node is specified using the structure X** identifier of the structure that it represents. The error code = 1 X** if `7B\tt topid`7D doesn't exist and = 2 if `7B\tt structid`7D is not a n Vode X** in the topology.`7D X*/ X`7B X ptksstruct *structptr; X Pint nodeid; X Ppoint3 nodept3; X ptkboolean found; X X *err = 0; X nodeid = 0; X settop(topid); X if (topptr != NULL) X `7B X structptr = topptr->structlist; X found = FALSE; X while ((!found) && (structptr != NULL)) X `7B X if (structptr->name == structid) X found = TRUE; X else X nodeid++; X structptr = structptr->next; X `7D X if (found) X `7B X nodept3 = ptk_point3(structptr->pos.x, structptr->pos.y, 0.0); X nodept3 = ptk_transform3(topptr->globaltran, &nodept3); X *nodept = ptk_point(nodept3.x, nodept3.y); X `7D X else X *err = 2; X `7D X else X *err = 1; X`7D /* ptk_inqnodeposition */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_tidytopology(C(Pint) wsid, C(Pint) topid,`20 X C(ptkenodetype) nodetype, X C(Pint) pickdev, C(Pint) pickpet, C(Ppickrec *) pickdatarec, X C(Pint) locdev, C(Pint) locpet, C(Plocrec *) locdatarec) XPreANSI(Pint wsid) XPreANSI(Pint topid) XPreANSI(ptkenodetype nodetype) XPreANSI(Pint pickdev) XPreANSI(Pint pickpet) XPreANSI(Ppickrec *pickdatarec) XPreANSI(Pint locdev) XPreANSI(Pint locpet) XPreANSI(Plocrec *locdatarec) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7Bptkenodetype`7D`7Bnodetype`7D`7Btype of node`7D`7BIN`7D X** \param`7BPint`7D`7Bpickdev`7D`7Bpick device`7D`7BIN`7D X** \param`7BPint`7D`7Bpickpet`7D`7Bpick prompt/echo type`7D`7BIN`7D X** \param`7BPpickrec *`7D`7Bpickdatarec`7D`7Bpick data record`7D`7BIN`7D X** \param`7BPint`7D`7Blocdev`7D`7Blocator device`7D`7BIN`7D X** \param`7BPint`7D`7Blocpet`7D`7Blocator prompt/echo type`7D`7BIN`7D X** \param`7BPlocrec *`7D`7Blocdatarec`7D`7Blocator data record`7D`7BIN`7D X** \paramend X** \blurb`7BThis function enables the user to set the position of X** a topology node, or group of nodes, interactively. The pick device X** `7B\tt pickdev`7D is used to request a topology node and if X** successful the locator device `7B\tt locdev`7D is used to specify X** a new node position. Prompt and echo types may be set for both X** the pick and locator devices.`7D X*/ X`7B X Pint nodeid; X Pintlst incl, excl; X Pint inclnames, i; X ptkboolean found; X Ppickpath initpath; X Plimit3 echo; X Pqpick pick; X Ppickpathel pathel`5B10`5D; X Ploc initloc; X Pqloc loc; X Pfloat maxdevx, maxdevy, maxdevz; X X settop(topid); X if (topptr != NULL) X `7B X ptk_inqmaxdevicecoords3(wsid, &maxdevx, &maxdevy, &maxdevz); X echo = ptk_limit3(0.0, maxdevx, 0.0, maxdevy, 0.0, maxdevz); X /* pick topology node */ X psetpickmode(wsid, pickdev, PREQUEST, PES_ECHO); X initpath.depth = 0; X pinitpick3(wsid, pickdev, PP_NOPICK, &initpath, pickpet, &echo,`20 X pickdatarec, PTOP_FIRST); X psetpickmode(wsid, pickdev, PREQUEST, PES_ECHO); X incl.number = 1; X incl.integers = &inclnames; X inclnames = topptr->topologyname; X excl.number = 0; X psetpickfilter(wsid, pickdev, &incl, &excl); X pick.pick.pick_path = pathel; +-+-+-+-+-+-+-+- END OF PART 259 +-+-+-+-+-+-+-+-