[GRASS-SVN] r51166 - grass/trunk/display/d.vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 26 21:22:43 EDT 2012
Author: hamish
Date: 2012-03-26 18:22:43 -0700 (Mon, 26 Mar 2012)
New Revision: 51166
Modified:
grass/trunk/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)
Modified: grass/trunk/display/d.vect/dir.c
===================================================================
--- grass/trunk/display/d.vect/dir.c 2012-03-26 14:47:48 UTC (rev 51165)
+++ grass/trunk/display/d.vect/dir.c 2012-03-27 01:22:43 UTC (rev 51166)
@@ -4,11 +4,14 @@
#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 display_dir(struct Map_info *Map, int type, struct cat_list *Clist,
int chcat, int dsize)
{
int ltype;
- double len, x, y, angle, msize;
+ double len, x, y, angle, msize, dist;
struct line_pnts *Points;
struct line_cats *Cats;
@@ -61,17 +64,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);
- D_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);
- D_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);
- D_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);
+ D_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ }
}
More information about the grass-commit
mailing list