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

« back to all changes in this revision

Viewing changes to vector/v.label/main.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:
16
16
#include <math.h>
17
17
#include <grass/gis.h>
18
18
#include <grass/display.h>
19
 
#include <grass/raster.h>
20
 
#include <grass/Vect.h>
 
19
#include <grass/vector.h>
21
20
#include <grass/dbmi.h>
22
21
#include <grass/glocale.h>
23
22
 
37
36
    int cat, direction;
38
37
    double x, y, linlength, lablength, size, space, ldist;
39
38
    double rotate, rot;
40
 
    char *mapset;
41
39
    char *txt, buf[2000];
42
40
    struct line_pnts *Points;
43
41
    struct line_cats *Cats;
58
56
 
59
57
    G_gisinit(argv[0]);
60
58
    module = G_define_module();
61
 
    module->keywords = _("vector, paint labels");
 
59
    G_add_keyword(_("vector"));
 
60
    G_add_keyword(_("paint labels"));
62
61
    module->description =
63
62
        _("Creates paint labels for a vector map from attached attributes.");
64
63
 
74
73
 
75
74
    Vectfile = G_define_standard_option(G_OPT_V_MAP);
76
75
 
77
 
    Colopt = G_define_standard_option(G_OPT_COLUMN);
 
76
    Colopt = G_define_standard_option(G_OPT_DB_COLUMN);
78
77
    Colopt->required = YES;
79
78
    Colopt->description = _("Name of attribute column to be used for labels");
80
79
 
83
82
    Typopt->answer = "point,line,boundary,centroid";
84
83
 
85
84
    Fieldopt = G_define_standard_option(G_OPT_V_FIELD);
86
 
    whereopt = G_define_standard_option(G_OPT_WHERE);
 
85
    whereopt = G_define_standard_option(G_OPT_DB_WHERE);
87
86
 
88
87
    Along_flag = G_define_flag();
89
88
    Along_flag->key = 'a';
148
147
    FontSize->options = "1-1000";
149
148
    FontSize->guisection = _("Font");
150
149
 
151
 
    Color = G_define_standard_option(G_OPT_C_FG);
 
150
    Color = G_define_standard_option(G_OPT_C);
152
151
    Color->label = _("Text color");
153
152
    Color->guisection = _("Colors");
154
153
 
155
154
    Rotation = G_define_option();
156
155
    Rotation->key = "rotation";
157
 
    Rotation->description = _("Rotation angle (degrees counter-clockwise)");
 
156
    Rotation->description = _("Rotation angle in degrees (counter-clockwise)");
158
157
    Rotation->type = TYPE_DOUBLE;
159
158
    Rotation->required = NO;
160
159
    Rotation->options = "0-360";
170
169
    Width->options = "0-25";
171
170
    Width->guisection = _("Effects");
172
171
 
173
 
    Hcolor = G_define_standard_option(G_OPT_C_BG);
174
 
    Hcolor->key = "hcolor";
 
172
    Hcolor = G_define_standard_option(G_OPT_CN);
 
173
    Hcolor->key = "highlight_color";
175
174
    Hcolor->label = _("Highlight color for text");
176
175
    Hcolor->answer = "none";
177
176
    Hcolor->guisection = _("Colors");
178
177
 
179
178
    Hwidth = G_define_option();
180
 
    Hwidth->key = "hwidth";
 
179
    Hwidth->key = "highlight_width";
181
180
    Hwidth->description = _("Width of highlight coloring");
182
181
    Hwidth->type = TYPE_DOUBLE;
183
182
    Hwidth->answer = "0";
184
183
    Hwidth->guisection = _("Effects");
185
184
 
186
 
    Bcolor = G_define_standard_option(G_OPT_C_BG);
187
 
    Bcolor->key = "background";
 
185
    Bcolor = G_define_standard_option(G_OPT_CN);
 
186
    Bcolor->key = "bgcolor";
188
187
    Bcolor->label = _("Background color");
189
188
    Bcolor->answer = "none";
190
189
    Bcolor->guisection = _("Colors");
191
190
 
192
 
    Border = G_define_standard_option(G_OPT_C_BG);
 
191
    Border = G_define_standard_option(G_OPT_CN);
193
192
    Border->key = "border";
194
193
    Border->label = _("Border color");
195
194
    Border->answer = "none";
230
229
        /* figure out space param dynamically from current dispay */
231
230
        /* don't bother if Space was explicitly given (bypasses xmon req) */
232
231
        if (Along_flag->answer && !Space->answer) {
233
 
            if (R_open_driver() != 0)   /* connect to the driver */
 
232
            if (D_open_driver() != 0)   /* connect to the driver */
234
233
                G_fatal_error(_("No graphics device selected"));
235
234
 
236
235
            /* Read in the map region associated with graphics window */
237
236
            D_setup(0);
238
237
            space = fontsize / D_get_u_to_d_xconv();    /* in earth units */
239
238
 
240
 
            R_close_driver();
 
239
            D_close_driver();
241
240
        }
242
241
    }
243
242
    else
265
264
    }
266
265
 
267
266
    /* open vector */
268
 
    mapset = G_find_vector2(Vectfile->answer, NULL);
269
 
    if (mapset == NULL)
270
 
        G_fatal_error(_("Vector map <%s> not found"), Vectfile->answer);
271
 
 
272
 
    Vect_open_old(&Map, Vectfile->answer, mapset);
 
267
    if (Vect_open_old(&Map, Vectfile->answer, "") < 0)
 
268
        G_fatal_error(_("Unable to open vector map <%s>"), Vectfile->answer);
273
269
 
274
270
    /* open database */
275
271
    field = atoi(Fieldopt->answer);