Mapper
libraries
common
redraw_frz_legend.c
Go to the documentation of this file.
1
2
#include "
prototypes_new.h
"
3
void
redraw_frz_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
maxzscale;
13
extern
unsigned
long
qmap
[16];
14
extern
unsigned
long
xmap
[16];
15
extern
int
zscale;
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
,
"Frz Level (Kft)"
);
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
==15)
59
sprintf
(
buf
,
"> %4.1f"
,
delim
[zscale][
k
]);
60
else
61
sprintf
(
buf
,
"%4.1f to %4.1f"
,
delim
[zscale][
k
],
62
delim
[zscale][
k
+1]);
63
64
XSetForeground(
display
,
gc
,
qmap
[15]);
65
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
66
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+(
k
+1)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
67
68
}
69
70
XSetForeground(
display
,
gc
,
qmap
[15]);
71
72
XSetFillStyle(
display
,
gc
,FillStippled);
73
XSetStipple(
display
,
gc
,
logo
[0]);
74
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+17*
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
+17*
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
+18*
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
+18*
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
+19*
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
+19*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
95
96
for
(
i
=0;
i
<maxzscale;
i
++) {
97
98
if
((
i
/2)*2==
i
)
99
XSetStipple(
display
,
gc
,
logo
[2]);
100
101
else
102
XSetStipple(
display
,
gc
,
logo
[0]);
103
104
XSetFillStyle(
display
,
gc
,FillStippled);
105
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+(20+
i
)*
rs
,
rs
,
rs
);
106
/* fix here */
107
108
sprintf
(
buf
,
"%4.1f - %4.1f"
,
delim
[
i
][0],
delim
[
i
][15]);
109
110
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
111
XSetFillStyle(
display
,
gc
,FillSolid);
112
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+(20+
i
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
113
114
}
115
116
XSetStipple(
display
,
gc
,
logo
[0]);
117
XSetFillStyle(
display
,
gc
,FillStippled);
118
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
119
legendystart
+(20+maxzscale)*
rs
,
rs
,
rs
);
120
strcpy(
buf
,
"raster"
);
121
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
122
XSetFillStyle(
display
,
gc
,FillSolid);
123
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
124
legendystart
+(20+maxzscale)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
125
126
XSetStipple(
display
,
gc
,
logo
[2]);
127
XSetFillStyle(
display
,
gc
,FillStippled);
128
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
129
legendystart
+(21+maxzscale)*
rs
,
rs
,
rs
);
130
strcpy(
buf
,
"contour"
);
131
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
132
XSetFillStyle(
display
,
gc
,FillSolid);
133
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
134
legendystart
+(21+maxzscale)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
135
136
XSetStipple(
display
,
gc
,
logo
[0]);
137
XSetFillStyle(
display
,
gc
,FillStippled);
138
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
139
legendystart
+(22+maxzscale)*
rs
,
rs
,
rs
);
140
strcpy(
buf
,
"close"
);
141
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
142
XSetFillStyle(
display
,
gc
,FillSolid);
143
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
144
legendystart
+(22+maxzscale)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
145
146
}
147
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
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
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
prototypes_new.h
redraw_frz_legend
void redraw_frz_legend(Drawable pixm)
Definition:
redraw_frz_legend.c:3
Generated by
1.9.1