2 #include <grass/display.h>
45 static struct vector U_to_D_conv;
46 static struct vector D_to_A_conv;
49 static int is_lat_lon;
50 static struct vector resolution;
74 struct vector D_size, U_size;
76 WIND.
north = (double)t;
77 WIND.
south = (double)b;
78 WIND.
west = (double)l;
79 WIND.
east = (double)r;
81 is_lat_lon = (window->proj == PROJECTION_LL);
83 resolution.
y = window->ns_res;
84 resolution.
x = window->ew_res;
87 U.
west = window->west;
88 U.
east = window->east;
89 U.
south = window->south;
90 U.
north = window->north;
98 U_to_D_conv.
x = D_size.
x / U_size.
x;
99 U_to_D_conv.
y = D_size.
y / U_size.
y;
101 if (U_to_D_conv.
x > U_to_D_conv.
y) {
102 U_to_D_conv.
x = U_to_D_conv.
y;
104 (double)(
int)((WIND.
west + WIND.
east -
105 U_size.
x * U_to_D_conv.
x) / 2);
107 (double)(
int)((WIND.
west + WIND.
east +
108 U_size.
x * U_to_D_conv.
x) / 2);
113 U_to_D_conv.
y = U_to_D_conv.
x;
118 U_size.
y * U_to_D_conv.
y) / 2);
121 U_size.
y * U_to_D_conv.
y) / 2);
124 D_size.
x =
D.east -
D.west;
125 D_size.
y =
D.south -
D.north;
127 ARRAY_SIZE.
x = window->cols;
128 ARRAY_SIZE.
y = window->rows;
132 A.
east = (double)ARRAY_SIZE.
x;
133 A.
south = (
double)ARRAY_SIZE.
y;
135 D_to_A_conv.
x = (double)ARRAY_SIZE.
x / D_size.
x;
136 D_to_A_conv.
y = (
double)ARRAY_SIZE.
y / D_size.
y;
140 " D_w %10.1f D_e %10.1f D_s %10.1f D_n %10.1f\n",
141 D.west,
D.east,
D.south,
D.north);
143 " A_w %10.1f A_e %10.1f A_s %10.1f A_n %10.1f\n",
146 " U_w %10.1f U_e %10.1f U_s %10.1f U_n %10.1f\n",
149 " ARRAY_ROWS %d resolution_ns %10.2f\n", ARRAY_SIZE.
y,
151 fprintf(stderr,
" ARRAY_COLS %d resolution_ew %10.2f\n", ARRAY_SIZE.
x,
153 fprintf(stderr,
" D_to_A_conv.x %10.1f D_to_A_conv.y %10.1f \n",
154 D_to_A_conv.
x, D_to_A_conv.
y);
155 fprintf(stderr,
" BOT %10.1f TOP %10.1f LFT %10.1f RHT %10.1f\n",
169 return (resolution.
y);
173 return (resolution.
x);
178 return (U_to_D_conv.
x);
182 return (U_to_D_conv.
y);
247 x[0][1] = (
int)A.
east;
249 x[1][1] = (
int)A.
south;
254 x[0][0] = (
int)
D.west;
255 x[0][1] = (
int)
D.east;
256 x[1][0] = (
int)
D.north;
257 x[1][1] = (
int)
D.south;
272 return (U.
north - U_row) / resolution.
y;
288 return (U_col - U.
west) / resolution.
x;
304 return D.north + (A_row - A.
north) / D_to_A_conv.
y;
321 return D.west + (A_col - A.
west) / D_to_A_conv.
x;
337 return D.north + (U.
north - U_row) * U_to_D_conv.
y;
353 return D.west + (U_col - U.
west) * U_to_D_conv.
x;
369 return U.
north - (D_row -
D.north) / U_to_D_conv.
y;
385 return U.
west + (D_col -
D.west) / U_to_D_conv.
x;
401 return A.
north + (D_row -
D.north) * D_to_A_conv.
y;
417 return A.
west + (D_col -
D.west) * D_to_A_conv.
x;
double D_d_to_a_col(double D_col)
screen to array (x)
double D_u_to_a_row(double U_row)
earth to array (north)
double D_get_a_east(void)
double D_get_u_to_d_yconv(void)
double D_d_to_a_row(double D_row)
screen to array (y)
double D_d_to_u_col(double D_col)
screen to earth (x)
double D_get_d_west(void)
double D_get_u_north(void)
double D_get_a_south(void)
double D_get_ew_resolution(void)
double D_get_a_west(void)
int D_do_conversions(const struct Cell_head *window, int t, int b, int l, int r)
initialize conversions
double D_get_u_east(void)
double D_get_d_east(void)
double D_get_d_north(void)
double D_u_to_d_col(double U_col)
earth to screen (east)
void D_get_u(double x[2][2])
double D_get_a_north(void)
void D_get_d(int x[2][2])
double D_get_ns_resolution(void)
double D_get_u_south(void)
double D_u_to_a_col(double U_col)
earth to array (east
double D_a_to_d_row(double A_row)
array to screen (row)
double D_get_d_south(void)
double D_get_u_to_d_xconv(void)
double D_d_to_u_row(double D_row)
screen to earth (y)
void D_get_a(int x[2][2])
double D_u_to_d_row(double U_row)
earth to screen (north)
double D_get_u_west(void)
double D_a_to_d_col(double A_col)
array to screen (column)