4 #define POINT_FILE "POINTS"
6 static int I_read_control_points(FILE *fd,
struct Control_Points *cp)
23 while (
G_getl2(buf,
sizeof buf, fd)) {
25 if (*buf ==
'#' || *buf == 0)
27 if (sscanf(buf,
"%lf%lf%lf%lf%d", &e1, &n1, &e2, &n2, &status) == 5)
57 double e2,
double n2,
int status)
65 size = cp->
count *
sizeof(double);
70 size = cp->
count *
sizeof(int);
82 static int I_write_control_points(FILE *fd,
const struct Control_Points *cp)
86 fprintf(fd,
"# %7s %15s %15s %15s %9s status\n",
"",
"image",
"",
"target",
88 fprintf(fd,
"# %15s %15s %15s %15s (1=ok)\n",
"east",
"north",
"east",
91 for (i = 0; i < cp->
count; i++)
93 fprintf(fd,
" %15f %15f %15f %15f %4d\n", cp->
e1[i], cp->
n1[i],
120 G_warning(
_(
"Unable to open control point file for group [%s in %s]"),
125 stat = I_read_control_points(fd, cp);
128 G_warning(
_(
"Bad format in control point file for group [%s in %s]"),
154 G_warning(
_(
"Unable to create control point file for group [%s in %s]"),
159 I_write_control_points(fd, cp);
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void G_warning(const char *,...) __attribute__((format(printf
const char * G_mapset(void)
Get current mapset name.
void G_strip(char *)
Removes all leading and trailing white space from string.
FILE * I_fopen_group_file_new(const char *, const char *)
FILE * I_fopen_group_file_old(const char *, const char *)
Open group file for reading.
int I_get_control_points(const char *group, struct Control_Points *cp)
read group control points
int I_new_control_point(struct Control_Points *cp, double e1, double n1, double e2, double n2, int status)
add new control point
int I_put_control_points(const char *group, const struct Control_Points *cp)
write group control points