diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/model/Server.js | 2 | ||||
-rw-r--r-- | web/app/store/MapTypes.js | 3 | ||||
-rw-r--r-- | web/app/view/admin/ServerDialog.js | 8 | ||||
-rw-r--r-- | web/app/view/map/Map.js | 12 | ||||
-rw-r--r-- | web/app/view/map/MapController.js | 5 | ||||
-rw-r--r-- | web/app/view/state/StateController.js | 12 |
6 files changed, 32 insertions, 10 deletions
diff --git a/web/app/model/Server.js b/web/app/model/Server.js index 9e4ab1eec..b21f28299 100644 --- a/web/app/model/Server.js +++ b/web/app/model/Server.js @@ -22,6 +22,8 @@ Ext.define('Traccar.model.Server', { { name: 'id', type: 'int' }, { name: 'registration', type: 'boolean' }, { name: 'map', type: 'string' }, + { name: 'bingKey', type: 'string' }, + { name: 'mapUrl', type: 'string' }, { name: 'language', type: 'string' }, { name: 'distanceUnit', type: 'string' }, { name: 'speedUnit', type: 'string' }, diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js index ebc45cc8d..fbdc49acc 100644 --- a/web/app/store/MapTypes.js +++ b/web/app/store/MapTypes.js @@ -20,6 +20,7 @@ Ext.define('Traccar.store.MapTypes', { data: [ {'key': 'osm', 'name': strings.mapOsm}, {'key': 'bingRoad', 'name': strings.mapBingRoad}, - {'key': 'bingAerial', 'name': strings.mapBingAerial} + {'key': 'bingAerial', 'name': strings.mapBingAerial}, + {'key': 'custom', 'name': strings.mapCustom}, ] }); diff --git a/web/app/view/admin/ServerDialog.js b/web/app/view/admin/ServerDialog.js index 37bb498a0..080e2fcc4 100644 --- a/web/app/view/admin/ServerDialog.js +++ b/web/app/view/admin/ServerDialog.js @@ -43,6 +43,14 @@ Ext.define('Traccar.view.admin.ServerDialog', { displayField: 'name', valueField: 'key' }, { + xtype: 'textfield', + name: 'bingKey', + fieldLabel: strings.mapBingKey + }, { + xtype: 'textfield', + name: 'mapUrl', + fieldLabel: strings.mapCustom + }, { xtype: 'combobox', name: 'distanceUnit', fieldLabel: strings.settingsDistanceUnit, diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js index 9d9a92886..cdb46342b 100644 --- a/web/app/view/map/Map.js +++ b/web/app/view/map/Map.js @@ -36,16 +36,20 @@ Ext.define('Traccar.view.map.Map', { var layer; var mapLayer = user.get('map') || server.get('map'); - var bindKey = 'AseEs0DLJhLlTNoxbNXu7DGsnnH4UoWuGue7-irwKkE3fffaClwc9q_Mr6AyHY8F'; + var bingKey = server.get('bingKey'); - if (mapLayer === 'bingRoad') { + if (mapLayer === 'custom') { + layer = new ol.layer.Tile({ source: new ol.source.XYZ({ + url: server.get('mapUrl') + })}); + } else if (mapLayer === 'bingRoad') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ - key: bindKey, + key: bingKey, imagerySet: 'Road' })}); } else if (mapLayer === 'bingAerial') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ - key: bindKey, + key: bingKey, imagerySet: 'Aerial' })}); } else { diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index 98922a307..0aab71725 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -128,9 +128,8 @@ Ext.define('Traccar.view.map.MapController', { var vectorSource = this.getView().vectorSource; - var data = Ext.getStore('Positions').getData().clone(); - data.sort('fixTime'); - + var data = Ext.getStore('Positions').getData(); + var index; var positions = []; this.reportRoutePoints = {}; diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js index 58bc5c55c..73dc28b50 100644 --- a/web/app/view/state/StateController.js +++ b/web/app/view/state/StateController.js @@ -73,6 +73,14 @@ Ext.define('Traccar.view.state.StateController', { } }, + formatValue: function(value) { + if (typeof(id) === 'number') { + return +value.toFixed(2); + } else { + return value; + } + }, + updatePosition: function(position) { var other; @@ -93,7 +101,7 @@ Ext.define('Traccar.view.state.StateController', { store.add(Ext.create('Traccar.model.Parameter', { priority: this.keys[key].priority, name: this.keys[key].name, - value: value + value: this.formatValue(value) })); } } @@ -119,7 +127,7 @@ Ext.define('Traccar.view.state.StateController', { name: key.replace(/^./, function (match) { return match.toUpperCase(); }), - value: value + value: this.formatValue(value) })); } } |