Commit 586806da authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

added period

parent 009eb85a
...@@ -66,7 +66,28 @@ ...@@ -66,7 +66,28 @@
<script> <script>
var map = L.map('map').setView([ 58.5, 19.0 ], 5);
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom : 18,
attribution : '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors</a>'
});
map.addLayer(osm);
var containerControl = new L.Control.Container({
position: 'topright',
collapse: true
});
map.addControl(containerControl);
var language = 'en'; var language = 'en';
var itracerLangData = {
};
var coordinatesLangData = { var coordinatesLangData = {
"tMarkerstart": "Click map to place point.", "tMarkerstart": "Click map to place point.",
"tPolygonstart": "Hold left mouse button to draw polygon on map.", "tPolygonstart": "Hold left mouse button to draw polygon on map.",
...@@ -112,67 +133,82 @@ ...@@ -112,67 +133,82 @@
"coordinates": coordinatesLangData "coordinates": coordinatesLangData
}; };
var forcing = {
"model": "NEMO",
L.Control.SimpleComponent = L.Control.extend({ "configuration": "NORDIC",
"domain": "NS02"
initialize: function (height, open) { };
this._height = '500px';
if (height) { var domainname = "HELCOM";
this._height = height;
} reqwest({
this.open = false; url: "forcing/config"+STWkit.jsonToQueryString(forcing),
if (typeof open === 'boolean') { method: 'get',
this.open = open; type: 'json',
} success: function (forcing) {
}, var properties = {
onAdd: function (map) { "domain" : domainname,
this.container = L.DomUtil.create('div', 'simple-component-control'); "lang": language,
var accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container); "langdata": langData
var cardid = 'cardid1'; };
var forcing = {}; if (forcing.features.length > 0) properties["forcing"] = forcing;
var forcing = false;
var obs = false; // SimpleCardControl = STWkit.CardControl.extend({
var card = new STWkit.LocationCard(cardid, accordionDiv, language, langData, map, forcing, obs); // setup: function (map) {
card.show(); // this.container = STWkit.DomUtil.create('div', +self.name+'-control');
// this.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container);
L.DomEvent.disableClickPropagation(this.container); // var locationid = self.initials+'locationCard';
// self.cardMap[locationid] = new Location(locationid, this.accordionDiv, self.lang, self.langData, map, self.forcing);
return this.container; // self.cardMap[locationid].show();
}, // // super.setup(map);
ready: function(name) { // this method is optional // },
if (this.open) { // show: function() {},
var evt = document.createEvent("CustomEvent"); // // ready: function(name) {super.ready(name)},
evt.initCustomEvent('container:showComponent', false, false, { // // clear: function() {super.clear()},
'name': name, // // hide: function() {super.hide()}
'show' : true // });
});
window.dispatchEvent(evt);
} class SimpleCardControl extends STWkit.CardControl {
}, constructor(options) {super(options);}
show: function() {}, setup(map) {
hide: function() {} this.container = STWkit.DomUtil.create('div', +self.name+'-control');
}); this.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container);
var options = {};
var initials = '';
options['singlebutton'] = true;
var map = L.map('map').setView([ 58.5, 19.0 ], 5); options['multiplebutton'] = true;
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { options['linebutton'] = true;
maxZoom : 18, options['areabutton'] = true;
attribution : '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors</a>' options['initials'] = initials;
}); var locationid = 'locationCard';
map.addLayer(osm); this.cardMap[locationid] = new STWkit.LocationCard(locationid, 'Specify location', this.accordionDiv, this.lang, this.langData, map, this.forcing, options);
this.cardMap[locationid].show();
var containerControl = new L.Control.Container({ var periodid = 'periodCard';
position: 'topright', this.cardMap[periodid] = new STWkit.PeriodCard(periodid, 'Simulation period', this.accordionDiv, this.lang, map, this.domain, this.forcingmodel);
collapse: true super.setup(map);
var chain = [];
chain[locationid] = periodid;
chain[periodid] = '';
this.cardMap[locationid].oncallback = (gonext) => {
super.callback(chain, locationid, gonext);
};
this.cardMap[periodid].oncallback = (gonext) => {
super.callback(chain, periodid, gonext);
};
}
show() {}
hide() {}
clear() {super.clear()}
ready(name) {super.ready(name)}
}
var cardcontrol = new SimpleCardControl(properties);
containerControl.addComponent("CardControl", cardcontrol);
cardcontrol.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', cardcontrol.container);
}
}); });
map.addControl(containerControl);
containerControl.addComponent("Component1", new L.Control.SimpleComponent());
</script> </script>
</body> </body>
......
var express = require('express'); var express = require('express');
var path = require('path'); var path = require('path');
var request = require('request');
var bodyParser = require('body-parser');
var app = express(); var app = express();
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
var url = '/demo'
require('../bower_components/leaflet-forcing-boundary/src/routes/forcingboundary')(url,app);
app.use('/bower_components', express.static(path.join(__dirname, '../bower_components'))); app.use('/bower_components', express.static(path.join(__dirname, '../bower_components')));
app.use('/src', express.static(path.join(__dirname, '../src'))); app.use('/src', express.static(path.join(__dirname, '../src')));
app.use('/demo', express.static(__dirname)); app.use('/demo', express.static(__dirname));
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"express": "4.x", "express": "4.x",
"path": "latest" "path": "latest",
"body-parser": "latest",
"request": "latest",
"@turf/within" : "latest"
}, },
"devDependencies": { "devDependencies": {
"grunt": "^1.0.1", "grunt": "^1.0.1",
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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