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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 21 00:23:24 PDT 2013


Author: hamish
Date: 2013-06-21 00:23:24 -0700 (Fri, 21 Jun 2013)
New Revision: 56864

Modified:
   grass/trunk/display/d.barscale/draw_scale.c
   grass/trunk/display/d.barscale/main.c
   grass/trunk/display/d.barscale/options.h
Log:
add another checkered barscale variant

Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c	2013-06-21 07:12:28 UTC (rev 56863)
+++ grass/trunk/display/d.barscale/draw_scale.c	2013-06-21 07:23:24 UTC (rev 56864)
@@ -185,6 +185,7 @@
 	    case STYLE_PART_CHECKER:
 	    case STYLE_FULL_CHECKER:
 	    case STYLE_MIXED_CHECKER:
+	    case STYLE_TAIL_CHECKER:
 	    case STYLE_SOLID_BAR:
 	    case STYLE_HOLLOW_BAR:
 	    case STYLE_TICKS_BOTH:
@@ -422,6 +423,55 @@
 	    }
 	}
     }
+    else if (style == STYLE_TAIL_CHECKER) {
+	/* first draw outside box */
+	D_begin();
+	D_move_abs(x_pos + 25, y_pos + 15 + 6);
+	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 == 5 ? 3 : 5); i++) {
+	    /* width is seg_len and height is 6 */
+	    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);
+	    D_polygon_rel(xarr, yarr, 5);
+	    D_pos_rel(seg_len, 0);
+	}
+	/* draw a vertical cross line */
+	D_begin();
+	D_move_rel(0, 6);
+	D_cont_rel(0, -12);
+	D_close();
+	D_end();  /* no-op? */
+	D_stroke();
+
+	D_pos_rel(0, 6);
+	xarr[0] = 0;
+	yarr[0] = 0;
+	xarr[1] = line_len/2.;
+	if (scales[incr].seg == 5)
+	    xarr[1] -= seg_len/2.;
+	yarr[1] = 0;
+	xarr[2] = 0;
+	yarr[2] = 6;
+	xarr[3] = -line_len/2.;
+	if (scales[incr].seg == 5)
+	    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, 0);
+    }
     else if (style == STYLE_TICKS_BOTH) {
 	/* draw simple line scale with corssing ticks */
 	D_begin();

Modified: grass/trunk/display/d.barscale/main.c
===================================================================
--- grass/trunk/display/d.barscale/main.c	2013-06-21 07:12:28 UTC (rev 56863)
+++ grass/trunk/display/d.barscale/main.c	2013-06-21 07:23:24 UTC (rev 56864)
@@ -72,7 +72,7 @@
     barstyle->key = "style";
     barstyle->description = _("Type of barscale to draw");
     barstyle->options =
-	"classic,line,solid,hollow,full_checker,part_checker,mixed_checker,up_ticks,down_ticks,both_ticks,arrow_ends";
+	"classic,line,solid,hollow,full_checker,part_checker,mixed_checker,tail_checker,up_ticks,down_ticks,both_ticks,arrow_ends";
     barstyle->answer = "classic";
 
     coords = G_define_option();
@@ -144,6 +144,9 @@
     case 'm':
 	bar_style = STYLE_MIXED_CHECKER;
 	break;
+    case 't':
+	bar_style = STYLE_TAIL_CHECKER;
+	break;
     case 'l':
 	bar_style = STYLE_THIN_WITH_ENDS;
 	break;

Modified: grass/trunk/display/d.barscale/options.h
===================================================================
--- grass/trunk/display/d.barscale/options.h	2013-06-21 07:12:28 UTC (rev 56863)
+++ grass/trunk/display/d.barscale/options.h	2013-06-21 07:23:24 UTC (rev 56864)
@@ -5,13 +5,14 @@
 #define STYLE_PART_CHECKER   2
 #define STYLE_FULL_CHECKER   3
 #define STYLE_MIXED_CHECKER  4
-#define STYLE_THIN_WITH_ENDS 5
-#define STYLE_SOLID_BAR      6
-#define STYLE_HOLLOW_BAR     7
-#define STYLE_TICKS_UP       8
-#define STYLE_TICKS_DOWN     9
-#define STYLE_TICKS_BOTH     10
-#define STYLE_ARROW_ENDS     11
+#define STYLE_TAIL_CHECKER   5
+#define STYLE_THIN_WITH_ENDS 6
+#define STYLE_SOLID_BAR      7
+#define STYLE_HOLLOW_BAR     8
+#define STYLE_TICKS_UP       9
+#define STYLE_TICKS_DOWN     10
+#define STYLE_TICKS_BOTH     11
+#define STYLE_ARROW_ENDS     12
 
 /* text placement */
 #define TEXT_UNDER 0



More information about the grass-commit mailing list