diff --git a/suiro/Extramak.js b/suiro/Extramak.js deleted file mode 100644 index 53efbae..0000000 --- a/suiro/Extramak.js +++ /dev/null @@ -1,16 +0,0 @@ -var unko=[38.72859248614108,139.82299320874214]; - -var redMarker = L.ExtraMarkers.icon({ - innerHTML:'', - icon: 'fa-coffee', - markerColor: 'red', - shape: 'square', - prefix: 'fa', - extraClasses:'movie' -}); - -//pop= '' - -var red_unko=L.marker(unko, {icon: redMarker}).addTo(mymap); - -console.log(red_unko); diff --git a/suiro/catgps.js b/suiro/catgps.js new file mode 100644 index 0000000..e7a34ba --- /dev/null +++ b/suiro/catgps.js @@ -0,0 +1,132 @@ +function distance(x1, y1, x2, y2) { // ヒュベニ式による距離概算 + rx = 6378137; // 赤道半径(m) WGS84 + ry = 6356752.314; // 極半径(m) WGS84 + e2=(rx*rx-ry*ry)/rx/rx; // 離心率 E^2 + dx = (x2-x1)*Math.PI/180; // 経度の差をラジアン変換 + dy = (y2-y1)*Math.PI/180; // 緯度の差をラジアン変換 + my = (y1+y2)/2.0*Math.PI/180; // 緯度の平均をラジアン変換 + w = Math.sqrt(1-e2*Math.sin(my)*Math.sin(my)); + m = rx*(1-e2)/Math.pow(w,3); // 子午線曲率半径 + n = rx/w; // 卯酉線曲率半径 + return Math.sqrt(Math.pow(dy*m,2) + Math.pow(dx*n*Math.cos(my),2)); +} + +function game(){ + var threshold = 10; // 何m接近をゴールとするか + + var timerInterval = 10000; // GPS失敗で何秒後に再取得か + var tmId = null; + var i = 0;//, countD = document.getElementById("countdown"); + + //var info = document.getElementById("info"); + + var point = L.marker(mymap.getCenter()); + // + var stop = document.getElementById("gps_off"); + + var gps = document.getElementById("gps_on"); + var nowTrying = null; + var doflag=true; + + function tryGetGPS() { + clearTimer(); + //ser.textContent = "GPS取得..." + nowTrying = navigator.geolocation.getCurrentPosition( + onSuccess, onError,{ + maximumAge: 0, timeout: 3000, enableHighAccuracy: true}) + } + + function onemore() { + if (nowTrying || tmId) { + //info.textContent = "既にGPS取得試行or待機中です"; + } else { + startTimer(); + //tm.textContent=""+naiyo[0]+""; + } + } + + function startTimer() { + if (tmId==null && doflag){ + tmId = setTimeout(tryGetGPS, 5000); + //ser.textContent = "5秒後にGPS取得…"; + //tme.textContent= "周りに注意して使用しましょう!"; + } + } + + function clearTimer() { + if (tmId) { + clearTimeout(tmId); + //nowTrying=nil; + } + } + + function countDown(){ + if (doflag){ + alert("周りに注意して使用して下さい"); + //alert(""+naiyo[0]+"") + tryGetGPS(); + } else{ + tryGetGPS(); + doflag=true; + tmId=null; + } + } + + function stopCountDown() { + doflag=false; + //countD.textContent = "stop!"; + //ser.innerHTML = "startボタンをもう一度押すと始まります"; + } + + function onSuccess(pos) { + nowTrying = null; + tmId=null; + mymap.setZoom(18); + var latlng = L.latLng([pos.coords.latitude, pos.coords.longitude]); + //ser.textContent = "現在の位置は"+latlng+"です。"; + mymap.panTo(latlng); + + //point.setPopupContent("あなたの位置はここです").openPopup().setLatLng(latlng); + point.bindPopup("あなたの位置はここです").setLatLng(latlng).addTo(mymap); + var lat = latlng.lat, lng = latlng.lng; + //alert(iro); + var g=100000,d=0,i=0, come,color,near_point; + //var m=feature.geometry.coordinates; + + for(i=0; i', -// className:'', -// //if not class name marker has select box -// iconAnchor: [22, 40], -// popupAnchor: [-10,-30], -// shadowUrl: 'https://www.yatex.org/gitbucket/natto/leaflet/raw/master/images/marker-shadow.png', -// shadowSize: [68, 95], -// shadowAnchor: [22, 94], -// tooltipAnchor:[0,-20] -// }); -// }else{ -// var mkdIcon=L.divIcon({ -// html:'', -// className:'Movie', -// //if not class name marker has select box -// iconAnchor: [22, 40], -// popupAnchor: [-10,-30], -// shadowUrl: 'https://www.yatex.org/gitbucket/natto/leaflet/raw/master/images/marker-shadow.png', -// shadowSize: [68, 95], -// shadowAnchor: [22, 94] -// }); -// } -// mcon.setIcon(mkdIcon); -// }; - function mak_click(marker,map){ marker.on('click', function(o){ map.closePopup(); @@ -394,13 +366,13 @@ //console.log("pop"); }); -var ati=document.getElementById("aps"); +// var ati=document.getElementById("aps"); -function aaaa(){ - //alert("unko"); -}; +// function aaaa(){ +// //alert("unko"); +// }; -aps.addEventListener("click",aaaa,false); +// aps.addEventListener("click",aaaa,false); /* マーカーに対する変更 diff --git a/suiro/map.html b/suiro/map.html index 18a54ac..0f8b917 100644 --- a/suiro/map.html +++ b/suiro/map.html @@ -9,15 +9,10 @@ - + - - - - - @@ -46,12 +41,14 @@ @@ -71,6 +79,7 @@ + diff --git a/suiro/mapkeys.js b/suiro/mapkeys.js deleted file mode 100644 index 7aab46b..0000000 --- a/suiro/mapkeys.js +++ /dev/null @@ -1,12 +0,0 @@ -var unko=[38.72859248614108,139.82239320874214]; -var mki = L.icon.mapkey({ - //htmlCode:'', - //htmlCode:'"); - var Link=Pic.replace(/\[\[/g, ""); - Link=Link.replace(/]]/g, ""); - - return [Link,Mov]; -}; - - -var osmTile = - L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: - '© OpenStreetMap \ -contributors' - }); - -var gsiTile = - L.tileLayer('//cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png', { - attribution: - '国土地理院' - }); - -var mymap= L.map("mymap", { - layers: [osmTile], //最初に指定するタイルレイヤー - center: ltlg, zoom: 14, scrollWheelZoom: false - //中心座標とズームレベルとマウスのホイールでのズームをしないよう設定 -}); - -//var time= document.getElementById("time"); - -var baseLayers = {'OpenStreetMap': osmTile, '国土地理院': gsiTile}; -//レイヤーの内容 - -var kasyo=[],naiyo=[],iro=[],k_type=[],ten=[],coments=[],usepan=[],mkname=[]; -var nakami=[]; - -function M_Icon(CON,MOV,mcon,pan){ - if(MOV==""){ - var mkdIcon=L.divIcon({ - html:'', - className:'', - //if not class name marker has select box - iconAnchor: [22, 40], - popupAnchor: [-10,-30], - shadowUrl: 'https://www.yatex.org/gitbucket/natto/leaflet/raw/master/images/marker-shadow.png', - shadowSize: [68, 95], - shadowAnchor: [22, 94], - tooltipAnchor:[0,-20] - }); - }else{ - var mkdIcon=L.divIcon({ - html:'', - className:'Movie', - //if not class name marker has select box - iconAnchor: [22, 40], - popupAnchor: [-10,-30], - shadowUrl: 'https://www.yatex.org/gitbucket/natto/leaflet/raw/master/images/marker-shadow.png', - shadowSize: [68, 95], - shadowAnchor: [22, 94] - }); - } - mcon.setIcon(mkdIcon); -}; - -function mak_click(marker,map){ - marker.on('click', function(o){ - map.closePopup(); - var pt=L.latLng(o.latlng); - map.flyTo(pt); - sidebar.open("home"); - id=o.originalEvent.explicitOriginalTarget.attributes.id; - val=document.getElementById(id.value); - location.href="#Point"+val.id; - console.log(val.id); - console.log(val); - }); -}; - -var count=0; - -var customLayer=L.geoJson(null,{ - style: function(feature) { - if (feature.properties._storage_options && feature.properties._storage_options.color){ - switch (feature.properties._storage_options.color) { - //alert(feature.properties._storege_opions); - case 'Red': return {color: "red"}; - case 'brown': return {color: "brown"}; - case 'Cyan': return {color: "cyan"}; - case 'lime': return {color: "lime"}; - } - } - if (feature.properties._storage_options && feature.properties._storage_options.weight){ - var hutosa=feature.properties._storage_options.weight; - return {weight: hutosa}; - } - if (feature.properties._storage_options && feature.properties._storage_options.dashArray){ - var hakai=feature.properties._storage_options.dashArray; - return {dashArray: hakai}; - } - }, - onEachFeature: (function (feature, layer){ - var propert= feature.properties, geomet=feature.geometry; - // 予めfeature.propertisをletで宣言。(varでも可) - if (propert && geomet) { - if (propert.name){ - var name=propert.name - } else { - var name=""; - } - if (propert.description){ - var tose=propert.description; - } else { - var tose=""; - } - if (propert._storage_options){ - if (propert._storage_options.color){ - var color=propert._storage_options.color; - iro.push(color); - }else { - color=""; - iro.push(color); - } - if (propert._storage_options.iconClass){ - var katati=propert._storage_options.iconClass; - }else { - katati=""; - } - - } - - var type=geomet.type, m=geomet.coordinates; - k_type.push(type); - if(type=="Point"){ - var Point_id=type+count; - var SMC=Set_Contents(tose); - var coment='

'+name+'

'+SMC[0]+'

'; - var movie=SMC[1]; - coments.push(movie); - usepan.push(m); - mkname.push(name); - var mak=layer.bindPopup(coment); - M_info.innerHTML+=coment; - mak.name=name; - M_Icon(count,movie,mak,m); - count++; - mak_click(mak,mymap); - }else{ - var coment='

'+name+'

'+tose+'

'; - usepan.push(m); - var line=layer.bindPopup(coment); - count++; - } - - layer.bindTooltip(name); - - //natu.addTo(mymap); - if (type=="LineString"){ - for(i=0; i