~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to display/d.zoom/print.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <string.h>
2
 
#include <grass/gis.h>
3
 
#include <grass/display.h>
4
 
#include <grass/raster.h>
5
 
#include "local_proto.h"
6
 
 
7
 
static int max(int a, int b)
8
 
{
9
 
    return a > b ? a : b;
10
 
}
11
 
 
12
 
int print_coor(struct Cell_head *window, double north, double east)
13
 
{
14
 
    char buffer[200];
15
 
    int len_n, len_s, len_e, len_w, t;
16
 
 
17
 
    len_n = len_s = len_e = len_w = 0;
18
 
 
19
 
    G_limit_north(&north, window->proj);
20
 
    G_limit_east(&east, window->proj);
21
 
 
22
 
    t = (window->north - north) / window->ns_res;
23
 
    north = window->north - (t) * window->ns_res;
24
 
 
25
 
    t = (window->east - east) / window->ew_res;
26
 
    east = window->east - (t) * window->ew_res;
27
 
 
28
 
    strcpy(buffer, "?");
29
 
    G_format_northing(north, buffer, window->proj);
30
 
    len_n = max(len_n, strlen(buffer));
31
 
    fprintf(stderr, "%-*s(N)  ", len_n, buffer);
32
 
 
33
 
    strcpy(buffer, "?");
34
 
    G_format_easting(east, buffer, window->proj);
35
 
    len_e = max(len_e, strlen(buffer));
36
 
    fprintf(stderr, "%-*s(E)  ", len_e, buffer);
37
 
 
38
 
    fprintf(stderr, "\r");
39
 
    fflush(stderr);
40
 
 
41
 
    return 1;
42
 
}
43
 
 
44
 
int print_win(struct Cell_head *window, double north, double south,
45
 
              double east, double west)
46
 
{
47
 
    char buffer[200];
48
 
    int len_n, len_s, len_e, len_w, t;
49
 
 
50
 
    len_n = len_s = len_e = len_w = 0;
51
 
 
52
 
    G_limit_north(&north, window->proj);
53
 
    G_limit_south(&south, window->proj);
54
 
    G_limit_east(&east, window->proj);
55
 
    G_limit_west(&west, window->proj);
56
 
 
57
 
    t = (window->north - north) / window->ns_res;
58
 
    north = window->north - (t) * window->ns_res;
59
 
 
60
 
    t = (south - window->south) / window->ns_res;
61
 
    south = window->south + (t) * window->ns_res;
62
 
 
63
 
    t = (window->east - east) / window->ew_res;
64
 
    east = window->east - (t) * window->ew_res;
65
 
 
66
 
    t = (west - window->west) / window->ew_res;
67
 
    west = window->west + (t) * window->ew_res;
68
 
 
69
 
    strcpy(buffer, "?");
70
 
    G_format_northing(north, buffer, window->proj);
71
 
    len_n = max(len_n, strlen(buffer));
72
 
    fprintf(stderr, "north: %-*s  ", len_n, buffer);
73
 
 
74
 
    strcpy(buffer, "?");
75
 
    G_format_northing(south, buffer, window->proj);
76
 
    len_s = max(len_s, strlen(buffer));
77
 
    fprintf(stderr, "south: %-*s  ", len_s, buffer);
78
 
 
79
 
    strcpy(buffer, "?");
80
 
    G_format_easting(east, buffer, window->proj);
81
 
    len_e = max(len_e, strlen(buffer));
82
 
    fprintf(stderr, "east: %-*s  ", len_e, buffer);
83
 
 
84
 
    strcpy(buffer, "?");
85
 
    G_format_easting(west, buffer, window->proj);
86
 
    len_w = max(len_w, strlen(buffer));
87
 
    fprintf(stderr, "west: %-*s  ", len_w, buffer);
88
 
 
89
 
    fprintf(stderr, "\r");
90
 
    fflush(stderr);
91
 
 
92
 
    return 1;
93
 
}
94
 
 
95
 
int print_limit(struct Cell_head *window, struct Cell_head *defwin)
96
 
{
97
 
    char buffer[1000];
98
 
    int limit = 0;
99
 
 
100
 
    if (window->north > defwin->north) {
101
 
        sprintf(buffer, "North");
102
 
        limit = 1;
103
 
    }
104
 
    if (window->south < defwin->south) {
105
 
        if (limit)
106
 
            sprintf(buffer, "%s, south", buffer);
107
 
        else
108
 
            sprintf(buffer, "South");
109
 
        limit = 1;
110
 
    }
111
 
    if (window->east > defwin->east) {
112
 
        if (limit)
113
 
            sprintf(buffer, "%s, east", buffer);
114
 
        else
115
 
            sprintf(buffer, "East");
116
 
        limit = 1;
117
 
    }
118
 
    if (window->west < defwin->west) {
119
 
        if (limit)
120
 
            sprintf(buffer, "%s, west", buffer);
121
 
        else
122
 
            sprintf(buffer, "West");
123
 
        limit = 1;
124
 
    }
125
 
    if (limit) {
126
 
        fprintf(stderr, "%s limit of default region reached.\n", buffer);
127
 
    }
128
 
 
129
 
    return (limit);
130
 
}