aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-21 11:42:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-21 11:42:39 +1300
commit9eed88cba15f8fc7e12a0a6d5083fa7bfd890165 (patch)
tree1ac893e39ce69a84733cc3847b3ed8c9cb9583fe
parent6280260c9d767844e8233912064443f166900406 (diff)
downloadtrackermap-server-9eed88cba15f8fc7e12a0a6d5083fa7bfd890165.tar.gz
trackermap-server-9eed88cba15f8fc7e12a0a6d5083fa7bfd890165.tar.bz2
trackermap-server-9eed88cba15f8fc7e12a0a6d5083fa7bfd890165.zip
Implement clustering for report
-rw-r--r--web/app/Style.js2
-rw-r--r--web/app/view/Map.js16
2 files changed, 6 insertions, 12 deletions
diff --git a/web/app/Style.js b/web/app/Style.js
index b75503c32..49dcd1b99 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -32,6 +32,8 @@ Ext.define('Traccar.Style', {
reportHeight: 250,
reportTime: 100,
+ mapClusterDistance: 30,
+
mapDefaultLat: 51.507222,
mapDefaultLon: -0.1275,
mapDefaultZoom: 6,
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index a2bbdc92c..d9b041535 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -99,21 +99,13 @@ Ext.define('Traccar.view.Map', {
this.reportSource = new ol.source.Vector({});
reportLayer = new ol.layer.Vector({
source: new ol.source.Cluster({
- distance: 40,
+ distance: Traccar.Style.mapClusterDistance,
source: this.reportSource
}),
style: function (feature, resolution) {
- style = [new ol.style.Style({
- image: new ol.style.Circle({
- radius: feature.get('radius'),
- fill: new ol.style.Fill({
- color: [255, 153, 0, Math.min(0.8, 0.4 + (feature.get('features').length / 100))]
- })
- }),
- text: new ol.style.Text({
- text: feature.get('features').length.toString()
- })
- })];
+ if (feature.get('features').length == 1) {
+ return [feature.get('features')[0].getStyle()];
+ }
}
});