Mapper
libraries
common
redraw_pcpn_legend.c
Go to the documentation of this file.
1
2
#include "
prototypes_new.h
"
3
void
redraw_pcpn_legend
(Drawable pixm)
4
5
{
6
extern
Font
font
[10];
7
extern
XFontStruct *
info_font
[10];
8
extern
int
qlegend_save
;
9
extern
Display *
display
;
10
extern
GC
gc
;
11
extern
float
delim
[][16];
12
extern
int
maxkscale
;
13
extern
unsigned
long
qmap
[16];
14
extern
unsigned
long
xmap
[16];
15
extern
int
kscale
;
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
27
legendystart
=
legendysize
+10;
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
,
"Precip (in)"
);
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
,
xmap
[
k
]);
50
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+(
k
+1)*
rs
,
rs
,
rs
);
51
if
(
qlegend_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
if
(
k
==0)
59
sprintf
(
buf
,
"%4.2f to %4.1f"
,
delim
[
kscale
][
k
],
60
delim
[
kscale
][
k
+1]);
61
else
if
(
k
==15)
62
sprintf
(
buf
,
"> %4.1f"
,
delim
[
kscale
][
k
]);
63
64
else
65
sprintf
(
buf
,
"%4.1f to %4.1f"
,
delim
[
kscale
][
k
],
66
delim
[
kscale
][
k
+1]);
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
+(
k
+1)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
71
72
}
73
74
XSetForeground(
display
,
gc
,
qmap
[15]);
75
76
XSetFillStyle(
display
,
gc
,FillStippled);
77
XSetStipple(
display
,
gc
,
logo
[0]);
78
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+17*
rs
,
rs
,
rs
);
79
strcpy(
buf
,
"filter down"
);
80
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
81
XSetFillStyle(
display
,
gc
,FillSolid);
82
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+17*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
83
84
XSetStipple(
display
,
gc
,
logo
[2]);
85
XSetFillStyle(
display
,
gc
,FillStippled);
86
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+18*
rs
,
rs
,
rs
);
87
strcpy(
buf
,
"filter up"
);
88
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
89
XSetFillStyle(
display
,
gc
,FillSolid);
90
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+18*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
91
92
XSetStipple(
display
,
gc
,
logo
[0]);
93
XSetFillStyle(
display
,
gc
,FillStippled);
94
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+19*
rs
,
rs
,
rs
);
95
strcpy(
buf
,
"filter off"
);
96
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
97
XSetFillStyle(
display
,
gc
,FillSolid);
98
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+19*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
99
100
for
(
i
=0;
i
<
maxkscale
;
i
++) {
101
102
if
((
i
/2)*2==
i
)
103
XSetStipple(
display
,
gc
,
logo
[2]);
104
105
else
106
XSetStipple(
display
,
gc
,
logo
[0]);
107
108
XSetFillStyle(
display
,
gc
,FillStippled);
109
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+(20+
i
)*
rs
,
rs
,
rs
);
110
/* fix here */
111
112
sprintf
(
buf
,
"%4.1f - %4.1f"
,
delim
[
i
][0],
delim
[
i
][15]);
113
114
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
115
XSetFillStyle(
display
,
gc
,FillSolid);
116
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+(20+
i
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
117
118
}
119
120
XSetStipple(
display
,
gc
,
logo
[0]);
121
XSetFillStyle(
display
,
gc
,FillStippled);
122
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
123
legendystart
+(20+
maxkscale
)*
rs
,
rs
,
rs
);
124
strcpy(
buf
,
"raster"
);
125
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
126
XSetFillStyle(
display
,
gc
,FillSolid);
127
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
128
legendystart
+(20+
maxkscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
129
130
XSetStipple(
display
,
gc
,
logo
[2]);
131
XSetFillStyle(
display
,
gc
,FillStippled);
132
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
133
legendystart
+(21+
maxkscale
)*
rs
,
rs
,
rs
);
134
strcpy(
buf
,
"contour"
);
135
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
136
XSetFillStyle(
display
,
gc
,FillSolid);
137
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
138
legendystart
+(21+
maxkscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
139
140
XSetStipple(
display
,
gc
,
logo
[0]);
141
XSetFillStyle(
display
,
gc
,FillStippled);
142
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
143
legendystart
+(22+
maxkscale
)*
rs
,
rs
,
rs
);
144
strcpy(
buf
,
"close"
);
145
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
146
XSetFillStyle(
display
,
gc
,FillSolid);
147
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
148
legendystart
+(22+
maxkscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
149
150
}
151
i
static int i
Definition:
get_apps_defaults.c:110
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_pcpn_legend
void redraw_pcpn_legend(Drawable pixm)
Definition:
redraw_pcpn_legend.c:3
sprintf
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
k
int k
Definition:
mapp2h.h:48
rs
int rs
Definition:
mapper.c:103
legendysize
int legendysize
Definition:
mapper.c:103
maxkscale
int maxkscale
Definition:
mapper.c:102
qmap
unsigned long qmap[16]
Definition:
mapper.c:116
logo
Pixmap logo[4]
Definition:
mapper.c:167
legendxsize
int legendxsize
Definition:
mapper.c:103
qlegend_save
int qlegend_save
Definition:
mapper.c:95
legendystart
int legendystart
Definition:
mapper.c:103
gc
GC gc
Definition:
mapper.c:163
xmap
unsigned long xmap[16]
Definition:
mapper.c:116
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
delim
float delim[][16]
Definition:
mapper.c:30
drawing_area
Widget drawing_area
Definition:
mapper.c:185
kscale
int kscale
Definition:
mapper.c:101
prototypes_new.h
Generated by
1.9.1