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