155 |
|
} |
156 |
|
|
157 |
|
|
158 |
< |
cbeamadd(bl, n, v, hr, vr) /* add beams to server list */ |
158 |
> |
cbeamop(op, bl, n, v, hr, vr) /* update beams on server list */ |
159 |
> |
int op; |
160 |
|
register struct beamcomp *bl; |
161 |
|
int n; |
162 |
|
VIEW *v; |
170 |
|
pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD)); |
171 |
|
if (pa == NULL) |
172 |
|
error(SYSTEM, "out of memory in cbeamadd"); |
172 |
– |
for (i = 0; i < n; i++) |
173 |
– |
pa[i].nr = npixels(v, hr, vr, |
174 |
– |
hdlist[pa[i].hd=bl[i].hd], |
175 |
– |
pa[i].bi=bl[i].bi) / 8; |
176 |
– |
|
177 |
– |
serv_request(DR_ADDSET, n*sizeof(PACKHEAD), (char *)pa); |
178 |
– |
free((char *)pa); |
179 |
– |
} |
180 |
– |
|
181 |
– |
|
182 |
– |
cbeamdel(bl, n) /* delete unwanted beam requests */ |
183 |
– |
register struct beamcomp *bl; |
184 |
– |
int n; |
185 |
– |
{ |
186 |
– |
register PACKHEAD *pa; |
187 |
– |
register int i; |
188 |
– |
|
189 |
– |
if (n <= 0) |
190 |
– |
return; |
191 |
– |
pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD)); |
192 |
– |
if (pa == NULL) |
193 |
– |
error(SYSTEM, "out of memory in cbeamdel"); |
173 |
|
for (i = 0; i < n; i++) { |
174 |
|
pa[i].hd = bl[i].hd; |
175 |
|
pa[i].bi = bl[i].bi; |
176 |
< |
pa[i].nr = 0; /* removes any request */ |
176 |
> |
pa[i].nr = v==NULL ? 0 : |
177 |
> |
npixels(v, hr, vr, hdlist[bl[i].hd], bl[i].bi); |
178 |
|
} |
179 |
< |
serv_request(DR_DELSET, n*sizeof(PACKHEAD), (char *)pa); |
179 |
> |
serv_request(op, n*sizeof(PACKHEAD), (char *)pa); |
180 |
|
free((char *)pa); |
181 |
|
} |
182 |
|
|
398 |
|
} |
399 |
|
|
400 |
|
|
401 |
+ |
beam_sync() /* synchronize beams on server */ |
402 |
+ |
{ |
403 |
+ |
cbeamop(DR_NEWSET, cbeam, ncbeams, &odev.v, odev.hres, odev.vres); |
404 |
+ |
} |
405 |
+ |
|
406 |
+ |
|
407 |
|
beam_view(vo, vn) /* change beam view */ |
408 |
|
VIEW *vo, *vn; |
409 |
|
{ |
413 |
|
|
414 |
|
if (!vn->type) { /* clear our beam list */ |
415 |
|
set_voxels(vlnew, 0); |
416 |
< |
cbeamdel(cbeam, ncbeams); |
416 |
> |
cbeamop(DR_DELSET, cbeam, ncbeams, NULL, 0, 0); |
417 |
|
ncbeams = 0; |
418 |
|
return; |
419 |
|
} |
430 |
|
else /* else add all new cells */ |
431 |
|
doview(&ca, vn); |
432 |
|
/* inform server of new beams */ |
433 |
< |
cbeamadd(cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres); |
433 |
> |
cbeamop(DR_ADDSET, cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres); |
434 |
|
/* sort list to put orphans at end */ |
435 |
|
cbeamsort(0); |
436 |
|
/* tell server to delete orphans */ |
437 |
< |
cbeamdel(cbeam+ncbeams, xcbeams); |
437 |
> |
cbeamop(DR_DELSET, cbeam+ncbeams, xcbeams, NULL, 0, 0); |
438 |
|
xcbeams = 0; /* truncate our list */ |
439 |
|
} |