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

« back to all changes in this revision

Viewing changes to display/d.where/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:
23
23
#include <grass/gis.h>
24
24
#include <grass/gprojects.h>
25
25
#include <grass/display.h>
26
 
#include <grass/raster.h>
27
26
#include "local_proto.h"
28
27
#include <grass/glocale.h>
29
28
 
32
31
int main(int argc, char **argv)
33
32
{
34
33
    struct GModule *module;
35
 
    struct Flag *once, *decimal, *latlong, *wgs84, *dcoord;
 
34
    struct Option *coords, *file;
 
35
    struct Flag *decimal, *latlong, *wgs84, *dcoord;
36
36
    int have_spheroid = 0;
 
37
    FILE *fp;
37
38
 
38
39
    /* Initialize the GIS calls */
39
40
    G_gisinit(argv[0]);
40
41
 
41
42
    module = G_define_module();
42
 
    module->keywords = _("display, position, querying");
 
43
    G_add_keyword(_("display"));
 
44
    G_add_keyword(_("sampling"));
 
45
    G_add_keyword(_("position"));
 
46
    G_add_keyword(_("querying"));
43
47
    module->description =
44
48
        _("Identifies the geographic coordinates associated with "
45
 
          "point locations in the active frame on the graphics monitor.");
46
 
 
47
 
    once = G_define_flag();
48
 
    once->key = '1';
49
 
    once->description = _("One mouse click only");
 
49
          "point locations given in display coordinates.");
 
50
 
 
51
    coords = G_define_option();
 
52
    coords->key = "at";
 
53
    coords->key_desc = "x,y";
 
54
    coords->type = TYPE_DOUBLE;
 
55
    coords->required = NO;
 
56
    coords->multiple = YES;
 
57
    coords->description =
 
58
        _("Display coordinates to convert");
 
59
 
 
60
    file = G_define_standard_option(G_OPT_F_INPUT);
 
61
    file->required = NO;
 
62
    file->description =
 
63
        _("File from which to read coordinates (\"-\" to read from stdin)");
50
64
 
51
65
    decimal = G_define_flag();
52
66
    decimal->key = 'd';
70
84
 
71
85
 
72
86
    /* if (G_parser(argc,argv)) */
73
 
    if (argc > 1 && G_parser(argc, argv))
 
87
    if (G_parser(argc, argv))
74
88
        exit(EXIT_FAILURE);
75
89
 
76
90
    if (latlong->answer && wgs84->answer)
140
154
 
141
155
    }
142
156
 
143
 
    if (R_open_driver() != 0)
144
 
        G_fatal_error(_("No graphics device selected"));
 
157
    if (file->answer) {
 
158
        if (strcmp(file->answer, "-") == 0)
 
159
            fp = stdin;
 
160
        else {
 
161
            fp = fopen(file->answer, "r");
 
162
            if (!fp)
 
163
                G_fatal_error(_("Unable to open input file <%s>"), file->answer);
 
164
        }
 
165
    }
 
166
    else
 
167
        fp = stdin;
 
168
 
 
169
    D_open_driver();
 
170
 
145
171
    D_setup(0);
146
 
    where_am_i(once->answer, have_spheroid, decimal->answer, wgs84->answer,
147
 
               dcoord->answer);
148
 
    R_close_driver();
 
172
 
 
173
    where_am_i(coords->answers, fp, have_spheroid, decimal->answer, dcoord->answer);
 
174
    
 
175
    D_close_driver();
149
176
 
150
177
    exit(EXIT_SUCCESS);
151
178
}