Commit 70039439 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

uncertainty and calculation mode added

parent 45ebdd78
......@@ -27,7 +27,7 @@ app.get('/demo/input', function (req, res) {
"simulation": {
"startDate": 1491225300000,
"stopDate": 1491398100000,
"mode": "Normal",
"mode": "Detailed",
"forecast": "NEMO",
"forwardCalculation": true,
"amount": "130.0",
......@@ -36,7 +36,7 @@ app.get('/demo/input', function (req, res) {
"substance": "JET FUEL AND KEROSINE",
"fresh": true,
"instantaneous": false,
"uncertainty": false,
"uncertainty": true,
"winddrag": "0",
"depth": "4",
"duration": "6",
......
......@@ -1028,7 +1028,46 @@ var L;
chain[periodid] = oiltypeid;
chain[oiltypeid] = amountid;
chain[amountid] = '';
var startDiv = L.DomUtil.create('div', 'uk-width-medium-1-2 uk-container-center', this.container);
var startDiv = L.DomUtil.create('div', 'uk-width-medium-1-1 uk-container-center uk-margin-top', this.container);
function addLabelDiv(parentDiv, labelTxt, labelInfo) {
var self = this;
var label = L.DomUtil.create('label', 'uk-form-label form-label', parentDiv);
label.textContent = labelTxt;
var addPositionInfo = L.DomUtil.create('span', 'uk-icon-hover uk-icon-info-circle', parentDiv);
addPositionInfo.onclick = function () {
UIkit.notify("<span class='uk-icon-small uk-icon-info-circle'></span> <b>" + labelTxt + "</b><p>" + labelInfo, { status: 'info', timeout: 10000 });
};
}
;
function addOption(parent, value, txt) {
var option = L.DomUtil.create('option', '', parent);
option.value = value;
option.textContent = txt;
}
var startform = L.DomUtil.create('form', 'uk-form uk-form-stacked', startDiv);
startform.onsubmit = function (e) {
e.preventDefault();
e.stopPropagation();
return false;
};
var fieldset = L.DomUtil.create('fieldset', '', startform);
var calculationRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(calculationRowDiv, "Calculation mode", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-calculationmode' target='_blank'>here</a>");
var calculationMode = L.DomUtil.create('div', 'uk-form-select', calculationRowDiv);
calculationMode.setAttribute('data-uk-form-select', '');
var selectedMode = L.DomUtil.create('span', '', calculationMode);
self.selectCalculationMode = L.DomUtil.create('select', '', calculationMode);
addOption(self.selectCalculationMode, 'Fast', 'Fast / less detailed');
addOption(self.selectCalculationMode, 'Normal', 'Normal');
addOption(self.selectCalculationMode, 'Detailed', 'Detailed / slower');
self.selectCalculationMode.selectedIndex = 1;
var uncertaintyRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(uncertaintyRowDiv, "Uncertainty", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-uncertainty' target='_blank'>here</a>");
var uncertaintyLabel = L.DomUtil.create('label', '', uncertaintyRowDiv);
uncertaintyLabel.style.display = 'block';
self.uncertaintyInput = L.DomUtil.create('input', '', uncertaintyLabel);
self.uncertaintyInput.type = 'checkbox';
uncertaintyLabel.appendChild(document.createTextNode(' Extra uncertainty in weather forecast is added to simulation'));
var hr = L.DomUtil.create('hr', 'uk-margin-top', startDiv);
self.startButton = L.DomUtil.create('button', 'uk-button uk-button-success uk-margin-top uk-align-center', startDiv);
self.startButton.textContent = 'Start model';
......@@ -1105,6 +1144,10 @@ var L;
card.populateData(geojson);
}
}
geojson["features"][0]["properties"]["simulation"]["uncertainty"] = false;
if (self.uncertaintyInput.checked)
geojson["features"][0]["properties"]["simulation"]["uncertainty"] = true;
geojson["features"][0]["properties"]["simulation"]["mode"] = self.selectCalculationMode.value;
reqwest({
url: 'startos',
type: 'json',
......@@ -1248,10 +1291,18 @@ var L;
card.show();
}
}
var evt = document.createEvent('Event');
evt.initEvent("change", true, true);
var simulation = geojson.features[0].properties.simulation;
self.selectCalculationMode.value = simulation.mode;
self.selectCalculationMode.dispatchEvent(evt);
self.uncertaintyInput.checked = simulation.uncertainty;
}
};
OilSpill.prototype.clear = function () {
var self = this;
self.selectCalculationMode.selectedIndex = 1;
self.uncertaintyInput.checked = false;
var c = 1;
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
......
......@@ -142,7 +142,46 @@ var L;
chain[periodid] = oiltypeid;
chain[oiltypeid] = amountid;
chain[amountid] = '';
var startDiv = L.DomUtil.create('div', 'uk-width-medium-1-2 uk-container-center', this.container);
var startDiv = L.DomUtil.create('div', 'uk-width-medium-1-1 uk-container-center uk-margin-top', this.container);
function addLabelDiv(parentDiv, labelTxt, labelInfo) {
var self = this;
var label = L.DomUtil.create('label', 'uk-form-label form-label', parentDiv);
label.textContent = labelTxt;
var addPositionInfo = L.DomUtil.create('span', 'uk-icon-hover uk-icon-info-circle', parentDiv);
addPositionInfo.onclick = function () {
UIkit.notify("<span class='uk-icon-small uk-icon-info-circle'></span> <b>" + labelTxt + "</b><p>" + labelInfo, { status: 'info', timeout: 10000 });
};
}
;
function addOption(parent, value, txt) {
var option = L.DomUtil.create('option', '', parent);
option.value = value;
option.textContent = txt;
}
var startform = L.DomUtil.create('form', 'uk-form uk-form-stacked', startDiv);
startform.onsubmit = function (e) {
e.preventDefault();
e.stopPropagation();
return false;
};
var fieldset = L.DomUtil.create('fieldset', '', startform);
var calculationRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(calculationRowDiv, "Calculation mode", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-calculationmode' target='_blank'>here</a>");
var calculationMode = L.DomUtil.create('div', 'uk-form-select', calculationRowDiv);
calculationMode.setAttribute('data-uk-form-select', '');
var selectedMode = L.DomUtil.create('span', '', calculationMode);
self.selectCalculationMode = L.DomUtil.create('select', '', calculationMode);
addOption(self.selectCalculationMode, 'Fast', 'Fast / less detailed');
addOption(self.selectCalculationMode, 'Normal', 'Normal');
addOption(self.selectCalculationMode, 'Detailed', 'Detailed / slower');
self.selectCalculationMode.selectedIndex = 1;
var uncertaintyRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(uncertaintyRowDiv, "Uncertainty", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-uncertainty' target='_blank'>here</a>");
var uncertaintyLabel = L.DomUtil.create('label', '', uncertaintyRowDiv);
uncertaintyLabel.style.display = 'block';
self.uncertaintyInput = L.DomUtil.create('input', '', uncertaintyLabel);
self.uncertaintyInput.type = 'checkbox';
uncertaintyLabel.appendChild(document.createTextNode(' Extra uncertainty in weather forecast is added to simulation'));
var hr = L.DomUtil.create('hr', 'uk-margin-top', startDiv);
self.startButton = L.DomUtil.create('button', 'uk-button uk-button-success uk-margin-top uk-align-center', startDiv);
self.startButton.textContent = 'Start model';
......@@ -219,6 +258,10 @@ var L;
card.populateData(geojson);
}
}
geojson["features"][0]["properties"]["simulation"]["uncertainty"] = false;
if (self.uncertaintyInput.checked)
geojson["features"][0]["properties"]["simulation"]["uncertainty"] = true;
geojson["features"][0]["properties"]["simulation"]["mode"] = self.selectCalculationMode.value;
reqwest({
url: 'startos',
type: 'json',
......@@ -362,10 +405,18 @@ var L;
card.show();
}
}
var evt = document.createEvent('Event');
evt.initEvent("change", true, true);
var simulation = geojson.features[0].properties.simulation;
self.selectCalculationMode.value = simulation.mode;
self.selectCalculationMode.dispatchEvent(evt);
self.uncertaintyInput.checked = simulation.uncertainty;
}
};
OilSpill.prototype.clear = function () {
var self = this;
self.selectCalculationMode.selectedIndex = 1;
self.uncertaintyInput.checked = false;
var c = 1;
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
......
This diff is collapsed.
......@@ -18,6 +18,8 @@ module L.Control {
private map: L.Map;
private compname: string;
private cardMap: any;
private selectCalculationMode: HTMLSelectElement;
private uncertaintyInput: HTMLInputElement;
private startButton: HTMLButtonElement;
constructor(options) {
......@@ -147,7 +149,46 @@ module L.Control {
chain[periodid] = oiltypeid;
chain[oiltypeid] = amountid;
chain[amountid] = '';
var startDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-width-medium-1-2 uk-container-center', this.container);
var startDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-width-medium-1-1 uk-container-center uk-margin-top', this.container);
function addLabelDiv(parentDiv, labelTxt, labelInfo){
var self = this;
var label = <HTMLLabelElement>L.DomUtil.create('label', 'uk-form-label form-label', parentDiv);
label.textContent = labelTxt;
var addPositionInfo = <HTMLSpanElement>L.DomUtil.create('span', 'uk-icon-hover uk-icon-info-circle', parentDiv);
addPositionInfo.onclick = function() {
UIkit.notify("<span class='uk-icon-small uk-icon-info-circle'></span> <b>" + labelTxt + "</b><p>" + labelInfo, { status: 'info', timeout: 10000 });
};
};
function addOption(parent, value, txt ) {
var option = <HTMLOptionElement>L.DomUtil.create('option', '', parent);
option.value = value;
option.textContent = txt;
}
var startform = <HTMLFormElement>L.DomUtil.create('form', 'uk-form uk-form-stacked', startDiv);
startform.onsubmit = function(e){
e.preventDefault();
e.stopPropagation();
return false;
};
var fieldset = <HTMLFieldSetElement>L.DomUtil.create('fieldset', '', startform);
var calculationRowDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(calculationRowDiv, "Calculation mode", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-calculationmode' target='_blank'>here</a>");
var calculationMode = <HTMLDivElement>L.DomUtil.create('div', 'uk-form-select', calculationRowDiv);
calculationMode.setAttribute('data-uk-form-select','');
var selectedMode = <HTMLSpanElement>L.DomUtil.create('span', '', calculationMode);
self.selectCalculationMode = <HTMLSelectElement>L.DomUtil.create('select', '', calculationMode);
addOption(self.selectCalculationMode,'Fast', 'Fast / less detailed');
addOption(self.selectCalculationMode,'Normal', 'Normal');
addOption(self.selectCalculationMode,'Detailed', 'Detailed / slower');
self.selectCalculationMode.selectedIndex = 1;
var uncertaintyRowDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-form-row', fieldset);
addLabelDiv(uncertaintyRowDiv, "Uncertainty", "See more information <a style='color:#faa732;' href='help/classic/#object-fo-uncertainty' target='_blank'>here</a>");
var uncertaintyLabel = <HTMLLabelElement>L.DomUtil.create('label', '', uncertaintyRowDiv);
uncertaintyLabel.style.display = 'block';
self.uncertaintyInput = <HTMLInputElement>L.DomUtil.create('input', '', uncertaintyLabel);
self.uncertaintyInput.type = 'checkbox';
uncertaintyLabel.appendChild(document.createTextNode(' Extra uncertainty in weather forecast is added to simulation'));
var hr = <HTMLDivElement>L.DomUtil.create('hr', 'uk-margin-top', startDiv);
self.startButton = <HTMLButtonElement>L.DomUtil.create('button', 'uk-button uk-button-success uk-margin-top uk-align-center', startDiv);
self.startButton.textContent = 'Start model';
......@@ -226,6 +267,9 @@ module L.Control {
card.populateData(geojson);
}
}
geojson["features"][0]["properties"]["simulation"]["uncertainty"] = false;
if (self.uncertaintyInput.checked) geojson["features"][0]["properties"]["simulation"]["uncertainty"] = true;
geojson["features"][0]["properties"]["simulation"]["mode"] = self.selectCalculationMode.value;
reqwest({
url: 'startos',
......@@ -377,11 +421,20 @@ module L.Control {
card.show();
}
}
var evt = document.createEvent('Event');
evt.initEvent("change", true, true);
var simulation = geojson.features[0].properties.simulation;
self.selectCalculationMode.value = simulation.mode;
self.selectCalculationMode.dispatchEvent(evt);
self.uncertaintyInput.checked = simulation.uncertainty;
}
}
private clear() {
var self = this;
self.selectCalculationMode.selectedIndex = 1;
self.uncertaintyInput.checked = false;
var c = 1;
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
......
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