3
#include <grass/display.h>
4
#include <grass/raster.h>
5
#include "local_proto.h"
7
static int max(int a, int b)
12
int print_coor(struct Cell_head *window, double north, double east)
15
int len_n, len_s, len_e, len_w, t;
17
len_n = len_s = len_e = len_w = 0;
19
G_limit_north(&north, window->proj);
20
G_limit_east(&east, window->proj);
22
t = (window->north - north) / window->ns_res;
23
north = window->north - (t) * window->ns_res;
25
t = (window->east - east) / window->ew_res;
26
east = window->east - (t) * window->ew_res;
29
G_format_northing(north, buffer, window->proj);
30
len_n = max(len_n, strlen(buffer));
31
fprintf(stderr, "%-*s(N) ", len_n, 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);
38
fprintf(stderr, "\r");
44
int print_win(struct Cell_head *window, double north, double south,
45
double east, double west)
48
int len_n, len_s, len_e, len_w, t;
50
len_n = len_s = len_e = len_w = 0;
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);
57
t = (window->north - north) / window->ns_res;
58
north = window->north - (t) * window->ns_res;
60
t = (south - window->south) / window->ns_res;
61
south = window->south + (t) * window->ns_res;
63
t = (window->east - east) / window->ew_res;
64
east = window->east - (t) * window->ew_res;
66
t = (west - window->west) / window->ew_res;
67
west = window->west + (t) * window->ew_res;
70
G_format_northing(north, buffer, window->proj);
71
len_n = max(len_n, strlen(buffer));
72
fprintf(stderr, "north: %-*s ", len_n, 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);
80
G_format_easting(east, buffer, window->proj);
81
len_e = max(len_e, strlen(buffer));
82
fprintf(stderr, "east: %-*s ", len_e, 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);
89
fprintf(stderr, "\r");
95
int print_limit(struct Cell_head *window, struct Cell_head *defwin)
100
if (window->north > defwin->north) {
101
sprintf(buffer, "North");
104
if (window->south < defwin->south) {
106
sprintf(buffer, "%s, south", buffer);
108
sprintf(buffer, "South");
111
if (window->east > defwin->east) {
113
sprintf(buffer, "%s, east", buffer);
115
sprintf(buffer, "East");
118
if (window->west < defwin->west) {
120
sprintf(buffer, "%s, west", buffer);
122
sprintf(buffer, "West");
126
fprintf(stderr, "%s limit of default region reached.\n", buffer);