From 4757c4c9f6bf780ecedbbcb0312712a617070226 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 23 Aug 2015 22:40:49 +1200 Subject: Add support for custom maps --- debug.xml | 2 ++ src/org/traccar/model/Server.java | 4 ++++ web/app/model/Server.js | 1 + web/app/store/MapTypes.js | 3 ++- web/app/view/admin/ServerDialog.js | 4 ++++ web/app/view/map/Map.js | 6 +++++- web/l10n/en.js | 1 + 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/debug.xml b/debug.xml index ff78736bb..ecbfe6857 100644 --- a/debug.xml +++ b/debug.xml @@ -125,6 +125,7 @@ registration BIT NOT NULL, map VARCHAR(128), bingKey VARCHAR(128), + mapUrl VARCHAR(128), language VARCHAR(128), distanceUnit VARCHAR(128), speedUnit VARCHAR(128), @@ -152,6 +153,7 @@ registration = :registration, map = :map, bingKey = :bingKey, + mapUrl = :mapUrl, language = :language, distanceUnit = :distanceUnit, speedUnit = :speedUnit, diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java index fb27b796a..b910e30ec 100644 --- a/src/org/traccar/model/Server.java +++ b/src/org/traccar/model/Server.java @@ -38,6 +38,10 @@ public class Server implements Factory { public String getBingKey() { return bingKey; } public void setBingKey(String bingKey) { this.bingKey = bingKey; } + private String mapUrl; + public String getMapUrl() { return mapUrl; } + public void setMapUrl(String mapUrl) { this.mapUrl = mapUrl; } + private String language; public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } diff --git a/web/app/model/Server.js b/web/app/model/Server.js index b7d356226..b21f28299 100644 --- a/web/app/model/Server.js +++ b/web/app/model/Server.js @@ -23,6 +23,7 @@ Ext.define('Traccar.model.Server', { { 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 7e316c8a6..080e2fcc4 100644 --- a/web/app/view/admin/ServerDialog.js +++ b/web/app/view/admin/ServerDialog.js @@ -46,6 +46,10 @@ Ext.define('Traccar.view.admin.ServerDialog', { xtype: 'textfield', name: 'bingKey', fieldLabel: strings.mapBingKey + }, { + xtype: 'textfield', + name: 'mapUrl', + fieldLabel: strings.mapCustom }, { xtype: 'combobox', name: 'distanceUnit', diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js index db7dde02e..cdb46342b 100644 --- a/web/app/view/map/Map.js +++ b/web/app/view/map/Map.js @@ -38,7 +38,11 @@ Ext.define('Traccar.view.map.Map', { 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: bingKey, imagerySet: 'Road' diff --git a/web/l10n/en.js b/web/l10n/en.js index 0ae9bea78..4c1e0f233 100644 --- a/web/l10n/en.js +++ b/web/l10n/en.js @@ -66,6 +66,7 @@ var strings = { mapTitle: 'Map', mapLayer: 'Map Layer', + mapCustom: 'Custom Map', mapOsm: 'Open Street Map', mapBingKey: 'Bing Maps Key', mapBingRoad: 'Bing Maps Road', -- cgit v1.2.3