|
|
|
@ -233,6 +233,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
defaultType: function(name) { |
|
|
|
|
if (name.toLowerCase() == "satellite" || name.toLowerCase() == "hybrid" || name.toLowerCase() == "terrain" || name.toLowerCase() == "roadmap") { |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
map_subdomains: ["", "a.", "b.", "c.", "d."], |
|
|
|
|
|
|
|
|
|
map_attribution: { |
|
|
|
@ -269,7 +277,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
"apple": { |
|
|
|
|
"url": "http://gsp2.apple.com/tile?api=1&style=slideshow&layers=default&lang=en_US&z={z}&x={x}&y={y}&v=9", |
|
|
|
|
"minZoom": 4, |
|
|
|
|
"maxZoom": 20, |
|
|
|
|
"maxZoom": 14, |
|
|
|
|
"attribution": "apple" |
|
|
|
|
}, |
|
|
|
|
"watercolor": { |
|
|
|
@ -281,7 +289,6 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
createMap: function(m) { |
|
|
|
|
trace(VMM.ExternalAPI.googlemaps.stamen_map_attribution); |
|
|
|
|
/* MAP PROVIDERS |
|
|
|
|
Including Stamen Maps |
|
|
|
|
http://maps.stamen.com/
|
|
|
|
@ -295,11 +302,19 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
map_attribution = VMM.ExternalAPI.googlemaps.map_attribution[VMM.ExternalAPI.googlemaps.map_providers[name].attribution]; |
|
|
|
|
return VMM.ExternalAPI.googlemaps.map_providers[name]; |
|
|
|
|
} else { |
|
|
|
|
throw 'No such provider: "' + name + '"'; |
|
|
|
|
if (VMM.ExternalAPI.googlemaps.defaultType(name)) { |
|
|
|
|
trace("GOOGLE MAP DEFAULT TYPE"); |
|
|
|
|
return google.maps.MapTypeId[name.toUpperCase()]; |
|
|
|
|
} else { |
|
|
|
|
trace("Not a maptype: " + name ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
google.maps.VeriteMapType = function(name) { |
|
|
|
|
if (VMM.ExternalAPI.googlemaps.defaultType(name)) { |
|
|
|
|
return google.maps.MapTypeId[name.toUpperCase()]; |
|
|
|
|
} else { |
|
|
|
|
var provider = mapProvider(name); |
|
|
|
|
return google.maps.ImageMapType.call(this, { |
|
|
|
|
"getTileUrl": function(coord, zoom) { |
|
|
|
@ -320,6 +335,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
"minZoom": provider.minZoom, |
|
|
|
|
"maxZoom": provider.maxZoom |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
google.maps.VeriteMapType.prototype = new google.maps.ImageMapType("_"); |
|
|
|
@ -328,9 +344,12 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
================================================== */ |
|
|
|
|
var layer; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type.of(VMM.master_config.Timeline.maptype) == "string") { |
|
|
|
|
if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { |
|
|
|
|
layer = google.maps.MapTypeId[VMM.master_config.Timeline.maptype.toUpperCase()]; |
|
|
|
|
} else { |
|
|
|
|
layer = VMM.master_config.Timeline.maptype; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
layer = "toner"; |
|
|
|
|
} |
|
|
|
@ -374,50 +393,45 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var unique_map_id = m.id.toString() + "_gmap"; |
|
|
|
|
|
|
|
|
|
VMM.attachElement("#" + m.id, "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'></div>"); |
|
|
|
|
|
|
|
|
|
var map = new google.maps.Map(document.getElementById(unique_map_id), map_options); |
|
|
|
|
map.mapTypes.set(layer, new google.maps.VeriteMapType(layer)); |
|
|
|
|
|
|
|
|
|
/* ATTRIBUTION |
|
|
|
|
================================================== */ |
|
|
|
|
if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
map.mapTypes.set(layer, new google.maps.VeriteMapType(layer)); |
|
|
|
|
// ATTRIBUTION
|
|
|
|
|
var map_attribution_html = "<div class='map-attribution'><div class='attribution-text'>" + map_attribution + "</div></div>"; |
|
|
|
|
VMM.appendElement("#"+unique_map_id, map_attribution_html); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
loadKML(); |
|
|
|
|
|
|
|
|
|
/* KML |
|
|
|
|
================================================== */ |
|
|
|
|
// KML
|
|
|
|
|
function loadKML() { |
|
|
|
|
var kml_url = m.url + "&output=kml"; |
|
|
|
|
kml_url = kml_url.replace("&output=embed", ""); |
|
|
|
|
|
|
|
|
|
var kml_layer = new google.maps.KmlLayer(kml_url, {preserveViewport:true}); |
|
|
|
|
kml_layer.setMap(map); |
|
|
|
|
|
|
|
|
|
var infowindow = new google.maps.InfoWindow(); |
|
|
|
|
kml_layer.setMap(map); |
|
|
|
|
|
|
|
|
|
google.maps.event.addListenerOnce(kml_layer, "defaultviewport_changed", function() { |
|
|
|
|
|
|
|
|
|
map.fitBounds(kml_layer.getDefaultViewport() ); |
|
|
|
|
|
|
|
|
|
if (has_location) { |
|
|
|
|
map.panTo(location); |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (has_zoom) { |
|
|
|
|
map.setZoom(zoom); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
google.maps.event.addListener(kml_layer, 'click', function(kmlEvent) { |
|
|
|
|
var text = kmlEvent.featureData.description; |
|
|
|
|
trace(kmlEvent.featureData.infoWindowHtml) |
|
|
|
|
showInfoWindow(text); |
|
|
|
|
|
|
|
|
|
function showInfoWindow(c) { |
|
|
|
|
//trace("showInfoWindow")
|
|
|
|
|
infowindow.setContent(c); |
|
|
|
|
infowindow.open(map); |
|
|
|
|
} |
|
|
|
|