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

feat: handle correctly landscape labels with negative angle #4176

Merged
merged 5 commits into from
Mar 14, 2025

Conversation

martignoni
Copy link
Contributor

@martignoni martignoni commented Mar 4, 2025

Description

Fixes #4174

Screenshots (if appropriate):

correct-labels

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Test Configuration:

  • Operating system: macOS Sequioa 15.3.1
  • Graphics Card: Radeon Pro 580X 8 Go

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

- See issue Stellarium#4174.
- This also fixes a placement bug when angle = 0.
Copy link

github-actions bot commented Mar 4, 2025

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

This is an automatically generated QA checklist based on modified files.

@alex-w alex-w added this to the 25.1 milestone Mar 4, 2025
@gzotti
Copy link
Member

gzotti commented Mar 4, 2025

At zero degrees the label has to be centered over (or in your case, under) the line. This was by design, not error.

@gzotti
Copy link
Member

gzotti commented Mar 4, 2025

I don't think this was intended either.
stellarium-145

@martignoni
Copy link
Contributor Author

At zero degrees the label has to be centered over (or in your case, under) the line. This was by design, not error.

Indeed, but with current implementation, there're not centered.

Screenshot with current implementation.

current

Screenshot with this PR change

new-fixed

@martignoni
Copy link
Contributor Author

I don't think this was intended either.

Can you please share this landscape (at least its gazetteer file) so that I can test?

@gzotti
Copy link
Member

gzotti commented Mar 5, 2025

I am talking about the appearance of the gazetter labels so far (above landscape), not your way (not originally developed). It's part of the Callanish3D package. Just that I edited it and made negative altitude offsets. Presumably you did the same, but you did not show your gazetteer either...
You can probably configure some points above, some below in your branch and see how they rotate. In any case, angle=0 implies "centered".

@martignoni
Copy link
Contributor Author

It's part of the Callanish3D package.

Thanks.

you did not show your gazetteer either

My gazetteer file is attached to the original issue description.

@alex-w
Copy link
Member

alex-w commented Mar 13, 2025

@martignoni is monitor HiDPI device?

@martignoni
Copy link
Contributor Author

@martignoni is monitor HiDPI device?

Yes. Here the relevant lines from the log:

[     1.539][INFO] Running in High Graphics Mode
[     1.539][INFO] Maximum texture anisotropy: 16
[     1.539][INFO] Maximum 2D texture size: 16384
[     1.539][INFO] Driver version string: 4.1 ATI-6.1.13
[     1.539][INFO] GL vendor: ATI Technologies Inc.
[     1.539][INFO] GL renderer: AMD Radeon Pro 580X OpenGL Engine
[     1.539][INFO] GL Shading Language version: 4.10
[     1.539][INFO] Vertex Array Objects are supported
[     1.541][INFO] Initial high-DPI scaling factor: 2

I'm suspecting now this is the reason of the different values calculated for fm.boundingRect(landscapeLabels.at(i).name).width(); in my config and the one of @gzotti.

@martignoni
Copy link
Contributor Author

@alex-w How can I handle HiDPI and non HiDPI devices with boundingRect?

@alex-w
Copy link
Member

alex-w commented Mar 13, 2025

@alex-w How can I handle HiDPI and non HiDPI devices with boundingRect?

Please see similar case in code for drawing compass marks:

hint: using ppx for correction of the coordinates

@martignoni
Copy link
Contributor Author

Current patch should fix problems mentioned by @gzotti. Thanks @alex-w for the hint 👍

Copy link
Member

@gzotti gzotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks!
Please fix indentation and remove commented-out new qDebug lines.

Else OK for me.

@martignoni martignoni requested a review from gzotti March 14, 2025 05:59
@gzotti gzotti merged commit 5b20f21 into Stellarium:master Mar 14, 2025
14 of 15 checks passed
@gzotti
Copy link
Member

gzotti commented Mar 14, 2025

Thanks!

@martignoni martignoni deleted the master branch March 14, 2025 12:19
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Mar 17, 2025
Copy link

Hello @martignoni!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Mar 23, 2025
Copy link

Hello @martignoni!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Gazetteer labels misplaced when degrees-towards-zenith are negative
3 participants