aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-22 16:31:47 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-22 16:31:47 +1200
commitf965e1b5de4010162bf4c132645a6ee7c6348b5d (patch)
tree24752f195c5a0c2c6ee8a8ae0125f919278c362e /web
parent96f34858dd2d095c75a72da6d10f5661ac51c042 (diff)
downloadtrackermap-server-f965e1b5de4010162bf4c132645a6ee7c6348b5d.tar.gz
trackermap-server-f965e1b5de4010162bf4c132645a6ee7c6348b5d.tar.bz2
trackermap-server-f965e1b5de4010162bf4c132645a6ee7c6348b5d.zip
Add functions to create style
Diffstat (limited to 'web')
-rw-r--r--web/app/view/map/MapController.js64
-rw-r--r--web/app/view/report/ReportController.js7
2 files changed, 43 insertions, 28 deletions
diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js
index f141b6646..cfc669d4d 100644
--- a/web/app/view/map/MapController.js
+++ b/web/app/view/map/MapController.js
@@ -28,11 +28,47 @@ Ext.define('Traccar.view.map.MapController', {
}
}
},
+
+ getLineStyle: function(color) {
+ return new ol.style.Style({
+ stroke: new ol.style.Stroke({
+ color: color,
+ width: 2
+ })
+ });
+ },
+
+ getMarkerStyle: function(color) {
+ return new ol.style.Style({
+ text: new ol.style.Text({
+ text: '\uf041',
+ font: 'normal 32px FontAwesome',
+ textBaseline: 'Bottom',
+ fill: new ol.style.Fill({
+ color: color
+ }),
+ stroke: new ol.style.Stroke({
+ color: 'black',
+ width: 2
+ })
+ })
+ });
+ },
reportShow: function() {
-
var vectorSource = this.getView().vectorSource;
+ var data = Ext.getStore('Positions').getData().splice();
+ data.sort(function(l, r) {
+ if (l < r) return -1;
+ if (r < l) return 1;
+ return 0;
+ });
+
+ var positions = [];
+
+ //for (let p of data)
+
this.iconFeature = new ol.Feature({
//geometry: new ol.geom.Point(ol.proj.fromLonLat([-1.257778, 51.751944]))
geometry: new ol.geom.LineString([
@@ -41,14 +77,7 @@ Ext.define('Traccar.view.map.MapController', {
])
});
- this.iconFeature.setStyle(
- new ol.style.Style({
- stroke: new ol.style.Stroke({
- color: 'black',
- width: 2
- })
- })
- );
+ this.iconFeature.setStyle(this.getLineStyle('black'));
vectorSource.addFeature(this.iconFeature);
},
@@ -57,22 +86,7 @@ Ext.define('Traccar.view.map.MapController', {
//this.getView().vectorSource.clear();
this.iconFeature.setGeometry(new ol.geom.Point(ol.proj.fromLonLat([-5.257778, 51.751944])));
- this.iconFeature.setStyle(
- new ol.style.Style({
- text: new ol.style.Text({
- text: '\uf041',
- font: 'normal 32px FontAwesome',
- textBaseline: 'Bottom',
- fill: new ol.style.Fill({
- color: 'red'
- }),
- stroke: new ol.style.Stroke({
- color: 'black',
- width: 2
- })
- })
- })
- );
+ this.iconFeature.setStyle(this.getMarkerStyle('red'));
}
});
diff --git a/web/app/view/report/ReportController.js b/web/app/view/report/ReportController.js
index d62e87973..415cdfe3a 100644
--- a/web/app/view/report/ReportController.js
+++ b/web/app/view/report/ReportController.js
@@ -41,15 +41,16 @@ Ext.define('Traccar.view.report.ReportController', {
deviceId: deviceId,
from: from,
to: to
+ },
+ scope: this,
+ callback: function() {
+ this.fireEvent("reportShow");
}
});
-
- this.fireEvent("reportShow");
},
onClearClick: function() {
Ext.getStore('Positions').removeAll();
-
this.fireEvent("reportClear");
}