aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-06 23:33:12 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-06 23:33:12 +1200
commitf119326f307635dddc6306d4f5a4e349e808b48a (patch)
tree3c04943e57947b10ac08e4772ac17e38b66611f0 /web
parent80e166430b79df771abc73e55892dc9f5fd0b2f1 (diff)
downloadtrackermap-server-f119326f307635dddc6306d4f5a4e349e808b48a.tar.gz
trackermap-server-f119326f307635dddc6306d4f5a4e349e808b48a.tar.bz2
trackermap-server-f119326f307635dddc6306d4f5a4e349e808b48a.zip
Display markers on the map
Diffstat (limited to 'web')
-rw-r--r--web/MapView.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/web/MapView.js b/web/MapView.js
index 33e0b348a..5c20dba9d 100644
--- a/web/MapView.js
+++ b/web/MapView.js
@@ -20,6 +20,29 @@ Ext.define('MapView', {
title: Strings.map_title,
layout: 'fit',
+
+ update: function() {
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/async',
+ success: function(response) {
+ var data = Ext.decode(response.responseText).data;
+
+ var i;
+ for (i = 0; i < data.length; i++) {
+ var iconFeature = new ol.Feature({
+ geometry: new ol.geom.Point([30, 30])
+ });
+ this.vectorSource.addFeature(iconFeature);
+ }
+
+ this.update();
+ },
+ failure: function() {
+ // error
+ }
+ });
+ },
listeners: {
afterrender: function() {
@@ -38,6 +61,9 @@ Ext.define('MapView', {
var layer = new ol.layer.Tile({ source: new ol.source.OSM({
})});*/
+
+ this.vectorSource = new ol.source.Vector({});
+ var vectorLayer = new ol.layer.Vector({ source: this.vectorSource });
var view = new ol.View({
center: ol.proj.transform(Styles.map_center, 'EPSG:4326', 'EPSG:3857'),
@@ -47,9 +73,11 @@ Ext.define('MapView', {
this.map = new ol.Map({
target: this.body.dom.id,
- layers: [ layer ],
+ layers: [ layer, vectorLayer ],
view: view
});
+
+ this.update();
},
resize: function() {