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
33
XSIZE
=(
display_set
[
display_flag
].
xmax
[0]-
34
display_set
[
display_flag
].
xmin
[0])/10;
35
YSIZE
=(
display_set
[
display_flag
].
ymax
[0]-
36
display_set
[
display_flag
].
ymin
[0])/10;
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
107
clear_drawable
(
window
);
108
109
write_screen
();
110
111
opoint
[0]=
npoint
[0];
112
opoint
[1]=
npoint
[1];
113
114
}
115
116
117
i
static int i
Definition:
get_apps_defaults.c:110
write_screen
void write_screen(void)
Definition:
mapper.c:1082
clear_drawable
void clear_drawable(Drawable)
Definition:
mapper.c:1067
redraw_map
void redraw_map(int win_x, int win_y, unsigned int button)
Definition:
redraw_map.c:4
add_topo_flag
int add_topo_flag
Definition:
mapper.c:96
current_raster
int current_raster
Definition:
mapper.c:73
xclip
signed long xclip
Definition:
mapper.c:109
yclip
signed long yclip
Definition:
mapper.c:109
opoint
int opoint[2]
Definition:
mapper.c:105
window
Window window
Definition:
mapper.c:190
change_map_flag
int change_map_flag
Definition:
mapper.c:86
cursorflag
int cursorflag[4]
Definition:
mapper.c:69
display_flag
int display_flag
Definition:
mapper.c:100
height
Dimension height
Definition:
plot_qpf_legend.c:22
width
Dimension width
Definition:
plot_qpf_legend.c:22
args
Arg args[10]
Definition:
plot_qpf_legend.c:23
XSIZE
unsigned long XSIZE
Definition:
plot_qpf_legend.c:24
zoom
int zoom
Definition:
plot_qpf_legend.c:9
drawing_area
Widget drawing_area
Definition:
mapper.c:185
npoint
int npoint[2]
Definition:
mapper.c:105
YSIZE
unsigned long YSIZE
Definition:
plot_qpf_legend.c:24
prototypes.h
display_set
Definition:
misc.h:603
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
Generated by
1.9.1