diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-18 19:12:49 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-18 19:12:49 +1300 |
commit | 30f97a3af0dab8724f6c4c3c32da25f1adbf4221 (patch) | |
tree | 93e37644f5d758cf17025bd1a3be85c2561e21b0 /web/app/view | |
parent | 94bbf51bdf1a303dfcb9a04f1629e9cee1567fce (diff) | |
download | traccar-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.tar.gz traccar-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.tar.bz2 traccar-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.zip |
Clean up map and state code
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/Map.js | 24 | ||||
-rw-r--r-- | web/app/view/MapController.js | 14 | ||||
-rw-r--r-- | web/app/view/StateController.js | 7 |
3 files changed, 18 insertions, 27 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 709684e29..9a032e79f 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -29,28 +29,28 @@ Ext.define('Traccar.view.Map', { listeners: { afterrender: function () { - var user = Traccar.app.getUser(); - var server = Traccar.app.getServer(); + var user, server, layer, type, bingKey, vectorLayer, lat, lon, zoom; - var layer; - var mapLayer = user.get('map') || server.get('map'); + user = Traccar.app.getUser(); + server = Traccar.app.getServer(); - var bingKey = server.get('bingKey'); + type = user.get('map') || server.get('map'); + bingKey = server.get('bingKey'); - if (mapLayer === 'custom') { + if (type === 'custom') { layer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: server.get('mapUrl') }) }); - } else if (mapLayer === 'bingRoad') { + } else if (type === 'bingRoad') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: bingKey, imagerySet: 'Road' }) }); - } else if (mapLayer === 'bingAerial') { + } else if (type === 'bingAerial') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: bingKey, @@ -64,13 +64,13 @@ Ext.define('Traccar.view.Map', { } this.vectorSource = new ol.source.Vector({}); - var vectorLayer = new ol.layer.Vector({ + vectorLayer = new ol.layer.Vector({ source: this.vectorSource }); - var lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat; - var lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon; - var zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom; + lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat; + lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon; + zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom; this.mapView = new ol.View({ center: ol.proj.fromLonLat([lon, lat]), diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index d8177335b..0b5e60175 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -95,20 +95,6 @@ Ext.define('Traccar.view.MapController', { }, getMarkerStyle: function (radius, color) { - /*return new ol.style.Style({ - text: new ol.style.Text({ - text: '\uf041', - font: 'normal 32px FontAwesome', - textBaseline: 'Bottom', - fill: new ol.style.Fill({ - color: color - }), - stroke: new ol.style.Stroke({ - color: 'black', - width: 2 - }) - }) - });*/ return new ol.style.Style({ image: new ol.style.Circle({ radius: radius, diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index a6adfc908..29f6a7c6d 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -22,7 +22,8 @@ Ext.define('Traccar.view.StateController', { listen: { controller: { '*': { - selectDevice: 'selectDevice' + selectDevice: 'selectDevice', + selectReport: 'selectReport' } } } @@ -123,6 +124,10 @@ Ext.define('Traccar.view.StateController', { } }, + selectReport: function (position) { + console.log(position); + }, + add: function (store, data) { if (this.deviceId === data[0].get('deviceId')) { this.updatePosition(data[0]); |