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,
47
group.omega, group.phi, group.kappa);
49
G_debug(2, "target raster: %.0f %.0f", *trx, *try);
50
get_z_from_cell2(*try, *trx, &spz);
51
G_debug(2, "target raster height: %.0f", spz);
54
G_debug(2, "target rast center: %.0f %.0f", *trx, *try);
59
double srx, sry; /* source raster */
60
double trx, try; /* target raster */
63
double width, magnific;
68
Compute_ortho_equation();
69
if (group.con_equation_stat <= 0)
72
/* Calc scale for target */
73
sry = VIEW_MAP1_ZOOM->cell.head.north;
74
srx = VIEW_MAP1_ZOOM->cell.head.west;
75
source_to_target(srx, sry, &trl, &try);
76
srx = VIEW_MAP1_ZOOM->cell.head.east;
77
source_to_target(srx, sry, &trr, &try);
78
width = trr - trl; /* ZOOM1 width in target units */
80
/* Calc magnification - relation between resolution
81
* in zoom window and cell head */
82
magnific = (VIEW_MAP1_ZOOM->right - VIEW_MAP1_ZOOM->left) / width;
83
G_debug(3, "width = %.0f magnific = %f", width, magnific);
85
/* Raster coordinates of center on ZOOM1 */
86
srx = (VIEW_MAP1_ZOOM->cell.head.east +
87
VIEW_MAP1_ZOOM->cell.head.west) / 2;
88
sry = (VIEW_MAP1_ZOOM->cell.head.north +
89
VIEW_MAP1_ZOOM->cell.head.south) / 2;
91
source_to_target(srx, sry, &trx, &try);
93
vx = easting_to_col(&VIEW_MAP2->cell.head, trx);
94
vy = northing_to_row(&VIEW_MAP2->cell.head, try);
95
G_debug(2, "target rast col, row: %d %d", vx, vy);
97
vx = col_to_view(VIEW_MAP2, vx);
98
vy = row_to_view(VIEW_MAP2, vy);
100
G_debug(2, "target view col, row: %d %d", vx, vy);
102
zoom_point2(vx, vy, 0, magnific);