Commit 92977e77 authored by Richard's avatar Richard

scroll trough simulation

parent 1b251929
...@@ -13,7 +13,7 @@ Ext.define('app.controller.Main', { ...@@ -13,7 +13,7 @@ Ext.define('app.controller.Main', {
control: { control: {
'listpanel #cities': { 'listpanel #cities': {
itemtap: 'showOverlay', itemtap: 'showOverlay',
tap: 'closeoverlay' tap: 'closeoverlay',
}, },
'sliderfield': { 'sliderfield': {
...@@ -24,27 +24,51 @@ Ext.define('app.controller.Main', { ...@@ -24,27 +24,51 @@ Ext.define('app.controller.Main', {
itemtap: 'simulation', itemtap: 'simulation',
}, },
'#ext-button-1': {
tap: 'callRemoveImages'
},
'#mapa': { '#mapa': {
maprender: 'setMap' maprender: 'setMap'
}, },
'#closebutton': { '#closebutton': {
tap: 'closeoverlay' tap: 'closeoverlay'
},
'#backwards': {
tap: 'prevImage'
},
'#forward': {
tap: 'nextImage'
},
'#overlay': {
hide: 'callRemoveImages',
} }
} }
}, },
callRemoveImages: function(){ callRemoveImages: function() {
//console.log('hide removeimages');
//this.getOverlay().hide();
},
prevImage: function(){
this.getMapView().prevImage();
}, },
callNextImage: function(){ nextImage: function(){
this.getMapView().nextImage(); this.getMapView().nextImage();
}, },
closeoverlay: function() { closeoverlay: function() {
console.log(this.getOverlay()); // console.log('call removeimages');
this.getOverlay().hide(); // console.log(this.getOverlay());
// this.getMapView().removeImages();
// this.getOverlay().hide();
}, },
setMap: function(extmap, map){ setMap: function(extmap, map){
......
...@@ -18,7 +18,7 @@ Ext.define('app.view.Map', { ...@@ -18,7 +18,7 @@ Ext.define('app.view.Map', {
{ {
this.overlayImages = []; this.overlayImages = [];
this.Images = []; this.Images = [];
this.imageIndex = null; this.imageIndex = 0;
this.imageBounds = null; this.imageBounds = null;
} }
} }
...@@ -62,6 +62,7 @@ Ext.define('app.view.Map', { ...@@ -62,6 +62,7 @@ Ext.define('app.view.Map', {
// 'http://sangkil.science.uva.nl:8003/drfsm/199419691/visualization/level/map/600.png' // 'http://sangkil.science.uva.nl:8003/drfsm/199419691/visualization/level/map/600.png'
// 'http://sangkil.science.uva.nl:8003/drfsm/207/visualization/level/map/300.png' ; // 'http://sangkil.science.uva.nl:8003/drfsm/207/visualization/level/map/300.png' ;
createOverlayImage: function(bounds, area_id, timesteps) { createOverlayImage: function(bounds, area_id, timesteps) {
//console.log('createOverlayImage');
this.imageIndex = 0; this.imageIndex = 0;
this.imageBounds = new google.maps.LatLngBounds( this.imageBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(bounds[2],bounds[3]), new google.maps.LatLng(bounds[2],bounds[3]),
...@@ -69,9 +70,10 @@ Ext.define('app.view.Map', { ...@@ -69,9 +70,10 @@ Ext.define('app.view.Map', {
this.bounds = bounds; this.bounds = bounds;
// delete all other images // delete all other images
if (this.overlayImages.length > 0) if (this.overlayImages.length > 1)
for (i in this.overlayImages) {
this.overlayImages[i].setMap(null); this.removeImages();
}
//var image = 'http://sangkil.science.uva.nl:8003/lsm/' + area_id +'/visualization/level/map/400.png'; //var image = 'http://sangkil.science.uva.nl:8003/lsm/' + area_id +'/visualization/level/map/400.png';
for (i in timesteps) for (i in timesteps)
...@@ -88,16 +90,50 @@ Ext.define('app.view.Map', { ...@@ -88,16 +90,50 @@ Ext.define('app.view.Map', {
nextImage: function() nextImage: function()
{ {
this.imageIndex += 1; var lastImagesIndex = this.imageIndex;
this.overlayImages[this.imageIndex - 1].setMap(null); this.imageIndex += this.imageIndex <= this.Images.length - 2 ? 1 : 0;
var overlay = new google.maps.GroundOverlay(this.Images[this.imageIndex], this.imageBounds, {map: this.globalMap}); console.log(this.imageIndex);
this.overlayImages.push(overlay); if (this.imageIndex != lastImagesIndex)
{
if (this.imageIndex >= this.overlayImages.length || this.overlayImages.length == 0)
{
var overlay = new google.maps.GroundOverlay(this.Images[this.imageIndex], this.imageBounds, {map: this.globalMap});
this.overlayImages.push(overlay);
console.log(this.overlayImages);
console.log("pushed "+ overlay);
} else {
console.log(this.overlayImages);
this.overlayImages[this.imageIndex].setMap(this.globalMap);
}
this.overlayImages[this.imageIndex - 1].setMap(null);
}
},
prevImage: function()
{
console.log(this.overlayImages);
console.log(this.overlayImages[this.imageIndex]);
console.log(this.imageIndex);
this.overlayImages[this.imageIndex].setMap(null);
console.log('removed');
this.imageIndex -= this.imageIndex > 0 ? 1 : 0;
if (this.imageIndex >= 0)
{
this.overlayImages[this.imageIndex].setMap(this.globalMap);
console.log(this.overlayImages[this.imageIndex]);
}
}, },
removeImages: function() removeImages: function()
{ {
console.log('removedImages');
for (i in this.overlayImages) for (i in this.overlayImages)
this.overlayImages[i].setMap(null); this.overlayImages[i].setMap(null);
this.imageIndex = 0;
this.overlayImages = [];
this.Images = [];
}, },
createOverlayPolygon: function(corners){ createOverlayPolygon: function(corners){
...@@ -105,7 +141,6 @@ Ext.define('app.view.Map', { ...@@ -105,7 +141,6 @@ Ext.define('app.view.Map', {
for (var i = 0; i < corners[0].length - 1; i++) { for (var i = 0; i < corners[0].length - 1; i++) {
cornerBounds.push(new google.maps.LatLng(corners[0][i][0], corners[0][i][1])); cornerBounds.push(new google.maps.LatLng(corners[0][i][0], corners[0][i][1]));
} }
console.log(cornerBounds);
var rectangle = new google.maps.Polygon({ var rectangle = new google.maps.Polygon({
paths: cornerBounds, paths: cornerBounds,
......
...@@ -18,29 +18,43 @@ Ext.define('app.view.Simulation', { ...@@ -18,29 +18,43 @@ Ext.define('app.view.Simulation', {
width: 300, width: 300,
height: 80, height: 80,
scroll: false, scroll: false,
items: [{ items: [
{
xtype: 'button', xtype: 'button',
id: 'closebutton', id: 'closebutton',
iconCls: 'delete', iconCls: 'delete',
iconMask: true, iconMask: true,
width: 45, width: 45,
bottom: -30, bottom: -30,
right: -20, right: -20,
}, },
{ {
xtype: 'segmentedbutton', layout: 'vbox',
items: [ top: 15,
align: 'center',
items : [
{ {
text: 'back' xtype: "button",
id: 'backwards',
width: 45,
iconCls: 'arrow_left',
floating: 'right',
iconMask: true,
left: 90,
align: 'center',
}, },
{ {
text: 'forward' xtype: "button",
} id: 'forward',
width: 45,
] floating: 'left',
iconCls: 'arrow_right',
align: 'center',
left: 155,
iconMask: true,
}]
}], }],
}], }]
}, },
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment