Mapper
libraries
common
plot_isoh.c
Go to the documentation of this file.
1
2
#include "
prototypes.h
"
3
4
5
void
plot_isoh
(Pixmap pixm,
int
h,
int
display_flag
)
6
7
{
8
9
extern
int
isom;
10
extern
int
iscale
;
11
extern
Display *
display
;
12
extern
int
npoint
[2],
zoom
;
13
extern
GC
gc
;
14
extern
struct
isoh
*
isoh
;
15
extern
unsigned
long
imap
[16];
16
extern
Widget
drawing_area
;
17
extern
struct
display_set
display_set
[4];
18
int
i
,
j
,
k
,m;
19
int
color
,
MY
=10;
20
float
xrat
,
yrat
,
mult
,
dmult
,
cmult
;
21
long
nx
[4],
ny
[4];
22
Dimension
width
,
height
;
23
Arg
args
[10];
24
unsigned
long
XSIZE
,
YSIZE
;
25
XPoint
point
[5];
26
long
xmin
,
xmax
,
ymin
,
ymax
,
lint1
,
lint2
;
27
signed
long
xcen
,
ycen
;
28
int
iflag,maxi,maxj,mini,minj,nlong,
dx
,
dy
,
di
[4],
dj
[4];
29
int
ceni,cenj;
30
float
ddi;
31
float
fm;
32
33
dx
=1;
dy
=1;
34
35
di
[0]=0;
dj
[0]=0;
36
di
[1]=1;
dj
[1]=0;
37
di
[2]=1;
dj
[2]=1;
38
di
[3]=0;
dj
[3]=1;
39
40
if
(
zoom
==1 && (
isoh
->
maxi
> 500 ||
isoh
->
maxj
> 500)){
41
42
dx
=2;
dy
=2;
43
di
[0]=0;
dj
[0]=0;
44
di
[1]=2;
dj
[1]=0;
45
di
[2]=2;
dj
[2]=2;
46
di
[3]=0;
dj
[3]=2;
47
48
}
49
50
dmult
=
display_set
[
display_flag
].
dmult
[h];
51
xmin
=
display_set
[
display_flag
].
xmin
[h];
52
xmax
=
display_set
[
display_flag
].
xmax
[h];
53
ymin
=
display_set
[
display_flag
].
ymin
[h];
54
ymax
=
display_set
[
display_flag
].
ymax
[h];
55
xcen
=
display_set
[
display_flag
].
xcen
[h];
56
ycen
=
display_set
[
display_flag
].
ycen
[h];
57
58
XtSetArg(
args
[0],XtNwidth,&
width
);
59
XtSetArg(
args
[1],XtNheight,&
height
);
60
XtGetValues(
drawing_area
,
args
,2);
61
62
XSIZE
=(long)
width
*10L;
63
YSIZE
=(long)
height
*10L;
64
65
xrat
=(float)
XSIZE
/(
float
)12800;
66
yrat
=(float)
YSIZE
/(
float
)9600;
67
68
if
(
xrat
<
yrat
)
69
mult
=
xrat
;
70
71
else
72
mult
=
yrat
;
73
74
cmult
=
dmult
*
mult
;
75
lint1
=(long)
npoint
[0]*(
long
)
MY
;
76
lint2
=(long)
npoint
[1]*(
long
)
MY
;
77
78
XSetFillRule(
display
,
gc
,WindingRule);
79
80
mini=minj=0;
81
maxi=
isoh
->
maxi
;
82
maxj=
isoh
->
maxj
;
83
ceni=maxi/2;
84
cenj=maxj/2;
85
86
if
(
zoom
> 1) {
87
88
iflag=0;
89
90
for
(
i
=0;
i
<maxi-
dx
;
i
++) {
91
92
nlong=(
xmin
+((float)
isoh
->
coord
[
i
][cenj].
x
*
cmult
-
lint1
))*
zoom
+
xcen
;
93
94
95
if
(iflag==0 && nlong <
xmin
)
96
continue
;
97
98
if
(iflag==1 && nlong <
xmax
)
99
continue
;
100
101
if
(iflag==0)
102
mini=
i
;
103
104
if
(iflag==1)
105
maxi=
i
;
106
107
iflag++;
108
109
110
}
111
112
iflag=0;
113
114
for
(
j
=0;
j
<maxj-
dy
;
j
++) {
115
116
nlong=(
ymin
+((float)
isoh
->
coord
[ceni][
j
].
y
*
cmult
-
lint2
))*
zoom
+
ycen
;
117
118
119
if
(iflag==0 && nlong <
ymin
)
120
continue
;
121
122
if
(iflag==1 && nlong <
ymax
)
123
continue
;
124
125
if
(iflag==0)
126
minj=
j
;
127
128
129
if
(iflag==1)
130
maxj=
j
;
131
132
iflag++;
133
134
}
135
136
}
137
138
139
if
(
iscale
==0)
140
fm=.5;
141
else
142
fm=pow(2,(
double
)(
iscale
-1));
143
144
145
printf
(
"isoh %d %d %f\n"
,
xmin
,
ymin
,
cmult
);
146
147
for
(
i
=mini;
i
<maxi-
dx
;
i
=
i
+
dx
) {
148
149
for
(
j
=minj;
j
<maxj-
dy
;
j
=
j
+
dy
) {
150
151
if
(
isoh
->
value
[isom][
i
+
di
[0]][
j
+
dj
[0]] < 0 ||
152
isoh
->
value
[isom][
i
+
di
[1]][
j
+
dj
[1]] < 0 ||
153
isoh
->
value
[isom][
i
+
di
[2]][
j
+
dj
[2]] < 0 ||
154
isoh
->
value
[isom][
i
+
di
[3]][
j
+
dj
[3]] < 0)
155
continue
;
156
157
ddi=(float)(
isoh
->
value
[isom][
i
+
di
[0]][
j
+
dj
[0]]+
158
isoh
->
value
[isom][
i
+
di
[1]][
j
+
dj
[1]] +
159
isoh
->
value
[isom][
i
+
di
[2]][
j
+
dj
[2]]+
160
isoh
->
value
[isom][
i
+
di
[3]][
j
+
dj
[3]])/(4*25.3);
161
162
if
(ddi <= 0)
163
continue
;
164
165
for
(h=1;h <= 16;h++) {
166
167
if
(ddi < fm*h ) {
168
169
color
=h;
170
break
;
171
172
}
173
174
}
175
176
if
(
color
> 16)
177
color
=16;
178
179
color
=
imap
[
color
-1];
180
181
if
(
color
==0)
182
continue
;
183
184
XSetForeground(
display
,
gc
,
color
);
185
186
if
(
zoom
<= 1) {
187
188
/* fix for wider gaps */
189
190
for
(
k
=0;
k
<4;
k
++) {
191
192
nx
[
k
]=
xmin
+(float)
isoh
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
cmult
;
193
ny
[
k
]=
ymin
+(
float
)
isoh
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
cmult
;
194
195
}
196
}
197
198
else
{
199
200
for
(
k
=0;
k
<4;
k
++) {
201
202
nx
[
k
]=(
xmin
+((float)
isoh
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
x
*
cmult
-
203
lint1
))*
zoom
+
xcen
;
204
ny
[
k
]=(
ymin
+((float)
isoh
->
coord
[
i
+
di
[
k
]][
j
+
dj
[
k
]].
y
*
cmult
-
205
lint2
))*
zoom
+
ycen
;
206
207
}
208
209
}
210
for
(
k
=0;
k
<4;
k
++) {
211
212
point
[
k
].
x
=(
nx
[
k
]+5)/
MY
;
213
point
[
k
].
y
=(
ny
[
k
]+5)/
MY
;
214
215
216
}
217
218
point
[4].
x
=
point
[0].
x
;
219
point
[4].
y
=
point
[0].
y
;
220
221
XFillPolygon(
display
,pixm,
gc
,
point
,5,Convex,CoordModeOrigin);
222
223
}
224
225
226
}
227
228
return
;
229
}
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
i
static int i
Definition:
get_apps_defaults.c:110
display
Display * display
Definition:
mapper.c:159
mult
float mult
Definition:
edit_stations.c:6
printf
printf("fbuf is %s\n", fbuf)
j
int j
Definition:
mapp2h.h:48
k
int k
Definition:
mapp2h.h:48
iscale
int iscale
Definition:
mapper.c:101
isoh
struct isoh * isoh
Definition:
mapper.c:144
imap
unsigned long imap[16]
Definition:
mapper.c:116
display_flag
int display_flag
Definition:
mapper.c:100
plot_isoh
void plot_isoh(Pixmap pixm, int h, int display_flag)
Definition:
plot_isoh.c:5
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
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
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
cmult
float cmult
Definition:
plot_qpf_legend.c:20
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
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
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
isoh
Definition:
misc.h:538
isoh::coord
struct coord ** coord
Definition:
misc.h:540
isoh::maxi
int maxi
Definition:
misc.h:542
isoh::value
short int *** value
Definition:
misc.h:541
isoh::maxj
int maxj
Definition:
misc.h:543
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