| 1 |
#include <grass/imagery.h> |
| 2 |
#include <grass/ortholib.h> |
| 3 |
#include <grass/gis.h> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 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 |
|
| 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 |
|
| 33 |
if (!I_find_camera_file(camera, file)) { |
| 34 |
camera_error(camera, file, "", " not found"); |
| 35 |
return -1; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 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 |
} |