[GRASS-SVN] r50831 - grass/trunk/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 16 03:55:02 EST 2012


Author: hamish
Date: 2012-02-16 00:55:02 -0800 (Thu, 16 Feb 2012)
New Revision: 50831

Modified:
   grass/trunk/ps/ps.map/do_plt.c
Log:
allow drawing of line decorations entirely outside of the map window. This is deactivated for lat/lon as apparently it would bypass 180 longitude wrap-around safeguards.

Modified: grass/trunk/ps/ps.map/do_plt.c
===================================================================
--- grass/trunk/ps/ps.map/do_plt.c	2012-02-16 08:25:39 UTC (rev 50830)
+++ grass/trunk/ps/ps.map/do_plt.c	2012-02-16 08:55:02 UTC (rev 50831)
@@ -56,10 +56,34 @@
 		set_color(&pcolor, color_R, color_G, color_B);
 		set_ps_color(&pcolor);
 		set_line_width(width);
-		start_line(e1, n1);
-		sec_draw = 0;
-		G_plot_line(e1, n1, e2, n2);
+
+		if (G_projection() == PROJECTION_LL) {
+		/* use the same method as the vlines instruction,
+		for completely out of region lines just move, don't put
+		the pen down. but the thing this method has going for it
+		is that for lat/lon (AFAIU) it draws the line twice,
+		so that at least one of them will go the desired way
+		around the sphere, and the other will be discarded.
+		(I think). But it means your self-defined lines need to
+		keep at least one little toe in the map box. --HB Feb2012 */
+		    start_line(e1, n1);
+		    sec_draw = 0;
+		    G_plot_line(e1, n1, e2, n2);
+		}
+		else {
+		    G_plot_where_xy(e1, n1, &x_int, &y_int);
+		    llx = (double)x_int / 10.;
+		    lly = (double)y_int / 10.;
+
+		    G_plot_where_xy(e2, n2, &x_int, &y_int);
+		    urx = (double)x_int / 10.;
+		    ury = (double)y_int / 10.;
+
+		    fprintf(PS.fp, " %.1f %.1f NM %.1f %.1f LN",
+			    llx, lly, urx, ury);
+		}
 		fprintf(PS.fp, " stroke\n");
+
 	    }
 	    break;
 



More information about the grass-commit mailing list