Commit 1c6abb80 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸
Browse files

fixes

parent 1a9ab687
......@@ -55,70 +55,70 @@
<script>
var map1 = L.map('map1').setView([ 58.5, 19.0 ], 5);
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>'
}).addTo(map1);
var language = 'en';
var langData = {
"tTitle" : "Player"
};
var player1 = new L.Control.Player({
"lang" : language,
"langdata" : langData,
"position": 'bottomleft',
"display" : 'horizontal'
});
// var map1 = L.map('map1').setView([ 58.5, 19.0 ], 5);
// 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>'
// }).addTo(map1);
// var language = 'en';
// var langData = {
// "tTitle" : "Player"
// };
// var player1 = new L.Control.Player({
// "lang" : language,
// "langdata" : langData,
// "position": 'bottomleft',
// "display" : 'horizontal'
// });
map1.addControl(player1);
var timeDimension1 = player1.getTimeDimension();
var wmsLayer1 = L.tileLayer.wms('http://wts.smhi.se/tile/', {
layers: "NEMO:NS02_oceancurrentarrows_neurope_",
transparent: true,
crs: L.CRS.EPSG900913,
format: 'image/png',
zIndex: 900,
attribution: 'Current forecasts from <a href="http://www.smhi.se" alt="Swedish Meteorological Hydrological Institute">SMHI</a>'
});
// map1.addControl(player1);
// var timeDimension1 = player1.getTimeDimension();
// var wmsLayer1 = L.tileLayer.wms('http://wts.smhi.se/tile/', {
// layers: "NEMO:NS02_oceancurrentarrows_neurope_",
// transparent: true,
// crs: L.CRS.EPSG900913,
// format: 'image/png',
// zIndex: 900,
// attribution: 'Current forecasts from <a href="http://www.smhi.se" alt="Swedish Meteorological Hydrological Institute">SMHI</a>'
// });
var weatherLayer1 = L.timeDimension.layer.wms.picasso(wmsLayer1, {
proxy: 'proxy',
cache: 10,
timeDimension : timeDimension1
});
weatherLayer1.on('metadataload', function(){
console.log('metadata loaded 1');
player1.refresh();
});
// var weatherLayer1 = L.timeDimension.layer.wms.picasso(wmsLayer1, {
// proxy: 'proxy',
// cache: 10,
// timeDimension : timeDimension1
// });
// weatherLayer1.on('metadataload', function(){
// console.log('metadata loaded 1');
// player1.refresh();
// });
map1.addLayer(weatherLayer1);
// map1.addLayer(weatherLayer1);
var wmsLayer2 = L.tileLayer.wms('http://wts.smhi.se/tile/', {
layers: "NEMO:NS02_oceancurrentspeed_neurope_",
transparent: true,
crs: L.CRS.EPSG900913,
format: 'image/png',
zIndex: 800,
attribution: 'Current forecasts from <a href="http://www.smhi.se" alt="Swedish Meteorological Hydrological Institute">SMHI</a>'
});
// var wmsLayer2 = L.tileLayer.wms('http://wts.smhi.se/tile/', {
// layers: "NEMO:NS02_oceancurrentspeed_neurope_",
// transparent: true,
// crs: L.CRS.EPSG900913,
// format: 'image/png',
// zIndex: 800,
// attribution: 'Current forecasts from <a href="http://www.smhi.se" alt="Swedish Meteorological Hydrological Institute">SMHI</a>'
// });
var weatherLayer2 = L.timeDimension.layer.wms.picasso(wmsLayer2, {
proxy: 'proxy',
cache: 10,
timeDimension : timeDimension1
});
weatherLayer2.on('metadataload', function(){
console.log('metadata loaded 2');
player1.refresh();
});
// var weatherLayer2 = L.timeDimension.layer.wms.picasso(wmsLayer2, {
// proxy: 'proxy',
// cache: 10,
// timeDimension : timeDimension1
// });
// weatherLayer2.on('metadataload', function(){
// console.log('metadata loaded 2');
// player1.refresh();
// });
map1.addLayer(weatherLayer2);
// map1.addLayer(weatherLayer2);
/*--------------------------------------------------*/
......@@ -141,7 +141,29 @@
map2.addControl(player2);
var timeDimension2 = player2.getTimeDimension();
function getBoundaryPointToLayer() {
return function (featureData, latlng) {
return L.circle(latlng, 2, {
color: '#000',
clickable: false
});
};
}
reqwest({
url: "output",
method: 'get',
type: 'json',
success: function (outputjson) {
var particleLayer = L.timeDimension.layer.geojsontime(JSON.parse(outputjson), {
cache: 10,
timeDimension: player2.getTimeDimension(),
duration: 'PT14M',
'pointToLayer': getBoundaryPointToLayer()
});
map2.addLayer(particleLayer);
player2.refresh();
}
});
</script>
......
This diff is collapsed.
var express = require('express');
var path = require('path');
var request = require('request');
var fs = require('fs');
var app = express();
......@@ -12,6 +13,16 @@ app.get('/demo/proxy', function (req, res) {
})
});
app.get('/demo/output',
function (req, res) {
fs.readFile('demo/output.json', 'utf8', function (err, data) {
if (err) throw err;
return res.json(data);
});
});
// app.use(express.static(__dirname + '/../bower_components'));
//console.log(__dirname + '/../bower_components');
app.use('/bower_components', express.static(path.join(__dirname, '../bower_components')));
......
......@@ -151,8 +151,9 @@ var L;
this.disable();
};
//TODO
// Player: Cannot click in progress bar when playing. Sometimes click are not registered. Try change from onChange to onFinish
// Player: Changing speed while backward play causes forward play
// Should stop if playing change transition time and then start playing with step to get right direction
// Player: Cannot click in progress bar when playing. Sometimes click are not registered. Try change from onChange to onFinish
// Player: Both playbuttons are sometimes active at the same time
// Player: Drag handle should be enabled
Player.prototype.addLayout = function () {
......@@ -212,14 +213,15 @@ var L;
stopPlay();
var date = moment(data.from * 1000).utc();
self.timeSelect.value = date.format("X");
self.timeDimension.setCurrentTime(date.valueOf());
if (play)
startPlay(steps);
},
onFinish: function (data) {
self.disable();
var date = moment(data.from * 1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
self.timeDimension.setCurrentTime(date.valueOf());
}
});
self.slider = $(timeSliderDiv).data("ionRangeSlider");
......@@ -242,7 +244,9 @@ var L;
transitionSpeed = 1;
break;
}
self.player.setTransitionTime(self.transitionTime / transitionSpeed);
console.log(self.player.getSteps());
console.log(self.player.getTransitionTime());
self.player.setTransitionTime(self.player.getSteps() * self.transitionTime / transitionSpeed);
title = self.replaceText(transitionButton, ' x' + transitionSpeed, title);
};
var timeButtonGroup = L.DomUtil.create('div', 'uk-button-group', controlsDiv);
......@@ -363,7 +367,7 @@ var L;
from: +date.format("X")
});
};
self.timeSelect.value = moment(self.slider.result.from * 1000).valueOf() + '';
self.timeSelect.value = moment(self.slider.result.from).valueOf() + '';
self.timeSelect.onchange = function () {
self.disable();
stopPlay();
......
This diff is collapsed.
......@@ -174,8 +174,9 @@ export class Player extends L.Control {
}
//TODO
// Player: Cannot click in progress bar when playing. Sometimes click are not registered. Try change from onChange to onFinish
// Player: Changing speed while backward play causes forward play
// Should stop if playing change transition time and then start playing with step to get right direction
// Player: Cannot click in progress bar when playing. Sometimes click are not registered. Try change from onChange to onFinish
// Player: Both playbuttons are sometimes active at the same time
// Player: Drag handle should be enabled
......@@ -235,13 +236,14 @@ export class Player extends L.Control {
if (play) stopPlay();
var date = moment(data.from*1000).utc();
self.timeSelect.value = date.format("X");
self.timeDimension.setCurrentTime(date.valueOf());
if (play) startPlay(steps);
},
onFinish: function (data) {
self.disable();
var date = moment(data.from*1000).utc();
self.timeDimension.setCurrentTime(date.valueOf());
self.timeSelect.value = date.format("X");
self.timeDimension.setCurrentTime(date.valueOf());
}
});
self.slider = $(timeSliderDiv).data("ionRangeSlider");
......@@ -265,7 +267,9 @@ export class Player extends L.Control {
transitionSpeed = 1;
break;
}
self.player.setTransitionTime(self.transitionTime/transitionSpeed);
console.log(self.player.getSteps());
console.log(self.player.getTransitionTime());
self.player.setTransitionTime(self.player.getSteps()*self.transitionTime/transitionSpeed);
title = self.replaceText(transitionButton, ' x'+transitionSpeed, title );
};
......@@ -390,7 +394,7 @@ export class Player extends L.Control {
});
};
self.timeSelect.value = moment(self.slider.result.from*1000).valueOf()+'';
self.timeSelect.value = moment(self.slider.result.from).valueOf()+'';
self.timeSelect.onchange = function() {
self.disable();
stopPlay();
......
Supports Markdown
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