2
/****************************************************************************
4
* MODULE: i.photo.camera
5
* AUTHOR(S): Mike Baba, DBA Systems, Inc. (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: Creates or modifies entries in a camera reference file
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
/* select a camera reference file for a given imagery group */
28
#include <unistd.h> /* for sleep() */
31
#include <grass/gis.h>
32
#include <grass/glocale.h>
33
#include "orthophoto.h"
36
int main(int argc, char *argv[])
38
struct GModule *module;
39
struct Option *group_opt, *camera_opt;
43
char group[GNAME_MAX];
49
/* must run in a term window */
50
G_putenv("GRASS_UI_TERM", "1");
54
module = G_define_module();
55
module->keywords = _("imagery, orthorectify");
57
_("Interactively select and modify the imagery group camera reference file.");
59
group_opt = G_define_standard_option(G_OPT_I_GROUP);
60
group_opt->description =
61
_("Name of imagery group for ortho-rectification");
63
camera_opt = G_define_standard_option(G_OPT_F_INPUT);
64
camera_opt->key = "camera";
65
camera_opt->required = NO;
66
camera_opt->gisprompt = "old_file,camera,camera";
67
camera_opt->description =
68
_("Name of camera reference file to use");
70
if (G_parser(argc, argv))
74
camera = (char *)G_malloc(GNAME_MAX * sizeof(char));
76
location = G_location();
79
strcpy(group, group_opt->answer);
81
if (!camera_opt->answer) {
82
/* select the camera to use */
83
if (!I_ask_camera_any(
84
_("Enter a camera reference file to be used with this imagery group"),
90
if (G_legal_filename (camera_opt->answer) < 0)
91
G_fatal_error(_("<%s> is an illegal file name"),
94
strcpy(camera, camera_opt->answer);
97
/* I_put_camera (camera); */
98
I_put_group_camera(group, camera);
101
_("Group [%s] in location [%s] mapset [%s] now has camera file [%s]"),
102
group, location, mapset, camera);
104
/* slight pause before the screen is cleared */
108
/* show the camera info for modification */
109
if (I_find_camera(camera)) {
111
I_get_cam_info(camera, &cam_info);
113
mod_cam_info(have_old, &cam_info);
114
I_put_cam_info(camera, &cam_info);