diff options
author | Abyss777 <abyss@fox5.ru> | 2016-12-29 18:03:24 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-12-29 18:03:24 +0500 |
commit | d9fe5597ece43539dd52d292720ade0edbd4f619 (patch) | |
tree | f415578cadb4c249a136229dd49e5de837839591 /web | |
parent | d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a (diff) | |
download | trackermap-web-d9fe5597ece43539dd52d292720ade0edbd4f619.tar.gz trackermap-web-d9fe5597ece43539dd52d292720ade0edbd4f619.tar.bz2 trackermap-web-d9fe5597ece43539dd52d292720ade0edbd4f619.zip |
- Combine latest and report markers to one layer
- Bring to front selected marker
Diffstat (limited to 'web')
-rw-r--r-- | web/app/view/Map.js | 17 | ||||
-rw-r--r-- | web/app/view/MapMarkerController.js | 10 |
2 files changed, 10 insertions, 17 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 062bf4cb..7f109fdf 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -85,18 +85,14 @@ Ext.define('Traccar.view.Map', { }] }, - getLatestSource: function () { - return this.latestSource; + getMarkersSource: function () { + return this.markersSource; }, getRouteSource: function () { return this.routeSource; }, - getReportSource: function () { - return this.reportSource; - }, - getGeofencesSource: function () { return this.geofencesSource; }, @@ -125,19 +121,14 @@ Ext.define('Traccar.view.Map', { }); this.map.addLayer(this.liveRouteLayer); - this.latestSource = new ol.source.Vector({}); - this.map.addLayer(new ol.layer.Vector({ - source: this.latestSource - })); - this.routeSource = new ol.source.Vector({}); this.map.addLayer(new ol.layer.Vector({ source: this.routeSource })); - this.reportSource = new ol.source.Vector({}); + this.markersSource = new ol.source.Vector({}); this.map.addLayer(new ol.layer.Vector({ - source: this.reportSource + source: this.markersSource })); } }); diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js index e4e3979e..907451b6 100644 --- a/web/app/view/MapMarkerController.js +++ b/web/app/view/MapMarkerController.js @@ -112,7 +112,7 @@ Ext.define('Traccar.view.MapMarkerController', { for (i = 0; i < data.length; i++) { deviceId = data[i].get('id'); if (this.latestMarkers[deviceId]) { - this.getView().getLatestSource().removeFeature(this.latestMarkers[deviceId]); + this.getView().getMarkersSource().removeFeature(this.latestMarkers[deviceId]); } } }, @@ -159,7 +159,7 @@ Ext.define('Traccar.view.MapMarkerController', { style.getText().setText(device.get('name')); marker.setStyle(style); this.latestMarkers[deviceId] = marker; - this.getView().getLatestSource().addFeature(marker); + this.getView().getMarkersSource().addFeature(marker); } @@ -248,7 +248,7 @@ Ext.define('Traccar.view.MapMarkerController', { Ext.Date.format(position.get('fixTime'), Traccar.Style.dateTimeFormat24));*/ marker.setStyle(style); this.reportMarkers[position.get('id')] = marker; - this.getView().getReportSource().addFeature(marker); + this.getView().getMarkersSource().addFeature(marker); } if (minx !== maxx || miny !== maxy) { this.getView().getMapView().fit([minx, miny, maxx, maxy], this.getView().getMap().getSize()); @@ -270,7 +270,7 @@ Ext.define('Traccar.view.MapMarkerController', { if (this.reportMarkers) { for (key in this.reportMarkers) { if (this.reportMarkers.hasOwnProperty(key)) { - this.getView().getReportSource().removeFeature(this.reportMarkers[key]); + this.getView().getMarkersSource().removeFeature(this.reportMarkers[key]); } } this.reportMarkers = {}; @@ -347,11 +347,13 @@ Ext.define('Traccar.view.MapMarkerController', { selectMarker: function (marker, center) { if (this.selectedMarker) { this.resizeMarker(this.selectedMarker.getStyle(), false); + this.selectedMarker.getStyle().setZIndex(0); this.selectedMarker.changed(); } if (marker) { this.resizeMarker(marker.getStyle(), true); + marker.getStyle().setZIndex(1); marker.changed(); if (center) { this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates()); |