diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 18:23:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 18:23:32 +1300 |
commit | 99d132dc78b42b6cc5833b3a7faf30d2fe56186f (patch) | |
tree | 045052b15478c32c44f36a07c70885a756ea19b3 /web/app/view/Map.js | |
parent | dcfe1d48998c3fb3baa704fafed43d996f329a07 (diff) | |
download | trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.tar.gz trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.tar.bz2 trackermap-server-99d132dc78b42b6cc5833b3a7faf30d2fe56186f.zip |
Disable JavaScript strict mode
Diffstat (limited to 'web/app/view/Map.js')
-rw-r--r-- | web/app/view/Map.js | 130 |
1 files changed, 63 insertions, 67 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 7165bfb56..709684e29 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -13,84 +13,80 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function () { - 'use strict'; - Ext.define('Traccar.view.Map', { - extend: 'Ext.form.Panel', - xtype: 'mapView', +Ext.define('Traccar.view.Map', { + extend: 'Ext.form.Panel', + xtype: 'mapView', - requires: [ - 'Traccar.view.MapController' - ], + requires: [ + 'Traccar.view.MapController' + ], - controller: 'map', + controller: 'map', - title: Strings.mapTitle, - layout: 'fit', + title: Strings.mapTitle, + layout: 'fit', - listeners: { - afterrender: function () { - var user = Traccar.app.getUser(); - var server = Traccar.app.getServer(); + listeners: { + afterrender: function () { + var user = Traccar.app.getUser(); + var server = Traccar.app.getServer(); - var layer; - var mapLayer = user.get('map') || server.get('map'); + var layer; + var mapLayer = user.get('map') || server.get('map'); - var bingKey = server.get('bingKey'); + var bingKey = server.get('bingKey'); - 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: bingKey, - imagerySet: 'Road' - }) - }); - } else if (mapLayer === 'bingAerial') { - layer = new ol.layer.Tile({ - source: new ol.source.BingMaps({ - key: bingKey, - imagerySet: 'Aerial' - }) - }); - } else { - layer = new ol.layer.Tile({ - source: new ol.source.OSM({}) - }); - } - - this.vectorSource = new ol.source.Vector({}); - var vectorLayer = new ol.layer.Vector({ - source: this.vectorSource + 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: bingKey, + imagerySet: 'Road' + }) + }); + } else if (mapLayer === 'bingAerial') { + layer = new ol.layer.Tile({ + source: new ol.source.BingMaps({ + key: bingKey, + imagerySet: 'Aerial' + }) }); + } else { + layer = new ol.layer.Tile({ + source: new ol.source.OSM({}) + }); + } - 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; + this.vectorSource = new ol.source.Vector({}); + var vectorLayer = new ol.layer.Vector({ + source: this.vectorSource + }); - this.mapView = new ol.View({ - center: ol.proj.fromLonLat([lon, lat]), - zoom: zoom, - maxZoom: Traccar.Style.mapMaxZoom - }); + 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; - this.map = new ol.Map({ - target: this.body.dom.id, - layers: [layer, vectorLayer], - view: this.mapView - }); - }, + this.mapView = new ol.View({ + center: ol.proj.fromLonLat([lon, lat]), + zoom: zoom, + maxZoom: Traccar.Style.mapMaxZoom + }); - resize: function () { - this.map.updateSize(); - } - } - }); + this.map = new ol.Map({ + target: this.body.dom.id, + layers: [layer, vectorLayer], + view: this.mapView + }); + }, -})(); + resize: function () { + this.map.updateSize(); + } + } +}); |