The signal emits a QList<int> filled with dive idexes from the
main backend dive table.
The MapWidgetHelper QML instance handles that in onSelectedDivesChanged().
This will only be needed for the mobile version, as the desktop version
should connect it's own slot in MapWidget.cpp.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Based on a current location (MapLocation), iterate the dive list
and add nearby dives (distance smaller than m_smallCircleRadius) to
a local QList property (m_selectedDiveIds).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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 method uses the helper printGPSCoords() to format the
coordinates of a location into either decimal or sexagesimal.
The selection is handled by the boolean flag "formatTraditional"
and the user preferences flag - prefs.coordinates_traditional.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When MapLocationModel updates the selected marker, MapWidgetHelper now
receives a signal. The slot is named selectedLocationChanged().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
reloadMapLocations() is the method which is called when the list
of markers (model) should be cleared and re-populated with new MapLocation
objects.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The idea here is that the QML code should be able to fetch a model
from the MapWidgetHelper instance which is instantiated inside the
QML code; fetch it in the lines of "mapHelper.model".
This way, updates at the backend would be reflected on the Map QML widget.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
MapWidget sould not handle any of the map backend.
Instead it should just pass calls to MapWidgetHelper.
Do that for centerOnDiveSite().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The idea with this class is that it should be used by both the mobile
and desktop version.
TODO STEPS:
1) the class should be registered in both the mobile and desktop version
with qmlRegisterType<MapWidgetHelper>...
2) the MapWidget.qml should create an instance of this class.
3) this way the helper will be part of the QML and both the desktop and
mobile version can have access to it.
4) the desktop version as a first implementation can just use findChild()
in desktop-widgets/mapwidget.cpp.
5) desktop-widgets/mapwidget.cpp on the desktop should just translate
calls from the rest of the desktop-widgets to this helper class.
6) the mobile version access to this object would be easy but is off the
scope for now.
7) the idea, when implementing the desktop support is to make it so
that when implementing the mobile version later, no or only minimal
changes would be required to the MapWidgetHelper class.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>