1
2
|
PACKETbasisplotDEFINESviewport,window,windowxmin,windowxmax,windowymin,windowymax,move,draw,where,box,xpixel,ypixel:INT VARxpixelanzahl,ypixelanzahl;REAL VARxpixelprocm,ypixelprocm,xcmgroesse,ycmgroesse,xpos,ypos,viewxmin:=0.0,viewxmax:=1.0,viewymin:=0.0,viewymax:=1.0,winxmin:=0.0,winxmax:=1.0,winymin:=0.0,winymax:=1.0,xkonst,ykonst,xfaktor,yfaktor;initialisierewerte;PROCinitialisierewerte:drawingarea(xcmgroesse,ycmgroesse,xpixelanzahl,ypixelanzahl);xpixelprocm:=real(xpixelanzahl)/xcmgroesse;ypixelprocm:=real(ypixelanzahl)/ycmgroesse;viewport(0.0,xcmgroesse,0.0,ycmgroesse);window(0.0,xcmgroesse,0.0,ycmgroesse);homeEND PROCinitialisierewerte;PROCviewport(REAL CONSTxmin,xmax,ymin,ymax):IFxmin<0.0CORxmax>xcmgroesseCORymin<0.0CORymax>ycmgroesseCORxmin=xmaxCORymin=ymaxCORaltewerteTHEN LEAVEviewportEND IF;viewxmin:=xmin;viewxmax:=xmax;viewymin:=ymin;viewymax:=ymax;setvalues.altewerte:viewxmin=xminCANDviewxmax=xmaxCANDviewymin=yminCANDviewymax=ymaxEND PROCviewport;PROCwindow(REAL CONSTxmin,xmax,ymin,ymax):IFxmin>=xmaxCORymin>=ymaxCORaltewerteTHEN LEAVEwindowEND IF;winxmin:=xmin;winxmax:=xmax;winymin:=ymin;winymax:=ymax;setvalues.altewerte:winxmin=xminCANDwinxmax=xmaxCANDwinymin=yminCANDwinymax=ymaxEND PROCwindow;REAL PROCwindowxmin:winxminEND PROCwindowxmin;REAL PROCwindowxmax:winxmaxEND PROCwindowxmax;REAL PROCwindowymin:winyminEND PROCwindowymin;REAL PROCwindowymax:winymaxEND PROCwindowymax;PROCsetvalues:xkonst:=0.5+viewxmin*xpixelprocm;ykonst:=0.5+viewymin*ypixelprocm;xfaktor:=xpixelprocm*(viewxmax-viewxmin)/(winxmax-winxmin);yfaktor:=ypixelprocm*(viewymax-viewymin)/(winymax-winymin)END PROCsetvalues;PROCmove(REAL CONSTx,y):INT VARi,j;IFx>winxmaxCORx<winxminCORy>winymaxCORy<winyminTHEN LEAVEmoveEND IF;xpos:=x;ypos:=y;transform(x,y,i,j);move(i,j)END PROCmove;PROCdraw(REAL CONSTx,y):INT VARi,j;IFx>winxmaxCORx<winxminCORy>winymaxCORy<winyminTHEN LEAVEdrawEND IF;transform(x,y,i,j);xpos:=x;ypos:=y;draw(i,j)END PROCdraw;PROCtransform(REAL CONSTx,y,INT VARi,j):i:=xpixel(x);j:=ypixel(y)END PROCtransform;INT PROCxpixel(REAL CONSTx):int(xkonst+(x-winxmin)*xfaktor)END PROCxpixel;INT PROCypixel(REAL CONSTy):int(ykonst+(y-winymin)*yfaktor)END PROCypixel;PROCbox:move(winxmin,winymax);draw(winxmax,winymax);draw(winxmax,winymin);draw(winxmin,winymin);draw(winxmin,winymax)END PROCbox;PROCwhere(REAL VARx,y):x:=xpos;y:=yposEND PROCwhere;PROChome:xpos:=winxmin;ypos:=winyminEND PROChome;END PACKETbasisplot
|