2
#include "local_proto.h"
4
static int cancel(void);
9
static Objects objects[] = {
10
MENU("CANCEL", cancel, &use),
11
MENU("BOX", zoom_box, &use),
12
MENU("POINT", zoom_point, &use),
13
INFO("Select type of zoom", &use),
17
Input_pointer(objects);
18
return 0; /* return, but don't QUIT */
21
static int cancel(void)
26
/* get target point for source point */
27
void source_to_target(double srx, double sry, double *trx, double *try)
30
double spx, spy, spz; /* source photo */
31
double trz; /* target raster */
33
G_debug(2, "source raster: %.0f %.0f", srx, sry);
35
/* Photo coordinates of center on ZOOM1 */
36
I_georef(srx, sry, &spx, &spy, group.E12, group.N12);
37
G_debug(2, "source photo: %.3f %.3f", spx, spy);
39
/* We need height but we don't know point on target ->
40
* get aproximately the point on target and use that
41
* height for more precise position */
43
for (i = 0; i < 3; i++) {
44
I_inverse_ortho_ref(spx, spy, spz, trx, try, &trz,
46
group.XC, group.YC, group.ZC, group.MI);
48
G_debug(2, "target raster: %.0f %.0f", *trx, *try);
49
get_z_from_cell2(*try, *trx, &spz);
50
G_debug(2, "target raster height: %.0f", spz);
53
G_debug(2, "target rast center: %.0f %.0f", *trx, *try);
58
double srx, sry; /* source raster */
59
double trx, try; /* target raster */
62
double width, magnific;
67
Compute_ortho_equation();
68
if (group.con_equation_stat <= 0)
71
/* Calc scale for target */
72
sry = VIEW_MAP1_ZOOM->cell.head.north;
73
srx = VIEW_MAP1_ZOOM->cell.head.west;
74
source_to_target(srx, sry, &trl, &try);
75
srx = VIEW_MAP1_ZOOM->cell.head.east;
76
source_to_target(srx, sry, &trr, &try);
77
width = trr - trl; /* ZOOM1 width in target units */
79
/* Calc magnification - relation between resolution
80
* in zoom window and cell head */
81
magnific = (VIEW_MAP1_ZOOM->right - VIEW_MAP1_ZOOM->left) / width;
82
G_debug(3, "width = %.0f magnific = %f", width, magnific);
84
/* Raster coordinates of center on ZOOM1 */
85
srx = (VIEW_MAP1_ZOOM->cell.head.east +
86
VIEW_MAP1_ZOOM->cell.head.west) / 2;
87
sry = (VIEW_MAP1_ZOOM->cell.head.north +
88
VIEW_MAP1_ZOOM->cell.head.south) / 2;
90
source_to_target(srx, sry, &trx, &try);
92
vx = easting_to_col(&VIEW_MAP2->cell.head, trx);
93
vy = northing_to_row(&VIEW_MAP2->cell.head, try);
94
G_debug(2, "target rast col, row: %d %d", vx, vy);
96
vx = col_to_view(VIEW_MAP2, vx);
97
vy = row_to_view(VIEW_MAP2, vy);
99
G_debug(2, "target view col, row: %d %d", vx, vy);
101
zoom_point2(vx, vy, 0, magnific);