1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| <script type="text/javascript">
var map;
var myPano;
var panoClient;
var nextPanoId;
function initialize() {
var fenwayPark = new GLatLng('<?php echo $adresses[0]["latitude"]; ?>','<?php echo $adresses[0]["longitude"]; ?>');
var fenwayPOV = {yaw:370.64659986187695,pitch:-20};
panoClient = new GStreetviewClient();
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(fenwayPark, 15);
GEvent.addListener(map, "click", function(overlay, latlng) {
// latlng will be null if the info window has been clicked.
if (latlng) {
panoClient.getNearestPanorama(latlng, showPanoData);
}
});
myPano = new GStreetviewPanorama(document.getElementById("pano"));
myPano.setLocationAndPOV(fenwayPark, fenwayPOV);
GEvent.addListener(myPano, "error", handleNoFlash);
panoClient.getNearestPanorama(fenwayPark, showPanoData);
}
function showPanoData(panoData) {
if (panoData.code != 200) {
GLog.write('showPanoData: Server rejected with code: ' + panoData.code);
return;
}
nextPanoId = panoData.links[0].panoId;
var displayString = [
"LatLng: " + panoData.location.latlng,
"Description: " + panoData.location.description,
].join("<br/>");
map.openInfoWindowHtml(panoData.location.latlng, displayString);
GLog.write('Viewer moved to' + panoData.location.latlng);
//myPano.setLocationAndPOV(panoData.location.latlng);
myPano.setLocationAndPOV("panoData.location.latlng").innerHTML = "<b>"+latlng+"</b>";
}
function next() {
// Get the next panoId
// Note that this is not sophisticated. At the end of the block, it will get stuck
panoClient.getPanoramaById(nextPanoId, showPanoData);
}
function handleNoFlash(errorCode) {
if (errorCode == 603) {
alert("Error: Flash doesn't appear to be supported by your browser");
return;
}
}
</script> |
Partager