Commit 110851ef authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

made period forwardbackward optional and you can change namne on location polygon

parent 6979c1de
......@@ -175,19 +175,23 @@
setup(map) {
this.container = STWkit.DomUtil.create('div', +self.name+'-control');
this.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container);
var options = {};
var locationoptions = {};
var initials = '';
options['single'] = false;
options['multiple'] = false;
options['line'] = false;
options['polygon'] = true;
options['circle'] = true;
options['initials'] = initials;
locationoptions['single'] = false;
locationoptions['multiple'] = false;
locationoptions['line'] = false;
locationoptions['polygon'] = {};
locationoptions['polygon']['show'] = true;
// locationoptions['polygon']['name'] = 'Area';
locationoptions['circle'] = true;
locationoptions['initials'] = initials;
var locationid = 'locationCard';
this.cardMap[locationid] = new STWkit.LocationCard(locationid, 'Specify location', this.accordionDiv, this.lang, this.langData, map, this.forcing, options);
this.cardMap[locationid] = new STWkit.LocationCard(locationid, 'Specify location', this.accordionDiv, this.lang, this.langData, map, this.forcing, locationoptions);
this.cardMap[locationid].show();
var periodoptions = {};
// periodoptions['forwardbackward'] = false;
var periodid = 'periodCard';
this.cardMap[periodid] = new STWkit.PeriodCard(periodid, 'Simulation period', this.accordionDiv, this.lang, map, this.domain, this.forcingmodel);
this.cardMap[periodid] = new STWkit.PeriodCard(periodid, 'Simulation period', this.accordionDiv, this.lang, map, this.domain, this.forcingmodel, periodoptions);
super.setup(map);
var chain = [];
chain[locationid] = periodid;
......
......@@ -121,7 +121,8 @@ var STWkit;
var initials = (options && options.hasOwnProperty('initials')) ? options.initials : '';
var showsingle = (options && options.hasOwnProperty('single')) ? options.single : true;
var showmultiple = (options && options.hasOwnProperty('multiple')) ? options.multiple : false;
var showpolygon = (options && options.hasOwnProperty('polygon')) ? options.polygon : true;
var showpolygon = (options && options.hasOwnProperty('polygon') && options.polygon.hasOwnProperty('show')) ? options.polygon.show : true;
var namepolygon = (options && options.hasOwnProperty('polygon') && options.polygon.hasOwnProperty('name')) ? options.polygon.name : 'Polygon';
var showline = (options && options.hasOwnProperty('line')) ? options.line : true;
var showcircle = (options && options.hasOwnProperty('circle')) ? options.circle : false;
var typeLabelGrid = L.DomUtil.create('div', 'uk-grid uk-margin-top', self.locationForm);
......@@ -152,7 +153,7 @@ var STWkit;
if (!showline)
self.lineButton.style.display = 'none';
self.polygonButton = L.DomUtil.create('button', 'uk-button uk-button-small', objectButtonGroup);
self.polygonButton.textContent = 'Polygon';
self.polygonButton.textContent = namepolygon;
if (!showpolygon)
self.polygonButton.style.display = 'none';
self.pointButton.onclick = function () { self.geometryType = "point"; self.control.setType(self.geometryType); };
......@@ -410,13 +411,14 @@ var STWkit;
STWkit.LocationCard = LocationCard;
var PeriodCard = (function (_super) {
__extends(PeriodCard, _super);
function PeriodCard(id, title, parentDiv, lang, map, domain, forcingmodel) {
function PeriodCard(id, title, parentDiv, lang, map, domain, forcingmodel, options) {
var _this = this;
var periodDiv = L.DomUtil.create('div', 'uk-width-1-1 uk-margin-top', parentDiv);
_this = _super.call(this, id, title, parentDiv, periodDiv) || this;
var self = _this;
self.domain = domain;
self.forcingmodel = forcingmodel;
var showforwardbackward = (options && options.hasOwnProperty('forwardbackward')) ? options.forwardbackward : true;
var form = L.DomUtil.create('form', 'uk-form uk-form-stacked', periodDiv);
form.onsubmit = function (e) {
e.preventDefault();
......@@ -454,6 +456,8 @@ var STWkit;
var hoursSpan = L.DomUtil.create('span', 'uk-width-1-6', durationDiv);
hoursSpan.textContent = " hours";
var directionRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
if (!showforwardbackward)
directionRowDiv.style.display = 'none';
_super.prototype.addLabelDiv.call(_this, directionRowDiv, "Forward / Backward", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-direction' target='_blank'>here</a>");
var directionDiv = L.DomUtil.create('div', 'uk-margin-bottom', directionRowDiv);
directionDiv.setAttribute('data-uk-button-radio', '');
......
This diff is collapsed.
......@@ -147,7 +147,8 @@ module STWkit {
var initials = (options && options.hasOwnProperty('initials'))?options.initials:'';
var showsingle = (options && options.hasOwnProperty('single'))?options.single:true;
var showmultiple = (options && options.hasOwnProperty('multiple'))?options.multiple:false;
var showpolygon = (options && options.hasOwnProperty('polygon'))?options.polygon:true;
var showpolygon = (options && options.hasOwnProperty('polygon') && options.polygon.hasOwnProperty('show'))?options.polygon.show:true;
var namepolygon = (options && options.hasOwnProperty('polygon') && options.polygon.hasOwnProperty('name'))?options.polygon.name:'Polygon';
var showline = (options && options.hasOwnProperty('line'))?options.line:true;
var showcircle = (options && options.hasOwnProperty('circle'))?options.circle:false;
var typeLabelGrid = <HTMLDivElement>L.DomUtil.create('div', 'uk-grid uk-margin-top', self.locationForm);
......@@ -174,7 +175,7 @@ module STWkit {
self.lineButton.disabled = false;
if (!showline) self.lineButton.style.display = 'none';
self.polygonButton = <HTMLButtonElement>L.DomUtil.create('button', 'uk-button uk-button-small', objectButtonGroup);
self.polygonButton.textContent = 'Polygon';
self.polygonButton.textContent = namepolygon;
if (!showpolygon) self.polygonButton.style.display = 'none';
self.pointButton.onclick = function () { self.geometryType = "point"; self.control.setType(self.geometryType); }
self.lineButton.onclick = function () { self.geometryType = "linestring"; self.control.setType(self.geometryType); }
......@@ -464,12 +465,14 @@ module STWkit {
public ready: boolean;
constructor(id, title, parentDiv, lang, map, domain, forcingmodel) {
constructor(id, title, parentDiv, lang, map, domain, forcingmodel, options?) {
var periodDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-width-1-1 uk-margin-top', parentDiv);
super(id, title, parentDiv, periodDiv);
var self = this;
self.domain = domain;
self.forcingmodel = forcingmodel;
var showforwardbackward = (options && options.hasOwnProperty('forwardbackward'))?options.forwardbackward:true;
var form = <HTMLFormElement>L.DomUtil.create('form', 'uk-form uk-form-stacked', periodDiv);
form.onsubmit = function (e) {
e.preventDefault();
......@@ -507,6 +510,7 @@ module STWkit {
var hoursSpan = <HTMLInputElement>L.DomUtil.create('span', 'uk-width-1-6', durationDiv);
hoursSpan.textContent = " hours";
var directionRowDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-form-row', fieldset);
if (!showforwardbackward) directionRowDiv.style.display = 'none';
super.addLabelDiv(directionRowDiv, "Forward / Backward", "See more information <a style='color:#faa732;' href='help/classic/#oil-oo-direction' target='_blank'>here</a>");
var directionDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-margin-bottom', directionRowDiv);
directionDiv.setAttribute('data-uk-button-radio', '');
......
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