Mapper
plot_mat.c
Go to the documentation of this file.
1 
2 
3 #include "prototypes_new.h"
4 
5 void plot_mat(Pixmap pixm,int h, int display_flag,int num)
6 
7 {
8 
9 extern struct pcp *spf;
10 extern int pcp_in_use[500];
11 extern int pcpn_time;
12 extern int rsmode;
13 extern int wfo_all;
14 extern int wfo_in_use[20];
15 extern struct map map[1500];
16 extern int tscale;
17 extern struct hrap_grid *hrap_grid;
18 extern Font font[10];
19 extern Display *display;
20 extern int npoint[2],zoom;
21 extern int tscale;
22 extern GC gc;
23 extern unsigned long mnmap[16];
24 extern unsigned long qmap[16];
25 extern Widget drawing_area;
26 extern float delim[][16];
27 extern struct display_set display_set[4];
28 int hh;
29 int k;
30 int x,y,ip,ib;
31 int color,MY=10;
32 float xrat,yrat,mult,dmult,cmult;
33 Dimension width,height;
34 Arg args[10];
35 unsigned long XSIZE,YSIZE;
36 signed long xmin,xmax,ymin,ymax,lint1,lint2;
37 signed long xcen,ycen;
38 int di[4],dj[4],dy,dx;
39 XPoint point[10000];
40 XPoint mpoint[6];
41 int l,line_width,line_style,cap_style,join_style;
42 double mapvalue;
43 signed long r,s;
44 int nx[6],ny[6];
45 int minx,miny,ix,iy,maxx,maxy;
46 extern Region region;
47 float uz,mz,lz,gz,fx,fy;
48 
49 minx=hrap_grid->hrap_minx;
50 miny=hrap_grid->hrap_miny;
51 maxx=hrap_grid->maxi;
52 maxy=hrap_grid->maxj;
53 
54 dx=1;dy=1;
55 
56 di[0]=0;dj[0]=0;
57 di[1]=1;dj[1]=0;
58 di[2]=1;dj[2]=1;
59 di[3]=0;dj[3]=1;
60 
68 
69 XtSetArg(args[0],XtNwidth,&width);
70 XtSetArg(args[1],XtNheight,&height);
71 XtGetValues(drawing_area,args,2);
72 
73 XSIZE=(long)width*10L;
74 YSIZE=(long)height*10L;
75 
76 xrat=(float)XSIZE/(float)12800;
77 yrat=(float)YSIZE/(float)9600;
78 
79 if(xrat < yrat)
80  mult=xrat;
81 
82 else
83  mult=yrat;
84 
86 lint1=(long)npoint[0]*(long)MY;
87 lint2=(long)npoint[1]*(long)MY;
88 XSetFillRule(display,gc,WindingRule);
89 
90 for(ib=0;map[ib].hb5[0]!=0;ib++) {
91 
92  if(map[ib].tmaps_done[num-150] <=0)
93  continue;
94 
95  if(wfo_all!=1) {
96 
97  for(hh=0;hh<20;hh++) {
98 
99  if(wfo_in_use[hh] == -1)
100  break;
101 
102  if(map[ib].owner==wfo_in_use[hh])
103  break;
104 
105  }
106 
107  if(wfo_in_use[hh]==-1)
108  continue;
109 
110  }
111 
112  for(l=0;l<map[ib].basin_points;l++) {
113 
114  r=map[ib].basin[l].x;
115  s=map[ib].basin[l].y;
116 
117  if(zoom<=1) {
118 
119  point[l].x=(xmin+(float)r * cmult)/MY;
120  point[l].y=(ymin+(float)s * cmult)/MY;
121 
122  }
123  else {
124 
125  fx =((((xmin+(float)r*cmult)-lint1)*zoom+xcen)/MY);
126  fy=((((ymin+(float)s*cmult)-lint2)*zoom+ycen)/MY);
127 
128 
129  if(fx < 0)
130  fx=0;
131  if(fy < 0)
132  fy=0;
133  if(fx > width)
134  fx=width;
135  if(fy>height)
136  fy=height;
137 
138  point[l].x=(short int)fx;
139  point[l].y=(short int)fy;
140 
141  }
142 
143  }
144 
145 
146  lz=map[ib].tlz[num-150];
147  mz=map[ib].tmz[num-150];
148  uz=map[ib].tuz[num-150];
149  gz=map[ib].tgz[num-150];
150 
151  if( map[ib].zones[1] !=1 &&
152  map[ib].zones[2] !=1 &&
153  map[ib].zones[3] !=1) {
154 
155  XSetClipMask(display,gc,None);
156 
157  mapvalue=lz;
158 
159  for(k=0;k<15;k++) {
160 
161  if(mapvalue >= delim[tscale][k] &&
162  mapvalue < delim[tscale][k+1]) {
163 
164  color=mnmap[k];
165  break;
166 
167  }
168 
169  }
170 
171  if(mapvalue > .01 || mapvalue < -.01) {
172 
173 
174  if(k==15)
175  color=mnmap[15];
176 
177  XSetForeground(display,gc,color);
178 
179  XFillPolygon(display,pixm,gc,point,map[ib].basin_points,Complex,CoordModeOrigin);
180 
181  }
182 
183  line_width=2;
184  line_style=LineSolid;
185  cap_style=CapButt;
186  join_style=JoinMiter;
187 
188  XSetLineAttributes(display,gc,line_width,line_style,cap_style,
189  join_style);
190 
191  XSetForeground(display,gc,qmap[15]);
192 
193  XDrawLines(display,pixm,gc,point,map[ib].basin_points,CoordModeOrigin);
194 
195  continue;
196 
197  }
198 
199  region=XPolygonRegion(point,map[ib].basin_points,WindingRule);
200 
201  XSetRegion(display,gc,region);
202  XDestroyRegion(region);
203  for(l=0;l<map[ib].hrap_points;l++) {
204 
205  x=map[ib].hrap_data[l].x;
206  y=map[ib].hrap_data[l].y;
207 
208  /* search for highest zone number is hrap block */
209 
210  ip=1;
211 
212  if(map[ib].hrap_data[l].zone[1] >= 0)
213  ip=2;
214 
215  if(map[ib].hrap_data[l].zone[2] >= 0)
216  ip=3;
217 
218  if(map[ib].hrap_data[l].zone[3] >= 0)
219  ip=4;
220 
221  if(ip==4)
222  mapvalue=gz;
223 
224  else if(ip==3)
225  mapvalue=uz;
226 
227  else if(ip==2)
228  mapvalue=mz;
229 
230  else
231  mapvalue=lz;
232 
233 
234  ix=x-minx;
235  iy=y-miny;
236 
237 
238  if(ix < 0 || iy < 0 || ix >= maxx-1 || iy >= maxy-1) {
239 
240  continue;
241 
242  }
243 
244 
245  if(zoom <= 1) {
246 
247  for(k=0;k<4;k++) {
248 
249  nx[k]=xmin+(float)hrap_grid->coord[ix+di[k]][iy+dj[k]].x*
250  cmult;
251  ny[k]=ymin+(float)hrap_grid->coord[ix+di[k]][iy+dj[k]].y*
252  cmult;
253 
254  }
255  }
256 
257  else {
258 
259  for(k=0;k<4;k++) {
260 
261  nx[k]=(xmin+((float)hrap_grid->coord[ix+di[k]][iy+dj[k]].x*
262  cmult-lint1))*zoom + xcen;
263  ny[k]=(ymin+((float)hrap_grid->coord[ix+di[k]][iy+dj[k]].y*
264  cmult-lint2))*zoom + ycen;
265 
266 
267  }
268 
269  }
270 
271  for(k=0;k<4;k++) {
272 
273  mpoint[k].x=(nx[k]+5)/MY;
274  mpoint[k].y=(ny[k]+5)/MY;
275 
276  }
277 
278  mpoint[4].x=mpoint[0].x;
279  mpoint[4].y=mpoint[0].y;
280 
281  for(k=0;k<15;k++) {
282 
283  if(mapvalue >= delim[tscale][k] &&
284  mapvalue < delim[tscale][k+1]) {
285 
286  color=mnmap[k];
287  break;
288 
289  }
290 
291  }
292 
293  if(mapvalue <= -999)
294  continue;
295 
296  else if(k==15)
297  color=mnmap[15];
298 
299  XSetForeground(display,gc,color);
300 
301  XFillPolygon(display,pixm,gc,mpoint,5,Convex,CoordModeOrigin);
302 
303  }
304 
305  line_width=2;
306  line_style=LineSolid;
307  cap_style=CapButt;
308  join_style=JoinMiter;
309 
310  XSetLineAttributes(display,gc,line_width,line_style,cap_style,
311  join_style);
312 
313  XSetForeground(display,gc,qmap[15]);
314 
315  XDrawLines(display,pixm,gc,point,map[ib].basin_points,CoordModeOrigin);
316 
317  }
318 
319 XSetClipMask(display,gc,None);
320 
321 }
322 
323 
324 
325 
326 
327 
328 
329 
330 
331 
332 
333 
334 
335 
336 
337 
338 
339 
340 
341 
342 
343 
344 
345 
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
362 
363 
364 
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
375 
376 
377 
378 
379 
380 
381 
382 
383 
384 
385 
386 
Display * display
Definition: mapper.c:159
Font font[10]
Definition: mapper.c:161
float mult
Definition: edit_stations.c:6
int k
Definition: mapp2h.h:48
int pcpn_time
Definition: mapper.c:83
unsigned long qmap[16]
Definition: mapper.c:116
struct pcp * spf
Definition: mapper.c:141
Region region
Definition: mapper.c:170
int display_flag
Definition: mapper.c:100
void plot_mat(Pixmap pixm, int h, int display_flag, int num)
Definition: plot_mat.c:5
float xrat
long xmax
int dj[4]
int color
float yrat
long ny[4]
long ymax
int dy
int pcp_in_use[50]
Definition: mapper.c:78
long lint1
GC gc
Definition: mapper.c:163
int dx
struct hrap_grid * hrap_grid
Definition: mapper.c:142
float cmult
signed long xcen
Dimension height
signed long ycen
Dimension width
long lint2
Arg args[10]
long xmin
unsigned long XSIZE
int MY
int zoom
float delim[][16]
Definition: mapper.c:30
long nx[4]
float dmult
Widget drawing_area
Definition: mapper.c:185
int npoint[2]
Definition: mapper.c:105
long ymin
unsigned long YSIZE
int di[4]
ib
Definition: shleap.cc:46
short int y
Definition: misc.h:498
short int x
Definition: misc.h:497
float dmult[4]
Definition: misc.h:613
long xmin[4]
Definition: misc.h:607
long xmax[4]
Definition: misc.h:609
long ymax[4]
Definition: misc.h:610
long ymin[4]
Definition: misc.h:608
long ycen[4]
Definition: misc.h:612
long xcen[4]
Definition: misc.h:611
int x
Definition: misc.h:230
int y
Definition: misc.h:231
short int hrap_miny
Definition: misc.h:583
short int hrap_minx
Definition: misc.h:582
short int maxi
Definition: misc.h:580
short int maxj
Definition: misc.h:581
struct coord ** coord
Definition: misc.h:584
Definition: misc.h:236
char hb5[10]
Definition: misc.h:238
float * tgz
Definition: misc_new.h:338
struct hrap_data * hrap_data
Definition: misc.h:245
int basin_points
Definition: misc.h:240
int hrap_points
Definition: misc.h:244
float * tuz
Definition: misc_new.h:339
float * tmz
Definition: misc_new.h:340
XPoint * basin
Definition: misc.h:243
float * tlz
Definition: misc_new.h:341
Definition: misc.h:596
Definition: mapp2h.h:29
int y
Definition: mapp2h.h:30
int x
Definition: mapp2h.h:30