-+-+-+-+-+-+-+-+ START OF PART 260 -+-+-+-+-+-+-+-+ X preqpick(wsid, pickdev, 10, &pick); X if (pick.status != PQP_OK) X return; X `20 X /* find picked node */ X i = 0; X found = FALSE; X while ((!found) && (i < 10)) X `7B X if (pick.pick.pick_path`5Bi`5D.struct_id == topptr->topologystid) X `7B X nodeid = pick.pick.pick_path`5Bi`5D.pick_id; X found = TRUE; X `7D X i++; X `7D X /* locate point */ X psetlocmode(wsid, locdev, PREQUEST, PES_ECHO); X initloc.view_index = 0; X initloc.position = ptk_point(0.5, 0.5); X pinitloc(wsid, locdev, &initloc, locpet, &echo, locdatarec); X psetlocmode(wsid, locdev, PREQUEST, PES_ECHO); X preqloc(wsid, locdev, &loc); X `20 X if (loc.status == PSTAT_NONE) X return; X `20 X ptk_setnodeposition(topid, nodeid, &loc.loc.position, nodetype); X `7D X`7D /* ptk_tidytopology */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_posttopology(C(Pint) wsid, C(Pint) topid, C(Pfloat) priority V) XPreANSI(Pint wsid) XPreANSI(Pint topid) XPreANSI(Pfloat priority) 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`7BPfloat`7D`7Bpriority`7D`7Bdisplay priority`7D`7BIN`7D X** \paramend X** \blurb`7BThis function posts a topology diagram structure to the X** workstation `7B\tt wsid`7D.`7D X*/ X`7B X settop(topid); X if (topptr != NULL) X `7B X ptk_poststruct(wsid, topptr->topologystid, priority); X addtointlst(wsid, &topptr->posted); X `7D X`7D /* ptk_posttopology */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_unposttopology(C(Pint) wsid, C(Pint) topid) XPreANSI(Pint wsid) XPreANSI(Pint topid) 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** \paramend X** \blurb`7BThis function unposts the topology diagram structure from X** the workstation `7B\tt wsid`7D.`7D X*/ X`7B X settop(topid); X if (topptr != NULL) X `7B X punpoststruct(wsid, topptr->topologystid); X removefromintlst(wsid, &topptr->posted); X `7D X`7D /* ptk_unposttopology */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_deltopology(C(Pint) topid) XPreANSI(Pint topid) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function deletes a topology diagram from the PHIGS Toolkit X** topology store. The function returns TRUE if a topology is deleted,`20 X** otherwise FALSE.`7D X*/ X`7B X ptkstopdraw *ptr, *junk; X Pchar stname`5B20`5D; X X settop(topid); X if (topptr != NULL) X `7B X if (topptr->topologytype == PTKESTRUCTTOPOLOGY) X delstructnodes(); X ptr = firsttop; X if (ptr->topologyid == topid) X `7B X firsttop = firsttop->next; X if (lasttop->topologyid == topid) X lasttop = firsttop; X `7D X else X `7B X while (ptr->next->topologyid != topid) X `7B X ptr = ptr->next; X if (ptr->next == NULL) X return FALSE; X `7D X junk = ptr->next; X ptr->next = junk->next; X if (ptr->next == NULL) X lasttop = ptr; X `7D X pdelstruct(ptr->topologystid); X /* dispose structlist */ X if (ptr->structlist != NULL) X disposestructlist(ptr->structlist); X /* dispose rowlist */ X if (ptr->rowlist != NULL) X disposerowlist(ptr->rowlist); X free(ptr); X X /* delete strings */ X sprintf(stname, "struct$topology%d", topid); X ptk_delstring("structureid", stname); X sprintf(stname, "name$topology%d", topid); X ptk_delstring("name", stname); X topologycount--; X return TRUE; X `7D X else X return FALSE; X`7D /* ptk_deltopology */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_storetopologylayout(C(FILE *) fileptr, C(Pint) topid) XPreANSI(FILE *fileptr) XPreANSI(Pint topid) X/* X** \parambegin X** \param`7BFILE *`7D`7Bfileptr`7D`7Bpointer to file`7D`7BOUT`7D X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function saves a topology layout in a text file. The X** layout refers to the positions of all the topology nodes. The X** format of the stored layout is: X**`20 X** `7B\tt start`7D X** `7B\tt (for each node in topology diagram)`7D X** `7B\tt x y`7D X** `7B\tt end`7D X** `7D X*/ X`7B X ptksstruct *structptr; X X settop(topid); X if (topptr != NULL) X `7B X structptr = topptr->structlist; X fprintf(fileptr, "\nstart\n"); X while (structptr != NULL) X `7B X fprintf(fileptr, "%f %f\n", structptr->pos.x, structptr->pos.y); X structptr = structptr->next; X `7D X fprintf(fileptr, "end\n"); X `7D X`7D /* ptk_storetopologylayout */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_restoretopologylayout(C(FILE *) fileptr, C(Pint) topid) XPreANSI(FILE *fileptr) XPreANSI(Pint topid) X/* X** \parambegin X** \param`7BFILE *`7D`7Bfileptr`7D`7Bpointer to file`7D`7BOUT`7D X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function reads a topology layout from a text file. X** The layout is used to reposition the nodes of the topology X** diagram `7B\tt topid`7D but will only really make sense if the layout X** was stored originally from the same topology.`7D`20 X*/ X`7B X ptksstruct *structptr; X Pchar str`5B255`5D; X Pintlst nameset; X X settop(topid); X if (topptr != NULL) X `7B X structptr = topptr->structlist; X /* find `60start' */ X do X `7B X fgets(str, 255, fileptr); `20 X `7D while (strncmp(str, "start", 5) != 0); X fgets(str, 255, fileptr); `20 X while ((structptr != NULL) && (strncmp(str, "end", 3) != 0))`20 X `7B X sscanf(str, "%f %f\n", &structptr->pos.x, &structptr->pos.y); X structptr = structptr->next; X fgets(str, 255, fileptr); `20 X `7D X X ptk_openstruct(topptr->topologystid); X psetelemptr(0); X pdelelemslabels(ptk_stringtoint("label", "globaltran"),`20 X ptk_stringtoint("label", "highlightattrs")); X pdelelemslabels(ptk_stringtoint("label", "starttopology"),`20 X ptk_stringtoint("label", "endtopology")); X topptr->extent = ptk_limit3(1000000.0, -10000000.0, 10000000.0, X -10000000.0, 0.0, 1.0); X pseteditmode(PEDIT_INSERT); `20 X setnode(1.0, 1.0); X switch (topptr->topologytype) X `7B X case PTKEBOXTOPOLOGY:`20 X drawnodes(); X break; X `20 X case PTKESTRUCTNETTOPOLOGY: X drawstructnetnodes(); X break; X `20 X case PTKESTRUCTTOPOLOGY: X drawstructnodes(); X break; X `7D X nameset.number = 1; X nameset.integers = &topptr->topologyname; X premovenameset(&nameset); `20 X drawconnections(); X drawnames(); X drawkeys(); X setscaling(); X ptk_closestruct(); X `7D X`7D /* ptk_restoretopologylayout */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqpostedtopologies(C(Pint) wsid, C(Pint) size,`20 X C(Pintlst *) topids, C(Pint *) totalsize, C(Pint *) err) XPreANSI(Pint wsid) XPreANSI(Pint size) XPreANSI(Pintlst *topids) XPreANSI(Pint *totalsize) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bsize`7D`7Bsize of buffer`7D`7BIN`7D X** \param`7BPintlst *`7D`7Btopids`7D`7Blist of posted topologies`7D`7BOUT`7D X** \param`7BPint *`7D`7Btotalsize`7D`7Blength of posted topologies list`7D`7 VBOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain a list of all the X** topology diagrams which are posted to the workstation `7B\tt wsid`7D.`7D X*/ X`7B X ptkstopdraw *ptrtop; X X *err = 0; X *totalsize = 0; X ptrtop = firsttop; X while (ptrtop != NULL) X `7B X if ((inintlst(wsid, &ptrtop->posted) != -1)) X (*totalsize)++; X ptrtop = ptrtop->next; X `7D X if (size >= *totalsize) X `7B X topids->number = 0; X ptrtop = firsttop; X while (ptrtop != NULL) X `7B X if ((inintlst(wsid, &ptrtop->posted) != -1)) X `7B X topids->integers`5Btopids->number`5D = ptrtop->topologyid; X topids->number++; X `7D X ptrtop = ptrtop->next; X `7D X `7D X`7D /* ptk_inqpostedtopologies */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologyids(C(Pint) size, C(Pintlst *) topids,`20 X C(Pint *) totalsize, C(Pint *) err) XPreANSI(Pint size) XPreANSI(Pintlst *topids) XPreANSI(Pint *totalsize) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bsize`7D`7Bsize of buffer`7D`7BIN`7D X** \param`7BPintlst *`7D`7Btopids`7D`7Blist of topology identifiers`7D`7BOUT V`7D X** \param`7BPint *`7D`7Btotalsize`7D`7Blength of topology identifiers list`7 VD`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain a list of all the topology X** diagrams in the PHIGS Toolkit topology store.`7D X*/ X`7B X ptkstopdraw *ptrtop; X X *err = 0; X *totalsize = topologycount; X if (size >= *totalsize) X `7B X topids->number = 0; X ptrtop = firsttop; X while (ptrtop != NULL) X `7B X topids->integers`5Btopids->number`5D = ptrtop->topologyid; X topids->number++; X ptrtop = ptrtop->next; X `7D X `7D X`7D /* ptk_inqtopologyids */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologystructid(C(Pint) topid, C(Pint *) topstid, X C(Pint *) err) XPreANSI(Pint topid) XPreANSI(Pint *topstid) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Btopstid`7D`7Btopology structure identifier`7D`7BIN`7 VD X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the structure identifier`20 X** of the topology diagram `7B\tt topid`7D. In the case of the BOX topology X** type the diagram is a single PHIGS structure but for STRUCT and X** STRUCTNET type diagrams it is a structure network.`20 X** 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 *topstid = topptr->topologystid; X else X *err = 1; X`7D /* ptk_inqtopologystructid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologyname(C(Pint) topid, C(Pint *) name, C(Pint *) err V)`20 XPreANSI(Pint topid) XPreANSI(Pint *name) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Bname`7D`7Btopology name for nameset filters`7D`7BOUT V`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the topology name for use`20 X** in the pick filter. When a topology name is added to the pick filter X** only the topology nodes are pickable. X** 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 *name = topptr->topologyname; X `7D X else X *err = 1; X`7D /* ptk_inqtopologyname */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_settopologyhighlightnode(C(Pint) topid, C(Pint) topnodestid) XPreANSI(Pint topid) XPreANSI(Pint topnodestid) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint`7D`7Btopnodestid`7D`7Btopology node structure identifier`7D V`7BIN`7D X** \paramend X** \blurb`7BThis function highlights a single topology node by X** setting the colour attribute values of the edge and interior of X** the node box. This function only works for BOX topology types.`7D X*/ X`7B X Pint nodeid; X ptksstruct *structptr; X ptkboolean found; X X found = FALSE; X nodeid = 0; X settop(topid); X if (topptr != NULL) X `7B X structptr = topptr->structlist; X while ((structptr != NULL) && (!found)) X `7B X if (structptr->name == topnodestid) X found = TRUE; X else X nodeid++; X structptr = structptr->next; X `7D X if (found) X `7B X topptr->highlightnode = nodeid; X redrawtopology(); X `7D X `7D X`7D /* ptk_settopologyhighlightnode */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqtopologyhighlightnode(C(Pint) topid,`20 X C(Pint *) topnodestid, C(Pint *) err) XPreANSI(Pint topid) XPreANSI(Pint *topnodestid) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Btopid`7D`7Btopology identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Btopnodestid`7D`7Btopology node structure identifier` V7D`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 structure X** identifier of the currently highlighted topology node. The error code X** = 1 if `7B\tt topid`7D doesn't exist and = 2 if there is no X** highlighted node.`7D X*/ X`7B X Pint i; X ptksstruct *structptr; X X *err = 0; X settop(topid); X if (topptr != NULL) X `7B X if (topptr->highlightnode != -1) X `7B X structptr = topptr->structlist; X for (i = 0; i < topptr->highlightnode; i++) X structptr = structptr->next; `20 +-+-+-+-+-+-+-+- END OF PART 260 +-+-+-+-+-+-+-+-