go-go gadget drone

This commit is contained in:
2018-08-01 19:23:42 -06:00
parent b28ba54d4c
commit d8bbfda775
7 changed files with 17 additions and 575 deletions

64
web.go Normal file
View File

@@ -0,0 +1,64 @@
package main
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
w.Header().Set("Location", "/")
w.WriteHeader(http.StatusMovedPermanently)
return
}
fmt.Fprintf(w, `<!DOCTYPE html>
<html>
<head>
<title>MandelMapper</title>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAZItO5CjoqDfPLwH_FZ4KcvQFt_L5dQBw"></script>
<script>
var mandelbrotTypeOptions = {
getTileUrl: function(coord, zoom) {
return '/mandelbrot/' + zoom + '/' + coord.x + '/' + coord.y + '.png';
},
tileSize: new google.maps.Size(256, 256),
maxZoom: (1<<16) - 1,
minZoom: 0,
name: 'Mandelbrot'
};
var mandelbrotMapType = new google.maps.ImageMapType(mandelbrotTypeOptions);
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 1,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: ['mandelbrot']
}
};
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
map.mapTypes.set('mandelbrot', mandelbrotMapType);
map.setMapTypeId('mandelbrot');
}
</script>
<style>
#map_canvas {
position: absolute !important;
left: 0 !important;
right: 0 !important;
top: 0 !important;
bottom: 0 !important;
}
</style>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>`)
})
}