aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapMarkerController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-11-30 11:23:46 +0500
committerAbyss777 <abyss@fox5.ru>2016-11-30 11:23:46 +0500
commit60fe1537206e2286423a7bc1ed5591b1f9c7a1d7 (patch)
tree0a1962ef178fa3c051c28e95b9a0101ed1d12e19 /web/app/view/MapMarkerController.js
parentcffccb69b067fe0f838b0257d8cb48fa4e13ce2f (diff)
downloadtrackermap-web-60fe1537206e2286423a7bc1ed5591b1f9c7a1d7.tar.gz
trackermap-web-60fe1537206e2286423a7bc1ed5591b1f9c7a1d7.tar.bz2
trackermap-web-60fe1537206e2286423a7bc1ed5591b1f9c7a1d7.zip
Revert one check, remove another.
Diffstat (limited to 'web/app/view/MapMarkerController.js')
-rw-r--r--web/app/view/MapMarkerController.js34
1 files changed, 18 insertions, 16 deletions
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index bda206ec..97e75925 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -202,24 +202,26 @@ Ext.define('Traccar.view.MapMarkerController', {
this.addReportMarkers(store, data);
- this.reportRoute = [];
- for (i = 0; i < data.length; i++) {
- position = data[i];
- point = ol.proj.fromLonLat([
- position.get('longitude'),
- position.get('latitude')
- ]);
- if (i === 0 || data[i].get('deviceId') !== data[i - 1].get('deviceId')) {
- this.reportRoute.push(new ol.Feature({
- geometry: new ol.geom.LineString([])
- }));
- this.reportRoute[this.reportRoute.length - 1].setStyle(this.getRouteStyle(data[i].get('deviceId')));
- this.getView().getRouteSource().addFeature(this.reportRoute[this.reportRoute.length - 1]);
+ if (data.length > 0) {
+ this.reportRoute = [];
+ for (i = 0; i < data.length; i++) {
+ position = data[i];
+ point = ol.proj.fromLonLat([
+ position.get('longitude'),
+ position.get('latitude')
+ ]);
+ if (i === 0 || data[i].get('deviceId') !== data[i - 1].get('deviceId')) {
+ this.reportRoute.push(new ol.Feature({
+ geometry: new ol.geom.LineString([])
+ }));
+ this.reportRoute[this.reportRoute.length - 1].setStyle(this.getRouteStyle(data[i].get('deviceId')));
+ this.getView().getRouteSource().addFeature(this.reportRoute[this.reportRoute.length - 1]);
+ }
+ this.reportRoute[this.reportRoute.length - 1].getGeometry().appendCoordinate(point);
}
- this.reportRoute[this.reportRoute.length - 1].getGeometry().appendCoordinate(point);
- }
- this.getView().getMapView().fit(this.reportRoute[0].getGeometry(), this.getView().getMap().getSize());
+ this.getView().getMapView().fit(this.reportRoute[0].getGeometry(), this.getView().getMap().getSize());
+ }
},
addReportMarkers: function (store, data) {