diff options
Diffstat (limited to 'web/app/view/map')
-rw-r--r-- | web/app/view/map/BaseMap.js | 32 | ||||
-rw-r--r-- | web/app/view/map/Map.js | 16 | ||||
-rw-r--r-- | web/app/view/map/MapController.js | 8 |
3 files changed, 50 insertions, 6 deletions
diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index efd05021..c27a8d79 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -30,12 +30,13 @@ Ext.define('Traccar.view.map.BaseMap', { }, initMap: function () { - var server, layer, type, bingKey, lat, lon, zoom, maxZoom, target, poiLayer, self = this; + var server, layer, type, bingKey, locationIqKey, lat, lon, zoom, maxZoom, target, poiLayer, self = this; server = Traccar.app.getServer(); type = Traccar.app.getPreference('map', null); bingKey = server.get('bingKey'); + locationIqKey = Traccar.app.getAttributePreference('locationIqKey', 'pk.0f147952a41c555a5b70614039fd148b'); layer = new ol.layer.Group({ title: Strings.mapLayer, @@ -125,8 +126,35 @@ Ext.define('Traccar.view.map.BaseMap', { new ol.layer.Tile({ title: Strings.mapOsm, type: 'base', - visible: type === 'osm' || type === 'wikimedia' || !type, + visible: type === 'osm', source: new ol.source.OSM({}) + }), + new ol.layer.Tile({ + title: Strings.mapLocationIqHybrid, + type: 'base', + visible: type === 'locationIqHybrid', + source: new ol.source.XYZ({ + url: 'https://{a-c}-tiles.locationiq.com/v3/hybrid/r/{z}/{x}/{y}.jpg?key=' + locationIqKey, + attributions: '© <a href="https://locationiq.com/">LocationIQ</a>' + }) + }), + new ol.layer.Tile({ + title: Strings.mapLocationIqEarth, + type: 'base', + visible: type === 'locationIqEarth', + source: new ol.source.XYZ({ + url: 'https://{a-c}-tiles.locationiq.com/v3/earth/r/{z}/{x}/{y}.jpg?key=' + locationIqKey, + attributions: '© <a href="https://locationiq.com/">LocationIQ</a>' + }) + }), + new ol.layer.Tile({ + title: Strings.mapLocationIqStreets, + type: 'base', + visible: type === 'locationIqStreets' || type === 'wikimedia' || !type, + source: new ol.source.XYZ({ + url: 'https://{a-c}-tiles.locationiq.com/v3/streets/r/{z}/{x}/{y}.png?key=' + locationIqKey, + attributions: '© <a href="https://locationiq.com/">LocationIQ</a>' + }) }) ] }); diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js index fbaa7587..36e81de7 100644 --- a/web/app/view/map/Map.js +++ b/web/app/view/map/Map.js @@ -66,6 +66,13 @@ Ext.define('Traccar.view.map.Map', { stateId: 'show-geofences-button', tooltip: Strings.sharedGeofences }, { + handler: 'showAccuracy', + reference: 'showAccuracyButton', + glyph: 'xf140@FontAwesome', + pressed: true, + stateId: 'show-accuracy-button', + tooltip: Strings.positionAccuracy + }, { handler: 'showCurrentLocation', glyph: 'xf124@FontAwesome', tooltip: Strings.mapCurrentLocation @@ -95,6 +102,10 @@ Ext.define('Traccar.view.map.Map', { return this.accuracySource; }, + getAccuracyLayer: function () { + return this.accuracyLayer; + }, + getRouteSource: function () { return this.routeSource; }, @@ -133,10 +144,11 @@ Ext.define('Traccar.view.map.Map', { })); this.accuracySource = new ol.source.Vector({}); - this.map.addLayer(new ol.layer.Vector({ + this.accuracyLayer = new ol.layer.Vector({ name: 'accuracyLayer', source: this.accuracySource - })); + }); + this.map.addLayer(this.accuracyLayer); this.markersSource = new ol.source.Vector({}); this.map.addLayer(new ol.layer.Vector({ diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index 7ba0ee3b..f6d88eed 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ Ext.define('Traccar.view.map.MapController', { init: function () { this.callParent(); this.lookupReference('showReportsButton').setVisible( - Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableReport')); + Traccar.app.isMobile() && !Traccar.app.getPreference('disableReports', false)); this.lookupReference('showEventsButton').setVisible( Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableEvents')); }, @@ -68,6 +68,10 @@ Ext.define('Traccar.view.map.MapController', { this.getView().getLiveRouteLayer().setVisible(button.pressed); }, + showAccuracy: function (button) { + this.getView().getAccuracyLayer().setVisible(button.pressed); + }, + getMapState: function () { var zoom, center, projection; projection = this.getView().getMapView().getProjection(); |