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

« back to all changes in this revision

Viewing changes to imagery/i.vpoints/graphics.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 "globals.h"
2
 
#include <grass/display.h>
3
 
#include <grass/raster.h>
4
 
 
5
 
static View *makeview(double bottom, double top, double left, double right)
6
 
{
7
 
    View *view;
8
 
 
9
 
    view = (View *) G_malloc(sizeof(View));
10
 
 
11
 
    top = 100 - top;
12
 
    bottom = 100 - bottom;
13
 
 
14
 
    view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
15
 
    view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
16
 
    view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
17
 
    view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
18
 
 
19
 
    if (view->top < SCREEN_TOP)
20
 
        view->top = SCREEN_TOP;
21
 
    if (view->bottom > SCREEN_BOTTOM)
22
 
        view->bottom = SCREEN_BOTTOM;
23
 
    if (view->left < SCREEN_LEFT)
24
 
        view->left = SCREEN_LEFT;
25
 
    if (view->right > SCREEN_RIGHT)
26
 
        view->right = SCREEN_RIGHT;
27
 
 
28
 
    Outline_box(view->top, view->bottom, view->left, view->right);
29
 
 
30
 
    view->top++;
31
 
    view->bottom--;
32
 
    view->left++;
33
 
    view->right--;
34
 
 
35
 
    view->nrows = view->bottom - view->top + 1;
36
 
    view->ncols = view->right - view->left + 1;
37
 
    view->cell.configured = 0;
38
 
 
39
 
    return view;
40
 
}
41
 
 
42
 
int Init_graphics(void)
43
 
{
44
 
    D_full_screen();
45
 
 
46
 
 
47
 
    SCREEN_TOP = R_screen_top();
48
 
    SCREEN_BOTTOM = R_screen_bot();
49
 
    SCREEN_LEFT = R_screen_left();
50
 
    SCREEN_RIGHT = R_screen_rite();
51
 
 
52
 
    R_standard_color(WHITE);
53
 
 
54
 
    VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
55
 
    VIEW_TITLE2 = makeview(97.5, 100.0, 50.0, 100.0);
56
 
    VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
57
 
    VIEW_MAP2 = makeview(51.0, 97.5, 50.0, 100.0);
58
 
    VIEW_TITLE1_ZOOM = makeview(47.5, 51.0, 0.0, 50.0);
59
 
    VIEW_TITLE2_ZOOM = makeview(47.5, 51.0, 50.0, 100.0);
60
 
    VIEW_MAP1_ZOOM = makeview(2.5, 47.5, 0.0, 50.0);
61
 
    VIEW_MAP2_ZOOM = makeview(2.5, 47.5, 50.0, 100.0);
62
 
    VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
63
 
 
64
 
    G_init_colors(&VIEW_MAP1->cell.colors);
65
 
    G_init_colors(&VIEW_MAP2->cell.colors);
66
 
 
67
 
    return 0;
68
 
}
69
 
 
70
 
int Outline_box(int top, int bottom, int left, int right)
71
 
{
72
 
    R_move_abs(left, top);
73
 
    R_cont_abs(left, bottom);
74
 
    R_cont_abs(right, bottom);
75
 
    R_cont_abs(right, top);
76
 
    R_cont_abs(left, top);
77
 
 
78
 
    return 0;
79
 
}
80
 
 
81
 
 
82
 
int Text_width(char *text)
83
 
{
84
 
    int top, bottom, left, right;
85
 
 
86
 
    R_get_text_box(text, &top, &bottom, &left, &right);
87
 
 
88
 
    if (right > left)
89
 
        return right - left + 1;
90
 
    else
91
 
        return left - right + 1;
92
 
}
93
 
 
94
 
int Text(char *text, int top, int bottom, int left, int right, int edge)
95
 
{
96
 
    R_set_window(top, bottom, left, right);
97
 
    R_move_abs(left + edge, bottom - edge);
98
 
    R_text(text);
99
 
    R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
100
 
 
101
 
    return 0;
102
 
}
103
 
 
104
 
int Uparrow(int top, int bottom, int left, int right)
105
 
{
106
 
    R_move_abs((left + right) / 2, bottom);
107
 
    R_cont_abs((left + right) / 2, top);
108
 
    R_cont_rel((left - right) / 2, (bottom - top) / 2);
109
 
    R_move_abs((left + right) / 2, top);
110
 
    R_cont_rel((right - left) / 2, (bottom - top) / 2);
111
 
 
112
 
    return 0;
113
 
}
114
 
 
115
 
int Downarrow(int top, int bottom, int left, int right)
116
 
{
117
 
    R_move_abs((left + right) / 2, top);
118
 
    R_cont_abs((left + right) / 2, bottom);
119
 
    R_cont_rel((left - right) / 2, (top - bottom) / 2);
120
 
    R_move_abs((left + right) / 2, bottom);
121
 
    R_cont_rel((right - left) / 2, (top - bottom) / 2);
122
 
 
123
 
    return 0;
124
 
}