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

archaeolines plugin: increase location accuracy #1447

Conversation

axd1967
Copy link
Contributor

@axd1967 axd1967 commented Dec 29, 2020

Description

The custom location lat/long input boxes accepted 2 digits after the comma, which lead to considerable azimuth deviations for custom locations less than a few km distant.
Precision has been increased to 6 digits (as used in current location precision).

Screenshots (if appropriate):

image

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

How Has This Been Tested?

Test Configuration:

  • Operating system: KUbuntu 20.04
  • Graphics Card: <Manufacturer (likely Intel, NVidia, AMD?), Model (HD, Geforce, Radeon..., with model number), driver version?>

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
  • 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

Note

There is a strange behaviour when entering values by keyboard (this used to happen in Ocular plugin if I'm not mistaken): the GUI prevents entering several digits at a time, so one has to enter digits one by one. Maybe due to too early event handling?

edit added: this is an issue that existed before this PR.

Workaround: after entering a digit, select the remaining digits (SHIFT+END) and type the next digit, until all digits have been entered.

@axd1967 axd1967 changed the title archeolines: increase location accuracy archaeolines plugin: increase location accuracy Dec 29, 2020
Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

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

Please fix CodeFactor warning

@gzotti
Copy link
Member

gzotti commented Dec 30, 2020

It may then be worth using the same coordinate input boxes that are used in the Location panel. They also automatically react to decimal degrees setting.

@gzotti gzotti added this to the 0.21.0 milestone Dec 30, 2020
@gzotti gzotti added the enhancement Improve existing functionality label Dec 30, 2020
- CodeFactor does not like whitespace :-(
@github-actions github-actions bot requested a review from alex-w December 30, 2020 13:36
@alex-w
Copy link
Member

alex-w commented Dec 30, 2020

It may then be worth using the same coordinate input boxes that are used in the Location panel. They also automatically react to decimal degrees setting.

Good idea! Plus following “Use decimal degrees” option from main GUI.

- named constants
- proposed logical order of changelog: newest on top
@axd1967
Copy link
Contributor Author

axd1967 commented Jan 1, 2021

It may then be worth using the same coordinate input boxes that are used in the Location panel. They also automatically react to decimal degrees setting.

Good idea! Plus following “Use decimal degrees” option from main GUI.

I've looked into the code of both classes and this is far from trivial. To start, both modules were written very differently (especially event handling). Also, additional work would be nice, eg introduce additional UI classes derived from AngleSpinBox (such as LongitudeSpinBox) to avoid too much duplication of code (such as setting properties such as limits, format, and prefixtype and handling events such as decimal degree mode).

I'd see this in a separate change request that should no longer block the current change.

@alex-w
Copy link
Member

alex-w commented Jan 1, 2021

Why you added weird StelLocation method? Why you added const int variables with strange names and why you don’t use it completely? Why AngleSpinBox is too hard to you and why you want to get a separate classes?

@axd1967
Copy link
Contributor Author

axd1967 commented Jan 1, 2021

Why you added weird StelLocation method? Why you added const int variables with strange names and why you don’t use it completely? Why AngleSpinBox is too hard to you and why you want to get a separate classes?

I won't take such aggressive remarks, sorry. This is NOT the way to treat contributions. You should be ashamed of your attitude!

@axd1967 axd1967 closed this Jan 1, 2021
@alex-w
Copy link
Member

alex-w commented Jan 1, 2021

Really?! Where do you see "aggressive remarks"? 

Maybe here:

Why did you add the weird StelLocation method?

But I really do not understand why you add a new method in StelLocation class which is unusable in any part of Stellarium except for one place - ArcheoLines plugin. Why you not use simple struct here?

Maybe here: 

Why you added const int variables with strange names and why you don’t use it completely?

You are added the LOCATION_DEGREE_PRECISION_DIGITS and LOCATION_RAD_PRECISION_DIGITS variables, but... where you see radians for latitude and longitude? Right now by the fact both variables are added just because you may add them. Why didn't you use LOCATION_RAD_PRECISION_DIGITS within the AngleSpinBox class (Hint: see constructor)?

Or maybe here:

Why AngleSpinBox is too hard for you and why you want to get separate classes?

I don't understand why AngleSpinBox is not usable for you and you need 2 separate classes for coordinates.

Why I should be ashamed if you writing something strange and unobvious?

@alex-w alex-w reopened this Jan 1, 2021
@github-actions
Copy link

github-actions bot commented Jan 1, 2021

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

@gzotti gzotti modified the milestones: 0.21.0, 0.21.1 Mar 9, 2021
@axd1967
Copy link
Contributor Author

axd1967 commented Mar 20, 2021

As a result of not accepting this PR, the current implementation (0.20.4) shows a horrible angular precision issue, just because the input boxes do not accept a higher precision.

image

here is the proposed change: master...axd1967:contrib/plugin/archeo/20201229-precision

One will notice that the proposed changes are very simple and basic (and removes DRY and meant to be more readable, with the price of an added dependency...). And I explain why I refuse to perform further refactoring. In exchange, I am being scolded. Profusingly.

@gzotti
Copy link
Member

gzotti commented Mar 20, 2021

What is KBC, what kind of line have you set, and what is DRY? You can set a line to 1/100 degrees accuracy, exceeding application of naked-eye resolution this plugin's use was originally intended for.

In a process of further developing this plugin it may make sense to replace Qt's default DoubleSpinBox by whatever multi-angle-detail GUI input element has been developed for use in the Location panel. A cheap solution would be to increase field width to 7 post-comma places. What for?

@alex-w
Copy link
Member

alex-w commented Mar 20, 2021

@axd1967 you are added new method in StelLocation class where is not used in this class, you are defined 2 variables in AngleSpinBox class and both variables are not used in this class - I asked why you doing it and what I got in answer?

@alex-w
Copy link
Member

alex-w commented Mar 20, 2021

n a process of further developing this plugin it may make sense to replace Qt's default DoubleSpinBox by whatever multi-angle-detail GUI input element has been developed for use in the Location panel.

In the Location panel and in the AstroCalc tool we use standard Qt's spinboxes, but with DMS style - no need some special for it.

To follow DD/DMS styles we need add additional 5 lines in the code - no need any strange work as @axd1967 proposed.

@gzotti
Copy link
Member

gzotti commented Mar 20, 2021

In the Location panel and in the AstroCalc tool we use standard Qt's spinboxes, but with DMS style - no need some special for it.

To follow DD/DMS styles we need add additional 5 lines in the code - no need any strange work as @axd1967 proposed.

OK, even better.

@axd1967
Copy link
Contributor Author

axd1967 commented Mar 20, 2021

KBC doesn't matter. it is a custom geographic location that I defined in the archeo plugin, and the corresponding azimuth towards that same location was separately computed in the landscape.

because of the limited input precision of the archeo plugin, it is currently not capable to compute accurate azimuths for nearby locations: the result in this case is a 7-degree difference.

For DRY, see https://en.wikipedia.org/wiki/Don%27t_repeat_yourself . that's the "strange work" and the seemingly "unneeded" constructor (and it's not because a method is not used in a class, that it makes no sense. a class can provide services for its clients without using those services). I believe in readability over efficiency, especially in an open source product: better readable code will attract more developers, who will then be even more productive.

@alex-w
Copy link
Member

alex-w commented Mar 20, 2021

According to DRY principle you should obtain coordinates for 2 locations from existing database of locations through existing methods in the class - not adding messing through adding "empty" methods with doubling data and unobvious dependencies. Please read about KISS principle. Same problem for introduced by you 2 variables in one class to using exclusively in the other class (really it need one variable!).

@gzotti
Copy link
Member

gzotti commented Mar 21, 2021

currently not capable to compute accurate azimuths for nearby locations: the result in this case is a 7-degree difference.

Finally you expressed the problem case clear enough to understand. Nearby locations.

@axd1967
Copy link
Contributor Author

axd1967 commented Mar 21, 2021

Good point, @gzotti , but no cigar, as I already mention it in the PR :-)
("considerable azimuth deviations for custom locations less than a few km distant")

@gzotti
Copy link
Member

gzotti commented Mar 21, 2021

I don't smoke... ;-)

gzotti added a commit that referenced this pull request Mar 28, 2021
- also add some property connector code to the AngleSpinBox
- also make sure cursor position does not change while mouse-wheeling an angle
@gzotti gzotti mentioned this pull request Mar 28, 2021
12 tasks
@gzotti
Copy link
Member

gzotti commented Mar 28, 2021

#1573 should provide what you need.

@axd1967 axd1967 closed this Mar 29, 2021
gzotti added a commit that referenced this pull request Apr 2, 2021
- Add Polar Circles (Fix #1555)
- Add two custom altitude lines
- Replace angle DoubleSpinBoxes by AngleSpinBoxes. (Supersedes #1447)
- Allow grabbing declination/azimuth/altitude data from selected object
- Allow direct selection of locations from Stellarium's location list
- SUG: Updated description of ArchaeoLines
- Added QTextEdit StelProperty connections
- AngleSpinBox: 
  - add property connector code
  - make sure cursor position does not change while mouse-wheeling an angle

Co-authored-by: Alexander Wolf <aw@altspu.ru>
@alex-w alex-w added the state: fixed The bug has been fixed label Apr 11, 2021
@alex-w alex-w removed the state: fixed The bug has been fixed label Jun 24, 2021
@github-actions
Copy link

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

@axd1967 axd1967 deleted the contrib/plugin/archeo/20201229-precision branch November 14, 2021 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants