[GRASS-SVN] r68556 - grass/trunk/display/d.grid
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 1 06:29:23 PDT 2016
Author: annakrat
Date: 2016-06-01 06:29:22 -0700 (Wed, 01 Jun 2016)
New Revision: 68556
Modified:
grass/trunk/display/d.grid/plot.c
Log:
d.grid: fix labels in latlon, see #3017
Modified: grass/trunk/display/d.grid/plot.c
===================================================================
--- grass/trunk/display/d.grid/plot.c 2016-06-01 08:41:21 UTC (rev 68555)
+++ grass/trunk/display/d.grid/plot.c 2016-06-01 13:29:22 UTC (rev 68556)
@@ -138,10 +138,21 @@
D_get_text_box(text, &bt, &bb, &bl, &br);
w = br - bl;
h = bt - bb;
+
+ if (w > 0)
+ w += 0.2 * fontsize * fabs(D_get_d_to_u_xconv());
+ else /* D_text() does not draw " ". */
+ w = 0.8 * fontsize * fabs(D_get_d_to_u_xconv());
+ if (h > 0)
+ h += 0.2 * fontsize * fabs(D_get_d_to_u_yconv());
+ else /* D_text() does not draw " ". */
+ h = 0.8 * fontsize * fabs(D_get_d_to_u_yconv());
+
bl = tx - w/2;
bt = ty + h/10;
br = tx + w + w/2;
bb = ty - h - h/10;
+
D_use_color(bgcolor);
D_box_abs(bl, bt, br, bb);
}
@@ -191,15 +202,13 @@
h = bt - bb;
if (w > 0)
- w += 0.2 * fontsize;
- else
- /* D_text() does not draw " ". */
- w = 0.8 * fontsize;
+ w += 0.2 * fontsize * fabs(D_get_d_to_u_xconv());
+ else /* D_text() does not draw " ". */
+ w = 0.8 * fontsize * fabs(D_get_d_to_u_xconv());
if (h > 0)
- h += 0.2 * fontsize;
- else
- /* D_text() does not draw " ". */
- h = 0.8 * fontsize;
+ h += 0.2 * fontsize * fabs(D_get_d_to_u_yconv());
+ else /* D_text() does not draw " ". */
+ h = 0.8 * fontsize * fabs(D_get_d_to_u_yconv());
bl = tx - w/10;
bt = ty + h + h/2;
More information about the grass-commit
mailing list