Created
September 30, 2014 15:22
-
-
Save tilast/31fde049d9564c51b4ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var markers = [], | |
ticketsStorage = [], | |
nowTicketId; | |
var mapProp = { | |
center: new google.maps.LatLng(50.4459229,30.5214291), | |
zoom: 10, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
var map = new google.maps.Map(document.getElementById("googleMap"),mapProp); | |
// Add a marker to the map and push to the array. | |
function addMarker(location) { | |
var marker = new google.maps.Marker({ | |
position: location, | |
map: map | |
}); | |
markers.push(marker); | |
} | |
// Sets the map on all markers in the array. | |
function setAllMap(map) { | |
for (var i = 0; i < markers.length; i++) { | |
markers[i].setMap(map); | |
} | |
} | |
// Removes the markers from the map, but keeps them in the array. | |
function clearMarkers() { | |
setAllMap(null); | |
} | |
// Shows any markers currently in the array. | |
function showMarkers() { | |
setAllMap(map); | |
} | |
// Deletes all markers in the array by removing references to them. | |
function deleteMarkers() { | |
clearMarkers(); | |
markers = []; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment