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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
| var arrMarkers = [{
'locNr': "Location 1",
'lat': 45.767299,
'lon': 4.834329,
'city': 'Lyon',
'zip': 69,
'land': "Fance",
'info': '<b>Lyon<\/b><br>la suite du texte...'
},
{ 'locNr': "Location 2",
'lat': 48.856667,
'lon': 2.350987,
'city': 'Paris',
'zip': 75,
'land': "Fance",
'info': '<b>Paris<\/b><br>la suite du texte...'
},
{ 'locNr': "Location 3",
'lat': 44.837368,
'lon': -0.576144,
'city': 'Bordeaux',
'zip': 33,
'land': "Fance",
'info': '<b>Bordeaux<\/b><br>la suite du texte...'
},
{ 'locNr': "Location 4",
'lat': 43.297612,
'lon': 5.381042,
'city': 'Marseille',
'zip': 13,
'land': "Fance",
'info': '<b>Marseille<\/b><br>la suite du texte...'
}];
var oMap = {
map: null,
markers: []
};
function initMaps(layerNbr)
{ if (document.getElementById)
{ var mapDiv = document.getElementById('Layer1');
var latlng = new google.maps.LatLng(46.316584,2.98169);
var options =
{ zoom: 6,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP, // Existe d'autre format Ex: HYBRID => Plan sur photo
scalecontrol: true,
navigationControl: true,
maxZoom : 20,
navigationControlOptions:
{ style: google.maps.NavigationControlStyle.SMALL
},
mapTypeControlOptions:
{ style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
streetViewControl: true
};
};
oMap.map = new google.maps.Map(mapDiv, options);
addMarker();
}
function addMarker(){
if (oMap.map){
//var latlng = new google.maps.LatLng(lat,lng);
for (var i in arrMarkers) {
var lat = arrMarkers[i].lat;
var lng = arrMarkers[i].lon;
var locNr = arrMarkers[i].locNr;
var city = arrMarkers[i].city;
var zip = arrMarkers[i].zip;
var land = arrMarkers[i].land;
var info = arrMarkers[i].info;
var latlngset = new google.maps.LatLng(lat, lng);
var markOpt = {
map: oMap.map,
position: latlngset,
title: city
};
var marker = new google.maps.Marker(markOpt);
oMap.markers.push(marker);
var contentInfoWindow = [
'<div id="InfoText">',
'<div class ="tabs">',
'<ul>',
'<li><a href="#tab1">General</a></li>',
'<li><a href="#tab2" id="SV">Street View</a></li>',
'</ul>',
'<div id="tab1">',
'<h3><b>' + locNr + '</h3></b>', '<p>' + city + '<BR>' + land + '<BR>' + zip + '<BR>' + info + '</p>',
'</div>',
'<div id="tab2">',
'<div id="pano"></div>',
'</div>',
'</div>',
'</div>'
].join('');
var infoWindowOptions = {
content: contentInfoWindow,
position: latlngset
};
var infowindow = new google.maps.InfoWindow(infoWindowOptions);
setEventMarker(marker, infowindow);
};
adjustViewPort()
};
}
function setEventMarker(marker, infowindow) {
google.maps.event.addListener(marker, "click", function () {
infowindow.open(this.getMap(), this);
});
google.maps.event.addListener(infowindow, 'domready', function () {
$(".tabs").tabs();
$('#SV').click(function (e) {
e.stopPropagation();
var panoramaOptions = {
position: marker.position
};
var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
//oMap.map.setStreetView(panorama);
});
});
};
adjustViewPort = function() {
if (oMap.map) {
var bounds = new google.maps.LatLngBounds();
for (var i in oMap.markers) {
bounds.extend(oMap.markers[i].getPosition());
}
oMap.map.fitBounds(bounds);
}}
/*----------------------------2 */
var oMap2 = {
map: null,
markers: []
};
function initMaps2()
{ if (document.getElementById)
{ var mapDiv2 = document.getElementById('Layer2');
var latlng = new google.maps.LatLng(46.316584,2.98169);
var options =
{ zoom: 6,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP, // Existe d'autre format Ex: HYBRID => Plan sur photo
scalecontrol: true,
navigationControl: true,
maxZoom : 20,
navigationControlOptions:
{ style: google.maps.NavigationControlStyle.SMALL
},
mapTypeControlOptions:
{ style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
streetViewControl: true
};
};
oMap2.map = new google.maps.Map(mapDiv2, options);
addMarker2();
}
function addMarker2(){
if (oMap2.map){
//var latlng = new google.maps.LatLng(lat,lng);
for (var i in arrMarkers) {
var lat = arrMarkers[i].lat;
var lng = arrMarkers[i].lon;
var locNr = arrMarkers[i].locNr;
var city = arrMarkers[i].city;
var zip = arrMarkers[i].zip;
var land = arrMarkers[i].land;
var info = arrMarkers[i].info;
var latlngset = new google.maps.LatLng(lat, lng);
var markOpt = {
map: oMap2.map,
position: latlngset,
title: city
};
var marker = new google.maps.Marker(markOpt);
oMap2.markers.push(marker);
var contentInfoWindow = [
'<div id="InfoText2">',
'<div class ="tabs2">',
'<ul>',
'<li><a href="#tab3">General</a></li>',
'<li><a href="#tab4" id="SV2">Street View</a></li>',
'</ul>',
'<div id="tab3">',
'<h3><b>' + locNr + '</h3></b>', '<p>' + city + '<BR>' + land + '<BR>' + zip + '<BR>' + info + '</p>',
'</div>',
'<div id="tab4">',
'<div id="pano2"></div>',
'</div>',
'</div>',
'</div>'
].join('');
var infoWindowOptions = {
content: contentInfoWindow,
position: latlngset
};
var infowindow = new google.maps.InfoWindow(infoWindowOptions);
setEventMarker2(marker, infowindow);
};
adjustViewPort2()
};
}
function setEventMarker2(marker, infowindow) {
google.maps.event.addListener(marker, "click", function () {
infowindow.open(this.getMap(), this);
});
google.maps.event.addListener(infowindow, 'domready', function () {
$(".tabs2").tabs();
$('#SV2').click(function (e) {
e.stopPropagation();
var panoramaOptions = {
position: marker.position
};
var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano2"), panoramaOptions);
//oMap.map.setStreetView(panorama);
});
});
};
adjustViewPort2 = function() {
if (oMap2.map) {
var bounds = new google.maps.LatLngBounds();
for (var i in oMap2.markers) {
bounds.extend(oMap2.markers[i].getPosition());
}
oMap2.map.fitBounds(bounds);
}} |
Partager