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
<!doctype html> | |
<html lang="fr"> | |
<head> | |
<meta charset="UTF-8"> | |
<link rel="stylesheet" href="styles/styles.css"> | |
<title>Polyline on Gmap</title> | |
</head> | |
<body> | |
<h1>Créez votre tracé!</h1> | |
<div class="map"> |
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
#reset{ | |
display: inline-block; | |
position: absolute; | |
right: 10px; | |
background-color: silver; | |
z-index: 10; | |
padding: 0.4em; | |
margin-right: 0.5em; | |
font-size: 1.3em; | |
} |
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 NUMBER_DOT_TWONUMBERS, SAMPLES, alert, calc_bounds, chart, display_on_map, draw_path, elevation_req_active, elevation_service, elevations, gm_init, gm_service, path, plot_elevation, poly_init; | |
NUMBER_DOT_TWONUMBERS = /^(\d+.)(\d{0,2})(\d+)/; | |
poly = 1; | |
chart = 1; | |
elevations = 1; |
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
gm_init = function() { | |
var gm_center, gm_map_type, map_options; | |
gm_center = new google.maps.LatLng(50.633333, 5.566667); | |
gm_map_type = google.maps.MapTypeId.ROADMAP; | |
map_options = { | |
zoom: 14, | |
center: gm_center, | |
panControl: false, | |
backgroundColor: "rgba(0,0,0,0)", | |
mapTypeControl: false, |
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
poly_init = function(map) { | |
var poly_options; | |
poly_options = { | |
draggable: true, | |
editable: true, | |
geodesic: true, | |
map: map, | |
strokeColor: 'rgba(0,0,0,0.6)' | |
}; | |
return new google.maps.Polyline(poly_options); |
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
draw_path = function(path) { | |
var pathRequest; | |
if (elevation_req_active || !path) { | |
r eturn; | |
} | |
pathRequest = { | |
path: path, | |
samples: SAMPLES | |
}; | |
elevation_req_active = true; |
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
plot_elevation = function(results, status) { | |
var data, i; | |
elevation_req_active = false; | |
if (status !== google.maps.ElevationStatus.OK) { | |
return; | |
} | |
elevations = results; | |
data = new google.visualization.DataTable(); | |
data.addColumn('string', 'Sample'); | |
data.addColumn('number', 'Elevation'); |
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
grow_path = function(origin, destination) { | |
return gm_service.route({ | |
origin: origin, | |
destination: destination, | |
travelMode: google.maps.DirectionsTravelMode.WALKING | |
}, function(result, status) { | |
var coords, i, _ref; | |
if (status !== google.maps.DirectionsStatus.OK) { | |
return; | |
} |
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
google.maps.LatLng.prototype.kmTo = function(a) { | |
var b, c, d, e, f, g, ra; | |
e = Math; | |
ra = e.PI / 180; | |
b = this.lat() * ra; | |
c = a.lat() * ra; | |
d = b - c; | |
g = this.lng() * ra - a.lng() * ra; | |
f = 2 * e.asin(e.sqrt(e.pow(e.sin(d / 2), 2) + e.cos(b) * e.cos(c) * e.pow(e.sin(g / 2), 2))); | |
return f * 6378.137; |
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 clear, close, dist, divMap, elevation_chart, grow_path, map, reset; | |
dist = document.getElementById("dist"); | |
reset = document.getElementById("reset"); | |
close = document.getElementById("close"); | |
clear = document.getElementById("clear"); | |
full = document.getElementById("full"); | |
divMap = document.getElementById("map_canvas"); | |
elevation_chart = document.getElementById('elevation_chart'); | |
chart = new google.visualization.ColumnChart(elevation_chart); | |
map = gm_init(); |
OlderNewer