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