~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to imagery/i.vpoints/conv.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "globals.h"
2
 
/* conversion routines to convert from view x,y to cell col,row
3
 
 * as well as cell col,row to cell east,north
4
 
 */
5
 
int view_to_col(View * view, int x)
6
 
{
7
 
    return x - view->cell.left;
8
 
}
9
 
 
10
 
int view_to_row(View * view, int y)
11
 
{
12
 
    return y - view->cell.top;
13
 
}
14
 
 
15
 
int col_to_view(View * view, int col)
16
 
{
17
 
    return view->cell.left + col;
18
 
}
19
 
 
20
 
int row_to_view(View * view, int row)
21
 
{
22
 
    return view->cell.top + row;
23
 
}
24
 
 
25
 
/* in these next 2 routines, location determines if we are
26
 
 * converting from center of the cell (location == .5)
27
 
 * top or left edge (location == 0.0)
28
 
 * bottom or right edge (location == 1.0)
29
 
 */
30
 
 
31
 
double row_to_northing(struct Cell_head *cellhd, int row, double location)
32
 
{
33
 
    return cellhd->north - (row + location) * cellhd->ns_res;
34
 
}
35
 
 
36
 
double col_to_easting(struct Cell_head *cellhd, int col, double location)
37
 
{
38
 
    return cellhd->west + (col + location) * cellhd->ew_res;
39
 
}
40
 
 
41
 
double northing_to_row(struct Cell_head *cellhd, double north)
42
 
{
43
 
    return (cellhd->north - north) / cellhd->ns_res;
44
 
}
45
 
 
46
 
double easting_to_col(struct Cell_head *cellhd, double east)
47
 
{
48
 
    return (east - cellhd->west) / cellhd->ew_res;
49
 
}