aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/Map.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/Map.js')
-rw-r--r--web/app/view/Map.js130
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();
+ }
+ }
+});