Commit 12ac0c6d authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

populate card

parent 9e6f924c
......@@ -131,7 +131,7 @@
"lang" : language,
"langdata" : langData
});
containerControl.addComponent("Oil spill", oilspill);
containerControl.addComponent("Continuous Oil spill", oilspill);
function getURLParams(param) {
var match,
......
......@@ -260,23 +260,6 @@ var OSLocation = (function (_super) {
OSLocation.prototype.populateCard = function (geojson) {
var self = this;
self.control.addGeoJSON(geojson);
var type = geojson.features[0].geometry.type.toLowerCase();
switch (type) {
case "point":
self.pointButton.click();
break;
case "multipoint":
self.multipointButton.click();
break;
case "linestring":
self.lineButton.click();
break;
case "polygon":
self.polygonButton.click();
break;
default:
break;
}
var simulation = geojson.features[0].properties.simulation;
self.depthInput.value = simulation.depth;
var observation = geojson.features[0].properties.observation[0];
......@@ -712,15 +695,18 @@ var OSType = (function (_super) {
};
OSType.prototype.populateCard = function (geojson) {
var self = this;
var evt = document.createEvent('Event');
evt.initEvent("change", true, true);
var simulation = geojson.features[0].properties.simulation;
if (simulation.oilclass == 'Oil classes') {
document.getElementById('osOilClassTab').click();
;
self.selectOilClass.value = geojson.features[0].properties["simulation"]["substance"];
self.selectOilClass.value = simulation.substance;
self.selectOilClass.dispatchEvent(evt);
}
if (simulation.oilclass == 'Oil, specific') {
document.getElementById('osOilSpecificTab').click();
self.selectOilClass.value = geojson.features[0].properties["simulation"]["substance"];
self.selectOilSpecific.value = simulation.substance;
self.selectOilSpecific.dispatchEvent(evt);
}
};
OSType.prototype.populateData = function (geojson) {
......
This diff is collapsed.
......@@ -292,23 +292,6 @@ class OSLocation extends OilSpillCard {
public populateCard(geojson) {
var self = this;
self.control.addGeoJSON(geojson);
var type = geojson.features[0].geometry.type.toLowerCase();
switch (type) {
case "point":
self.pointButton.click();
break;
case "multipoint":
self.multipointButton.click();
break;
case "linestring":
self.lineButton.click();
break;
case "polygon":
self.polygonButton.click();
break;
default:
break;
}
var simulation = geojson.features[0].properties.simulation;
self.depthInput.value = simulation.depth;
var observation = geojson.features[0].properties.observation[0];
......@@ -783,16 +766,22 @@ class OSType extends OilSpillCard {
}
public populateCard(geojson) {
var self = this;
var evt = document.createEvent('Event');
evt.initEvent("change", true, true);
var simulation = geojson.features[0].properties.simulation;
if (simulation.oilclass == 'Oil classes') {
document.getElementById('osOilClassTab').click();;
self.selectOilClass.value = geojson.features[0].properties["simulation"]["substance"];
document.getElementById('osOilClassTab').click();
self.selectOilClass.value = simulation.substance;
self.selectOilClass.dispatchEvent(evt);
}
if (simulation.oilclass == 'Oil, specific') {
document.getElementById('osOilSpecificTab').click();
self.selectOilClass.value = geojson.features[0].properties["simulation"]["substance"];
self.selectOilSpecific.value = simulation.substance;
self.selectOilSpecific.dispatchEvent(evt);
}
}
public populateData(geojson) {
......
......@@ -353,7 +353,7 @@ var L;
};
OilSpill.prototype.open = function (geojson) {
var self = this;
if (geojson.features[0].properties.type == 'object') {
if (geojson.features[0].properties.type == 'oil' && geojson.features[0].properties.subtype == 'spill') {
self.clear();
for (var i in self.cardMap) {
if (self.cardMap.hasOwnProperty(i)) {
......
This diff is collapsed.
......@@ -368,7 +368,7 @@ module L.Control {
public open(geojson) {
var self = this;
if (geojson.features[0].properties.type == 'object') {
if (geojson.features[0].properties.type == 'oil' && geojson.features[0].properties.subtype == 'spill') {
self.clear();
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