Mapper
redraw_maxmin_legend.c
Go to the documentation of this file.
1 
2 #include "prototypes_new.h"
3 void redraw_maxmin_legend(Drawable pixm)
4 
5 {
6 extern Font font[10];
7 extern XFontStruct *info_font[10];
8 extern int mnlegend_save;
9 extern Display *display;
10 extern GC gc;
11 extern float delim[][16];
12 extern int maxtscale;
13 extern unsigned long qmap[16];
14 extern unsigned long mnmap[16];
15 extern int tscale;
16 extern Widget drawing_area;
17 extern int rs;
18 extern int legendysize,legendxsize;
19 extern Pixmap logo[4];
20 char buf[50];
21 int k,text_width;
22 Dimension width,height;
23 Arg args[10];
24 int legendystart;
25 int i;
26 
28 
29 XtSetArg(args[0],XtNwidth,&width);
30 XtSetArg(args[1],XtNheight,&height);
31 XtGetValues(drawing_area,args,2);
32 
33 XSetForeground(display,gc,0);
34 XSetBackground(display,gc,0);
35 
36 XSetFunction(display,gc,GXcopy);
37 
38 XFillRectangle(display,pixm,gc,width-legendxsize+1,0,width,height);
39 
40 XSetFont(display,gc,font[3]);
41 strcpy(buf,"Temp (degF)");
42 XSetForeground(display,gc,qmap[15]);
43 text_width=XTextWidth(info_font[3],buf,strlen(buf));
44 XDrawString(display,pixm,gc,width-5-text_width,legendystart+5,buf,strlen(buf));
45 XSetFont(display,gc,font[1]);
46 
47 for(k=0;k<16;k++) {
48 
49  XSetForeground(display,gc,mnmap[k]);
50  XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(k+1)*rs,rs,rs);
51  if(mnlegend_save==k) {
52 
53  XSetForeground(display,gc,qmap[15]);
54  XDrawRectangle(display,pixm,gc,width-rs-5,legendystart+(k+1)*rs,rs-1,rs-1);
55 
56  }
57 
58 
59  if(k==0)
60  sprintf(buf,"< %4.1f",delim[tscale][0]);
61 
62  else if(k==15)
63  sprintf(buf,"> %4.1f",delim[tscale][15]);
64 
65  else
66  sprintf(buf,"%4.1f to %4.1f",delim[tscale][k],
67  delim[tscale][k+1]);
68 
69  XSetForeground(display,gc,qmap[15]);
70  text_width=XTextWidth(info_font[1],buf,strlen(buf));
71  XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(k+1)*rs+rs/2+3,buf,strlen(buf));
72 
73  }
74 
75 XSetForeground(display,gc,qmap[15]);
76 
77 XSetFillStyle(display,gc,FillStippled);
78 XSetStipple(display,gc,logo[0]);
79 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+17*rs,rs,rs);
80 strcpy(buf,"filter down");
81 text_width=XTextWidth(info_font[1],buf,strlen(buf));
82 XSetFillStyle(display,gc,FillSolid);
83 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+17*rs+rs/2+3,buf,strlen(buf));
84 
85 XSetStipple(display,gc,logo[2]);
86 XSetFillStyle(display,gc,FillStippled);
87 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+18*rs,rs,rs);
88 strcpy(buf,"filter up");
89 text_width=XTextWidth(info_font[1],buf,strlen(buf));
90 XSetFillStyle(display,gc,FillSolid);
91 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+18*rs+rs/2+3,buf,strlen(buf));
92 
93 XSetStipple(display,gc,logo[0]);
94 XSetFillStyle(display,gc,FillStippled);
95 XFillRectangle(display,pixm,gc,width-rs-5,legendystart+19*rs,rs,rs);
96 strcpy(buf,"filter off");
97 text_width=XTextWidth(info_font[1],buf,strlen(buf));
98 XSetFillStyle(display,gc,FillSolid);
99 XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+19*rs+rs/2+3,buf,strlen(buf));
100 
101 for(i=0;i<maxtscale;i++) {
102 
103  if((i/2)*2==i)
104  XSetStipple(display,gc,logo[2]);
105 
106  else
107  XSetStipple(display,gc,logo[0]);
108 
109  XSetFillStyle(display,gc,FillStippled);
110  XFillRectangle(display,pixm,gc,width-rs-5,legendystart+(20+i)*rs,rs,rs);
111  /* fix here */
112 
113  sprintf(buf,"%4.1f - %4.1f",delim[i][0],delim[i][15]);
114 
115  text_width=XTextWidth(info_font[1],buf,strlen(buf));
116  XSetFillStyle(display,gc,FillSolid);
117  XDrawString(display,pixm,gc,width-rs-10-text_width,legendystart+(20+i)*rs+rs/2+3,buf,strlen(buf));
118 
119  }
120 
121 XSetStipple(display,gc,logo[0]);
122 XSetFillStyle(display,gc,FillStippled);
123 XFillRectangle(display,pixm,gc,width-rs-5,
124  legendystart+(20+maxtscale)*rs,rs,rs);
125 strcpy(buf,"raster");
126 text_width=XTextWidth(info_font[1],buf,strlen(buf));
127 XSetFillStyle(display,gc,FillSolid);
128 XDrawString(display,pixm,gc,width-rs-10-text_width,
129  legendystart+(20+maxtscale)*rs+rs/2+3,buf,strlen(buf));
130 
131 XSetStipple(display,gc,logo[2]);
132 XSetFillStyle(display,gc,FillStippled);
133 XFillRectangle(display,pixm,gc,width-rs-5,
134  legendystart+(21+maxtscale)*rs,rs,rs);
135 strcpy(buf,"contour");
136 text_width=XTextWidth(info_font[1],buf,strlen(buf));
137 XSetFillStyle(display,gc,FillSolid);
138 XDrawString(display,pixm,gc,width-rs-10-text_width,
139  legendystart+(21+maxtscale)*rs+rs/2+3,buf,strlen(buf));
140 
141 XSetStipple(display,gc,logo[0]);
142 XSetFillStyle(display,gc,FillStippled);
143 XFillRectangle(display,pixm,gc,width-rs-5,
144  legendystart+(22+maxtscale)*rs,rs,rs);
145 strcpy(buf,"close");
146 text_width=XTextWidth(info_font[1],buf,strlen(buf));
147 XSetFillStyle(display,gc,FillSolid);
148 XDrawString(display,pixm,gc,width-rs-10-text_width,
149  legendystart+(22+maxtscale)*rs+rs/2+3,buf,strlen(buf));
150 
151 }
152 
static int i
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
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
int k
Definition: mapp2h.h:48
int rs
Definition: mapper.c:103
int legendysize
Definition: mapper.c:103
unsigned long qmap[16]
Definition: mapper.c:116
Pixmap logo[4]
Definition: mapper.c:167
int legendxsize
Definition: mapper.c:103
int legendystart
Definition: mapper.c:103
GC gc
Definition: mapper.c:163
Dimension height
Dimension width
Arg args[10]
float delim[][16]
Definition: mapper.c:30
Widget drawing_area
Definition: mapper.c:185
void redraw_maxmin_legend(Drawable pixm)