File: cp.c

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (69 lines) | stat: -rw-r--r-- 2,231 bytes parent folder | download | duplicates (2)
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;
}