Mapper
raster_data.c
Go to the documentation of this file.
1
2
#include "
prototypes.h
"
3
4
void
raster_data
(Pixmap pixm,
int
h,
int
display_flag
)
5
6
{
7
8
extern
int
data_type
;
9
extern
struct
grid
*
grid
;
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
int
kscale
;
16
extern
GC
gc
;
17
extern
unsigned
long
xmap
[16];
18
extern
Widget
drawing_area
;
19
extern
float
delim
[16];
20
extern
struct
display_set
display_set
[4];
21
extern
struct
hrap_grid
*
hrap_grid
;
22
int
i
,
j
,
k
;
23
int
color
,
MY
=10;
24
float
xrat
,
yrat
,
mult
,
dmult
,
cmult
;
25
long
nx
[4],
ny
[4];
26
Dimension
width
,
height
;
27
Arg
args
[10];
28
unsigned
long
XSIZE
,
YSIZE
;
29
XPoint
point
[5];
30
long
xmin
,
xmax
,
ymin
,
ymax
,
lint1
,
lint2
;
31
signed
long
xcen
,
ycen
;
32
int
di
[4],
dj
[4],
dy
,
dx
,
yheight
;
33
float
value
;
34
35
XSetFont(
display
,
gc
,
font
[4]);
36
yheight
=
info_font
[4]->ascent+2;
37
38
dx
=1;
dy
=1;
39
40
di
[0]=0;
dj
[0]=0;
41
di
[1]=1;
dj
[1]=0;
42
di
[2]=1;
dj
[2]=1;
43
di
[3]=0;
dj
[3]=1;
44
45
dmult
=
display_set
[
display_flag
].
dmult
[h];
46
xmin
=
display_set
[
display_flag
].
xmin
[h];
47
xmax
=
display_set
[
display_flag
].
xmax
[h];
48
ymin
=
display_set
[
display_flag
].
ymin
[h];
49
ymax
=
display_set
[
display_flag
].
ymax
[h];
50
xcen
=
display_set
[
display_flag
].
xcen
[h];
51
ycen
=
display_set
[
display_flag
].
ycen
[h];
52
53
XtSetArg(
args
[0],XtNwidth,&
width
);
54
XtSetArg(
args
[1],XtNheight,&
height
);
55
XtGetValues(
drawing_area
,
args
,2);
56
57
XSIZE
=(long)
width
*10L;
58
YSIZE
=(long)
height
*10L;
59
60
xrat
=(float)
XSIZE
/(
float
)12800;
61
yrat
=(float)
YSIZE
/(
float
)9600;
62
63
if
(
xrat
<
yrat
)
64
mult
=
xrat
;
65
66
else
67
mult
=
yrat
;
68
69
cmult
=
dmult
*
mult
;
70
lint1
=(long)
npoint
[0]*(
long
)
MY
;
71
lint2
=(long)
npoint
[1]*(
long
)
MY
;
72
XSetFillRule(
display
,
gc
,WindingRule);
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)
grid
->
value
[
i
][
j
];
79
80
if
(
data_type
!= 13 &&
data_type
!= 14
81
&&
data_type
!= 15 &&
data_type
!= 16) {
82
83
for
(
k
=0;
k
<15;
k
++) {
84
85
if
(
k
==0) {
86
87
if
(
value
<
delim
[
k
]) {
88
89
color
=
xmap
[0];
90
break
;
91
92
}
93
94
continue
;
95
96
}
97
98
if
(
value
>=
delim
[
k
-1] &&
99
value
<
delim
[
k
]) {
100
101
color
=
xmap
[
k
];
102
break
;
103
104
}
105
106
}
107
108
}
109
110
else
{
111
112
if
(value<=0.01 && value >=-0.01)
113
continue
;
114
115
for
(
k
=0;
k
<15;
k
++) {
116
117
if
(
value
>=
delim
[
k
] &&
118
value
<
delim
[
k
+1]) {
119
120
color
=
xmap
[
k
];
121
break
;
122
123
}
124
125
}
126
127
128
}
129
130
if
(
k
==15)
131
color
=
xmap
[15];
132
133
if
(
color
==0)
134
continue
;
135
136
XSetForeground(
display
,
gc
,
color
);
137
138
if
(
zoom
<= 1) {
139
140
for
(
k
=0;
k
<4;
k
++) {
141
142
nx
[
k
]=
xmin
+(float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
cmult
;
143
ny
[
k
]=
ymin
+(
float
)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
cmult
;
144
145
}
146
}
147
148
else
{
149
150
for
(
k
=0;
k
<4;
k
++) {
151
152
nx
[
k
]=
xmin
+((float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
153
cmult
-
lint1
)*
zoom
+
xcen
;
154
ny
[
k
]=
ymin
+((float)
hrap_grid
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
155
cmult
-
lint2
)*
zoom
+
ycen
;
156
157
158
}
159
160
}
161
162
163
for
(
k
=0;
k
<4;
k
++) {
164
165
point
[
k
].
x
=(
nx
[
k
]+5)/
MY
;
166
point
[
k
].
y
=(
ny
[
k
]+5)/
MY
;
167
168
169
}
170
171
point
[4].
x
=
point
[0].
x
;
172
point
[4].
y
=
point
[0].
y
;
173
174
XFillPolygon(
display
,pixm,
gc
,
point
,5,Convex,CoordModeOrigin);
175
176
177
}
178
179
}
180
181
return
;
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
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
data_type
int data_type
Definition:
mapper.c:63
grid
struct grid * grid
Definition:
mapper.c:127
display_flag
int display_flag
Definition:
mapper.c:100
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
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
kscale
int kscale
Definition:
mapper.c:101
di
int di[4]
Definition:
plot_qpf_legend.c:28
prototypes.h
raster_data
void raster_data(Pixmap pixm, int h, int display_flag)
Definition:
raster_data.c:4
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
grid
Definition:
misc.h:538
grid::value
float ** value
Definition:
misc.h:540
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
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