4
Loop through all files to be rectified and do the retification.
5
Handles things like support files.
11
#include <sys/types.h>
16
int exec_rectify(char *extension, char *interp_method, char *angle_map)
24
struct Categories cats;
26
int colr_ok, hist_ok, cats_ok;
27
long start_time, rectify_time;
30
struct cache *ebuffer;
32
G_debug(1, "Open elevation raster: ");
34
/* open elevation raster */
36
G_set_window(&target_window);
37
G_debug(1, "target window: rs=%d cs=%d n=%f s=%f w=%f e=%f\n",
38
target_window.rows, target_window.cols, target_window.north,
39
target_window.south, target_window.west, target_window.east);
41
elevfd = G_open_cell_old(elev_name, elev_mapset);
43
G_fatal_error(_("Could not open elevation raster"));
46
ebuffer = readcell(elevfd, seg_mb_elev, 1);
50
/* get an average elevation of the control points */
51
/* this is used only if target cells have no elevation */
52
get_aver_elev(&group.control_points, &aver_z);
54
/* rectify each file */
55
for (n = 0; n < group.group_ref.nfiles; n++) {
59
name = group.group_ref.file[n].name;
60
mapset = group.group_ref.file[n].mapset;
62
G_malloc(strlen(group.group_ref.file[n].name) + strlen(extension) + 1);
63
strcpy(result, group.group_ref.file[n].name);
64
strcat(result, extension);
66
G_debug(2, "ORTHO RECTIFYING:");
67
G_debug(2, "NAME %s", name);
68
G_debug(2, "MAPSET %s", mapset);
69
G_debug(2, "RESULT %s", result);
70
G_debug(2, "select_current_env...");
72
G_message(_("Rectified input raster map <%s> will be saved as <%s>"),
77
cats_ok = G_read_cats(name, mapset, &cats) >= 0;
78
colr_ok = G_read_colors(name, mapset, &colr) > 0;
79
hist_ok = G_read_history(name, mapset, &hist) >= 0;
80
G_debug(2, "reading was fine...");
84
G_debug(2, "Starting the rectification...");
86
if (rectify(name, mapset, ebuffer, aver_z, result, interp_method)) {
87
G_debug(2, "Done. Writing results...");
90
G_write_cats(result, &cats);
94
G_write_colors(result, G_mapset(), &colr);
98
G_write_history(result, &hist);
100
/* Initialze History */
102
G_short_history(name, type, &hist);
103
G_command_history(&hist);
104
G_write_history(result, &hist);
106
select_current_env();
108
report(rectify_time - start_time, 1);
117
release_cache(ebuffer);
120
camera_angle(angle_map);