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

added positions with max depth

parent 4e871785
......@@ -155,7 +155,7 @@ var STWkit;
self.polygonButton.onclick = function () { self.geometryType = "polygon"; self.control.setType(self.geometryType); };
self.circleButton.onclick = function () { self.geometryType = "circle"; self.control.setType(self.geometryType); };
self.polygonButton.disabled = false;
self.hasPosition = false;
self.positions = [];
var positionLabelGrid = L.DomUtil.create('div', 'uk-grid uk-margin-top', self.locationForm);
var positionlabelDiv = L.DomUtil.create('div', 'uk-width-1-1', positionLabelGrid);
_super.prototype.addLabelDiv.call(_this, positionlabelDiv, "Position", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-position' target='_blank'>here</a>");
......@@ -203,7 +203,7 @@ var STWkit;
"buttons": false,
"tabs": false,
"callback": function (latlngs, geojson) {
self.hasPosition = false;
self.positions = [];
if (latlngs.length > 0) {
var toggleevt = document.createEvent("CustomEvent");
toggleevt.initCustomEvent('container:toggleVisibility', false, false, {
......@@ -244,7 +244,8 @@ var STWkit;
self.forcingBoundary.addListener(self.control.layers);
}
self.control.showTable();
self.hasPosition = true;
for (var i = 0; i < coordinates.length; i++)
self.positions.push([coordinates[i][1], coordinates[i][0], self.forcingBoundary.depth(coordinates[i][1], coordinates[i][0])]);
self.validate();
}
}
......@@ -326,7 +327,7 @@ var STWkit;
_super.prototype.show.call(this);
};
LocationCard.prototype.validate = function () {
if (!this.hasPosition)
if (this.positions.length == 0)
return;
this.status = true;
AccordionCard.enableNext(this.nextButton, true);
......
This diff is collapsed.
......@@ -107,7 +107,7 @@ module STWkit {
public timeFormat: string;
public datetimeFormat: string;
public datetimeTFormat: string;
public hasPosition: boolean;
public positions: any[];
public geometryType: string;
private forcingBoundary: any;
private locationDiv: HTMLDivElement;
......@@ -177,7 +177,7 @@ module STWkit {
self.circleButton.onclick = function () { self.geometryType = "circle"; self.control.setType(self.geometryType); }
self.polygonButton.disabled = false;
self.hasPosition = false;
self.positions = [];
var positionLabelGrid = <HTMLDivElement>L.DomUtil.create('div', 'uk-grid uk-margin-top', self.locationForm);
......@@ -231,7 +231,7 @@ module STWkit {
"buttons": false,
"tabs": false,
"callback": function (latlngs, geojson) {
self.hasPosition = false;
self.positions = [];
if (latlngs.length > 0) {
var toggleevt = document.createEvent("CustomEvent");
toggleevt.initCustomEvent('container:toggleVisibility', false, false, {
......@@ -270,7 +270,8 @@ module STWkit {
self.forcingBoundary.addListener(self.control.layers);
}
self.control.showTable();
self.hasPosition = true;
for (var i = 0; i < coordinates.length; i++)
self.positions.push([coordinates[i][1], coordinates[i][0], self.forcingBoundary.depth(coordinates[i][1], coordinates[i][0])]);
self.validate();
}
}
......@@ -357,7 +358,7 @@ module STWkit {
}
public validate() {
if (!this.hasPosition) return;
if (this.positions.length == 0) return;
this.status = true;
AccordionCard.enableNext(this.nextButton, true);
(this.oncallback && this.oncallback());
......
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