grass icon indicating copy to clipboard operation
grass copied to clipboard

d.rast.num: Align grid with/without -a preserving the aspect ratio

Open HuidaeCho opened this issue 1 year ago • 3 comments

This PR addresses #3503 by using the same pattern in d.rast.arrow.

HuidaeCho avatar Mar 15 '24 05:03 HuidaeCho

The second 0 in https://github.com/OSGeo/grass/blob/827f9889ea26ac84b7910ad944312a215b79ada7/display/d.rast.num/main.c#L235 means don't adjust the destination coordinate system to preserve the aspect ratio.

https://github.com/OSGeo/grass/blob/827f9889ea26ac84b7910ad944312a215b79ada7/lib/display/setup.c#L97-L114

However, setting that argument to 0 only works for the -a flag because the number of cells within the display extent counts actual raster cells, not what's shown with constrained resolution (for no -a flag). This is why d.rast.arrow works fine in d.mon wx0 with/without -a.

HuidaeCho avatar Mar 15 '24 05:03 HuidaeCho

Who's knowledgeable to review this, and review this in relation to the other half dozen PRs related to the same problem/fixes? I personally didn't follow after the approach changed in one of the d.* PRs, and I'm lost with the discussions scattered.

echoix avatar Mar 25 '24 00:03 echoix

Who's knowledgeable to review this, and review this in relation to the other half dozen PRs related to the same problem/fixes? I personally didn't follow after the approach changed in one of the d.* PRs, and I'm lost with the discussions scattered.

Hi, that's probably me, although I expect @HuidaeCho is a bit more up to speed than I am on the modern display library. But I'm currently refamiliarizing myself with it, admittedly in an effort to understand some low level weirdness I'm seeing in some of my own code as I port the d.barb module from grass6-addons to grass8 (d.barb is a much enhanced version of d.rast.arrow, and partly based on it). I think I'll have to hunt back in the grass-dev archives from August 2008 to see if @glynnc ever fully described the 'new' source → destination rendering philosophy at a high level and if so add that into the Doxygen comments.

n.b. my usual first stop is to revisit the very well written GRASS 5 Programmer's Manual PDF to see how the original library design was intended so at least I have a solid starting point to understand the changes that followed.

regards, Hamish

HamishB avatar Aug 19 '24 03:08 HamishB