mapper icon indicating copy to clipboard operation
mapper copied to clipboard

Increase precision of grivation for better OCAD import/export

Open pkturner opened this issue 4 years ago • 4 comments

This implements what was discussed for #1896, increasing the precision with which Mapper represents grivation, from 2 decimal places to 8.

The basic change is an increase in the number of decimal places when grivation is set, and when it is saved to XML or OCD. That change opens questions of "When should the precision present in grivation be respected, or taken advantage of?" In this PR, some georeferencing actions which affect grivation are revised for the added precision.

Most of the attention to enhanced precision occurs in the Georeferencing dialog. If the user changes the georeferencing CRS (while grivation is unlocked) keeping "Geographic coordinates", the grivation is changed precisely, based on the change in convergence. If the user changes the reference point it is handled the same way.

Beyond that, if Map::rotateMap is called with the "adjust declination" option, the grivation is rotated by the given angle, rather than being set from the less precise declination.

A more pedestrian approach to this enhancement would be to maintain and save 8 decimal places of precision for both the declination and grivation, while exposing just 2 decimal places to the user. The additional precision would need to be saved in the XML file format, even for declination.

I was not content to implement the enhancement that way. If the Georeferencing state includes

  • the declination rounded to 2 places
  • the grivation rounded to 8 places
  • the convergence (not rounded)

then that should be enough. In fact, we don't want the declination to have more precision. So I discovered and made use of a nifty way to extract a precise declination from those properties of the Georeferencing state. This is the Georeferencing::getDeclinationSetting() function.

pkturner avatar Mar 26 '21 12:03 pkturner

Thanks, Scott, for your interest in my code review! I know little about the georeferencing corner of Mapper code but I'll dive deeper into it in the coming days to verify the code changes.

I've got a handful of comments. Some of them are optional enhancements. I'll tag those accordingly.

lpechacek avatar Apr 02 '21 18:04 lpechacek

Libor, thank you for looking over this PR. I requested you due to the interest you showed in #1925 (precision of grivation in OCAD import/export).

While I am able to respond to all of today's comments, I apologize in advance that I will shortly be unavailable. I will not be able to help put the finishing polish on this PR until May.

pkturner avatar Apr 02 '21 23:04 pkturner

As I said, it will be some weeks before I am available again to develop the code. Thanks, @lpechacek for the review. The getDeclinationSetting() method can be made more comprehensible, and I look forward to resuming the work before too long.

pkturner avatar Apr 05 '21 01:04 pkturner

I'm back, with no more lengthy vacations planned.

I've revised the PR as discussed above. Most significant is changing the name of getDeclinationSetting() to getPreciseDeclination(), and revising that method's code to be more descriptive and better motivated (I hope).

pkturner avatar May 14 '21 01:05 pkturner