diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-06 22:17:25 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-06 22:17:25 -0600 |
commit | a273d60becc5ccc9e4626325ea2dca20271b36bc (patch) | |
tree | 1fe4a6651a6e93514b15e7431e125e1c4226c17f | |
parent | cf3555f3d9330f6711bd27ec9a24b74106703000 (diff) | |
parent | f00ddba99b1d56c9471b19e68c8354ed27749d36 (diff) | |
download | etbsa-traccar-web-a273d60becc5ccc9e4626325ea2dca20271b36bc.tar.gz etbsa-traccar-web-a273d60becc5ccc9e4626325ea2dca20271b36bc.tar.bz2 etbsa-traccar-web-a273d60becc5ccc9e4626325ea2dca20271b36bc.zip |
Merge branch 'master' of git://github.com/traccar/traccar-web
-rw-r--r-- | modern/src/map/Map.js | 8 | ||||
-rw-r--r-- | modern/src/map/mapStyles.js | 2 | ||||
-rw-r--r-- | web/app/store/MapTypes.js | 9 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 6 | ||||
-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 | 4 | ||||
-rw-r--r-- | web/l10n/en.json | 4 |
8 files changed, 74 insertions, 7 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js index 5e182a4..dcf5a92 100644 --- a/modern/src/map/Map.js +++ b/modern/src/map/Map.js @@ -8,7 +8,7 @@ import { SwitcherControl } from './switcher/switcher'; import deviceCategories from '../common/deviceCategories'; import { prepareIcon, loadImage } from './mapUtil'; import { - styleCarto, styleMapbox, styleMapTiler, styleOsm, + styleCarto, styleLocationIq, styleMapbox, styleMapTiler, styleOsm, } from './mapStyles'; import { useAttributePreference } from '../common/preferences'; import palette from '../theme/palette'; @@ -89,6 +89,7 @@ const Map = ({ children }) => { const mapboxAccessToken = useAttributePreference('mapboxAccessToken'); const mapTilerKey = useAttributePreference('mapTilerKey'); + const locationIqKey = useAttributePreference('locationIqKey', 'pk.0f147952a41c555a5b70614039fd148b'); useEffect(() => { maplibregl.accessToken = mapboxAccessToken; @@ -96,6 +97,9 @@ const Map = ({ children }) => { useEffect(() => { switcher.updateStyles([ + { id: 'locationIqStreets', title: t('mapLocationIqStreets'), uri: styleLocationIq('streets', locationIqKey) }, + { id: 'locationIqEarth', title: t('mapLocationIqEarth'), uri: styleLocationIq('earth', locationIqKey) }, + { id: 'locationIqHybrid', title: t('mapLocationIqHybrid'), uri: styleLocationIq('hybrid', locationIqKey) }, { id: 'osm', title: t('mapOsm'), uri: styleOsm() }, { id: 'carto', title: t('mapCarto'), uri: styleCarto() }, { id: 'mapboxStreets', title: t('mapMapboxStreets'), uri: styleMapbox('streets-v11') }, @@ -103,7 +107,7 @@ const Map = ({ children }) => { { id: 'mapboxSatellite', title: t('mapMapboxSatellite'), uri: styleMapbox('satellite-v9') }, { id: 'mapTilerBasic', title: t('mapMapTilerBasic'), uri: styleMapTiler('basic', mapTilerKey) }, { id: 'mapTilerHybrid', title: t('mapMapTilerHybrid'), uri: styleMapTiler('hybrid', mapTilerKey) }, - ], 'osm'); + ], 'locationIqStreets'); }, [mapTilerKey]); useEffect(() => { diff --git a/modern/src/map/mapStyles.js b/modern/src/map/mapStyles.js index 9650ead..86813a1 100644 --- a/modern/src/map/mapStyles.js +++ b/modern/src/map/mapStyles.js @@ -51,3 +51,5 @@ export const styleCarto = () => ({ export const styleMapbox = (style) => `mapbox://styles/mapbox/${style}`; export const styleMapTiler = (style, key) => `https://api.maptiler.com/maps/${style}/style.json?key=${key}`; + +export const styleLocationIq = (style, key) => `https://tiles.locationiq.com/v3/${style}/vector.json?key=${key}`; diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js index f91f366..1564789 100644 --- a/web/app/store/MapTypes.js +++ b/web/app/store/MapTypes.js @@ -20,6 +20,15 @@ Ext.define('Traccar.store.MapTypes', { fields: ['key', 'name'], data: [{ + key: 'locationIqStreets', + name: Strings.mapLocationIqStreets + }, { + key: 'locationIqEarth', + name: Strings.mapLocationIqEarth + }, { + key: 'locationIqHybrid', + name: Strings.mapLocationIqHybrid + }, { key: 'osm', name: Strings.mapOsm }, { diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index cc0fd4a..4241df3 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -528,6 +528,12 @@ Ext.define('Traccar.view.ReportController', { return Traccar.app.getEventString(value); } }, { + text: Strings.positionAlarm, + dataIndex: 'attributes', + renderer: function (value) { + return value['alarm']; + } + }, { text: Strings.sharedGeofence, dataIndex: 'geofenceId', renderer: Traccar.AttributeFormatter.getFormatter('geofenceId') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 507ee7a..7813aa6 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, @@ -88,8 +89,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 fbaa758..36e81de 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 7ba0ee3..d025b58 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -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(); diff --git a/web/l10n/en.json b/web/l10n/en.json index fae517b..ff5f61a 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -263,6 +263,9 @@ "mapMapboxSatellite": "Mapbox Satellite", "mapMapTilerBasic": "MapTiler Basic", "mapMapTilerHybrid": "MapTiler Hybrid", + "mapLocationIqStreets": "LocationIQ Streets", + "mapLocationIqEarth": "LocationIQ Earth", + "mapLocationIqHybrid": "LocationIQ Hybrid", "mapShapePolygon": "Polygon", "mapShapeCircle": "Circle", "mapShapePolyline": "Polyline", @@ -375,7 +378,6 @@ "alarmJamming": "Jamming", "alarmTemperature": "Temperature", "alarmParking": "Parking", - "alarmShock": "Shock", "alarmBonnet": "Bonnet", "alarmFootBrake": "Foot Brake", "alarmFuelLeak": "Fuel Leak", |