~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to imagery/i.ortho.photo/photo.2image/where.c

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <grass/imagery.h>
2
 
#include "globals.h"
3
 
 
4
 
 
5
 
static char buf[300];
6
 
 
7
 
static int where_12(View *, int, int);
8
 
static int where_21(View *, int, int);
9
 
static int where_am_i(View *, int, int, Window *, double *, double *,
10
 
                      Window *);
11
 
 
12
 
 
13
 
int where(int x, int y)
14
 
{
15
 
    if (VIEW_MAP1->cell.configured && In_view(VIEW_MAP1, x, y))
16
 
        where_12(VIEW_MAP1, x, y);
17
 
    else if (VIEW_MAP1_ZOOM->cell.configured && In_view(VIEW_MAP1_ZOOM, x, y))
18
 
        where_12(VIEW_MAP1_ZOOM, x, y);
19
 
    /*
20
 
       else if (VIEW_MAP2->cell.configured && In_view (VIEW_MAP2, x, y))
21
 
       where_21 (VIEW_MAP2, x, y);
22
 
       else if (VIEW_MAP2_ZOOM->cell.configured && In_view (VIEW_MAP2_ZOOM, x, y))
23
 
       where_21 (VIEW_MAP2_ZOOM, x, y);
24
 
     */
25
 
    return 0;                   /* return but don't quit */
26
 
}
27
 
 
28
 
static int where_12(View * view, int x, int y)
29
 
{
30
 
    where_am_i(view, x, y, MENU_WINDOW, group.E12, group.N12, INFO_WINDOW);
31
 
 
32
 
    return 0;
33
 
}
34
 
 
35
 
static int where_21(View * view, int x, int y)
36
 
{
37
 
    where_am_i(view, x, y, INFO_WINDOW, group.E21, group.N21, MENU_WINDOW);
38
 
 
39
 
    return 0;
40
 
}
41
 
 
42
 
static int where_am_i(View * view, int x, int y, Window * w1, double *E,
43
 
                      double *N, Window * w2)
44
 
{
45
 
    double e1, n1, e2, n2;
46
 
    int row, col;
47
 
 
48
 
    /* convert x,y to east,north at center of cell */
49
 
    col = view_to_col(view, x);
50
 
    e1 = col_to_easting(&view->cell.head, col, 0.5);
51
 
    row = view_to_row(view, y);
52
 
    n1 = row_to_northing(&view->cell.head, row, 0.5);
53
 
 
54
 
    Curses_clear_window(w1);
55
 
    sprintf(buf, "East:  %10.2f", e1);
56
 
    Curses_write_window(w1, 3, 3, buf);
57
 
    sprintf(buf, "North: %10.2f", n1);
58
 
    Curses_write_window(w1, 4, 3, buf);
59
 
 
60
 
    /* if transformation equation is useable, determine point via equation */
61
 
    if (group.ref_equation_stat <= 0)
62
 
        return 1;
63
 
 
64
 
    I_georef(e1, n1, &e2, &n2, E, N);
65
 
    Curses_clear_window(w2);
66
 
    sprintf(buf, "East:  %10.2f", e2);
67
 
    Curses_write_window(w2, 3, 3, buf);
68
 
    sprintf(buf, "North: %10.2f", n2);
69
 
    Curses_write_window(w2, 4, 3, buf);
70
 
 
71
 
    return 0;
72
 
}