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)
58 double e1,
double n1,
double e2,
double n2,
67 size = cp->
count *
sizeof(double);
72 size = cp->
count *
sizeof(int);
84 static int I_write_control_points(FILE * fd,
const struct Control_Points *cp)
88 fprintf(fd,
"# %7s %15s %15s %15s %9s status\n",
"",
"image",
"",
90 fprintf(fd,
"# %15s %15s %15s %15s (1=ok)\n",
"east",
"north",
"east",
93 for (i = 0; i < cp->
count; i++)
95 fprintf(fd,
" %15f %15f %15f %15f %4d\n",
96 cp->
e1[i], cp->
n1[i], cp->
e2[i], cp->
n2[i],
124 G_warning(
_(
"Unable to open control point file for group [%s in %s]"),
129 stat = I_read_control_points(fd, cp);
132 G_warning(
_(
"Bad format in control point file for group [%s in %s]"),
159 G_warning(
_(
"Unable to create control point file for group [%s in %s]"),
164 I_write_control_points(fd, cp);
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
int I_new_control_point(struct Control_Points *cp, double e1, double n1, double e2, double n2, int status)
add new control point
FILE * I_fopen_group_file_old(const char *, const char *)
Open group file for reading.
void G_strip(char *)
Removes all leading and trailing white space from string.
int I_put_control_points(const char *group, const struct Control_Points *cp)
write group control points
int I_get_control_points(const char *group, struct Control_Points *cp)
read group control points
FILE * I_fopen_group_file_new(const char *, const char *)
const char * G_mapset(void)
Get current mapset name.
void G_warning(const char *,...) __attribute__((format(printf