var panorama;
var timer;
var start_n = 38.26209; // Sendai Station
var start_e = 140.880765;
var isMoving = false;
var map;
var dir = 0;
var pov;
function load()
{
panorama = new GStreetviewPanorama(document.getElementById("pano"));
panorama.setLocationAndPOV(new GLatLng(start_n, start_e), {yaw: 0, pitch: 0, zoom: 0});
timer = window.setInterval(moveNext, 2000);
map = new GMap(document.getElementById('map'));
map.centerAndZoom(new GPoint(start_e, start_n), -1);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
GEvent.addListener(panorama, "initialized", function(location) {
lat = location.latlng.lat();
lng = location.latlng.lng();
document.getElementById('nowPos').innerHTML = lat + ' / ' + lng;
map.panTo(location.latlng);
pov = {yaw: dir, pitch: 0, zoom: 0};
panorama.panTo(pov);
var marker = new GMarker(new GPoint(lng, lat));
map.clearOverlays();
map.addOverlay(marker);
});
}
function moveNext()
{
if(isMoving){
panorama.followLink(dir);
}
GDownloadUrl("point.xml", setCenterXml);///
}
function setCenterXml(dat)
{
var point = GXml.parse(dat);
var sw = Number(point.getElementsByTagName("moveSwitch")[0].firstChild.nodeValue);
if (sw == "1") isMoving = true;
else isMoving = false;
var yaw = Number(point.getElementsByTagName("yaw")[0].firstChild.nodeValue);
dir = parseInt(yaw)
document.getElementById('dir').innerHTML = dir;
}
now position: ,
now dir: