summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/MapWidget.qml
AgeCommit message (Collapse)Author
2017-08-07mapwidget.qml: add menu action for selecting visible locationsGravatar Lubomir I. Ivanov
MapWidgetContextMenu now has a new action (SELECT_VISIBLE_LOCATIONS), that will invoke the MapWidgetHelper method selectVisibleLocations(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: implement centerOnRectangle()Gravatar Lubomir I. Ivanov
First, this function calculates the zoom out effect until both the current Map center and the target rectangle are visible - see the "calculate zoom out" part. Then it calculates a zoom level, so that the target rectangle fits the viewport, but also so that the zoom is not too much (clamped). see the "calculate zoom in" part. NOTE: "centerStored" (the variable used to store the current map center) is created using QtPositioning.coordinate(), because the code needs a new object and not a reference of the map.center QGeoCoordinate object. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: add a couple of helpersGravatar Lubomir I. Ivanov
Add stopZoomAnimations(), which is really just a precaution function to make sure we have stopped all animation of the map before doing calculations! Since the animation *should* be running in a separate thread, this would make sure the Map "center" and "zoomLevel" properties do not change. Add pointIsVisible(), which is a helper to determine if a point created by map.fromCoordinate() method is inside the viewport. fromCoordinate() has to be called without the "false" (clip) flag for this to work. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidgethelper: support tracking of all selected dive sitesGravatar Lubomir I. Ivanov
MapWidgetHelper::centerOnDiveSite() now checks if more than one dive sites are selected and finds the most top-left and bottom-right ones in the coordinate system to form a rectangle. It also supports the special cases where a selected dive site does not have coordinates or the case where only a single dive site with GPS coordinates are selected. TODO: implement mapwidget.qml::centerOnRectangle() This QML function will receive a QGeoCoordinate based rectangle which has to be centered in the viewport with animation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: add better error reporing on a missing map pluginGravatar Lubomir I. Ivanov
For instance, if the 'googlemaps' geoservices plugin is missing a new message is now shown: "qml: MapWidget.qml: cannot find a plugin with the name 'googlemaps'" Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget: use "satallite" maps instead of "hybrid"Gravatar Lubomir I. Ivanov
Do so until the following issue is resolved: https://github.com/vladest/googlemaps/issues/9 With the satellite map ([1]), the black tiles at relatively high zoom levels over the Red Sea cannot be seen. Instead it shows white tiles at the ultra-maximum zoom level at places. As a side note, the "satellite" map does not have the country labels which the "hybrid" map has. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-02mapwidget.qml: use a custom built googlemaps pluginGravatar Lubomir I. Ivanov
This patch makes use of the geolocation plugin "googlemaps" for Qt Location with source code from here: https://github.com/vladest/googlemaps The change from the ESRI plugin is that it requires new indexes for the Hybrid ([3]) and Street ([0]) map types. There are more zoom levels in this plugins, but our default zoom-in settings seem to transition well to it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-31Smaller buttons on map widgetGravatar Robert C. Helling
... so they take up less space while still being clickable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-07-31QML UI: stop showing location labels earlierGravatar Dirk Hohndel
We are stepping by 2 - so 11 makes it clear that at 12 the labels are shown, but at 10 they are not. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-28map: whitespace cleanup in QML and C++ filesGravatar Lubomir I. Ivanov
- remove ";"s - remove {} where not needed or move them to the same line Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: track the coordinatesChanged() signal in QMLGravatar Lubomir I. Ivanov
The C++ side for the desktop version already does that. Add a slot for that in QML, for later use in the mobile version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: use darker text color for the deselected markersGravatar Lubomir I. Ivanov
Use "lightgrey" instead of "white" for deselected markers. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add new logic for zooming and editing supportGravatar Lubomir I. Ivanov
The editing support is added via dragging. It is handled via the MouseArea's drag.target of the MapQuickItem. The drag target changes with the model selectedUuid. "mapAnimationZoomIn" now also does an initial zoom-out before moving to a new location. centerOnCoordinate() now pefroms calculations to determine how much the animation needs to zoom out. What it does is it reduces the Map zoomLevel util both the current and the new target coordinates are visible. It then restores the zoomLevel and performs animation based on newZoomOut. animateMapZoomIn() is now obsolete. The patch also includes the following smaller changes: - remove the setSelectedUuid() call in deselectMapLocation() This is now handled in C++ - sets "defaultZoomIn" to 12.0 - use ">=" when determining if a mapItem text should be visible Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add visual tracking of editMode from MapWidgetHelperGravatar Lubomir I. Ivanov
The MapWidgetHelper QML instance now has the slot onEditModeChanged() which toggles the visiblity of a newly added message box that notifies the user if editing mode is enabled. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: change centerOnDiveSite()Gravatar Lubomir I. Ivanov
Call setSelectedUuid() from C++ also center on coodinates instead on a MapLocation, as there is no point to pass the MapLocation object back to QML. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: include map location textGravatar Lubomir I. Ivanov
The MapItemView delegate now includes a white Text element. It uses the MapLocation "name" property as text. This text is only visible if the map zoom is above "textVisibleZoom". For hundreds of dives, using the DropShadow effect for the text makes it laggy. Instead, using a fake drop shadow (duplicate black Text under the default text) makes it much better. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add zoom-in and zoom-out buttonsGravatar Lubomir I. Ivanov
The buttons are positioned bellow the "toggle map type" button and increment / decrement the zoom by "zoomStep" (2 for now). Also clamp the zoom-in level to "map.maximumZoomLevel". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: ";" and variable declaration cleanupGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add double click on zoomGravatar Lubomir I. Ivanov
Double clicking a marker or the newly added MouseArea now performs a +2 zoom-in over a period of 500ms and centers on that clicked coordinate. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: store the selected dives count in "nSelectedDives"Gravatar Lubomir I. Ivanov
Different actions might be performed depending on the count of selected dives - e.g. deep zoom only for a single selected dive. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: emit a selectedDivesChanged() signalGravatar Lubomir I. Ivanov
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>
2017-07-28maplocationmodel: make setSelectedUuid() accept "fromClick" flagGravatar Lubomir I. Ivanov
The idea of this flag is to be able to only to emit the selectedLocationChanged() signal when the user clicked on the map (fromClick == true). MapWidgetHelper::selectedLocationChanged() listens for this signal and only then it will select nearby dives based on a "small-cicle". If "fromClick" is false, it's the backend or the dive list that updated the selection and MapWidgetHelper::selectedLocationChanged() should no be called. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: call calculateSmallCircleRadius() on zoom changesGravatar Lubomir I. Ivanov
Each time the zoom changes MapWidgetHelper::calculateSmallCircleRadius() is called, and the "small circle" radius is stored in both C++ and QML. On the C++ side this radius will be used to select multiple nearby dives. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: call "copy to clipboard" actions in the maphelper C++Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: open current location in Google MapsGravatar Lubomir I. Ivanov
openLocationInGoogleMaps() now can be used to open a URL in an external browser, triggered by the context menu. Use the same Google Maps URL formating as in main.qml showMap(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgetcontextmenu: add the actionSelected() signalGravatar Lubomir I. Ivanov
The actionSelected() signal is now dispatched when the user selects an action from the menu (see the "actions" object). Then the declaration of the MapWidgetContextMenu object in mapwidget.qml can catch that signal in the onActionSelected() slot and obtain the action via switch() branching. The actions enumeration is kept in QML for now, with the idea that specific C++ methods from the mapwidgethelper class will be called directly (if marked as Q_INVOCABLE), instead of a generic onMapAction(action) C++ method in the helper. But if the actions are possible from QML (like copying to clipboard) and are also small and non-expensive, it might be better to keep them in mapwidget.qml. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgetcontextmenu: position the contextMenu on the mapGravatar Lubomir I. Ivanov
The anchor of the menu itself will be positioned near the edge of the map widget, while the menu contents will have negative coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgetcontextmenu: add placeholder QMLGravatar Lubomir I. Ivanov
This QML component will be used to provide a context menu for the QML map widget. Include the file in QRC and test it's creation in MapWidget.qml. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: move the new map type toggle on top of the mapGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: animate the map type toggle image on clickGravatar Lubomir I. Ivanov
Add a SequentialAnimation that performs a slight animation of the toggle image scale. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add an small icon (top-left) to toggle the map typeGravatar Lubomir I. Ivanov
Clicking the image toggles the map.activeMapType value from type STREET to type SATELLITE. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: simplify the map type enumeration into "mapType"Gravatar Lubomir I. Ivanov
Make the "enumeration" local to the Map object for now. This will possibly break if another plugin is used in place of the ESRI plugin, but it will simplify the map toggle button which is about to be implemented next. If support for multiple plugins is added on runtime a simple helper function will be needed that will check the current plugin "name". And return the appropriate supportedMapTypes[X] for e.g. STREET of that plugin. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: use a seprate animation for zooming outGravatar Lubomir I. Ivanov
The animation sequence when deselecting a zoomed in map location, should be: - zoom out completely - pan to center To achieve that a new animation object is created - "mapAnimationZoomOut" The previous zoom in animation is renamed to "mapAnimationZoomIn". The map functions centerOnMapLocation() and deselectMapLocation() now call the helper functions animateMapZoomIn() and animateMapZoomOut(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: reduce the properies in mapAnimation to single linesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: don't use the onSourceChanged() slot for flag animationGravatar Lubomir I. Ivanov
It's best to only animate the flags when clicked, thus play the animation in the onClicked() slot from the MouseArea. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add deselectMapLocation()Gravatar Lubomir I. Ivanov
When called this function will zoom-out the map and set it's center to (0, 0) Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: remove some redundant "map." referencesGravatar Lubomir I. Ivanov
Inside the Map object, properties can be referenced directly. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add the animateMapTo() helper functionGravatar Lubomir I. Ivanov
To be used to center the map on a dive location or reset the map if a dive from the dive list doesn't have GPS coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: use map.newZoom and map.defaultZoomInGravatar Lubomir I. Ivanov
When centering on a map location, use the predefined zoom map.defaultZoomIn. Later the map should be able to center on (0, 0) and zoom-out if a dive doesn't have GPS data. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: whitespace and ';' cleanupGravatar Lubomir I. Ivanov
The rest of the QML code in subsurface doesn't use the ';' to end a line of code or a declaration. Remove all the redundant ';'. Also clean extra blank lines. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: play little animation on marker clicksGravatar Lubomir I. Ivanov
If a marker is clicked it's source image changes, which will call the onSourceChanged() slot. If a marker is selected play the newly added sourceItemAnimation which is a short scale animation for the image. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: update the Z order of selected markersGravatar Lubomir I. Ivanov
If a marker is selected bring it up front (high Z value) else set it behind everything else. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add some properties for zoom and centerGravatar Lubomir I. Ivanov
These properties will be used when zooming-in on a map location or when zooming out if no map location is selected. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: pass a MapLocation object to QML in centerOnDiveSite()Gravatar Lubomir I. Ivanov
The function in QML centerOnCoordinate() is now renamed centerOnMapLocation() and accepts a MapLocation object, so that a marker is selected (based on UUID). In MapWidgetHelper::centerOnDiveSite(), the pointer to a MapLocation is retrieved via MapLocationModel::getMapLocationForUuid(). Added in the previous commit. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: track the marker selectionGravatar Lubomir I. Ivanov
Add a MouseArea to the MapItemView delagate and onClick set the "mapHelper.model.selectedUuid" to the uuid of the clicked marker. This updates the "selectedUuid" property inside MapLocationModel. Based on "mapHelper.model.selectedUuid" it is now possible to show two seprate images for selected / deselected markers. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: pass a QGeoCoordinate to the QML mapGravatar Lubomir I. Ivanov
Rename the QML function "centerOnCoordinates" to "centerOnCoordinate" and pass a QGeoCoordinate to it in ::centerOnDiveSite(). This will prevent the creation of a QGeoCoordinate object on the QML side and instead it will be created in C++. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: store the coordinate as QGeoCoordinateGravatar Lubomir I. Ivanov
Instead of maintaining a seperate latitude/longitude values in C++ and passing them to QML separatelly, pass them as a QGeoCoordinate. This reduces the number of model "roles" and also prevents the creations of extra objects in QML (e.g. via QtPositioning.coordinate(..)). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: implement the MapItemView with delegateGravatar Lubomir I. Ivanov
MapItemView is the QML class that handles the "create map markers based on a model". In this case the model is created as part of the MapWidgetHelper, so here passing "mapHelper.model" to the "model" property is enough. The delegate receives coordinates from the model as "model.latitude", "model.logitude" and converts them to QGeoCoordinate. The "sourceItem" image for the delagete is just an image ATM and is fetched from QRC. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28add the SPDX-License-Identifier to new source filesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: implement some map animationGravatar Lubomir I. Ivanov
When calling centerOnCoordinates() the map will now animate over a period of 3 seconds the zoom level and over 2 seconds the center of the map. Can be tweaked and improved later on. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>