[Marble-devel] Review Request 123579: UTM grid and coordinates fixed

Alejandro García Montoro alejandro.garciamontoro at gmail.com
Sun May 10 23:37:56 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123579/
-----------------------------------------------------------

(Updated May 10, 2015, 11:37 p.m.)


Review request for Marble.


Changes
-------

This update makes the following changes:

#### GeoDataCoordinates.h

* Four public functions for UTM-related work are added: `utmZone()`, `utmLatitudeBand()`, `utmEasting()` and `utmNorthing()`.
* The `{lon,lat,lonLat}ToUTMString()` are deleted, as all the work is done from the `{lon,lat}ToString`. In these latter functions, a `@FIXME` comment is added, as a further bigger refactoring is needed: by now, the `{lon,lat}toString` functions only receive longitude or latitude values; in UTM, both of them are needed to obtain the correct values. This scenario produces some misbehaviours in the exceptional zones. I will open a bug report if this review request is accepted. 

#### GeoDataCoordinates_p.h

* All UTM mathematical functions and constants are now located in GeoDataCoordinates_p.h

#### GraticulePlugin.cpp

* The UTM grid had a bug in the rendering of the 31X zone: it starts in the standard longitude, but the previous code drew its line 3 degrees to the right.
* The precision needed when labelling UTM zones is 0 (only zone or latitude band should be showed, not easting nor northing)

#### TestGeoDataCoordinates.cpp

* The TestGeoDataCoordinates.cpp file is updated with a new function, `testUTM()`, in which the public UTM-related functions -`utmZone()`, `utmLatitudeBand()`, `utmEasting()` and `utmNorthing()`- are tested. Randomly located values, but convering all the exceptional zones, are used.

#### Other changes

All the issues opened are now fixed:

* Variable names and the position of their declaration were reviewed.
* UTM mathematical functions returns coordinates through a QPointF.
* QString format is now used.
* Typos fixed.


Repository: marble


Description
-------

Two different tasks have been accomplished concerning UTM coordinate system:

1. The UTM grid rendering has been fixed. Now the grid and labels are drawn as expected (see http://upload.wikimedia.org/wikipedia/commons/e/ed/Utm-zones.jpg for comparison)
2. Some UTM functions have been added in order to properly calculate and display the coordinates on the status bar. Those functions have been wrapped in the new GeoDataUTM namespace inside GeoDataCoordinates.cpp If you prefer to see the functions integrated in the GeoDataCoordinates class, please, let me know.
 
**Still to be fixed**: The UTM string showed in the status bar is too long for the text field in which it is shown. I have not been able to change its size, as I have not found the relevant .ui file; where in the code should I check to change that?

**Note**: The lat/lon <-> UTM conversion algorithm has been adapted from this JavaScript code http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html. The author says in the page "The JavaScript source code in this document may be copied and reused without restriction", and I have linked the website in the code. However, as I am not sure about all the licenses and authoring stuff, I would like you to review it.


Diffs (updated)
-----

  src/apps/marble-kde/marble_part.cpp 283ad87a39f91e01c391a4dd8f4c9ddbeef41481 
  src/apps/marble-qt/QtMainWindow.cpp c4280c62b4534b7d10387b6895d142920f957bb7 
  src/lib/marble/geodata/data/GeoDataCoordinates.h 6efabd047f8f3aff63381facb78cb371c0740bf4 
  src/lib/marble/geodata/data/GeoDataCoordinates.cpp fe74a2e42db921b152a29ef04246ceaaa16c2325 
  src/lib/marble/geodata/data/GeoDataCoordinates_p.h 7b84e860c11937602b66faef2cee6b9cc403a132 
  src/plugins/render/graticule/GraticulePlugin.cpp a5e6d14a921c66d55cf01e39b16564dedcf6532b 
  tests/TestGeoDataCoordinates.cpp a38b090104503f021fb98eed5f3f4394c10d5f8f 

Diff: https://git.reviewboard.kde.org/r/123579/diff/


Testing
-------

Changes tested in master branch @ 1st May.
Grid and coordinates work well (except for the displaying issue explained above) and are consistent with the UTM coordinate system.


File Attachments
----------------

UTM grid exceptions around Norway
  https://git.reviewboard.kde.org/media/uploaded/files/2015/05/01/505df756-87f2-47bb-a6c1-d5b52629547a__NorwayScreenshot.png


Thanks,

Alejandro García Montoro

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20150510/6168761f/attachment.html>


More information about the Marble-devel mailing list