Skip to content
Snippets Groups Projects
Commit 68fdc0b1 authored by Richard Torenvliet's avatar Richard Torenvliet
Browse files

did some changes to includes, still have an error because the API is out of date

parent 65cf9e79
Branches master
No related tags found
No related merge requests found
//<debug>
Ext.Loader.setPath({ Ext.Loader.setPath({
'Ext': 'sdk/src' 'Ext': 'sdk/src'
}); });
//</debug>
Ext.Loader.setConfig({enabled:true});
Ext.application({ Ext.application({
controllers: ["Main", "ChartController"], controllers: ["Main", "ChartController"],
models: ["SimulationModel", "SimulationDetails"], models: ["SimulationModel", "SimulationDetails"],
stores: ['SimulationStore', 'FloodDetailStore', 'SimulationsSummary', 'LsmStore', 'chartStore'], stores: ['SimulationStore', 'FloodDetailStore', 'SimulationsSummary', 'LsmStore', 'chartStore'],
name: 'app', name: 'app',
...@@ -15,7 +16,7 @@ Ext.application({ ...@@ -15,7 +16,7 @@ Ext.application({
'Ext.MessageBox', 'Ext.MessageBox',
], ],
views: ['Main', "Simulation", "List", 'Map', 'StepsOverlay', 'OptionsPanel', views: ['Main', "Simulation", "List", 'Map', 'StepsOverlay', 'OptionsPanel',
'SimulationList', 'LsmSimulationList', 'Chart'], 'SimulationList', 'LsmSimulationList', 'Chart'],
icon: { icon: {
...@@ -24,7 +25,7 @@ Ext.application({ ...@@ -24,7 +25,7 @@ Ext.application({
114: 'resources/icons/Icon@2x.png', 114: 'resources/icons/Icon@2x.png',
144: 'resources/icons/Icon~ipad@2x.png' 144: 'resources/icons/Icon~ipad@2x.png'
}, },
phoneStartupScreen: 'resources/loading/Homescreen.jpg', phoneStartupScreen: 'resources/loading/Homescreen.jpg',
tabletStartupScreen: 'resources/loading/Homescreen~ipad.jpg', tabletStartupScreen: 'resources/loading/Homescreen~ipad.jpg',
......
...@@ -75,7 +75,7 @@ Ext.define('app.controller.ChartController', { ...@@ -75,7 +75,7 @@ Ext.define('app.controller.ChartController', {
console.log(event); console.log(event);
lat = event.latLng.lat(); lat = event.latLng.lat();
lng = event.latLng.lng(); lng = event.latLng.lng();
app.Api.getIzid(lat, lng, map.areaId); app.Api.getIzid(lat, lng, map.areaId);
} }
}); });
}, },
...@@ -97,9 +97,7 @@ Ext.define('app.controller.ChartController', { ...@@ -97,9 +97,7 @@ Ext.define('app.controller.ChartController', {
volume : parseInt(line_clmns[2]), volume : parseInt(line_clmns[2]),
}); });
} }
console.log(data);
store.setData(data); store.setData(data);
console.log(store);
this.openChart(); this.openChart();
}, },
...@@ -112,9 +110,9 @@ Ext.define('app.controller.ChartController', { ...@@ -112,9 +110,9 @@ Ext.define('app.controller.ChartController', {
this.getFloodchart().hide(); this.getFloodchart().hide();
}, },
expandChart: function(){ //TODO:
//expandChart: function(){
} //}
}); });
\ No newline at end of file
/** /**
* Main controller object * Main controller object
* *
* *
*/ */
Ext.define('app.controller.Main', { Ext.define('app.controller.Main', {
...@@ -34,7 +34,7 @@ Ext.define('app.controller.Main', { ...@@ -34,7 +34,7 @@ Ext.define('app.controller.Main', {
autoCreate: true, autoCreate: true,
}, },
simOptionsButton: { simOptionsButton: {
selector: '#simulationOptions', selector: '#simulationOptions',
autoCreate: true, autoCreate: true,
}, },
...@@ -121,7 +121,7 @@ Ext.define('app.controller.Main', { ...@@ -121,7 +121,7 @@ Ext.define('app.controller.Main', {
initiateCities: function() { initiateCities: function() {
this.getSimOptionsButton().show(); this.getSimOptionsButton().show();
}, },
/* first function to call */ /* first function to call */
setMap: function(extmap, map) { setMap: function(extmap, map) {
this.globalMap = map; this.globalMap = map;
...@@ -187,24 +187,24 @@ Ext.define('app.controller.Main', { ...@@ -187,24 +187,24 @@ Ext.define('app.controller.Main', {
this.getPause().hide(); this.getPause().hide();
this.getPlayBackw().show() this.getPlayBackw().show()
this.getPauseBackw().hide(); this.getPauseBackw().hide();
/*clear interval, even if there wasn't any*/ /*clear interval, even if there wasn't any*/
clearInterval(this.interval); clearInterval(this.interval);
this.getMapView().removeImages(); this.getMapView().removeImages();
this.getOverlay().hide(); this.getOverlay().hide();
}, },
/* Initialize simulation, responds when tapped on a list item /* Initialize simulation, responds when tapped on a list item
* of the simulation panel * of the simulation panel
*/ */
simulate: function(list, index, element, record) { simulate: function(list, index, element, record) {
var me = this; var me = this;
/*first, remove all images, even if there werent any*/ /*first, remove all images, even if there werent any*/
this.getMapView().removeImages(); this.getMapView().removeImages();
/*create reference, cb looses scope of this.*/ /*create reference, cb looses scope of this.*/
var map = this.getMapView(), var map = this.getMapView(),
/*The simulationDetailStore has the details of the get test_id*/ /*The simulationDetailStore has the details of the get test_id*/
test_id = record.get('test_id'), test_id = record.get('test_id'),
/*bounds variable used later on*/ /*bounds variable used later on*/
bounds; bounds;
...@@ -235,11 +235,11 @@ Ext.define('app.controller.Main', { ...@@ -235,11 +235,11 @@ Ext.define('app.controller.Main', {
* steps available, crucial data for the displaying the images. * steps available, crucial data for the displaying the images.
*/ */
var url = ''; var url = '';
if (this.SimulType == 'Flood') if (this.SimulType == 'Flood') {
{
url = 'http://sangkil.science.uva.nl:8003/drfsm/'+ test_id +'/info.json'; url = 'http://sangkil.science.uva.nl:8003/drfsm/'+ test_id +'/info.json';
} else {
url = 'http://sangkil.science.uva.nl:8003/lsm/'+ test_id +'/visualization/paru/info.json';
} }
else url = 'http://sangkil.science.uva.nl:8003/lsm/'+ test_id +'/visualization/paru/info.json';
this.requestInfo(test_id, cb, url); this.requestInfo(test_id, cb, url);
/*show overlay*/ /*show overlay*/
...@@ -258,11 +258,11 @@ Ext.define('app.controller.Main', { ...@@ -258,11 +258,11 @@ Ext.define('app.controller.Main', {
/*store center*/ /*store center*/
var center = record.get('center'); var center = record.get('center');
var area_id = record.get('area_id'); var area_id = record.get('area_id');
/* This is used because this function may only be /* This is used because this function may only be
* executed onece. */ * executed onece. */
var selected = false; var selected = false;
for (i in this.selectedIndex) for (i in this.selectedIndex)
if (this.selectedIndex[i] == index) if (this.selectedIndex[i] == index)
selected = true; selected = true;
...@@ -288,7 +288,7 @@ Ext.define('app.controller.Main', { ...@@ -288,7 +288,7 @@ Ext.define('app.controller.Main', {
} }
else if(this.SimulType == 'Lsm') else if(this.SimulType == 'Lsm')
this.getSidepanel().push(this.getLsmSimulation()); this.getSidepanel().push(this.getLsmSimulation());
/*the store with details of the simulation*/ /*the store with details of the simulation*/
var store = Ext.getStore('FloodDetailStore'); var store = Ext.getStore('FloodDetailStore');
...@@ -308,7 +308,7 @@ Ext.define('app.controller.Main', { ...@@ -308,7 +308,7 @@ Ext.define('app.controller.Main', {
store.each(function(r) { store.each(function(r) {
dikes = r.get('dikes'); dikes = r.get('dikes');
}); });
if (dikes.length != 0) if (dikes.length != 0)
this.getMapView().createOverlayPolygon(dikes); this.getMapView().createOverlayPolygon(dikes);
this.getMapView().createMarker(center); this.getMapView().createMarker(center);
...@@ -328,12 +328,10 @@ Ext.define('app.controller.Main', { ...@@ -328,12 +328,10 @@ Ext.define('app.controller.Main', {
var me = this; var me = this;
var summary_store = Ext.getStore('SimulationsSummary'); var summary_store = Ext.getStore('SimulationsSummary');
// var mapImage ='http://maps.googleapis.com/maps/api/staticmap?center='+ center[0] +','+ center[1] + '&zoom=13&size=300x180&maptype=roadmap&sensor=false';
summary_store.each(function(record){ summary_store.each(function(record){
var test_id = record.get('test_id'); var test_id = record.get('test_id');
var setImages = function(result){ var setImages = function(result){
// document.getElementById(test_id + "_map").src = mapImage;//me.getMapView().getFloodImage(test_id, result['timesteps'][result['timesteps'].length - 1]);
var image = me.getMapView().getFloodImage(test_id, result['timesteps'][result['timesteps'].length - 1]) || 'resources/images/noimage.png'; var image = me.getMapView().getFloodImage(test_id, result['timesteps'][result['timesteps'].length - 1]) || 'resources/images/noimage.png';
document.getElementById(test_id + "_flood").src = image; document.getElementById(test_id + "_flood").src = image;
} }
...@@ -345,8 +343,8 @@ Ext.define('app.controller.Main', { ...@@ -345,8 +343,8 @@ Ext.define('app.controller.Main', {
var url = url || 'http://sangkil.science.uva.nl:8003/drfsm/'+ test_id +'/info.json'; var url = url || 'http://sangkil.science.uva.nl:8003/drfsm/'+ test_id +'/info.json';
var request = Ext.Ajax.request({ var request = Ext.Ajax.request({
method: 'GET', method: 'GET',
url: url,//'http://sangkil.science.uva.nl:8003/drfsm/'+ test_id +'/info.json', url: url,
success: function(response, opts){ success: function(response, opts){
var result = Ext.decode(response.responseText); var result = Ext.decode(response.responseText);
callback(result); callback(result);
...@@ -371,6 +369,6 @@ Ext.define('app.controller.Main', { ...@@ -371,6 +369,6 @@ Ext.define('app.controller.Main', {
this.SimulType = 'Lsm' this.SimulType = 'Lsm'
else if (record.get('type') == 'Flood' && this.SimulType != 'Flood') else if (record.get('type') == 'Flood' && this.SimulType != 'Flood')
this.SimulType = 'Flood' this.SimulType = 'Flood'
this.getSimulationOptions().hide(); this.getSimulationOptions().hide();
}, },
}); });
Ext.define('app.model.SimulationDetails', { Ext.define('app.model.SimulationDetails', {
extend: 'Ext.data.Model', extend: 'Ext.data.Model',
config: { config: {
fields: ['name', 'center', 'corners', 'size', 'extents', 'visbounds', 'vissize', 'projection', 'dikes'], fields: ['name', 'center', 'corners', 'size', 'extents', 'visbounds', 'vissize', 'projection', 'dikes'],
}, },
}); });
\ No newline at end of file
Ext.define('app.model.SimulationModel', { Ext.define('app.model.SimulationModel', {
extend: 'Ext.data.Model', extend: 'Ext.data.Model',
config: { config: {
fields: ['name', 'corners', 'visbounds', 'area_id', 'center', 'size'], fields: ['name', 'corners', 'visbounds', 'area_id', 'center', 'size'],
}, },
}); });
\ No newline at end of file
...@@ -18,9 +18,9 @@ Ext.define('app.store.FloodDetailStore', { ...@@ -18,9 +18,9 @@ Ext.define('app.store.FloodDetailStore', {
} }
}, },
setUrl: function(area_id) { setUrl: function(area_id) {
var store = Ext.getStore('FloodDetailStore').getProxy(); var store = Ext.getStore('FloodDetailStore').getProxy();
store._url = 'http://sangkil.science.uva.nl:8003/area/' + area_id + '/info.json'; store._url = 'http://sangkil.science.uva.nl:8003/area/' + area_id + '/info.json';
}, },
}); });
\ No newline at end of file
<!DOCTYPE HTML> <pDOCTYPE HTML>
<html manifest="" lang="en-US"> <html manifest="" lang="en-US">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Floodsimulation Browser</title> <title>Floodsimulation Browser</title>
<style type="text/css"> <style type="text/css">
/** /**
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
.map_thumb { .map_thumb {
position: relative; position: relative;
left: 0px; left: 0px;
top: 0px; top: 0px;
} }
#overlay { #overlay {
...@@ -99,11 +100,11 @@ ...@@ -99,11 +100,11 @@
} }
#controls_title { #controls_title {
} }
.x-back-button { .x-back-button {
} }
#controls_title h2 { #controls_title h2 {
...@@ -120,10 +121,12 @@ ...@@ -120,10 +121,12 @@
} }
</style> </style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script> <script id="microloader" type="text/javascript"
<script type="text/javascript" src="sdk/touch-charts.js"></script> src="sdk/microloader/development.js"></script>
<script type="text/javascript"
src="sdk/touch-charts.js"></script>
</head> </head>
<body> <body>
<div id="appLoadingIndicator"> <div id="appLoadingIndicator">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment