Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja"> | |||
<head> | |||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |||
<title>GeoDelta</title> | |||
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |||
<script type="text/javascript" src="hex.js"></script> | |||
</head> | |||
<body> | |||
<div id="map_canvas" style="width: 800px; height: 600px;"></div> | |||
</body> | |||
</html> |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,51 @@ | |||
|
|||
$(function() { | |||
var map = new google.maps.Map(document.getElementById("map_canvas"), { | |||
zoom: 10, | |||
center: new google.maps.LatLng(34.68, 135.18), | |||
mapTypeId: google.maps.MapTypeId.ROADMAP | |||
}); | |||
|
|||
var cache = {}; | |||
|
|||
google.maps.event.addListener(map, "bounds_changed", function() { | |||
var bounds = map.getBounds(); | |||
var north_east = bounds.getNorthEast(); | |||
var south_west = bounds.getSouthWest(); | |||
var params = { | |||
north: north_east.lat(), | |||
south: south_west.lat(), | |||
west: south_west.lng(), | |||
east: north_east.lng(), | |||
level: 11 | |||
}; | |||
|
|||
$.get("/api/get_all_deltas", params, function(data) { | |||
var deltas = data.response.deltas; | |||
|
|||
for ( var i = 0, len = deltas.length; i < len; i++ ) | |||
{ | |||
var code = deltas[i].code; | |||
|
|||
if ( !cache[code] ) | |||
{ | |||
var coordinates = deltas[i].coordinates; | |||
var points = [ | |||
new google.maps.LatLng(coordinates[1].lat, coordinates[1].lng), | |||
new google.maps.LatLng(coordinates[2].lat, coordinates[2].lng), | |||
new google.maps.LatLng(coordinates[3].lat, coordinates[3].lng), | |||
new google.maps.LatLng(coordinates[1].lat, coordinates[1].lng) | |||
]; | |||
var path = new google.maps.Polyline({ | |||
map: map, | |||
path: points, | |||
strokeColor: "#FF0000", | |||
strokeOpacity: 0.5, | |||
strokeWeight: 1 | |||
}); | |||
cache[code] = path; | |||
} | |||
} | |||
}); | |||
}); | |||
}); |
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