Bladeren bron

make it easier to increase the number of arrow heads per line (currently 3 which can be too few for very long lines)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51166 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 13 jaren geleden
bovenliggende
commit
11394de6af
1 gewijzigde bestanden met toevoegingen van 11 en 12 verwijderingen
  1. 11 12
      display/d.vect/dir.c

+ 11 - 12
display/d.vect/dir.c

@@ -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 @@ int display_dir(struct Map_info *Map, int type, struct cat_list *Clist,
 
 	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);
+	}
     }