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