diff --git a/html5video/movplay.js b/html5video/movplay.js index 1d9fc7d..6566e09 100644 --- a/html5video/movplay.js +++ b/html5video/movplay.js @@ -3,24 +3,16 @@ */ function phook() { - // Video Handling functions - function dispTime(e) { - var pt = document.getElementById("time"); - if (pt) { - pt.innerHTML = vi.currentTime; - } - } - vi = document.getElementById("vid"); - vi.addEventListener('timeupdate', dispTime); - function setTime(e) { - var input = document.getElementById('settime') - if (e.type=='keypress' && e.key != 'Enter') return; - if (input) { - vi.currentTime = input.value;; - } - } - document.getElementById("b").addEventListener('click', setTime); - document.getElementById("settime").addEventListener('keypress', setTime); + // Global markers in a map + var map = L.map('map').setView([38.891, 139.824], 16); + var marker = L.marker().setLatLng(map.getCenter()).addTo(map); + var timescale = 20; + timescale = 1; + // var videostart = new Date ('2019-07-29 09:32:35').getTime(); + var videostart = new Date ('2019-07-29T00:32:35Z').getTime(); + // videostart = 1510000; + videostart += -81000; + // alert(videostart); // MAP handling functions var basemaps = { @@ -40,8 +32,6 @@ '© 国土地理院', maxZoom: 20, maxNativeZoom: 18}, }; - var map = L.map('map').setView([38.891, 139.824], 16); - var marker = L.marker().setLatLng(map.getCenter()).addTo(map); var layers = {}; for (let i in basemaps) { layers[i] = L.tileLayer(basemaps[i].url, basemaps[i]); @@ -50,19 +40,111 @@ layers['OpenStreetMap'].addTo(map); // Load gpx var gpxgj, times, coords; - var gpx = omnivore.gpx("2019_07_29-Yawata.gpx"). - on('ready', function() { - var cons = document.getElementById('console'); - gpxgj = this.toGeoJSON(); - times = gpxgj.features[0].properties.coordTimes; - coords = gpxgj.features[0].geometry.coordinates; - cons.textContent = times - // alert(times[0][0]); - var d = new Date(Date.parse(times[0][0])); - alert(d.toLocaleString()); - cons.textContent += JSON.stringify(gpxgj, null, " "); - - }).addTo(map); + // var gpx = omnivore.gpx("2019_07_29-Yawata.gpx"); + var pointnum=0; + function setProperty(f, layer) { // カスタムレイヤ作成用の関数 + pointnum++; + } + var gpx = omnivore.gpx("2019_07_29-Yawata.gpx", + null, + L.geoJson(null, { + style: {color: "green", weight: 8}, + onEachFeature: setProperty + })); + var tmarray = []; + gpx.on('ready', function() { + var cons = document.getElementById('console'); + gpxgj = this.toGeoJSON(); + times = gpxgj.features[0].properties.coordTimes; + coords = gpxgj.features[0].geometry.coordinates; + // cons.textContent = times; + // alert(times[0][0]); + var d = new Date(Date.parse(times[0][0])), + start = d.getTime(); // Millisecond + var ofs, t, tm; + for (let i=0; i