Mapper
libraries
common
redraw_diff_legend.c
Go to the documentation of this file.
1
2
#include "
prototypes_new.h
"
3
void
redraw_diff_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
unsigned
long
qmap
[16];
13
extern
unsigned
long
xmap
[16];
14
extern
int
kscale
;
15
extern
Widget
drawing_area
;
16
extern
int
rs
;
17
extern
int
legendysize
,
legendxsize
;
18
extern
Pixmap
logo
[4];
19
char
buf
[50];
20
int
k
,text_width;
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
XSetForeground(
display
,
gc
,0);
32
XSetBackground(
display
,
gc
,0);
33
34
XSetFunction(
display
,
gc
,GXcopy);
35
36
XFillRectangle(
display
,pixm,
gc
,
width
-
legendxsize
+1,0,
width
,
height
);
37
38
XSetFont(
display
,
gc
,
font
[3]);
39
strcpy(
buf
,
"Diff (in)"
);
40
XSetForeground(
display
,
gc
,
qmap
[15]);
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
XSetFont(
display
,
gc
,
font
[1]);
44
45
for
(
k
=0;
k
<16;
k
++) {
46
47
XSetForeground(
display
,
gc
,
xmap
[
k
]);
48
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
49
legendystart
+(
k
+1)*
rs
,
rs
,
rs
);
50
if
(
qlegend_save
==
k
) {
51
52
XSetForeground(
display
,
gc
,
qmap
[15]);
53
XDrawRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
54
legendystart
+(
k
+1)*
rs
,
rs
-1,
rs
-1);
55
56
}
57
58
59
if
(
k
==15)
60
sprintf
(
buf
,
"> %4.1f"
,
delim
[
kscale
][
k
]);
61
else
62
sprintf
(
buf
,
"%4.1f to %4.1f"
,
delim
[
kscale
][
k
],
63
delim
[
kscale
][
k
+1]);
64
65
XSetForeground(
display
,
gc
,
qmap
[15]);
66
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
67
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
68
legendystart
+(
k
+1)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
69
70
}
71
72
XSetForeground(
display
,
gc
,
qmap
[15]);
73
XSetFillStyle(
display
,
gc
,FillStippled);
74
XSetStipple(
display
,
gc
,
logo
[0]);
75
76
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+17*
rs
,
rs
,
rs
);
77
strcpy(
buf
,
"filter down"
);
78
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
79
XSetFillStyle(
display
,
gc
,FillSolid);
80
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+17*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
81
82
XSetStipple(
display
,
gc
,
logo
[2]);
83
XSetFillStyle(
display
,
gc
,FillStippled);
84
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+18*
rs
,
rs
,
rs
);
85
strcpy(
buf
,
"filter up"
);
86
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
87
XSetFillStyle(
display
,
gc
,FillSolid);
88
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+18*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
89
90
XSetStipple(
display
,
gc
,
logo
[0]);
91
XSetFillStyle(
display
,
gc
,FillStippled);
92
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+19*
rs
,
rs
,
rs
);
93
strcpy(
buf
,
"change scale"
);
94
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
95
XSetFillStyle(
display
,
gc
,FillSolid);
96
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+19*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
97
98
XSetStipple(
display
,
gc
,
logo
[2]);
99
XSetFillStyle(
display
,
gc
,FillStippled);
100
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+20*
rs
,
rs
,
rs
);
101
strcpy(
buf
,
"filter off"
);
102
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
103
XSetFillStyle(
display
,
gc
,FillSolid);
104
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+20*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
105
106
XSetStipple(
display
,
gc
,
logo
[0]);
107
XSetFillStyle(
display
,
gc
,FillStippled);
108
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+21*
rs
,
rs
,
rs
);
109
strcpy(
buf
,
"raster"
);
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
+21*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
113
114
XSetStipple(
display
,
gc
,
logo
[2]);
115
XSetFillStyle(
display
,
gc
,FillStippled);
116
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+22*
rs
,
rs
,
rs
);
117
strcpy(
buf
,
"contour"
);
118
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
119
XSetFillStyle(
display
,
gc
,FillSolid);
120
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
legendystart
+22*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
121
122
XSetStipple(
display
,
gc
,
logo
[0]);
123
XSetFillStyle(
display
,
gc
,FillStippled);
124
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+23*
rs
,
rs
,
rs
);
125
strcpy(
buf
,
"close"
);
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,
legendystart
+23*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
129
130
}
131
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
kscale
int kscale
Definition:
mapper.c:101
prototypes_new.h
redraw_diff_legend
void redraw_diff_legend(Drawable pixm)
Definition:
redraw_diff_legend.c:3
Generated by
1.9.1