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

« back to all changes in this revision

Viewing changes to imagery/i.ortho.photo/photo.2image/view.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 <string.h>
2
 
#include <grass/raster.h>
3
 
#include "globals.h"
4
 
 
5
 
int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res  /* original map resolution */
6
 
    )
7
 
{
8
 
    Erase_view(view);
9
 
    view->cell.configured = 0;
10
 
 
11
 
    /* copy the cell name into the view */
12
 
    strcpy(view->cell.name, name);
13
 
    strcpy(view->cell.mapset, mapset);
14
 
 
15
 
    /* determine the map edges */
16
 
    view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
17
 
    view->cell.right = view->cell.left + view->cell.head.cols - 1;
18
 
    view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
19
 
    view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
20
 
 
21
 
    /* remember original resolutions */
22
 
    view->cell.ns_res = ns_res;
23
 
    view->cell.ew_res = ew_res;
24
 
 
25
 
    view->cell.configured = 1;
26
 
 
27
 
    return 0;
28
 
}
29
 
 
30
 
int In_view(View * view, int x, int y)
31
 
{
32
 
    return (x >= view->left && x <= view->right && y >= view->top &&
33
 
            y <= view->bottom);
34
 
}
35
 
 
36
 
int Erase_view(View * view)
37
 
{
38
 
    R_standard_color(BLACK);
39
 
    R_box_abs(view->left, view->top, view->right, view->bottom);
40
 
 
41
 
    return 0;
42
 
}
43
 
 
44
 
double magnification(View * view)
45
 
{
46
 
    if (!view->cell.configured)
47
 
        return ((double)0.0);
48
 
    return (view->cell.ew_res / view->cell.head.ew_res);
49
 
}