mapwidgethelper: add means to obtain a small circle radius

Based on a QGeoCoordinate, calculateSmallCircleRadius() calls
some QML Map methods to obtain how big a circle is in meters if
a circle is drawn over the Map widget with radius SMALL_CIRCLE_RADIUS_PX
pixels.

This is called a "small circle" of a sphere:
https://en.wikipedia.org/wiki/Circle_of_a_sphere

This "small circle" radius becomes huge if the map is zoomed out, while
quite small if the map is really zoomed in.

The idea behind this circle is to be able to select multiple nearby dives,
when clicking on the map (TODO).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2017-07-24 04:14:28 +03:00 committed by Dirk Hohndel
parent 4b8b61100a
commit 91302b3d8b
2 changed files with 27 additions and 0 deletions

View file

@ -21,10 +21,12 @@ public:
void centerOnDiveSite(struct dive_site *);
void reloadMapLocations();
Q_INVOKABLE void copyToClipboardCoordinates(QGeoCoordinate coord, bool formatTraditional);
Q_INVOKABLE void calculateSmallCircleRadius(QGeoCoordinate coord);
private:
QObject *m_map;
MapLocationModel *m_mapLocationModel;
qreal m_smallCircleRadius;
private slots:
void selectedLocationChanged(MapLocation *);