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

« back to all changes in this revision

Viewing changes to raster/r.what.color/main.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
1
 
2
2
/****************************************************************************
3
3
 *
4
 
 * MODULE:       r.what.color
 
4
 * MODULE:       r.what
5
5
 * AUTHOR(S):    Michael Shapiro, CERL (original contributor)
6
6
 *               Markus Neteler <neteler itc.it>,Brad Douglas <rez touchofmadness.com>,
7
7
 *               Huidae Cho <grass4u gmail.com>, Glynn Clements <glynn gclements.plus.com>,
20
20
#include <unistd.h>
21
21
#include <string.h>
22
22
#include <grass/gis.h>
 
23
#include <grass/raster.h>
23
24
#include <grass/glocale.h>
24
25
 
25
26
static const char *fmt;
37
38
            fprintf(stdout, "*: *\n");
38
39
            return 0;
39
40
        }
40
 
        if (!G_get_c_raster_color(&ival, &red, &grn, &blu, colors)) {
 
41
        if (!Rast_get_c_color(&ival, &red, &grn, &blu, colors)) {
41
42
            fprintf(stdout, "%d: *\n", ival);
42
43
            return 0;
43
44
        }
52
53
            fprintf(stdout, "*: *\n");
53
54
            return 0;
54
55
        }
55
 
        if (!G_get_d_raster_color(&fval, &red, &grn, &blu, colors)) {
 
56
        if (!Rast_get_d_color(&fval, &red, &grn, &blu, colors)) {
56
57
            fprintf(stdout, "%.15g: *\n", fval);
57
58
            return 0;
58
59
        }
78
79
        struct Flag *i;
79
80
    } flag;
80
81
    const char *name;
81
 
    const char *mapset;
82
82
    struct Colors colors;
83
83
    RASTER_MAP_TYPE type;
84
84
 
85
85
    G_gisinit(argv[0]);
86
86
 
87
87
    module = G_define_module();
88
 
    module->keywords = _("raster, querying");
 
88
    G_add_keyword(_("raster"));
 
89
    G_add_keyword(_("querying"));
 
90
    G_add_keyword(_("color table"));
89
91
    module->description = _("Queries colors for a raster map layer.");
90
92
 
91
93
    opt.input = G_define_option();
121
123
        G_fatal_error(_("Either \"-i\" or \"value=\" must be given"));
122
124
 
123
125
    name = opt.input->answer;
124
 
    mapset = G_find_cell2(name, "");
125
 
 
126
 
    if (!mapset)
127
 
        G_fatal_error("Raster map <%s> not found", name);
128
 
 
129
 
    type = G_raster_map_type(name, mapset);
 
126
 
 
127
    type = Rast_map_type(name, "");
130
128
    if (type < 0)
131
129
        G_fatal_error("Unable to determine type of input map %s", name);
132
130
 
133
 
    if (G_read_colors(name, mapset, &colors) < 0)
 
131
    if (Rast_read_colors(name, "", &colors) < 0)
134
132
        G_fatal_error("Unable to read colors for input map %s", name);
135
133
 
136
134
    fmt = opt.format->answer;