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

« back to all changes in this revision

Viewing changes to imagery/i.ortho.photo/i.photo.2image/drawcell.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 <stdlib.h>
2
 
#include <grass/gis.h>
3
 
#include <grass/display.h>
4
 
#include <grass/raster.h>
5
 
#include "globals.h"
6
 
 
7
 
int drawcell(View * view)
8
 
{
9
 
    int fd;
10
 
    int left, top;
11
 
    int ncols, nrows;
12
 
    int row;
13
 
    CELL *cell;
14
 
    struct Colors *colors = NULL;
15
 
    int read_colors = 0;
16
 
    char msg[100];
17
 
 
18
 
 
19
 
    if (!view->cell.configured)
20
 
        return 0;
21
 
    if (view == VIEW_MAP1 || view == VIEW_MAP1_ZOOM) {
22
 
        colors = &VIEW_MAP1->cell.colors;
23
 
        read_colors = view == VIEW_MAP1;
24
 
    }
25
 
    if (read_colors) {
26
 
        G_free_colors(colors);
27
 
        if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
28
 
            return 0;
29
 
    }
30
 
 
31
 
 
32
 
    display_title(view);
33
 
 
34
 
    set_colors(colors);
35
 
 
36
 
    G_set_window(&view->cell.head);
37
 
    nrows = G_window_rows();
38
 
    ncols = G_window_cols();
39
 
 
40
 
    left = view->cell.left;
41
 
    top = view->cell.top;
42
 
 
43
 
    R_standard_color(BLUE);
44
 
    Outline_box(top, top + nrows - 1, left, left + ncols - 1);
45
 
 
46
 
    if (getenv("NO_DRAW"))
47
 
        return 1;
48
 
 
49
 
    fd = G_open_cell_old(view->cell.name, view->cell.mapset);
50
 
    if (fd < 0)
51
 
        return 0;
52
 
    cell = G_allocate_cell_buf();
53
 
 
54
 
 
55
 
    sprintf(msg, "Plotting %s ...", view->cell.name);
56
 
    Menu_msg(msg);
57
 
 
58
 
    D_cell_draw_setup(top, top + nrows, left, left + ncols);
59
 
    for (row = 0; row < nrows; row++) {
60
 
        if (G_get_map_row_nomask(fd, cell, row) < 0)
61
 
            break;
62
 
        D_draw_c_raster(row, cell, colors);
63
 
    }
64
 
    D_cell_draw_end();
65
 
    G_close_cell(fd);
66
 
    G_free(cell);
67
 
 
68
 
    if (colors != &VIEW_MAP1->cell.colors)
69
 
        set_colors(&VIEW_MAP1->cell.colors);
70
 
 
71
 
    return row == nrows;
72
 
}