Mapper
plot_nexrad.c
Go to the documentation of this file.
1
2
#include "
prototypes.h
"
3
4
void
plot_nexrad
(Pixmap pixm,
int
h,
int
display_flag
)
5
6
{
7
8
extern
unsigned
long
nmap
[20];
9
extern
struct
pcp
*
spf
;
10
extern
int
pcp_in_use
[50];
11
extern
Font
font
[10];
12
extern
XFontStruct *
info_font
[10];
13
extern
Display *
display
;
14
extern
int
npoint
[2],
zoom
;
15
extern
GC
gc
;
16
extern
unsigned
long
xmap
[16];
17
extern
Widget
drawing_area
;
18
extern
float
delim
[16];
19
extern
struct
display_set
display_set
[4];
20
extern
struct
hrap_grid
*
hrap_grid
;
21
int
i
,
j
,
k
;
22
int
color
,
MY
=10;
23
float
xrat
,
yrat
,
mult
,
dmult
,
cmult
;
24
long
nx
[4],
ny
[4];
25
Dimension
width
,
height
;
26
Arg
args
[10];
27
unsigned
long
XSIZE
,
YSIZE
;
28
XPoint
point
[5];
29
long
xmin
,
xmax
,
ymin
,
ymax
,
lint1
,
lint2
;
30
signed
long
xcen
,
ycen
;
31
int
di
[4],
dj
[4],
dy
,
dx
,
pts
,
yheight
;
32
float
value
;
33
34
XSetFont(
display
,
gc
,
font
[4]);
35
yheight
=
info_font
[4]->ascent+2;
36
37
dx
=1;
dy
=1;
38
39
di
[0]=0;
dj
[0]=0;
40
di
[1]=1;
dj
[1]=0;
41
di
[2]=1;
dj
[2]=1;
42
di
[3]=0;
dj
[3]=1;
43
44
dmult
=
display_set
[
display_flag
].
dmult
[h];
45
xmin
=
display_set
[
display_flag
].
xmin
[h];
46
xmax
=
display_set
[
display_flag
].
xmax
[h];
47
ymin
=
display_set
[
display_flag
].
ymin
[h];
48
ymax
=
display_set
[
display_flag
].
ymax
[h];
49
xcen
=
display_set
[
display_flag
].
xcen
[h];
50
ycen
=
display_set
[
display_flag
].
ycen
[h];
51
52
XtSetArg(
args
[0],XtNwidth,&
width
);
53
XtSetArg(
args
[1],XtNheight,&
height
);
54
XtGetValues(
drawing_area
,
args
,2);
55
56
XSIZE
=(long)
width
*10L;
57
YSIZE
=(long)
height
*10L;
58
59
xrat
=(float)
XSIZE
/(
float
)12800;
60
yrat
=(float)
YSIZE
/(
float
)9600;
61
62
if
(
xrat
<
yrat
)
63
mult
=
xrat
;
64
65
else
66
mult
=
yrat
;
67
68
cmult
=
dmult
*
mult
;
69
lint1
=(long)
npoint
[0]*(
long
)
MY
;
70
lint2
=(long)
npoint
[1]*(
long
)
MY
;
71
XSetFillRule(
display
,
gc
,WindingRule);
72
pts
=0;
73
74
for
(
i
=0;
i
<
hrap_grid
->
maxi
-1;
i
++) {
75
76
for
(
j
=0;
j
<
hrap_grid
->
maxj
-1;
j
++) {
77
78
value
=(float)
spf
->
value
[
i
][
j
]/100;
79
80
if
(value<=0.01 && value >=-0.01)
81
continue
;
82
83
for
(
k
=0;
k
<15;
k
++) {
84
85
if
(
value
>=
delim
[
k
] &&
86
value
<
delim
[
k
+1]) {
87
88
color
=
xmap
[
k
];
89
break
;
90
91
}
92
93
}
94
95
if
(
k
==15)
96
color
=
xmap
[15];
97
98
if
(
value
< -99.98)
99
color
=
nmap
[16];
100
101
if
(
color
==0)
102
continue
;
103
104
pts
++;
105
106
XSetForeground(
display
,
gc
,
color
);
107
108
if
(
zoom
<= 1) {
109
110
for
(
k
=0;
k
<4;
k
++) {
111
112
nx
[
k
]=
xmin
+(float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
cmult
;
113
ny
[
k
]=
ymin
+(
float
)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
cmult
;
114
115
}
116
}
117
118
else
{
119
120
for
(
k
=0;
k
<4;
k
++) {
121
122
nx
[
k
]=
xmin
+((float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
123
cmult
-
lint1
)*
zoom
+
xcen
;
124
ny
[
k
]=
ymin
+((float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
125
cmult
-
lint2
)*
zoom
+
ycen
;
126
127
128
}
129
130
}
131
132
133
for
(
k
=0;
k
<4;
k
++) {
134
135
point
[
k
].
x
=(
nx
[
k
]+5)/
MY
;
136
point
[
k
].
y
=(
ny
[
k
]+5)/
MY
;
137
138
139
}
140
141
point
[4].
x
=
point
[0].
x
;
142
point
[4].
y
=
point
[0].
y
;
143
144
XFillPolygon(
display
,pixm,
gc
,
point
,5,Convex,CoordModeOrigin);
145
146
147
}
148
149
}
150
151
return
;
152
153
}
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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
mult
float mult
Definition:
edit_stations.c:6
j
int j
Definition:
mapp2h.h:48
k
int k
Definition:
mapp2h.h:48
nmap
unsigned long nmap[20]
Definition:
mapper.c:116
spf
struct pcp * spf
Definition:
mapper.c:141
display_flag
int display_flag
Definition:
mapper.c:100
plot_nexrad
void plot_nexrad(Pixmap pixm, int h, int display_flag)
Definition:
plot_nexrad.c:4
xrat
float xrat
Definition:
plot_qpf_legend.c:20
xmax
long xmax
Definition:
plot_qpf_legend.c:26
dj
int dj[4]
Definition:
plot_qpf_legend.c:28
color
int color
Definition:
plot_qpf_legend.c:19
value
float value
Definition:
plot_qpf_legend.c:29
yrat
float yrat
Definition:
plot_qpf_legend.c:20
ny
long ny[4]
Definition:
plot_qpf_legend.c:21
ymax
long ymax
Definition:
plot_qpf_legend.c:26
dy
int dy
Definition:
plot_qpf_legend.c:28
pcp_in_use
int pcp_in_use[50]
Definition:
mapper.c:78
lint1
long lint1
Definition:
plot_qpf_legend.c:26
gc
GC gc
Definition:
mapper.c:163
dx
int dx
Definition:
plot_qpf_legend.c:28
hrap_grid
struct hrap_grid * hrap_grid
Definition:
mapper.c:142
cmult
float cmult
Definition:
plot_qpf_legend.c:20
xmap
unsigned long xmap[16]
Definition:
mapper.c:116
xcen
signed long xcen
Definition:
plot_qpf_legend.c:27
pts
int pts
Definition:
plot_qpf_legend.c:28
height
Dimension height
Definition:
plot_qpf_legend.c:22
ycen
signed long ycen
Definition:
plot_qpf_legend.c:27
width
Dimension width
Definition:
plot_qpf_legend.c:22
yheight
int yheight
Definition:
plot_qpf_legend.c:28
lint2
long lint2
Definition:
plot_qpf_legend.c:26
args
Arg args[10]
Definition:
plot_qpf_legend.c:23
xmin
long xmin
Definition:
plot_qpf_legend.c:26
XSIZE
unsigned long XSIZE
Definition:
plot_qpf_legend.c:24
MY
int MY
Definition:
plot_qpf_legend.c:19
zoom
int zoom
Definition:
plot_qpf_legend.c:9
delim
float delim[][16]
Definition:
mapper.c:30
nx
long nx[4]
Definition:
plot_qpf_legend.c:21
dmult
float dmult
Definition:
plot_qpf_legend.c:20
drawing_area
Widget drawing_area
Definition:
mapper.c:185
npoint
int npoint[2]
Definition:
mapper.c:105
ymin
long ymin
Definition:
plot_qpf_legend.c:26
YSIZE
unsigned long YSIZE
Definition:
plot_qpf_legend.c:24
di
int di[4]
Definition:
plot_qpf_legend.c:28
prototypes.h
coord::y
short int y
Definition:
misc.h:498
coord::x
short int x
Definition:
misc.h:497
display_set
Definition:
misc.h:603
display_set::dmult
float dmult[4]
Definition:
misc.h:613
display_set::xmin
long xmin[4]
Definition:
misc.h:607
display_set::xmax
long xmax[4]
Definition:
misc.h:609
display_set::ymax
long ymax[4]
Definition:
misc.h:610
display_set::ymin
long ymin[4]
Definition:
misc.h:608
display_set::ycen
long ycen[4]
Definition:
misc.h:612
display_set::xcen
long xcen[4]
Definition:
misc.h:611
hrap_grid
Definition:
misc.h:578
hrap_grid::maxi
short int maxi
Definition:
misc.h:580
hrap_grid::maxj
short int maxj
Definition:
misc.h:581
hrap_grid::coord
struct coord ** coord
Definition:
misc.h:584
pcp
Definition:
misc.h:596
pcp::value
short int ** value
Definition:
misc.h:599
point
Definition:
mapp2h.h:29
point::y
int y
Definition:
mapp2h.h:30
point::x
int x
Definition:
mapp2h.h:30
Generated by
1.9.1