Mapper
redraw_isohyet_legend.c
Go to the documentation of this file.
1 
2 #include "prototypes.h"
3 void redraw_isohyet_legend(Drawable pixm)
4 
5 {
6 
7 
8 extern Display *display;
9 extern GC gc;
10 extern unsigned long qmap[16];
11 extern unsigned long imap[16];
12 extern Widget drawing_area;
13 extern int rs;
14 extern int legendysize,legendxsize;
15 extern int ilegend_save;
16 extern Pixmap logo[4];
17 extern XFontStruct *info_font[10];
18 extern Font font[10];
19 extern int iscale;
20 char buf[50];
21 int k,text_width,maxtopo,m;
22 Dimension width,height;
23 Arg args[10];
24 int legendystart;
25 
27 
28 XtSetArg(args[0],XtNwidth,&width);
29 XtSetArg(args[1],XtNheight,&height);
30 XtGetValues(drawing_area,args,2);
31 
32 XSetFunction(display,gc,GXcopy);
33 
34 XSetForeground(display,gc,0);
35 XSetBackground(display,gc,0);
36 XFillRectangle(display,pixm,gc,width-legendxsize+1,0,width,height);
37 
38 strcpy(buf,"Isohyets (in)");
39 XSetFont(display,gc,font[3]);
40 XSetForeground(display,gc,qmap[15]);
41 text_width=XTextWidth(info_font[3],buf,strlen(buf));
42 XDrawString(display,pixm,gc,width-5-text_width,legendystart+5,buf,strlen(buf));
43 XSetFont(display,gc,font[1]);
44 for(k=0;k<15;k++) {
45 
46  XSetForeground(display,gc,imap[k]);
47  XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(k+1)*rs,rs,rs);
48  if(ilegend_save==k) {
49 
50  XSetForeground(display,gc,qmap[15]);
51  XDrawRectangle(display,pixm,gc,width-rs-5,legendystart+(k+1)*rs,rs-1,rs-1);
52 
53  }
54 
55  m=(int)pow(2,(double)(iscale+1));
56 
57  sprintf(buf,"%d to %d",k*m,(k+1)*m);
58  XSetForeground(display,gc,qmap[15]);
59  text_width=XTextWidth(info_font[1],buf,strlen(buf));
60  XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(k+1)*rs+rs/2+3,buf,strlen(buf));
61 
62  }
63 
64 maxtopo=16;
65 XSetForeground(display,gc,qmap[15]);
66 XSetFillStyle(display,gc,FillStippled);
67 XSetStipple(display,gc,logo[0]);
68 
69 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+maxtopo*rs,rs,rs);
70 strcpy(buf,"filter down");
71 text_width=XTextWidth(info_font[1],buf,strlen(buf));
72 XSetFillStyle(display,gc,FillSolid);
73 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+maxtopo*rs+rs/2+3,buf,strlen(buf));
74 
75 XSetStipple(display,gc,logo[2]);
76 XSetFillStyle(display,gc,FillStippled);
77 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+1)*rs,rs,rs);
78 strcpy(buf,"filter up");
79 text_width=XTextWidth(info_font[1],buf,strlen(buf));
80 XSetFillStyle(display,gc,FillSolid);
81 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+1)*rs+rs/2+3,buf,strlen(buf));
82 
83 XSetStipple(display,gc,logo[0]);
84 XSetFillStyle(display,gc,FillStippled);
85 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+2)*rs,rs,rs);
86 strcpy(buf,"change scale");
87 text_width=XTextWidth(info_font[1],buf,strlen(buf));
88 XSetFillStyle(display,gc,FillSolid);
89 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+2)*rs+rs/2+3,buf,strlen(buf));
90 
91 XSetStipple(display,gc,logo[2]);
92 XSetFillStyle(display,gc,FillStippled);
93 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+3)*rs,rs,rs);
94 strcpy(buf,"filter off");
95 text_width=XTextWidth(info_font[1],buf,strlen(buf));
96 XSetFillStyle(display,gc,FillSolid);
97 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+3)*rs+rs/2+3,buf,strlen(buf));
98 
99 XSetStipple(display,gc,logo[0]);
100 XSetFillStyle(display,gc,FillStippled);
101 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+4)*rs,rs,rs);
102 strcpy(buf,"raster");
103 text_width=XTextWidth(info_font[1],buf,strlen(buf));
104 XSetFillStyle(display,gc,FillSolid);
105 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+4)*rs+rs/2+3,buf,strlen(buf));
106 
107 XSetStipple(display,gc,logo[2]);
108 XSetFillStyle(display,gc,FillStippled);
109 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+5)*rs,rs,rs);
110 strcpy(buf,"contour");
111 text_width=XTextWidth(info_font[1],buf,strlen(buf));
112 XSetFillStyle(display,gc,FillSolid);
113 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+5)*rs+rs/2+3,buf,strlen(buf));
114 
115 XSetStipple(display,gc,logo[0]);
116 XSetFillStyle(display,gc,FillStippled);
117 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(maxtopo+6)*rs,rs,rs);
118 strcpy(buf,"close");
119 text_width=XTextWidth(info_font[1],buf,strlen(buf));
120 XSetFillStyle(display,gc,FillSolid);
121 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(maxtopo+6)*rs+rs/2+3,buf,strlen(buf));
122 
123 }
124 
XFontStruct * info_font[10]
Definition: mapper.c:195
Display * display
Definition: mapper.c:159
Font font[10]
Definition: mapper.c:161
struct stat buf
Definition: is_file_closed.c:8
void redraw_isohyet_legend(Drawable pixm)
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
int k
Definition: mapp2h.h:48
int ilegend_save
Definition: mapper.c:94
int rs
Definition: mapper.c:103
int legendysize
Definition: mapper.c:103
unsigned long qmap[16]
Definition: mapper.c:116
int iscale
Definition: mapper.c:101
Pixmap logo[4]
Definition: mapper.c:167
int legendxsize
Definition: mapper.c:103
unsigned long imap[16]
Definition: mapper.c:116
int legendystart
Definition: mapper.c:103
GC gc
Definition: mapper.c:163
Dimension height
Dimension width
Arg args[10]
Widget drawing_area
Definition: mapper.c:185