Debian Codegraph @

imagery/i.ortho.photo/lib/open_camera.c

raw symbols SCIP
1 #include <grass/imagery.h>
2 #include <grass/ortholib.h>
3 #include <grass/gis.h>
4
5 /******************************************************
6 * I_open_cam_file_new()
7 * I_open_cam_file_old()
8 *
9 * open new and old imagery group files in the current mapset
10 *******************************************************/
11 static int camera_error(char *, char *, char *, char *);
12
13 int I_open_cam_file_new(char *camera, char *file)
14 {
15 int fd;
16 char element[100];
17
18 /* get group element name */
19 snprintf(element, sizeof(element), "camera");
20
21 fd = G_open_new(element, camera);
22 if (fd < 0)
23 camera_error(camera, file, "can't create ", "");
24 return fd;
25 }
26
27 int I_open_cam_file_old(char *camera, char *file)
28 {
29 int fd;
30 char element[100];
31
32 /* find the file first */
33 if (!I_find_camera_file(camera, file)) {
34 camera_error(camera, file, "", " not found");
35 return -1;
36 }
37
38 /* get group element name */
39 snprintf(element, sizeof(element), "camera/%s", camera);
40
41 fd = G_open_old(element, camera, G_mapset());
42 if (fd < 0)
43 camera_error(camera, file, "can't open ", "");
44 return fd;
45 }
46
47 static int camera_error(char *camera, char *file, char *msga, char *msgb)
48 {
49 char buf[100];
50
51 snprintf(buf, sizeof(buf), "%sfile [%s] of group [%s in %s]%s", msga, file,
52 camera, G_mapset(), msgb);
53 G_warning("%s", buf);
54
55 return 0;
56 }