Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HuidaeCho
Copy link
Member

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

@HuidaeCho HuidaeCho self-assigned this Mar 15, 2024
@github-actions github-actions bot added C Related code is in C module display labels Mar 15, 2024
@HuidaeCho HuidaeCho linked an issue Mar 15, 2024 that may be closed by this pull request
@HuidaeCho HuidaeCho added bug Something isn't working GUI wxGUI related raster Related to raster data processing and removed C Related code is in C module labels Mar 15, 2024
@HuidaeCho
Copy link
Member Author

The second 0 in

D_setup2(0, 0, t, b, l, r);
means don't adjust the destination coordinate system to preserve the aspect ratio.

grass/lib/display/setup.c

Lines 97 to 114 in 827f988

/*!
\brief Sets source coordinate system
Sets the source coordinate system to its arguments, and if
the <b>fit</b> argument is non-zero, adjusts the destination coordinate
system to preserve the aspect ratio.
If <b>clear</b> is true, the frame is cleared (same as running
<i>d.erase</i>). Otherwise, it is not cleared.
\param clear non-zero code to clear the frame
\param fit non-zero code to adjust destination coordinate system
\param s_top
\param s_bottom
\param s_left
\param s_right
*/
void D_setup2(int clear, int fit, double st, double sb, double sl, double sr)

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.

@echoix
Copy link
Member

echoix commented Mar 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working display GUI wxGUI related raster Related to raster data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants