|
|
1.1 root 1: /*******************************************************************
2: * *
3: * File: CIFPLOT/select.c *
4: * Written by Dan Fitzpatrick *
5: * copyright 1980 -- Regents of the University of California *
6: * *
7: ********************************************************************/
8:
9: #include <stdio.h>
10: #include "defs.h"
11: #include "globals.h"
12: #include "parser_defs.h"
13: #include "structs.h"
14: #include "out_structs.h"
15: #include "alloc.h"
16:
17: IMPORT transform *MatrixMult();
18: IMPORT Trans();
19: IMPORT real TCompare();
20: IMPORT struct LCell *GetLayer();
21: FORWARD real ICompare();
22:
23: Selector(i)
24: iedge *i;
25: {
26: instance *item;
27: transform *trans;
28: real x,y;
29: TextStruct *t;
30: Command *c;
31: struct BBox bb;
32: struct LCell *layer;
33:
34: switch(i->type) {
35: case EDGE:
36: if(i->x1 == i->x2) {
37: --(i->poly->refs);
38: FreeIEdge(i);
39: return;
40: }
41: break;
42: case TEXT:
43: item = (instance *) i;
44: trans = MatrixMult(item->item->Ctype.Text.TTrans,item->trans);
45: x = 0.0; y = 0.0;
46: Trans(&x,&y,trans);
47: FreeTransform(trans);
48: ClipText(item->item->Ctype.Text.TString,x,y,item->item->Ctype.Text.TLoc);
49: return;
50: case SPOLYGON:
51: case SFLASH:
52: case SWIRE:
53: case SCALL:
54: case STEXT:
55: case VECTOR:
56: { Command *icom;
57: icom = (Command *) i;
58: if(icom->CBBox.xmax < Window.xmin || Window.xmax < icom->CBBox.xmin ||
59: icom->CBBox.ymax < Window.ymin || Window.ymax < icom->CBBox.ymin) {
60: Free(icom);
61: return;
62: }
63: icom->min = CONVERT(icom->CBBox.xmin-1.0);
64: }
65: break;
66: case POLYGON:
67: case WIRE:
68: case BOX:
69: case POINTNAME:
70: item = (instance *) i;
71: layer = GetLayer(item->item->level);
72: if(layer != NIL && !(layer->visible)) return;
73: /* else continue through next case */
74: default:
75: item = (instance *) i;
76: c = item->item;
77: ZeroBBox(&bb);
78: BBoxTransform(&bb,&(c->CBBox),item->trans);
79: if(bb.xmax < Window.xmin || Window.xmax < bb.xmin ||
80: bb.ymax < Window.ymin || Window.ymax < bb.ymin) {
81: FreeItem(item);
82: return;
83: }
84: item->min = CONVERT(bb.xmin-1.0);
85: break;
86: }
87: PutUnAct(i);
88: }
89:
90: real
91: ICompare(i,j)
92: instance *i,*j;
93: /* ICompare(i,j) <= 0 iff i->min <= j->min iff i->min - j->min <= 0 */
94: {
95: return((real) (i->min - j->min));
96: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.