2
/****************************************************************************
5
* AUTHOR(S): Mike Baba (original contributor)
6
* Markus Neteler <neteler itc.it>,
7
* Roberto Flor <flor itc.it>,
8
* Bernhard Reiter <bernhard intevation.de>,
9
* Glynn Clements <glynn gclements.plus.com>
12
* PURPOSE: Select the elevation model
13
* COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
15
* This program is free software under the GNU General Public
16
* License (>=v2). Read the file COPYING that comes with GRASS
19
*****************************************************************************/
21
/* read the target for the block and cast it into the alternate GRASS env */
27
#include <grass/gis.h>
28
#include <grass/imagery.h>
29
#include <grass/glocale.h>
30
#include "orthophoto.h"
42
int main(int argc, char *argv[])
45
struct GModule *module;
46
struct Option *group_opt;
48
char location[GMAPSET_MAX];
49
char mapset[GMAPSET_MAX];
50
char group[GNAME_MAX];
56
/* must run in a term window */
57
G_putenv("GRASS_UI_TERM", "1");
61
module = G_define_module();
62
module->keywords = _("imagery, orthorectify");
64
_("Interactively select or modify the target elevation model.");
66
group_opt = G_define_standard_option(G_OPT_I_GROUP);
67
group_opt->description =
68
_("Name of imagery group for ortho-rectification");
70
if (G_parser(argc, argv))
73
elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char));
74
mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char));
75
tl = (char *)G_malloc(80 * sizeof(char));
76
math_exp = (char *)G_malloc(80 * sizeof(char));
77
units = (char *)G_malloc(80 * sizeof(char));
78
nd = (char *)G_malloc(80 * sizeof(char));
87
strcpy(group, group_opt->answer);
89
G_suppress_warnings(1);
90
if (!I_get_target(group, location, mapset)) {
91
sprintf(buf, _("Target information for group [%s] missing\n"), group);
95
G_suppress_warnings(0);
96
sprintf(buf, "%s/%s", G_gisdbase(), location);
97
if (access(buf, 0) != 0) {
98
sprintf(buf, _("Target location [%s] not found\n"), location);
102
I_get_group_elev(group, elev_layer, mapset_elev, tl, math_exp, units, nd);
104
G__setenv("LOCATION_NAME", location);
106
stat = G__mapset_permissions(mapset);
108
G__setenv("MAPSET", mapset);
109
G__create_alt_search_path();
111
G__switch_search_path();
114
/* get elevation layer raster map in target location */
116
ask_elev(group, location, mapset);
118
/* select current location */
119
select_current_env();
121
I_put_group_elev(group, elev_layer, mapset_elev, tl,
122
math_exp, units, nd);
127
sprintf(buf, _("Mapset [%s] in target location [%s] - "), mapset, location);
128
strcat(buf, stat == 0 ? _("permission denied\n") : _("not found\n"));
131
strcat(buf, _("Please select a target for group"));
133
G_suppress_warnings(0);
138
int select_current_env(void)
140
if (which_env != 0) {
142
G__switch_search_path();
149
int select_target_env(void)
151
if (which_env != 1) {
153
G__switch_search_path();