Add new plugin 'Object visibility'#4933
Conversation
It's the first step toward complete ''Visibility plugin'' which was cancelled
|
Great PR! Please pay attention to the following items before merging: Files matching
This is an automatically generated QA checklist based on modified files. |
There was a problem hiding this comment.
Would be better if the lines were antialiased. Ideally, the source should be in SVG format (and stored in the repo as for all the other buttons). And the enabled version of the icon should glow, see the others. How to do this is explained in the documentation layer of data/gui/icons.svg (at least I can see it if I open the file in Inkscape).
There was a problem hiding this comment.
Should be fixed now, please have a look.
There was a problem hiding this comment.
Hmm, took quite a bit for me to figure out why it doesn't work in Inkscape from Ubuntu 22.04. How did you create it?
The following patch makes it more compatible (though Geeqie still fails to understand it):
diff --git a/plugins/ObjectVisibility/icons.svg b/plugins/ObjectVisibility/icons.svg
index 8edb6017ad..1e78bf983c 100644
--- a/plugins/ObjectVisibility/icons.svg
+++ b/plugins/ObjectVisibility/icons.svg
@@ -29,6 +29,7 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
width="160"
height="160"
viewBox="0 0 32 32"
@@ -110,7 +111,7 @@
id="off"
stroke="#6d6d6d" fill="none"
opacity="0.7">
- <use href="#iconShape" />
+ <use xlink:href="#iconShape" />
</g>
<!-- ===== Layer: on (active state) =====
@@ -124,11 +125,11 @@
id="on">
<!-- Soft halo: same shape, passed through the glow filter. -->
<g stroke="#ffffff" fill="none" filter="url(#glow)">
- <use href="#iconShape" />
+ <use xlink:href="#iconShape" />
</g>
<!-- Crisp white icon on top of the halo. -->
<g stroke="#ffffff" fill="none">
- <use href="#iconShape" />
+ <use xlink:href="#iconShape" />
</g>
</g>
</svg>And also, how did you add the comments?
There was a problem hiding this comment.
Ah, I generated the icon with Claude AI with Equation of Time icon as a reference, I thought that would solve it. I guess that could have lead to incompatibilities across OS's. Should I recreate it, or is your patch enough to cover the problem?
There was a problem hiding this comment.
Ah, this explains a lot.
This actual icon doesn't even resemble that of Equation of Time in structure. I guess it might be OK for now, but if you could just take the shapes from this SVG, replace with them those in the icon of Equation of Time, and save in place of this one, it would be much easier for the future developers who may need to edit it.
And an unrelated question: was the C++ code of this PR also created with the help of AI?
There was a problem hiding this comment.
Yes, it was, otherwise I would have never been able to create it.
|
Why legend has white background? What about light grey color? |
I was aiming for readability. Could try light grey to see how it looks. |
The ideal solution would be to somehow fetch a background from the CSS, like the rest of the GUI. Not sure if it's feasible though (is there any way to query it without manually parsing the stylesheet?). |
|
|
||
| void ObjectVisibilityDialog::setVisible(bool v) | ||
| { | ||
| // On hide: clear the "armed" state of click-to-set mode so the |
There was a problem hiding this comment.
This behavior was quite irritating while I was testing. I just hid the dialog to clear the sky, and now on reopening it clicks in the map no longer work until I check the checkbox. Can we improve the UX here somehow?
Or maybe it wouldn't be a common use case? @alex-w What do you think?
| if (gui) | ||
| { | ||
| enableKineticScrolling(gui->getFlagUseKineticScrolling()); | ||
| connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), |
There was a problem hiding this comment.
Please use the modern connect style (with function pointers). The old string-based one should be abolished, at least for the new code (with a few exceptional use cases, which this isn't).
|
The "Select a star or DSO, then click Calculate" could be improved on by saying that the currently selected object doesn't fit because its type is XYZ. Otherwise one might wonder why the Calculate button doesn't get enabled when the Sun is selected (or even a planet, just due to clicking by mistake or something). And no, the tooltip isn't discoverable enough. I only guessed to look at it after reading the code. |
| double latitudeDeg, | ||
| const QPen& pen) const | ||
| { | ||
| if (latitudeDeg < -90.0 - EPS || latitudeDeg > 90.0 + EPS) return; |
There was a problem hiding this comment.
Why do we allow latitude to be ±90.000000001, but not beyond? What is the point of this EPS?
|
|
||
| void ObjectVisibility::setGoodVisibilityLimit(int degrees) | ||
| { | ||
| degrees = std::max(1, std::min(89, degrees)); |
There was a problem hiding this comment.
std::clamp will be more readable.
Description
(This is the first step in a rewrite of #4924.)
This PR introduces the plugin Object visibility, which shows lines and markings on an Earth map, visualizing the visibility of any star or DSO. To use it, click on a star and hit "Calculate". The Earth map is zoomable and pannable, just like the one in the Location dialog. With a checkbox, users can change location by clicking in the map.
Five markings are shown:
Solid line = limit of visibility
Dashed line = limit of "good" visibility (customizable, default is 5 degrees)
Cross = object passes through zenith
Up-arrow = northern limit of circumpolarity
Down-arrow = southern limit of circumpolarity
It takes precession and proper motion into account, making sure we also show historical and future visibilities correctly. Note that lines are only generated when clicking "Calculate". There is no "live update" mode, following Stellarium's time automatically.
Planets and other solar system bodies are disabled for this plugin.
All ideas have been taken from https://astro-geo-gis.com/, in the article The 49 brightest stars in the night sky – when and where can we see them? found here. Credit is given both in the source files and in the
Aboutsection of the plugin.The plugin works for all planets (Mercury -> Neptune), Pluto, the Moon and the Galilean moons of Jupiter. For other bodies, the button "Calculate" greys out and a message is shown.
Screenshots:
Achernar's visibility.

Type of change
Test Configuration:
Fedora 44 KDE Plasma / Ubuntu 24.04.4 LTS
Qt 6.11.1 / Qt 6.4.2
Checklist: