[GRASS-SVN] r51167 - grass/branches/develbranch_6/display/d.vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 26 21:23:33 EDT 2012
Author: hamish
Date: 2012-03-26 18:23:33 -0700 (Mon, 26 Mar 2012)
New Revision: 51167
Modified:
grass/branches/develbranch_6/display/d.vect/dir.c
Log:
make it easier to increase the number of arrow heads per line (currently 3 which can be too few for very long lines) merge from head
Modified: grass/branches/develbranch_6/display/d.vect/dir.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/dir.c 2012-03-27 01:22:43 UTC (rev 51166)
+++ grass/branches/develbranch_6/display/d.vect/dir.c 2012-03-27 01:23:33 UTC (rev 51167)
@@ -5,10 +5,13 @@
#include <grass/glocale.h>
#include "plot.h"
+/* arrow heads will be drawn at 25,50,75% of the line length */
+#define PERC_OF_LINE 25
+
int dir(struct Map_info *Map, int type, struct cat_list *Clist, int chcat)
{
int ltype, dsize;
- double len, x, y, angle, msize;
+ double len, x, y, angle, msize, dist;
struct line_pnts *Points;
struct line_cats *Cats;
@@ -62,17 +65,13 @@
len = Vect_line_length(Points);
- Vect_point_on_line(Points, len * 0.25, &x, &y, NULL, &angle, NULL);
- G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
-
- Vect_point_on_line(Points, len * 0.5, &x, &y, NULL, &angle, NULL);
- G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
-
- Vect_point_on_line(Points, len * 0.75, &x, &y, NULL, &angle, NULL);
- G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ for (dist = PERC_OF_LINE / 100.0; dist <= 1.0 - PERC_OF_LINE / 100.0;
+ dist += PERC_OF_LINE / 100.0) {
+ Vect_point_on_line(Points, len * dist, &x, &y, NULL, &angle,
+ NULL);
+ G_debug(4, "plot direction: %f, %f", x, y);
+ G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ }
}
More information about the grass-commit
mailing list