[GRASS-SVN] r56846 - grass/trunk/display/d.barscale

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 20 17:26:21 PDT 2013


Author: hamish
Date: 2013-06-20 17:26:21 -0700 (Thu, 20 Jun 2013)
New Revision: 56846

Modified:
   grass/trunk/display/d.barscale/draw_scale.c
   grass/trunk/display/d.barscale/main.c
Log:
enable checkerboard barscale with left side twice the freq of the right

Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c	2013-06-20 18:05:29 UTC (rev 56845)
+++ grass/trunk/display/d.barscale/draw_scale.c	2013-06-21 00:26:21 UTC (rev 56846)
@@ -419,6 +419,51 @@
 	    D_pos_rel(seg_len, 0);
 	}
     }
+
+    else if (style == STYLE_PART_CHECKER) {
+	D_begin();
+	D_move_abs(x_pos + 25, y_pos + 15 + 6);
+	/* actual width is line_len-1+1=line_len and height is 7+1=8 */
+	D_cont_rel(line_len, 0);
+	D_cont_rel(0, -12);
+	D_cont_rel(-line_len, 0);
+	D_cont_rel(0, +12);
+	D_close();
+	D_end();  /* no-op? */
+	D_stroke();
+
+	D_pos_rel(0, -6);
+	for (i = 1; i <= scales[incr].seg; i++) {
+	    if (i <= (scales[incr].seg == 5 ? 2 : 4)) {
+		xarr[0] = 0;		yarr[0] = 0;
+		xarr[1] = seg_len/2.;	yarr[1] = 0;
+		xarr[2] = 0;		yarr[2] = -6;
+		xarr[3] = -seg_len/2.;	yarr[3] = 0;
+		xarr[4] = 0;		yarr[4] = 6;
+		D_polygon_rel(xarr, yarr, 5);
+		D_pos_rel(seg_len/2., 0);
+
+		xarr[0] = 0;		yarr[0] = 0;
+		xarr[1] = seg_len/2.;	yarr[1] = 0;
+		xarr[2] = 0;		yarr[2] = 6;
+		xarr[3] = -seg_len/2.;	yarr[3] = 0;
+		xarr[4] = 0;		yarr[4] = -6;
+		D_polygon_rel(xarr, yarr, 5);
+		D_pos_rel(seg_len/2., 0);
+	    }
+	    else {
+		xarr[0] = 0;	    yarr[0] = 0;
+		xarr[1] = seg_len;  yarr[1] = 0;
+		xarr[2] = 0;	    yarr[2] = (i % 2 ? -6 : 6);
+		xarr[3] = -seg_len; yarr[3] = 0;
+		xarr[4] = 0;	    yarr[4] = (i % 2 ? 6 : -6);
+		/* width is seg_len and height is 4 */
+		D_polygon_rel(xarr, yarr, 5);
+		D_pos_rel(seg_len, 0);
+	    }
+
+	}
+    }
     else if (style == STYLE_TICKS_BOTH) {
 	/* draw simple line scale with corssing ticks */
 	D_move_abs(x_pos + 25, y_pos + 5);

Modified: grass/trunk/display/d.barscale/main.c
===================================================================
--- grass/trunk/display/d.barscale/main.c	2013-06-20 18:05:29 UTC (rev 56845)
+++ grass/trunk/display/d.barscale/main.c	2013-06-21 00:26:21 UTC (rev 56846)
@@ -71,9 +71,9 @@
     barstyle = G_define_option();
     barstyle->key = "style";
     barstyle->description = _("Type of barscale to draw");
-/* TODO:   barstyle->options: part_checker (left side twice the freq of the right) and  |<--arrow_ends-->| */
+/* TODO:   barstyle->options:  |<--arrow_ends-->| */
     barstyle->options =
-	"classic,line,solid,hollow,full_checker,up_ticks,down_ticks,both_ticks";
+	"classic,line,solid,hollow,full_checker,part_checker,up_ticks,down_ticks,both_ticks";
     barstyle->answer = "classic";
 
     coords = G_define_option();



More information about the grass-commit mailing list