Created
July 30, 2012 00:58
-
-
Save ptn/3203064 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
class MapManager | |
constructor: -> | |
path = @buildPath() | |
map = new GMaps | |
div: "#map" | |
lat: -10 | |
lng: -76 | |
zoom: 6 | |
idle: -> | |
map.refresh() | |
@map = map | |
@map.drawPolyline | |
path: path | |
strokeColor: '#476D00' | |
strokeOpacity: 0.6 | |
strokeWeight: 6 | |
$.each path, (_, coord) => | |
@stopBy(coord) | |
@map.drawOverlay | |
lat: path[0][0] | |
lng: path[0][1] | |
content: '<div class="map-overlay">Inicio</div>' | |
verticalAlign: 'bottom' | |
horizontalAlign: 'center' | |
stopBy: (coord) -> | |
@map.addMarker | |
lat: coord[0] | |
lng: coord[1] | |
title: coord[2] | |
infoWindow: | |
content: "<p><b>" + coord[2] + "</b></p><p>" + coord[3] + "</p>" | |
buildPath: -> | |
path = [] | |
$("img[data-lat]").each (idx, _)-> | |
path.push [ | |
$(this).data('lat'), | |
$(this).data('lng'), | |
$(this).data('name'), | |
$(this).data('descr'), | |
idx + 1 | |
] | |
path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment