Mapper
redraw_map.c
Go to the documentation of this file.
1 
2 #include "prototypes_new.h"
3 
4 void redraw_map(int win_x,int win_y,unsigned int button)
5 
6 {
7 
8 extern int odisplay_flag;
9 extern void send_expose();
10 extern int add_topo_flag,add_isohyet_flag;
11 extern int add_max_flag,add_min_flag;
12 extern int current_raster;
13 extern int change_map_flag;
14 extern int display_flag;
15 extern int xclip;
16 extern void write_screen();
17 extern Widget drawing_area;
18 extern int npoint[2],zoom,opoint[2];
19 extern struct display_set display_set[4];
20 extern int display_flag;
21 Arg args[10];
22 int XSIZE,YSIZE;
23 Dimension width,height;
24 
25 /* check if a cursor function or map layer */
26 
27 XtSetArg(args[0],XtNwidth,&width);
28 XtSetArg(args[1],XtNheight,&height);
29 XtGetValues(drawing_area,args,2);
30 
33 YSIZE=(display_set[0].ymax[0]-
34  display_set[0].ymin[0])/10;
35 
36 if(display_flag != odisplay_flag) {
37 
38  printf("not equal2\n");
39 
40  if(display_flag==0)
41  opoint[0]=opoint[0]*2;
42 
43  if(display_flag==1)
44  opoint[0]=opoint[0]/2;
45 
46  odisplay_flag=display_flag;
47 
48  }
49 
50 
51 if(display_flag != 0) {
52 
53  if(win_x > (width-xclip/10)/2)
54  win_x=win_x-(width - xclip/10)/2;
55 
56  }
57 
58 if(button==Button3) {
59 
60 /* reposition */
61 
62  npoint[0]=opoint[0]+(win_x-XSIZE/2)/zoom;
63  npoint[1]=opoint[1]+(win_y-YSIZE/2)/zoom;
64 
65  if(zoom==1) {
66 
67  npoint[0]=opoint[0]=XSIZE/2;
68  npoint[1]=opoint[1]=YSIZE/2;
69 
70  }
71 
72  }
73 
74 else if(button==Button2) {
75 
76 /* un zoom */
77 
78  npoint[0]=opoint[0]+(win_x-XSIZE/2)/zoom;
79  npoint[1]=opoint[1]+(win_y-YSIZE/2)/zoom;
80 
81  zoom=zoom/2;
82 
83  if(zoom==0)
84  zoom=1;
85 
86  if(zoom==1) {
87 
88  npoint[0]=opoint[0]=XSIZE/2;
89  npoint[1]=opoint[1]=YSIZE/2;
90 
91  }
92 
93  }
94 
95 
96 else if(button==Button1) {
97 
98 /* zoom */
99 
100  npoint[0]=opoint[0]+(win_x-XSIZE/2)/zoom;
101  npoint[1]=opoint[1]+(win_y-YSIZE/2)/zoom;
102 
103  zoom=zoom*2;
104 
105  }
106 
107 /* on zoom or resize current raster set to -1 -
108  if topo reselected redraw
109  if already selected redraw */
110 
111 if(add_topo_flag != 1 && add_isohyet_flag != 1 &&
112  add_max_flag != 1 && add_min_flag != 1)
113  current_raster=-1;
114 
115 if(add_topo_flag==1 || add_isohyet_flag==1 ||
116  add_max_flag==1 || add_min_flag==1)
117  change_map_flag=1;
118 
119 send_expose();
120 
121 opoint[0]=npoint[0];
122 opoint[1]=npoint[1];
123 
124 }
125 
126 
127 
128 
129 
void write_screen(void)
Definition: mapper.c:1082
void send_expose(void)
Definition: mapper.c:4026
void redraw_map(int win_x, int win_y, unsigned int button)
Definition: redraw_map.c:4
printf("fbuf is %s\n", fbuf)
int add_topo_flag
Definition: mapper.c:96
int current_raster
Definition: mapper.c:73
signed long xclip
Definition: mapper.c:109
int opoint[2]
Definition: mapper.c:105
int change_map_flag
Definition: mapper.c:86
int display_flag
Definition: mapper.c:100
Dimension height
Dimension width
Arg args[10]
unsigned long XSIZE
int zoom
Widget drawing_area
Definition: mapper.c:185
int npoint[2]
Definition: mapper.c:105
unsigned long YSIZE
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