#3017: support for background option for grid labels in d.grid
-------------------------+-------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Keywords: d.grid | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
It would be nice to also have background color option (along with grid
color, text color and border color) when adding grid labels with d.grid.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by annakrat):
Thanks for the patch, but I am getting weird results (see attachment).
It's possible I might have done something wrong when applying the patch,
because I needed to get rid of the whitespace changes. Could you please
check this?
Also `bg_color` should be probably changed to `bgcolor` to be compatible
with all other modules having this option.
Ideally please upload a new patch without the whitespace changes.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by lazaa):
Replying to [comment:2 annakrat]:
> Thanks for the patch, but I am getting weird results (see attachment).
It's possible I might have done something wrong when applying the patch,
because I needed to get rid of the whitespace changes. Could you please
check this?
>
> Also `bg_color` should be probably changed to `bgcolor` to be compatible
with all other modules having this option.
>
> Ideally please upload a new patch without the whitespace changes.
OK, I will change it to {{{bgcolor}}}. I think the problem is not in
whitespaces. The size of label background depends on the font size. I
tested it on several font sizes and I got good results but obviously it
doesn't work in general.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by annakrat):
Replying to [comment:3 lazaa]:
> Replying to [comment:2 annakrat]:
> > Thanks for the patch, but I am getting weird results (see attachment).
It's possible I might have done something wrong when applying the patch,
because I needed to get rid of the whitespace changes. Could you please
check this?
> >
> > Also `bg_color` should be probably changed to `bgcolor` to be
compatible with all other modules having this option.
> >
> > Ideally please upload a new patch without the whitespace changes.
>
> OK, I will change it to {{{bgcolor}}}. I think the problem is not in
whitespaces. The size of label background depends on the font size. I
tested it on several font sizes and I got good results but obviously it
doesn't work in general.
It seems to change with zoom level, so I think you have to somehow convert
between the pixel and geographic coordinates.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by lazaa):
Replying to [comment:4 annakrat]:
> Replying to [comment:3 lazaa]:
> > Replying to [comment:2 annakrat]:
> > > Thanks for the patch, but I am getting weird results (see
attachment). It's possible I might have done something wrong when applying
the patch, because I needed to get rid of the whitespace changes. Could
you please check this?
> > >
> > > Also `bg_color` should be probably changed to `bgcolor` to be
compatible with all other modules having this option.
> > >
> > > Ideally please upload a new patch without the whitespace changes.
> >
> > OK, I will change it to {{{bgcolor}}}. I think the problem is not in
whitespaces. The size of label background depends on the font size. I
tested it on several font sizes and I got good results but obviously it
doesn't work in general.
>
> It seems to change with zoom level, so I think you have to somehow
convert between the pixel and geographic coordinates.
I uploaded new patch with original whitespaces/tabs.
I looked how it is done in d.text module. Now is the margin of the text
box calculated from width and height of the text inside text box.
Another problem is that if user uses flag -g or -w. The geographical grid
isn't horizontal/vertical so the labels are a bit rotated. But I couldn't
find any way how to rotate the text box for filling background. I attached
an image.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by annakrat):
Replying to [comment:5 lazaa]:
> I uploaded new patch with original whitespaces/tabs.
>
> I looked how it is done in d.text module. Now is the margin of the text
box calculated from width and height of the text inside text box.
>
> Another problem is that if user uses flag -g or -w. The geographical
grid isn't horizontal/vertical so the labels are a bit rotated. But I
couldn't find any way how to rotate the text box for filling background. I
attached an image.
Thank you, I committed it. I don't think the rotation is a huge problem
here for most cases. You could look at d.labels, it can do the rotation of
the background. But I don't think you should focus on this now.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by veroandreo):
Hi, I'm happy to have background option in d.grid
I did a quick test and I attach an example below. I noted that when
choosing white background for grid labels, I loose part of the map in the
east (See no-transparency in fig 1 vs transparency in fig 2). So,
background of labels seems to be a continuous white strip for Y
coordinate, while it's fine for X coordinate.
On the other hand, grid lines overlap the white background of labels,
while IMHO, label should always be in front.
I personally don't like the border tickmarks of d.grid but when disabling
them, labels remain aligned as if there were border tickmarks (last fig).
Maybe they could be aligned more close to the border (if not against it)
as in ps.map.
And, would that be possible to also change font of labels??
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by annakrat):
Replying to [comment:8 veroandreo]:
> Hi, I'm happy to have background option in d.grid
>
> I did a quick test and I attach an example below. I noted that when
choosing white background for grid labels, I loose part of the map in the
east (See no-transparency in fig 1 vs transparency in fig 2). So,
background of labels seems to be a continuous white strip for Y
coordinate, while it's fine for X coordinate.
I can confirm this, the size of the background rectangle still needs
fixing, the problem showed up only in latlon for me.
>
> On the other hand, grid lines overlap the white background of labels,
while IMHO, label should always be in front.
Yes, the horizontal labels are fine, just the vertical ones are below the
grid lines.
>
> I personally don't like the border tickmarks of d.grid but when
disabling them, labels remain aligned as if there were border tickmarks
(last fig). Maybe they could be aligned more close to the border (if not
against it) as in ps.map.
>
> And, would that be possible to also change font of labels??
>
You can do that from GUI settings - you set display font for all d.*
commands.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by lazaa):
Replying to [comment:9 annakrat]:
> Replying to [comment:8 veroandreo]:
> > Hi, I'm happy to have background option in d.grid
> >
> > I did a quick test and I attach an example below. I noted that when
choosing white background for grid labels, I loose part of the map in the
east (See no-transparency in fig 1 vs transparency in fig 2). So,
background of labels seems to be a continuous white strip for Y
coordinate, while it's fine for X coordinate.
>
> I can confirm this, the size of the background rectangle still needs
fixing, the problem showed up only in latlon for me.
I tried to find the problem, but I didn't succeed
> >
> > On the other hand, grid lines overlap the white background of labels,
while IMHO, label should always be in front.
>
> Yes, the horizontal labels are fine, just the vertical ones are below
the grid lines.
I fixed this problem. Now the grid lines are drawn first (both vertical
and horizontal) and after that are drawn labels so at final they are shown
in front.
> >
> > I personally don't like the border tickmarks of d.grid but when
disabling them, labels remain aligned as if there were border tickmarks
(last fig). Maybe they could be aligned more close to the border (if not
against it) as in ps.map.
> >
> > And, would that be possible to also change font of labels??
> >
> You can do that from GUI settings - you set display font for all d.*
commands.
#3017: support for background option for grid labels in d.grid
--------------------------+-------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.grid, gsoc2016, cartography
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------------------------
Comment (by veroandreo):
I confirm that the rectangular size in Y coordinate now appears as
expected, but I noticed that disabling grid drawing (-n) also makes text
disappear (both in latlong and projected locations).