瀏覽代碼

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.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50831 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 13 年之前
父節點
當前提交
a414519617
共有 1 個文件被更改,包括 27 次插入3 次删除
  1. 27 3
      ps/ps.map/do_plt.c

+ 27 - 3
ps/ps.map/do_plt.c

@@ -56,10 +56,34 @@ int do_plt(int after_masking)
 		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;