[GRASS-SVN] r57720 - grass/trunk/display/d.northarrow
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Sep 16 23:30:06 PDT 2013
Author: hamish
Date: 2013-09-16 23:30:05 -0700 (Mon, 16 Sep 2013)
New Revision: 57720
Modified:
grass/trunk/display/d.northarrow/draw_n_arrow.c
grass/trunk/display/d.northarrow/main.c
grass/trunk/display/d.northarrow/options.h
Log:
add line width option (line width currently broken in display library also for d.vect)
Modified: grass/trunk/display/d.northarrow/draw_n_arrow.c
===================================================================
--- grass/trunk/display/d.northarrow/draw_n_arrow.c 2013-09-17 06:07:03 UTC (rev 57719)
+++ grass/trunk/display/d.northarrow/draw_n_arrow.c 2013-09-17 06:30:05 UTC (rev 57720)
@@ -11,7 +11,8 @@
#include <grass/glocale.h>
#include "options.h"
-int draw_n_arrow(double east, double north, double fontsize, char *n_arrow_num)
+int draw_n_arrow(double east, double north, double fontsize,
+ char *n_arrow_num, double line_width)
{
double x_pos, y_pos;
double t, b, l, r;
@@ -35,6 +36,9 @@
x_pos = east * (r - l) / 100.;
y_pos = (100. - north) * (b - t) / 100.;
+ if (line_width > 0)
+ D_line_width(line_width);
+
if (fontsize > 0) {
/* draw the "N" */
D_get_text_box("N", &tt, &tb, &tl, &tr);
@@ -155,6 +159,10 @@
S_stroke(Symb, symbol_size, 0.0, 0);
D_symbol(Symb, x0, y0, line_color, fill_color);
+
+ if (line_width > 0)
+ D_line_width(0);
+
G_free(Symb);
G_free(line_color);
G_free(fill_color);
Modified: grass/trunk/display/d.northarrow/main.c
===================================================================
--- grass/trunk/display/d.northarrow/main.c 2013-09-17 06:07:03 UTC (rev 57719)
+++ grass/trunk/display/d.northarrow/main.c 2013-09-17 06:30:05 UTC (rev 57720)
@@ -29,10 +29,11 @@
int main(int argc, char **argv)
{
struct GModule *module;
- struct Option *bg_color_opt, *fg_color_opt, *coords, *n_arrow, *fsize;
+ struct Option *bg_color_opt, *fg_color_opt, *coords, *n_arrow, *fsize,
+ *width_opt;
struct Flag *no_text;
double east, north;
- double fontsize;
+ double fontsize, line_width;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
@@ -69,6 +70,12 @@
bg_color_opt->answer = _("black");
bg_color_opt->guisection = _("Colors");
+ width_opt = G_define_option();
+ width_opt->key = "width";
+ width_opt->type = TYPE_DOUBLE;
+ width_opt->answer = "0";
+ width_opt->description = _("Line width");
+
fsize = G_define_option();
fsize->key = "fontsize";
fsize->type = TYPE_DOUBLE;
@@ -100,14 +107,20 @@
if (bg_color == 0)
do_background = FALSE;
+ line_width = atof(width_opt->answer);
+ if (line_width < 0)
+ line_width = 0;
+ else if (line_width > 72)
+ line_width = 72;
+
if (D_open_driver() != 0)
G_fatal_error(_("No graphics device selected. "
"Use d.mon to select graphics device."));
D_setup(0);
- draw_n_arrow(east, north, fontsize, n_arrow->answer);
+ draw_n_arrow(east, north, fontsize, n_arrow->answer, line_width);
D_save_command(G_recreate_command());
Modified: grass/trunk/display/d.northarrow/options.h
===================================================================
--- grass/trunk/display/d.northarrow/options.h 2013-09-17 06:07:03 UTC (rev 57719)
+++ grass/trunk/display/d.northarrow/options.h 2013-09-17 06:30:05 UTC (rev 57720)
@@ -5,4 +5,4 @@
extern int do_background;
/* draw_n_arrow.c */
-int draw_n_arrow(double, double, double, char *);
+int draw_n_arrow(double, double, double, char *, double);
More information about the grass-commit
mailing list