1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <stdlib.h>
#include <string.h>
#include "global.h"
int get_control_points(struct Image_Group *group, int order)
{
char msg[GNAME_MAX + GMAPSET_MAX + 64];
if (!I_get_control_points(group->name, &group->control_points))
exit(0);
sprintf(msg, _("Control Point file for group <%s@%s> - "), group->name,
G_mapset());
G_verbose_message(_("Computing equations..."));
if (order == 0) {
switch (I_compute_georef_equations_tps(&group->control_points,
&group->E12_t, &group->N12_t,
&group->E21_t, &group->N21_t)) {
case 0:
strcat(
msg,
_("Not enough active control points for thin plate spline."));
break;
case -1:
strcat(msg, _("Poorly placed control points."));
strcat(msg, _(" Can not generate the transformation equation."));
break;
case -2:
strcat(msg,
_("Not enough memory to solve transformation equations."));
break;
case -3:
strcat(msg, _("Invalid order."));
break;
default:
return 1;
}
}
else {
switch (I_compute_georef_equations(&group->control_points, group->E12,
group->N12, group->E21, group->N21,
order)) {
case 0:
sprintf(&msg[strlen(msg)],
_("Not enough active control points for current order, %d "
"are required."),
(order + 1) * (order + 2) / 2);
break;
case -1:
strcat(msg, _("Poorly placed control points."));
strcat(msg, _(" Can not generate the transformation equation."));
break;
case -2:
strcat(msg,
_("Not enough memory to solve transformation equations."));
break;
case -3:
strcat(msg, _("Invalid order"));
break;
default:
return 1;
}
}
G_fatal_error("%s", msg);
return 0;
}
|