[BACK]Return to plotp.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / plot

Diff for /OpenXM_contrib2/asir2000/plot/plotp.c between version 1.8 and 1.9

version 1.8, 2001/08/22 09:19:21 version 1.9, 2001/10/09 01:36:28
Line 45 
Line 45 
  * 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/plotp.c,v 1.7 2000/11/09 02:30:45 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.8 2001/08/22 09:19:21 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 63 
Line 63 
 static POINT oldpos;  static POINT oldpos;
 #endif  #endif
   
 if_print(display,tab,can)  void if_print(DISPLAY *display,double **tab,struct canvas *can)
 DISPLAY *display;  
 double **tab;  
 struct canvas *can;  
 {  {
         int ix,iy,width,height;          int ix,iy,width,height;
         double *px,*px1,*px2;          double *px,*px1,*px2;
Line 90  struct canvas *can;
Line 87  struct canvas *can;
   
 #define MEMORY_DRAWPOINT(a,len,x,y) (((a)[(len)*(y)+((x)>>3)]) |= (1<<((x)&7)))  #define MEMORY_DRAWPOINT(a,len,x,y) (((a)[(len)*(y)+((x)>>3)]) |= (1<<((x)&7)))
   
 memory_if_print(tab,can,bytes)  void memory_if_print(double **tab,struct canvas *can,BYTEARRAY *bytes)
 double **tab;  
 struct canvas *can;  
 BYTEARRAY *bytes;  
 {  {
         int ix,iy,width,height;          int ix,iy,width,height;
         double *px,*px1,*px2;          double *px,*px1,*px2;
Line 118  BYTEARRAY *bytes;
Line 112  BYTEARRAY *bytes;
                         }                          }
 }  }
   
 con_print(display,tab,can)  void con_print(DISPLAY *display,double **tab,struct canvas *can)
 DISPLAY *display;  
 double **tab;  
 struct canvas *can;  
 {  {
         int ix,iy,iz,width,height,pas,pai,len;          int ix,iy,iz,width,height,pas,pai,len;
         double zstep,z;          double zstep,z;
Line 168  struct canvas *can;
Line 159  struct canvas *can;
         flush();          flush();
 }  }
   
 memory_con_print(tab,can,bytes)  void memory_con_print(double **tab,struct canvas *can,BYTEARRAY *bytes)
 double **tab;  
 struct canvas *can;  
 BYTEARRAY *bytes;  
 {  {
         int ix,iy,iz,width,height,pas,pai,len;          int ix,iy,iz,width,height,pas,pai,len;
         double zstep,z;          double zstep,z;
Line 217  BYTEARRAY *bytes;
Line 205  BYTEARRAY *bytes;
                 }                  }
 }  }
   
 qif_print(display,tab,can)  void qif_print(DISPLAY *display,char **tab,struct canvas *can)
 DISPLAY *display;  
 char **tab;  
 struct canvas *can;  
 {  {
         int ix,iy,width,height;          int ix,iy,width,height;
         char *px;          char *px;
Line 237  struct canvas *can;
Line 222  struct canvas *can;
         flush();          flush();
 }  }
   
 plot_print(display,can)  void plot_print(DISPLAY *display,struct canvas *can)
 DISPLAY *display;  
 struct canvas *can;  
 {  {
         int len,i;          int len;
         POINT *pa;          POINT *pa;
   
 #if defined(VISUAL)  #if defined(VISUAL)
Line 259  struct canvas *can;
Line 242  struct canvas *can;
 #endif  #endif
 }  }
   
 draw_point(display,can,x,y,color)  void draw_point(DISPLAY *display,struct canvas *can,int x,int y,int color)
 DISPLAY *display;  
 struct canvas *can;  
 int x,y;  
 int color;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         HDC dc;          HDC dc;
Line 285  int color;
Line 264  int color;
 #endif  #endif
 }  }
   
 draw_line(display,can,x,y,u,v,color)  void draw_line(DISPLAY *display,struct canvas *can,int x,int y,int u,int v,int color)
 DISPLAY *display;  
 struct canvas *can;  
 int x,y,u,v;  
 int color;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         HDC dc;          HDC dc;
Line 329  int color;
Line 304  int color;
   
 #define D 5  #define D 5
   
 pline(display,can,d)  void pline(DISPLAY *display,struct canvas *can,DRAWABLE d)
 DISPLAY *display;  
 struct canvas *can;  
 DRAWABLE d;  
 {  {
         double w,w1,k,e,n;          double w,w1,e,n;
         int x0,y0,x,y,xadj,yadj;          int x0,y0,x,y,xadj,yadj;
         char buf[BUFSIZ];          char buf[BUFSIZ];
         double adjust_scale();          double adjust_scale();
Line 366  DRAWABLE d;
Line 338  DRAWABLE d;
         w1 = w * DEFAULTWIDTH/can->width;          w1 = w * DEFAULTWIDTH/can->width;
         e = adjust_scale(EXP10(floor(log10(w1))),w1);          e = adjust_scale(EXP10(floor(log10(w1))),w1);
         for ( n = ceil(can->xmin/e); n*e<= can->xmax; n++ ) {          for ( n = ceil(can->xmin/e); n*e<= can->xmax; n++ ) {
                 x = (int)can->width*(n*e-can->xmin)/w;                  x = (int)(can->width*(n*e-can->xmin)/w);
                 DRAWLINE(display,d,drawGC,x,y0,x,y0-D);                  DRAWLINE(display,d,drawGC,x,y0,x,y0-D);
                 sprintf(buf,"%g",n*e);                  sprintf(buf,"%g",n*e);
                 DRAWSTRING(display,d,scaleGC,x+2,y0+2,buf,strlen(buf));                  DRAWSTRING(display,d,scaleGC,x+2,y0+2,buf,strlen(buf));
Line 377  DRAWABLE d;
Line 349  DRAWABLE d;
         w1 = w * DEFAULTHEIGHT/can->height;          w1 = w * DEFAULTHEIGHT/can->height;
         e = adjust_scale(EXP10(floor(log10(w1))),w1);          e = adjust_scale(EXP10(floor(log10(w1))),w1);
         for ( n = ceil(can->ymin/e); n*e<= can->ymax; n++ ) {          for ( n = ceil(can->ymin/e); n*e<= can->ymax; n++ ) {
                 y = (int)can->height*(1-(n*e-can->ymin)/w);                  y = (int)(can->height*(1-(n*e-can->ymin)/w));
                 DRAWLINE(display,d,drawGC,x0,y,x0+D,y);                  DRAWLINE(display,d,drawGC,x0,y,x0+D,y);
                 sprintf(buf,"%g",n*e);                  sprintf(buf,"%g",n*e);
                 if ( can->xmax <= 0 ) {                  if ( can->xmax <= 0 ) {
Line 394  DRAWABLE d;
Line 366  DRAWABLE d;
         }          }
 }  }
   
 double adjust_scale(e,w)  double adjust_scale(double e,double w)
 double e,w;  
 {  {
         switch ( (int)floor(w/e) ) {          switch ( (int)floor(w/e) ) {
                 case 1:                  case 1:
Line 410  double e,w;
Line 381  double e,w;
         }          }
 }  }
   
 initmarker(can,message)  void initmarker(struct canvas *can,char *message)
 struct canvas *can;  
 char *message;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         can->real_can->percentage = 0;          can->real_can->percentage = 0;
Line 424  char *message;
Line 393  char *message;
 #endif  #endif
 }  }
   
 marker(can,dir,p)  void marker(struct canvas *can,int dir,int p)
 struct canvas *can;  
 int dir,p;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         if ( dir == DIR_X )          if ( dir == DIR_X )
                 can->real_can->percentage = ceil((float)p/(float)can->real_can->width*100);                  can->real_can->percentage = (int)ceil((float)p/(float)can->real_can->width*100);
         else if ( dir == DIR_Y )          else if ( dir == DIR_Y )
                 can->real_can->percentage = ceil((float)p/(float)can->real_can->height*100);                  can->real_can->percentage = (int)ceil((float)p/(float)can->real_can->height*100);
         else          else
                 can->real_can->percentage = ceil((float)p/(float)can->real_can->nzstep*100);                  can->real_can->percentage = (int)ceil((float)p/(float)can->real_can->nzstep*100);
 #else  #else
         if ( dir == DIR_X ) {          if ( dir == DIR_X ) {
                 XawScrollbarSetThumb(can->xdone,(float)p/(float)can->width,0.05);                  XawScrollbarSetThumb(can->xdone,(float)p/(float)can->width,0.05);
Line 449  int dir,p;
Line 416  int dir,p;
 #endif  #endif
 }  }
   
 define_cursor(w,cur)  void define_cursor(WINDOW w,CURSOR cur)
 WINDOW w;  
 CURSOR cur;  
 {  {
 #if !defined(VISUAL)  #if !defined(VISUAL)
         XDefineCursor(display,w,cur); flush();          XDefineCursor(display,w,cur); flush();
Line 465  static int flush_count;
Line 430  static int flush_count;
 #define MAX_COUNT 32  #define MAX_COUNT 32
 #endif  #endif
   
 count_and_flush() {  void count_and_flush() {
 #if !defined(VISUAL)  #if !defined(VISUAL)
         if ( ++flush_count == MAX_COUNT )          if ( ++flush_count == MAX_COUNT )
                 flush();                  flush();
 #endif  #endif
 }  }
   
 flush() {  void flush() {
 #if !defined(VISUAL)  #if !defined(VISUAL)
         flush_count = 0;          flush_count = 0;
         XFlush(display);          XFlush(display);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>