aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Style.js6
-rw-r--r--web/app/model/Position.js29
-rw-r--r--web/app/store/MapTypes.js12
-rw-r--r--web/app/store/ReportChartTypes.js6
-rw-r--r--web/app/view/ReportController.js4
-rw-r--r--web/app/view/map/BaseMap.js88
-rw-r--r--web/app/view/permissions/BaseController.js4
7 files changed, 126 insertions, 23 deletions
diff --git a/web/app/Style.js b/web/app/Style.js
index aa749ce9..f8569a8e 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -41,8 +41,8 @@ Ext.define('Traccar.Style', {
columnWidthNormal: 100,
- mapDefaultLat: 12.966667,
- mapDefaultLon: 77.566667,
+ mapDefaultLat: 1.283333,
+ mapDefaultLon: 103.833333,
mapDefaultZoom: 4,
mapRouteColor: [
@@ -68,7 +68,7 @@ Ext.define('Traccar.Style', {
mapScaleNormal: 1,
mapScaleSelected: 1.5,
- mapMaxZoom: 19,
+ mapMaxZoom: 18,
mapDelay: 500,
mapAccuracyColor: 'rgba(96, 96, 96, 1.0)',
diff --git a/web/app/model/Position.js b/web/app/model/Position.js
index 3b85a1b7..4b1a429f 100644
--- a/web/app/model/Position.js
+++ b/web/app/model/Position.js
@@ -59,12 +59,6 @@ Ext.define('Traccar.model.Position', {
name: 'speed',
type: 'float'
}, {
- name: 'speedConverted',
- type: 'float',
- calculate: function (data) {
- return Ext.getStore('SpeedUnits').convertValue(data.speed, Traccar.app.getPreference('speedUnit'));
- }
- }, {
name: 'course',
type: 'float'
}, {
@@ -73,11 +67,30 @@ Ext.define('Traccar.model.Position', {
}, {
name: 'attributes'
}, {
+ name: 'speedConverted',
+ type: 'float',
+ calculate: function (data) {
+ return Ext.getStore('SpeedUnits').convertValue(
+ data.speed, Traccar.app.getPreference('speedUnit'));
+ }
+ }, {
name: 'distanceConverted',
type: 'float',
calculate: function (data) {
- return Ext.getStore('DistanceUnits').convertValue(data.attributes.distance,
- Traccar.app.getPreference('distanceUnit'));
+ return Ext.getStore('DistanceUnits').convertValue(
+ data.attributes.distance, Traccar.app.getPreference('distanceUnit'));
+ }
+ }, {
+ name: 'rpm',
+ type: 'float',
+ calculate: function (data) {
+ return data.attributes.rpm;
+ }
+ }, {
+ name: 'fuel',
+ type: 'float',
+ calculate: function (data) {
+ return data.attributes.fuel;
}
}]
});
diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js
index dba506dd..77c10ebd 100644
--- a/web/app/store/MapTypes.js
+++ b/web/app/store/MapTypes.js
@@ -32,6 +32,18 @@ Ext.define('Traccar.store.MapTypes', {
key: 'bingAerial',
name: Strings.mapBingAerial
}, {
+ key: 'bingHybrid',
+ name: Strings.mapBingHybrid
+ }, {
+ key: 'baidu',
+ name: Strings.mapBaidu
+ }, {
+ key: 'yandexMap',
+ name: Strings.mapYandexMap
+ }, {
+ key: 'yandexSat',
+ name: Strings.mapYandexSat
+ }, {
key: 'custom',
name: Strings.mapCustom
}]
diff --git a/web/app/store/ReportChartTypes.js b/web/app/store/ReportChartTypes.js
index 7a63fd08..889db50d 100644
--- a/web/app/store/ReportChartTypes.js
+++ b/web/app/store/ReportChartTypes.js
@@ -26,5 +26,11 @@ Ext.define('Traccar.store.ReportChartTypes', {
}, {
key: 'distanceConverted',
name: Strings.positionDistance
+ }, {
+ key: 'rpm',
+ name: Strings.positionRpm
+ }, {
+ key: 'fuel',
+ name: Strings.positionFuel
}]
});
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index e8955a8c..d83d9986 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -463,6 +463,10 @@ Ext.define('Traccar.view.ReportController', {
text: Strings.reportEngineHours,
dataIndex: 'engineHours',
renderer: Traccar.AttributeFormatter.getFormatter('hours')
+ }, {
+ text: Strings.reportSpentFuel,
+ dataIndex: 'spentFuel',
+ renderer: Traccar.AttributeFormatter.getFormatter('spentFuel')
}],
tripsColumns: [{
diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js
index ac3b2694..c4297f68 100644
--- a/web/app/view/map/BaseMap.js
+++ b/web/app/view/map/BaseMap.js
@@ -62,29 +62,91 @@ Ext.define('Traccar.view.map.BaseMap', {
imagerySet: 'Aerial'
})
});
- } else if (type === 'osm') {
+ } else if (type === 'bingHybrid') {
layer = new ol.layer.Tile({
- source: new ol.source.OSM({})
+ source: new ol.source.BingMaps({
+ key: bingKey,
+ imagerySet: 'AerialWithLabels'
+ })
});
- } else {
+ } else if (type === 'carto') {
layer = new ol.layer.Tile({
source: new ol.source.XYZ({
- urls: [
- 'https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
- 'https://cartodb-basemaps-b.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
- 'https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
- 'https://cartodb-basemaps-d.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png'
- ],
+ url: 'https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
attributions: [
new ol.Attribution({
html: [
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
- 'contributors, &copy; <a href="https://carto.com/attributions">CARTO</a>'
+ 'contributors, &copy; <a href="https://carto.com/attributions">CARTO</a>'
]
})
]
})
});
+ } else if (type === 'baidu') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ projection: 'BD-MC',
+ tileUrlFunction: function (tileCoord) {
+ var urlsLength = 5, z = tileCoord[0], x = tileCoord[1], y = tileCoord[2], hash, index;
+
+ hash = (x << z) + y;
+ index = hash % urlsLength;
+ index = index < 0 ? index + urlsLength : index;
+
+ if (x < 0) {
+ x = 'M' + (-x);
+ }
+ if (y < 0) {
+ y = 'M' + (-y);
+ }
+ return 'http://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl'
+ .replace('{}', index).replace('{x}', x).replace('{y}', y).replace('{z}', z);
+ },
+ tileGrid: new ol.tilegrid.TileGrid({
+ extent: ol.proj.transformExtent([-180, -74, 180, 74], 'EPSG:4326', 'BD-MC'),
+ origin: [0, 0],
+ minZoom: 3,
+ resolutions: [
+ 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048,
+ 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5
+ ]
+ }),
+ attributions: [
+ new ol.Attribution({
+ html: '&copy; <a href="http://map.baidu.com/">Baidu</a>'
+ })
+ ]
+ })
+ });
+ } else if (type === 'yandexMap') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: 'https://vec0{1-4}.maps.yandex.net/tiles?l=map&x={x}&y={y}&z={z}',
+ projection: 'EPSG:3395',
+ attributions: [
+ new ol.Attribution({
+ html: '&copy; <a href="https://yandex.com/maps/">Yandex</a>'
+ })
+ ]
+ })
+ });
+ } else if (type === 'yandexSat') {
+ layer = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: 'https://sat0{1-4}.maps.yandex.net/tiles?l=sat&x={x}&y={y}&z={z}',
+ projection: 'EPSG:3395',
+ attributions: [
+ new ol.Attribution({
+ html: '&copy; <a href="https://yandex.com/maps/">Yandex</a>'
+ })
+ ]
+ })
+ });
+ } else {
+ layer = new ol.layer.Tile({
+ source: new ol.source.OSM({})
+ });
}
lat = Traccar.app.getPreference('latitude', Traccar.Style.mapDefaultLat);
@@ -143,4 +205,10 @@ Ext.define('Traccar.view.map.BaseMap', {
this.map.updateSize();
}
}
+}, function () {
+
+ proj4.defs('BD-MC', '+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs');
+ proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
+ ol.proj.get('EPSG:3395').setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]);
+
});
diff --git a/web/app/view/permissions/BaseController.js b/web/app/view/permissions/BaseController.js
index dc4d6ef2..8a85a5e2 100644
--- a/web/app/view/permissions/BaseController.js
+++ b/web/app/view/permissions/BaseController.js
@@ -57,7 +57,7 @@ Ext.define('Traccar.view.permissions.BaseController', {
jsonData: Ext.util.JSON.encode(data),
callback: function (options, success, response) {
if (!success) {
- selection.deselect(record);
+ selection.deselect(record, true);
Traccar.app.showError(response);
}
}
@@ -75,7 +75,7 @@ Ext.define('Traccar.view.permissions.BaseController', {
jsonData: Ext.util.JSON.encode(data),
callback: function (options, success, response) {
if (!success) {
- selection.select(record);
+ selection.select(record, true, true);
Traccar.app.showError(response);
}
}