Mapper
libraries
common
redraw_isohyet_legend.c
Go to the documentation of this file.
1
2
#include "
prototypes_new.h
"
3
void
redraw_isohyet_legend
(Drawable pixm)
4
5
{
6
7
extern
int
maxiscale
;
8
extern
Display *
display
;
9
extern
GC
gc
;
10
extern
unsigned
long
qmap
[16];
11
extern
unsigned
long
imap
[16];
12
extern
Widget
drawing_area
;
13
extern
int
rs
;
14
extern
int
legendysize
,
legendxsize
;
15
extern
int
ilegend_save
;
16
extern
Pixmap
logo
[4];
17
extern
XFontStruct *
info_font
[10];
18
extern
Font
font
[10];
19
extern
int
iscale
;
20
char
buf
[50];
21
int
k
,text_width,maxtopo,m;
22
Dimension
width
,
height
;
23
Arg
args
[10];
24
int
legendystart
;
25
float
fm;
26
int
i
;
27
28
legendystart
=
legendysize
+10;
29
30
XtSetArg(
args
[0],XtNwidth,&
width
);
31
XtSetArg(
args
[1],XtNheight,&
height
);
32
XtGetValues(
drawing_area
,
args
,2);
33
34
XSetFunction(
display
,
gc
,GXcopy);
35
36
XSetForeground(
display
,
gc
,0);
37
XSetBackground(
display
,
gc
,0);
38
XFillRectangle(
display
,pixm,
gc
,
width
-
legendxsize
+1,0,
width
,
height
);
39
40
strcpy(
buf
,
"Isohyets (in)"
);
41
XSetFont(
display
,
gc
,
font
[3]);
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
for
(
k
=0;
k
<15;
k
++) {
47
48
XSetForeground(
display
,
gc
,
imap
[
k
]);
49
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
50
legendystart
+(
k
+1)*
rs
,
rs
,
rs
);
51
if
(
ilegend_save
==
k
) {
52
53
XSetForeground(
display
,
gc
,
qmap
[15]);
54
XDrawRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
55
legendystart
+(
k
+1)*
rs
,
rs
-1,
rs
-1);
56
57
}
58
59
if
(
iscale
==0)
60
fm=.5;
61
else
62
fm=pow(2,(
double
)(
iscale
-1));
63
64
sprintf
(
buf
,
"%4.1f to %4.1f"
,
k
*fm,(
k
+1)*fm);
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,
legendystart
+(
k
+1)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
68
69
}
70
71
maxtopo=16;
72
XSetForeground(
display
,
gc
,
qmap
[15]);
73
XSetFillStyle(
display
,
gc
,FillStippled);
74
75
XSetStipple(
display
,
gc
,
logo
[0]);
76
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
legendystart
+maxtopo*
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
+maxtopo*
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
+(maxtopo+1)*
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
+(maxtopo+1)*
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
+(maxtopo+2)*
rs
,
rs
,
rs
);
93
strcpy(
buf
,
"filter off"
);
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
+(maxtopo+2)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
97
98
for
(
i
=0;
i
<
maxiscale
;
i
++) {
99
100
if
((
i
/2)*2==
i
)
101
XSetStipple(
display
,
gc
,
logo
[2]);
102
103
else
104
XSetStipple(
display
,
gc
,
logo
[0]);
105
106
XSetFillStyle(
display
,
gc
,FillStippled);
107
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
108
legendystart
+(maxtopo+3+
i
)*
rs
,
rs
,
rs
);
109
110
if
(
i
==0)
111
fm=.5;
112
else
113
fm=pow(2,(
double
)(
i
-1));
114
115
sprintf
(
buf
,
"%4.1f - %4.1f"
,0*fm,15*fm);
116
117
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
118
XSetFillStyle(
display
,
gc
,FillSolid);
119
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
120
legendystart
+(maxtopo+3+
i
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
121
122
}
123
124
XSetStipple(
display
,
gc
,
logo
[0]);
125
XSetFillStyle(
display
,
gc
,FillStippled);
126
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
127
legendystart
+(maxtopo+3+
maxiscale
)*
rs
,
rs
,
rs
);
128
strcpy(
buf
,
"raster"
);
129
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
130
XSetFillStyle(
display
,
gc
,FillSolid);
131
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
132
legendystart
+(maxtopo+3+
maxiscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
133
134
XSetStipple(
display
,
gc
,
logo
[2]);
135
XSetFillStyle(
display
,
gc
,FillStippled);
136
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
137
legendystart
+(maxtopo+4+
maxiscale
)*
rs
,
rs
,
rs
);
138
strcpy(
buf
,
"contour"
);
139
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
140
XSetFillStyle(
display
,
gc
,FillSolid);
141
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
142
legendystart
+(maxtopo+4+
maxiscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
143
144
XSetStipple(
display
,
gc
,
logo
[0]);
145
XSetFillStyle(
display
,
gc
,FillStippled);
146
XFillRectangle(
display
,pixm,
gc
,
width
-
rs
-5,
147
legendystart
+(maxtopo+5+
maxiscale
)*
rs
,
rs
,
rs
);
148
strcpy(
buf
,
"close"
);
149
text_width=XTextWidth(
info_font
[1],
buf
,strlen(
buf
));
150
XSetFillStyle(
display
,
gc
,FillSolid);
151
XDrawString(
display
,pixm,
gc
,
width
-
rs
-10-text_width,
152
legendystart
+(maxtopo+5+
maxiscale
)*
rs
+
rs
/2+3,
buf
,strlen(
buf
));
153
154
}
155
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_isohyet_legend
void redraw_isohyet_legend(Drawable pixm)
Definition:
redraw_isohyet_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
ilegend_save
int ilegend_save
Definition:
mapper.c:94
rs
int rs
Definition:
mapper.c:103
legendysize
int legendysize
Definition:
mapper.c:103
qmap
unsigned long qmap[16]
Definition:
mapper.c:116
iscale
int iscale
Definition:
mapper.c:101
logo
Pixmap logo[4]
Definition:
mapper.c:167
legendxsize
int legendxsize
Definition:
mapper.c:103
imap
unsigned long imap[16]
Definition:
mapper.c:116
maxiscale
int maxiscale
Definition:
mapper.c:102
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