version 1.24, 2013/12/19 05:48:24 |
version 1.30, 2014/06/27 07:58:29 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.23 2011/08/11 06:25:06 saito Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.29 2014/05/25 03:07:04 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
|
|
static struct oEGT ltime; |
static struct oEGT ltime; |
static double r0; |
static double r0; |
double get_rtime(); |
double get_rtime(); |
|
void MSGdraw(char *); |
|
char msg[128]; |
#if defined(ITV_TIME_CHECK) |
#if defined(ITV_TIME_CHECK) |
void tstart() |
void tstart() |
{ |
{ |
Line 102 int open_canvas(NODE arg){ |
|
Line 104 int open_canvas(NODE arg){ |
|
|
|
wsize=(LIST)ARG0(arg); |
wsize=(LIST)ARG0(arg); |
wname=(STRING)ARG1(arg); |
wname=(STRING)ARG1(arg); |
can=canvas[id=search_canvas()]; |
id=search_canvas(); |
can->mode=MODE_INTERACTIVE; |
can=canvas[id]; |
|
can->mode=modeNO(INTERACTIVE); |
if(!wsize){ |
if(!wsize){ |
can->width=DEFAULTWIDTH; |
can->width=DEFAULTWIDTH; |
can->height=DEFAULTHEIGHT; |
can->height=DEFAULTHEIGHT; |
Line 117 int open_canvas(NODE arg){ |
|
Line 120 int open_canvas(NODE arg){ |
|
return id; |
return id; |
} |
} |
|
|
|
|
int plot(NODE arg,int fn){ |
int plot(NODE arg,int fn){ |
int id; |
int id; |
NODE n; |
NODE n; |
Line 146 int plot(NODE arg,int fn){ |
|
Line 148 int plot(NODE arg,int fn){ |
|
} |
} |
can->mode=fn; |
can->mode=fn; |
if(zrange){ |
if(zrange){ |
n=BDY(zrange); can->zmin=ToReal(BDY(n)); |
n=NEXT(BDY(zrange)); |
|
can->zmin=ToReal(BDY(n)); |
n=NEXT(n);can->zmax=ToReal(BDY(n)); |
n=NEXT(n);can->zmax=ToReal(BDY(n)); |
n=NEXT(n); |
n=NEXT(n); |
if(can->mode==MODE_CONPLOT)can->nzstep=QTOS((Q)BDY(n)); |
if(can->mode==modeNO(CONPLOT))can->nzstep=n?QTOS((Q)BDY(n)):MAXGC; |
else { |
else { |
can->vx=VR((P)BDY(BDY(zrange))); |
can->vx=VR((P)BDY(BDY(zrange))); |
can->nzstep=QTOS((Q)BDY(n)); |
can->nzstep=n?QTOS((Q)BDY(n)):DEFAULTPOLARSTEP; |
} |
} |
} |
} |
if(!wsize){ |
if(!wsize){ |
Line 162 int plot(NODE arg,int fn){ |
|
Line 165 int plot(NODE arg,int fn){ |
|
can->width=QTOS((Q)BDY(BDY(wsize))); |
can->width=QTOS((Q)BDY(BDY(wsize))); |
can->height=QTOS((Q)BDY(NEXT(BDY(wsize)))); |
can->height=QTOS((Q)BDY(NEXT(BDY(wsize)))); |
} |
} |
if(wname) can->wname = BDY(wname); |
if(wname) can->wname=BDY(wname); |
else can->wname=""; |
else can->wname=""; |
can->formula=formula; |
can->formula=formula; |
if(can->mode==MODE_PLOT){ |
if(can->mode==modeNO(PLOT)){ |
//plot |
//plot |
plotcalc(can); |
plotcalc(can); |
create_canvas(can); |
create_canvas(can); |
plot_print(display,can); |
plot_print(display,can); |
} else if(can->mode==MODE_POLARPLOT){ |
} else if(can->mode==modeNO(POLARPLOT)){ |
//polarplot |
polarcalc(can); |
polarplotcalc(can); |
|
create_canvas(can); |
create_canvas(can); |
plot_print(display,can); |
plot_print(display,can); |
} else { |
} else { |
//ifplot,conplot |
|
create_canvas(can); |
create_canvas(can); |
ifplotmainOld(can); |
ifplotmain(can); |
} |
} |
copy_to_canvas(can); |
copy_to_canvas(can); |
return id; |
return id; |
} |
} |
|
|
void ifplotmainOld(struct canvas *can){ |
void ifplotmain(struct canvas *can){ |
int i,width,height; |
int i,width,height; |
double ** tabe; |
double ** tabe; |
|
|
Line 194 void ifplotmainOld(struct canvas *can){ |
|
Line 195 void ifplotmainOld(struct canvas *can){ |
|
define_cursor(can->window,runningcur); |
define_cursor(can->window,runningcur); |
set_busy(can); set_selection(); |
set_busy(can); set_selection(); |
calc(tabe,can,0); |
calc(tabe,can,0); |
if_printOld(display,tabe,can); |
if_print(display,tabe,can); |
reset_selection(); reset_busy(can); |
reset_selection(); reset_busy(can); |
define_cursor(can->window,normalcur); |
define_cursor(can->window,normalcur); |
} |
} |
Line 229 int memory_plot(NODE arg,LIST *bytes){ |
|
Line 230 int memory_plot(NODE arg,LIST *bytes){ |
|
if( zrange ){ |
if( zrange ){ |
n=NEXT(BDY(zrange)); |
n=NEXT(BDY(zrange)); |
can->zmin=ToReal(BDY(n)); n=NEXT(n); can->zmax=ToReal(BDY(n)); |
can->zmin=ToReal(BDY(n)); n=NEXT(n); can->zmax=ToReal(BDY(n)); |
if(n=NEXT(n)) can->nzstep=QTOS((Q)BDY(n)); |
n=NEXT(n); |
|
if(n) can->nzstep=QTOS((Q)BDY(n)); |
else can->nzstep=MAXGC; |
else can->nzstep=MAXGC; |
can->mode=MODE_CONPLOT; |
can->mode=modeNO(CONPLOT); |
} else |
} else |
can->mode=MODE_IFPLOT; |
can->mode=modeNO(IFPLOT); |
} else |
} else |
can->mode=MODE_PLOT; |
can->mode=modeNO(PLOT); |
if( !wsize ){ |
if( !wsize ){ |
can->width=DEFAULTWIDTH; can->height=DEFAULTHEIGHT; |
can->width=DEFAULTWIDTH; can->height=DEFAULTHEIGHT; |
} else { |
} else { |
Line 244 int memory_plot(NODE arg,LIST *bytes){ |
|
Line 246 int memory_plot(NODE arg,LIST *bytes){ |
|
} |
} |
can->wname=""; |
can->wname=""; |
can->formula=formula; |
can->formula=formula; |
if( can->mode == MODE_PLOT ){ |
if( can->mode==modeNO(PLOT)){ |
plotcalc(can); |
plotcalc(can); |
memory_print(can,&barray); |
memory_print(can,&barray); |
STOQ(can->width,qw); STOQ(can->height,qh); |
STOQ(can->width,qw); STOQ(can->height,qh); |
Line 261 int memory_plot(NODE arg,LIST *bytes){ |
|
Line 263 int memory_plot(NODE arg,LIST *bytes){ |
|
n=mknode(3,qw,qh,barray); |
n=mknode(3,qw,qh,barray); |
MKLIST(*bytes,n); |
MKLIST(*bytes,n); |
} |
} |
|
return 0; |
} |
} |
|
|
int plotover(NODE arg){ |
int plotover(NODE arg){ |
int id,orgcolor,color; |
int id; |
|
unsigned int orgcolor; |
P formula; |
P formula; |
struct canvas *can; |
struct canvas *can; |
VL vl,vl0; |
VL vl,vl0; |
|
|
id=QTOS((Q)ARG0(arg)); |
id=QTOS((Q)ARG0(arg)); |
formula=(P)ARG1(arg); |
formula=(P)ARG1(arg); |
color=QTOS((Q)ARG2(arg)); |
|
|
|
can=canvas[id]; |
can=canvas[id]; |
orgcolor=can->color; |
orgcolor=can->color; |
can->color=color; |
if(argc(arg)==3) can->color=QTOS((Q)ARG2(arg)); |
|
else can->color=0; |
get_vars_recursive((Obj)formula,&vl); |
get_vars_recursive((Obj)formula,&vl); |
for(vl0=vl;vl0;vl0=NEXT(vl0)) |
for(vl0=vl;vl0;vl0=NEXT(vl0)) |
if(vl0->v->attr==(pointer)V_IND) |
if(vl0->v->attr==(pointer)V_IND) |
if(vl->v!=can->vx && vl->v!=can->vy)return -1; |
if(vl->v!=can->vx && vl->v!=can->vy)return -1; |
if(argc(arg)==3) can->color=QTOS((Q)ARG2(arg)); |
|
else can->color=0; |
|
#if !defined(VISUAL) |
#if !defined(VISUAL) |
set_drawcolor(can->color); |
set_drawcolor(can->color); |
#endif |
#endif |
current_can=can; |
current_can=can; |
can->formula=formula; |
can->formula=formula; |
if(can->mode==MODE_PLOT){ |
if(can->mode==modeNO(PLOT)){ |
plotcalc(can); |
plotcalc(can); |
plot_print(display,can); |
plot_print(display,can); |
} else ifplotmainOld(can); |
} else ifplotmain(can); |
copy_to_canvas(can); |
copy_to_canvas(can); |
can->color=color; |
can->color=orgcolor; |
#if !defined(VISUAL) |
#if !defined(VISUAL) |
set_drawcolor(can->color); |
set_drawcolor(can->color); |
#endif |
#endif |
return index; |
return id; |
} |
} |
|
|
int drawcircle(NODE arg){ |
int drawcircle(NODE arg){ |
#if !defined(VISUAL) |
#if !defined(VISUAL) |
int id,index,wx,wy,wr,c; |
int id,index,wx,wy,wr; |
|
unsigned int c; |
pointer ptr; |
pointer ptr; |
Q ret; |
Q ret; |
LIST xyr; |
LIST xyr; |
Line 329 int drawcircle(NODE arg){ |
|
Line 331 int drawcircle(NODE arg){ |
|
} |
} |
|
|
int draw_obj(NODE arg){ |
int draw_obj(NODE arg){ |
int index,color,x,y,u,v,len,r; |
int index,x,y,u,v,len,r; |
|
unsigned int color; |
NODE obj,n; |
NODE obj,n; |
RealVect *vect; |
RealVect *vect; |
struct canvas *can; |
struct canvas *can; |
Line 381 int draw_obj(NODE arg){ |
|
Line 384 int draw_obj(NODE arg){ |
|
} |
} |
|
|
int draw_string(NODE arg){ |
int draw_string(NODE arg){ |
int index,x,y,color; |
int index,x,y; |
|
unsigned int color; |
char *str; |
char *str; |
NODE pos; |
NODE pos; |
struct canvas *can; |
struct canvas *can; |
Line 423 int clear_canvas(NODE arg){ |
|
Line 427 int clear_canvas(NODE arg){ |
|
copy_to_canvas(can); |
copy_to_canvas(can); |
// clear the history |
// clear the history |
can->history=0; |
can->history=0; |
|
return 0; |
} |
} |
|
|
#define RealtoDbl(r) ((r)?BDY(r):0.0) |
#define RealtoDbl(r) ((r)?BDY(r):0.0) |
Line 451 int arrayplot(NODE arg){ |
|
Line 456 int arrayplot(NODE arg){ |
|
can->width=QTOS((Q)BDY(BDY(wsize))); |
can->width=QTOS((Q)BDY(BDY(wsize))); |
can->height=QTOS((Q)BDY(NEXT(BDY(wsize)))); |
can->height=QTOS((Q)BDY(NEXT(BDY(wsize)))); |
} |
} |
can->wname=wname; can->formula=0; can->mode=MODE_PLOT; |
can->wname=wname; can->formula=0; can->mode=modeNO(PLOT); |
create_canvas(can); |
create_canvas(can); |
w=array->len; |
w=array->len; |
h=can->height; |
h=can->height; |
Line 488 int arrayplot(NODE arg){ |
|
Line 493 int arrayplot(NODE arg){ |
|
copy_to_canvas(can); |
copy_to_canvas(can); |
return id; |
return id; |
} |
} |
|
/* |
void ifplot_resize(struct canvas *can,POINT spos,POINT epos){ |
void ifplot_resize(struct canvas *can,POINT spos,POINT epos){ |
struct canvas *ncan; |
struct canvas *ncan; |
struct canvas fakecan; |
struct canvas fakecan; |
Line 497 void ifplot_resize(struct canvas *can,POINT spos,POINT |
|
Line 502 void ifplot_resize(struct canvas *can,POINT spos,POINT |
|
Q s,t; |
Q s,t; |
int new; |
int new; |
int w,h,m; |
int w,h,m; |
|
|
if(XC(spos)<XC(epos) && YC(spos)<YC(epos)){ |
if(XC(spos)<XC(epos) && YC(spos)<YC(epos)){ |
if(can->precise && !can->wide){ |
if(can->precise && !can->wide){ |
fakecan=*can; |
fakecan=*can; |
Line 570 void ifplot_resize(struct canvas *can,POINT spos,POINT |
|
Line 574 void ifplot_resize(struct canvas *can,POINT spos,POINT |
|
} else { |
} else { |
create_canvas(ncan); |
create_canvas(ncan); |
if( can->precise ) qifplotmain(ncan); |
if( can->precise ) qifplotmain(ncan); |
else ifplotmain(ncan); |
else ifplotmainNG(ncan); |
copy_to_canvas(ncan); |
copy_to_canvas(ncan); |
} |
} |
} |
} |
} |
} |
|
*/ |
|
|
void plot_resize(struct canvas *can,POINT spos,POINT epos){ |
void plot_resize(struct canvas *can,POINT spos,POINT epos){ |
struct canvas *ncan; |
struct canvas *ncan; |
Q dx,dx2,xmin,xmax,xmid; |
Q dx,dx2,xmin,xmax,xmid,sx,ex,cw,ten,two,s,t; |
double dy,ymin,ymax,ymid; |
double dy,ymin,ymax,ymid; |
Q sx,ex,cw,ten,two; |
int new,w,h,m; |
Q s,t; |
|
int new; |
|
int w,h,m; |
|
|
|
if( XC(spos)<XC(epos) && YC(spos)<YC(epos) ){ |
if( XC(spos)<XC(epos) && YC(spos)<YC(epos) ){ |
new=search_canvas(); ncan=canvas[new]; |
new=search_canvas(); ncan=canvas[new]; |
Line 593 void plot_resize(struct canvas *can,POINT spos,POINT e |
|
Line 595 void plot_resize(struct canvas *can,POINT spos,POINT e |
|
ncan->wname=can->wname; |
ncan->wname=can->wname; |
ncan->vx=can->vx; ncan->vy=can->vy; |
ncan->vx=can->vx; ncan->vy=can->vy; |
ncan->formula=can->formula; |
ncan->formula=can->formula; |
|
ncan->color=can->color; |
w=XC(epos)-XC(spos); |
w=XC(epos)-XC(spos); |
h=YC(epos)-YC(spos); |
h=YC(epos)-YC(spos); |
m=MAX(can->width,can->height); |
m=MAX(can->width,can->height); |
if( w>h ){ |
if( w>h ){ |
ncan->width=m; ncan->height=m * h/w; |
ncan->width=m; |
|
ncan->height=m * h/w; |
} else { |
} else { |
ncan->width=m * w/h; ncan->height=m; |
ncan->width=m * w/h; |
|
ncan->height=m; |
} |
} |
if( can->wide ){ |
if( can->wide ){ |
STOQ(10,ten); STOQ(2,two); |
STOQ(10,ten); STOQ(2,two); |
subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx); |
subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx); |
addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid); |
addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid); |
divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax); |
divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax); |
|
|
dy=(can->ymax-can->ymin)*10; |
dy=(can->ymax-can->ymin)*10; |
ymid=(can->ymax+can->ymin)/2; |
ymid=(can->ymax+can->ymin)/2; |
ymin=ymid-dy/2; ymax=ymid+dy/2; |
ymin=ymid-dy/2; ymax=ymid+dy/2; |
} else { |
} else { |
subq(can->qxmax,can->qxmin,&dx); |
subq(can->qxmax,can->qxmin,&dx); |
xmin=can->qxmin; xmax=can->qxmax; |
xmin=can->qxmin; |
|
xmax=can->qxmax; |
dy=can->ymax-can->ymin; |
dy=can->ymax-can->ymin; |
ymin=can->ymin; ymax=can->ymax; |
ymin=can->ymin; |
|
ymax=can->ymax; |
} |
} |
STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw); |
STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw); |
mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin); |
mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin); |
mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax); |
mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax); |
ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax); |
ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax); |
|
|
ncan->ymin=ymax-YC(epos)*dy/can->height; |
ncan->ymin=ymax-YC(epos)*dy/can->height; |
ncan->ymax=ymax-YC(spos)*dy/can->height; |
ncan->ymax=ymax-YC(spos)*dy/can->height; |
|
|
create_canvas(ncan); |
create_canvas(ncan); |
plotcalc(ncan); |
|
plot_print(display,ncan); |
switch (ncan->mode){ |
|
case 0://IFPLOT |
|
case 1://CONPLOT |
|
ifplotmain(ncan); |
|
break; |
|
case 2://PLOT |
|
plotcalc(ncan); |
|
plot_print(display,ncan); |
|
break; |
|
case 4://POLARPLOT |
|
polarcalc(ncan); |
|
plot_print(display,ncan); |
|
break; |
|
case 30://MEMORY_PLOT |
|
break; |
|
case 31://ARRAYPLOT |
|
break; |
|
case 33://DRAWCIRCLE |
|
break; |
|
case 34://DRAW_OBJ |
|
break; |
|
case 35://DRAW_STRING |
|
break; |
|
case 36://OBJ_CP |
|
break; |
|
case 6://IFPLOTD |
|
case 7://IFPLOTQ |
|
case 8://IFPLOTB |
|
case 9://INEQND |
|
case 10://INEQNQ |
|
case 11://INEQNB |
|
case 21://CONPLOTD |
|
case 22://CONPLOTQ |
|
case 23://CONPLOTB |
|
case 24://ITVIFPLOT |
|
//ifplotNG |
|
ifplotmainNG(ncan); |
|
break; |
|
case 12://INEQNDAND |
|
case 13://INEQNQAND |
|
case 14://INEQNBAND |
|
case 15://INEQNDOR |
|
case 16://INEQNQOR |
|
case 17://INEQNBOR |
|
case 18://INEQNDXOR |
|
case 19://INEQNQXOR |
|
case 20://INEQNBXOR |
|
case 25://PLOTOVERD |
|
case 26://PLOTOVERQ |
|
case 27://PLOTOVERB |
|
//ifplotOP |
|
ifplotmainNG(ncan); |
|
break; |
|
case 38://POLARPLOTD |
|
//polarplotNG |
|
polarcalcNG(ncan); |
|
polar_print(display,ncan); |
|
break; |
|
} |
copy_to_canvas(ncan); |
copy_to_canvas(ncan); |
} |
} |
} |
} |
Line 651 void qifplotmain(struct canvas *can) |
|
Line 712 void qifplotmain(struct canvas *can) |
|
} |
} |
|
|
//*******************ifplotNG |
//*******************ifplotNG |
int ifplotNG(NODE arg,char *func){ |
int ifplotNG(NODE arg,int func){ |
int id,orgcolor,color,op_code; |
int id,op_code; |
|
unsigned int color; |
NODE n; |
NODE n; |
struct canvas *can; |
struct canvas *can; |
P formula; |
P formula; |
LIST xrange,yrange,zrange,wsize; |
LIST xrange,yrange,zrange,wsize; |
STRING wname; |
STRING wname; |
|
|
|
can=canvas[id=search_canvas()]; |
formula=(P)ARG0(arg); |
formula=(P)ARG0(arg); |
color=QTOS((Q)ARG1(arg)); |
can->color=QTOS((Q)ARG1(arg)); |
xrange=(LIST)ARG2(arg); |
xrange=(LIST)ARG2(arg); |
yrange=(LIST)ARG3(arg); |
yrange=(LIST)ARG3(arg); |
zrange=(LIST)ARG4(arg); |
zrange=(LIST)ARG4(arg); |
wsize=(LIST)ARG5(arg); |
wsize=(LIST)ARG5(arg); |
wname=(STRING)ARG6(arg); |
wname=(STRING)ARG6(arg); |
|
|
can=canvas[id=search_canvas()]; |
|
orgcolor=can->color; |
|
can->color=color; |
|
can->division=0; |
can->division=0; |
// set canvas data |
// set canvas data |
if(xrange){ |
if(xrange){ |
Line 697 int ifplotNG(NODE arg,char *func){ |
|
Line 756 int ifplotNG(NODE arg,char *func){ |
|
if(wname) can->wname=BDY(wname); |
if(wname) can->wname=BDY(wname); |
else can->wname=""; |
else can->wname=""; |
can->formula=formula; |
can->formula=formula; |
set_drawcolor(color); |
set_drawcolor(can->color); |
if(!strcmp(func,"ifplot"))can->mode=MODE_IFPLOT; |
can->mode=func; |
else if(!strcmp(func,"ifplotD"))can->mode=MODE_IFPLOTD; |
|
else if(!strcmp(func,"ifplotQ"))can->mode=MODE_IFPLOTQ; |
|
else if(!strcmp(func,"ifplotB"))can->mode=MODE_IFPLOTB; |
|
else if(!strcmp(func,"ineqnD"))can->mode=MODE_INEQND; |
|
else if(!strcmp(func,"ineqnQ"))can->mode=MODE_INEQNQ; |
|
else if(!strcmp(func,"ineqnB"))can->mode=MODE_INEQNB; |
|
else if(!strcmp(func,"conplotD"))can->mode=MODE_CONPLOTD; |
|
else if(!strcmp(func,"conplotQ"))can->mode=MODE_CONPLOTQ; |
|
else if(!strcmp(func,"conplotB"))can->mode=MODE_CONPLOTB; |
|
else if(!strcmp(func,"itvifplot")){ |
|
can->mode=MODE_ITVIFPLOT; |
|
can->division=QTOS((Q)ARG7(arg)); |
|
} |
|
else can->mode=MODE_IFPLOTD; |
|
create_canvas(can); |
create_canvas(can); |
ifplotmain(can); |
ifplotmainNG(can); |
set_drawcolor(orgcolor); |
|
copy_to_canvas(can); |
copy_to_canvas(can); |
can->color=orgcolor; |
|
return id; |
return id; |
} |
} |
|
|
int ifplotOP(NODE arg,char *func){ |
int ifplotOP(NODE arg,int func){ |
//ineqnor[D,Q,B],ineqnand[D,Q,B],ineqnxor[D,Q,b] |
//ineqnor[D,Q,B],ineqnand[D,Q,B],ineqnxor[D,Q,b],plotover[D,Q,B] |
int index,orgcolor,color,op_code; |
int index,op_code; |
NODE n; |
unsigned int orgcolor,color; |
struct canvas *can; |
|
P formula; |
P formula; |
//s_id,fname,w_id,poly,color |
struct canvas *can; |
|
VL vl,vl0; |
|
NODE n; |
|
|
index=QTOS((Q)ARG0(arg)); |
index=QTOS((Q)ARG0(arg)); |
formula=(P)ARG1(arg); |
formula=(P)ARG1(arg); |
color=QTOS((Q)ARG2(arg)); |
color=QTOS((Q)ARG2(arg)); |
|
// set canvas data |
can=canvas[index]; |
can=canvas[index]; |
orgcolor=can->color; |
orgcolor=can->color; |
can->color=color; |
can->color=color; |
// set canvas data |
|
can->formula=formula; |
can->formula=formula; |
if(!strcmp(func,"ineqnandD"))can->mode=MODE_INEQNANDD; |
current_can=can; |
else if(!strcmp(func,"ineqnandQ"))can->mode=MODE_INEQNANDQ; |
get_vars_recursive((Obj)formula,&vl); |
else if(!strcmp(func,"ineqnandB"))can->mode=MODE_INEQNANDB; |
for(vl0=vl;vl0;vl0=NEXT(vl0)) |
else if(!strcmp(func,"ineqnorD"))can->mode=MODE_INEQNORD; |
if(vl0->v->attr==(pointer)V_IND) |
else if(!strcmp(func,"ineqnorQ"))can->mode=MODE_INEQNORQ; |
if(vl->v!=can->vx && vl->v!=can->vy)return -1; |
else if(!strcmp(func,"ineqnorB"))can->mode=MODE_INEQNORB; |
#if !defined(VISUAL) |
else if(!strcmp(func,"ineqnxorD"))can->mode=MODE_INEQNXORD; |
set_drawcolor(can->color); |
else if(!strcmp(func,"ineqnxorQ"))can->mode=MODE_INEQNXORQ; |
#endif |
else if(!strcmp(func,"ineqnxorB"))can->mode=MODE_INEQNXORB; |
can->mode=func; |
else if(!strcmp(func,"plotoverD"))can->mode=MODE_PLOTOVERD; |
|
else if(!strcmp(func,"plotoverQ"))can->mode=MODE_PLOTOVERQ; |
|
else if(!strcmp(func,"plotoverB"))can->mode=MODE_PLOTOVERB; |
|
else can->mode=MODE_IFPLOTD; |
|
set_drawcolor(color); |
set_drawcolor(color); |
ifplotmain(can); |
ifplotmainNG(can); |
set_drawcolor(orgcolor); |
set_drawcolor(orgcolor); |
copy_to_canvas(can); |
copy_to_canvas(can); |
can->color=orgcolor; |
can->color=orgcolor; |
|
#if !defined(VISUAL) |
|
set_drawcolor(can->color); |
|
#endif |
return index; |
return index; |
} |
} |
|
|
void ifplotmain(struct canvas *can){ |
void ifplotmainNG(struct canvas *can){ |
int width,height,i,j,ix,iy,**mask; |
int width,height,i,j,ix,iy,**mask; |
double **tabe; |
double **tabe; |
|
|
Line 768 void ifplotmain(struct canvas *can){ |
|
Line 812 void ifplotmain(struct canvas *can){ |
|
set_busy(can); set_selection(); |
set_busy(can); set_selection(); |
set_drawcolor(can->color); |
set_drawcolor(can->color); |
switch(can->mode){ |
switch(can->mode){ |
case MODE_IFPLOTD: |
case 6://IFPLOTD |
calc(tabe,can,0); |
calc(tabe,can,0); |
if_print(display,tabe,can,1); |
if_printNG(display,tabe,can,1); |
break; |
break; |
case MODE_IFPLOTQ: |
case 7://IFPLOTQ |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
if_print(display,tabe,can,1); |
if_printNG(display,tabe,can,1); |
break; |
break; |
case MODE_IFPLOTB: |
case 8://IFPLOTB |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
if_print(display,tabe,can,0); |
if_printNG(display,tabe,can,0); |
break; |
break; |
case MODE_INEQND: |
case 9://INEQND |
calc(tabe,can,0); |
calc(tabe,can,0); |
area_print(display,tabe,can,0); |
area_print(display,tabe,can,0); |
break; |
break; |
case MODE_INEQNQ: |
case 10://INEQNQ |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
area_print(display,tabe,can,0); |
area_print(display,tabe,can,0); |
break; |
break; |
case MODE_INEQNB: |
case 11://INEQNB |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
area_print(display,tabe,can,0); |
area_print(display,tabe,can,0); |
break; |
break; |
case MODE_INEQNANDD: |
case 12://INEQNFAND |
calc(tabe,can,0); |
calc(tabe,can,0); |
area_print(display,tabe,can,0); |
area_print(display,tabe,can,2); |
break; |
break; |
case MODE_INEQNANDQ: |
case 13://INEQNQAND |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
area_print(display,tabe,can,2); |
area_print(display,tabe,can,2); |
break; |
break; |
case MODE_INEQNANDB: |
case 14://INEQNBAND |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
area_print(display,tabe,can,2); |
area_print(display,tabe,can,2); |
break; |
break; |
case MODE_INEQNORD: |
case 15://INEQNDOR |
calc(tabe,can,0); |
calc(tabe,can,0); |
area_print(display,tabe,can,3); |
area_print(display,tabe,can,3); |
break; |
break; |
case MODE_INEQNORQ: |
case 16://INEQNQOR |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
area_print(display,tabe,can,3); |
area_print(display,tabe,can,3); |
break; |
break; |
case MODE_INEQNORB: |
case 17://INEQNBOR |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
area_print(display,tabe,can,3); |
area_print(display,tabe,can,3); |
break; |
break; |
case MODE_INEQNXORD: |
case 18://INEQNDXOR |
calc(tabe,can,0); |
calc(tabe,can,0); |
area_print(display,tabe,can,4); |
area_print(display,tabe,can,4); |
break; |
break; |
case MODE_INEQNXORQ: |
case 19://INEQNQXOR |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
area_print(display,tabe,can,4); |
area_print(display,tabe,can,4); |
break; |
break; |
case MODE_INEQNXORB: |
case 20://INEQNBXOR |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
area_print(display,tabe,can,4); |
area_print(display,tabe,can,4); |
break; |
break; |
case MODE_CONPLOTD: |
case 21://CONPLOTD |
calc(tabe,can,0); |
calc(tabe,can,0); |
con_print(display,tabe,can); |
con_print(display,tabe,can); |
break; |
break; |
case MODE_CONPLOTB: |
case 22://CONPLOTQ |
calcb(tabe,can,0); |
calcq(tabe,can,0); |
con_print(display,tabe,can); |
con_print(display,tabe,can); |
break; |
break; |
case MODE_CONPLOTQ: |
case 23://CONPLOTB |
calcq(tabe,can,0); |
calcb(tabe,can,0); |
con_print(display,tabe,can); |
con_print(display,tabe,can); |
break; |
break; |
case MODE_PLOTOVERD: |
#if defined(INTERVAL) |
|
case 24://ITVIFPLOT: |
|
itvcalc(tabe,can,1); |
|
if_printNG(display,tabe,can,1); |
|
break; |
|
#endif |
|
case 25://PLOTOVERD |
calc(tabe,can,0); |
calc(tabe,can,0); |
over_print(display,tabe,can,0); |
over_print(display,tabe,can,0); |
break; |
break; |
case MODE_PLOTOVERQ: |
case 26://PLOTOVERQ: |
calcq(tabe,can,0); |
calcq(tabe,can,0); |
over_print(display,tabe,can,0); |
over_print(display,tabe,can,0); |
break; |
break; |
case MODE_PLOTOVERB: |
case 27://PLOTOVERB: |
calcb(tabe,can,0); |
calcb(tabe,can,0); |
over_print(display,tabe,can,0); |
over_print(display,tabe,can,0); |
break; |
break; |
#if defined(INTERVAL) |
|
case MODE_ITVIFPLOT: |
|
itvcalc(tabe,can,1); |
|
if_print(display,tabe,can,1); |
|
break; |
|
#endif |
|
} |
} |
set_drawcolor(can->color); |
set_drawcolor(can->color); |
reset_selection(); reset_busy(can); |
reset_selection(); reset_busy(can); |
define_cursor(can->window,normalcur); |
define_cursor(can->window,normalcur); |
} |
} |
|
|
|
#if defined(INTERVAL) |
int objcp(NODE arg){ |
int objcp(NODE arg){ |
int idsrc, idtrg, op_code; |
int idsrc, idtrg, op_code; |
struct canvas *cansrc, *cantrg; |
struct canvas *cansrc, *cantrg; |
Line 961 void obj_op(struct canvas *cansrc, struct canvas *cant |
|
Line 1006 void obj_op(struct canvas *cansrc, struct canvas *cant |
|
count_and_flush(); |
count_and_flush(); |
flush(); |
flush(); |
} |
} |
|
|
//ifplotNG |
|
/* |
|
int ineqnover(NODE arg) |
|
{ |
|
int id; |
|
struct canvas *can; |
|
int orgcolor, op_code; |
|
|
|
id = QTOS((Q)ARG0(arg)); |
|
can = canvas[id]; |
|
orgcolor = can->color; |
|
can->formula = (P)ARG1(arg); |
|
can->color = QTOS((Q)ARG2(arg)); |
|
op_code = QTOS((Q)ARG3(arg)); |
|
can->mode = MODE_INEQNP; |
|
ineqnmain(can, orgcolor, op_code); |
|
return id; |
|
} |
|
void ineqnmain(struct canvas *can, int orgcolor, int op_code) |
|
{ |
|
int **mask; |
|
double **tbl; |
|
int i,j; |
|
|
|
current_can = can; |
|
tbl = (double **)ALLOCA((can->height+1)*sizeof(double *)); |
|
for ( i = 0; i <= can->height; i++ ) |
|
tbl[i] = (double *)ALLOCA((can->width+1)*sizeof(double)); |
|
mask = (int **)ALLOCA(can->height*sizeof(int *)); |
|
for ( i = 0; i < can->height; i++) |
|
mask[i] = (int *)ALLOCA(can->width*sizeof(int)); |
|
|
|
define_cursor(can->window,runningcur); |
|
set_busy(can); set_selection(); |
|
// ineqncalc(tbl, can, 1); |
|
calc(tab,can,1); |
|
for (j = 0; j < can->height; j++){ |
|
for (i = 0; i < can->width; i++){ |
|
if ( tbl[j][i] >= 0 ){ |
|
if ( (tbl[j+1][i] <= 0 ) || |
|
(tbl[j][i+1] <= 0) || |
|
(tbl[j+1][i+1] <= 0) ) mask[j][i] = 0; |
|
else mask[j][i] = 1; |
|
} else { |
|
if( (tbl[j+1][i] >= 0) || |
|
(tbl[j][i+1] >= 0) || |
|
(tbl[j+1][i+1] >= 0) ) mask[j][i] = 0; |
|
else mask[j][i] = -1; |
|
} |
|
} |
|
} |
|
area_print(display, mask, can, op_code); |
|
reset_selection(); |
|
reset_busy(can); |
|
define_cursor(can->window,normalcur); |
|
#if !defined(VISUAL) |
|
set_drawcolor(orgcolor); |
|
can->color = orgcolor; |
|
#endif |
#endif |
copy_to_canvas(can); |
|
} |
|
*/ |
|
int polarplotNG(NODE arg){ |
int polarplotNG(NODE arg){ |
int id,color,orgcolor; |
int i,id,width,height; |
NODE n; |
NODE n; |
struct canvas *can; |
struct canvas *can; |
P formula; |
LIST range,geom; |
LIST xrange,wsize; |
|
STRING wname; |
STRING wname; |
V v; |
V v; |
|
|
formula=(P)ARG0(arg); |
id=search_canvas(); |
xrange=(LIST)ARG1(arg); |
can=canvas[id]; |
color=QTOS((Q)ARG2(arg)); |
can->mode=modeNO(POLARPLOTD); |
wsize=(LIST)ARG3(arg); |
can->formula=(P)ARG0(arg); |
|
can->color=QTOS((Q)ARG1(arg)); |
|
range=(LIST)ARG2(arg); |
|
geom=(LIST)ARG3(arg); |
wname=(STRING)ARG4(arg); |
wname=(STRING)ARG4(arg); |
|
|
can=canvas[id=search_canvas()]; |
if(range){ |
if(xrange){ |
n=NEXT(BDY(range)); |
n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n); |
can->zmin=ToReal(BDY(n)); |
can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n); |
n=NEXT(n);can->zmax=ToReal(BDY(n)); |
can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax); |
n=NEXT(n); |
|
can->vx=VR((P)BDY(BDY(range))); |
|
can->nzstep=n?QTOS((Q)BDY(n)):DEFAULTPOLARSTEP; |
} |
} |
can->mode=MODE_POLARPLOT; |
if(geom){ |
if(!wsize){ |
can->width=width=QTOS((Q)BDY(BDY(geom))); |
can->width=DEFAULTWIDTH; |
can->height=height=QTOS((Q)BDY(NEXT(BDY(geom)))); |
can->height=DEFAULTHEIGHT; |
|
} else { |
|
can->width=QTOS((Q)BDY(BDY(wsize))); |
|
can->height=QTOS((Q)BDY(NEXT(BDY(wsize)))); |
|
} |
} |
if(wname)can->wname=BDY(wname); |
if(wname)can->wname=BDY(wname); |
else can->wname=""; |
else can->wname=""; |
can->formula=formula; |
polarcalcNG(can); |
orgcolor=can->color; |
|
can->color=color; |
|
polarplotcalc(can); |
|
create_canvas(can); |
create_canvas(can); |
plot_print(display,can); |
set_drawcolor(can->color); |
can->color=orgcolor; |
polar_print(display,can); |
copy_to_canvas(can); |
reset_selection(); |
|
reset_busy(can); |
|
define_cursor(can->window,normalcur); |
return id; |
return id; |
} |
} |
|
|
int plotoverD(NODE arg){ |
void MSGdraw(char *str){ |
int index, color; |
int id,x,y; |
P formula; |
|
struct canvas *can; |
struct canvas *can; |
VL vl,vl0; |
|
|
|
index=QTOS((Q)ARG0(arg)); |
id=search_canvas(); |
formula=(P)ARG1(arg); |
can=canvas[id]; |
can=canvas[index]; |
can->mode=modeNO(INTERACTIVE); |
color=can->color; |
can->width=300; |
if(!can->window)return -1; |
can->height=300; |
get_vars_recursive((Obj)formula,&vl); |
can->wname="MSG"; |
for(vl0=vl;vl0;vl0=NEXT(vl0)) |
x=100; |
if(vl0->v->attr==(pointer)V_IND) |
y=100; |
if(vl->v!=can->vx && vl->v!=can->vy) return -1; |
create_canvas(can); |
if(argc(arg)== 3)can->color=QTOS((Q)ARG2(arg)); |
draw_character_string(display,can,x,y,str,0xff0000); |
else can->color=0; |
|
#if !defined(VISUAL) |
|
set_drawcolor(can->color); |
|
#endif |
|
current_can=can; |
|
can->formula=formula; |
|
if(can->mode==MODE_PLOT){ |
|
calcq(can); |
|
plot_print(display,can); |
|
} else ifplotmain(can); |
|
copy_to_canvas(can); |
|
can->color=color; |
|
#if !defined(VISUAL) |
|
set_drawcolor(can->color); |
|
#endif |
|
return index; |
|
} |
} |
|
|