Skip to content
Permalink
Browse files

Include the map renderer html file automatically in the output directory

  • Loading branch information...
ferrybig committed Mar 13, 2019
1 parent 901fece commit 710a1298635fd43384b3264c96f2371c6f676b8e

This file was deleted.

Oops, something went wrong.
@@ -17,6 +17,7 @@
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -112,7 +113,12 @@ public void finishRender() throws IOException {

@Override
public void startRender() throws IOException {
Files.createDirectories(outputDir);
Files.createDirectories(this.outputDir);
Files.copy(
this.getClass().getResourceAsStream("ComplexImageOutputRenderer.html"),
this.outputDir.resolve("index.html"),
StandardCopyOption.REPLACE_EXISTING
);
}

@Override
@@ -0,0 +1,61 @@
<!doctype html>
<title>Map renderer of a Minecraft world</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js" integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" crossorigin=""></script>
<style>
html, body {
height: 100%;
margin: 0;
}
#map {
width: 100%;
height: 100%;
}
</style>
<div id='map'></div>
<script>
var map = (function() {
var defaultZoomLevel = 10;
var factorx = Math.pow(2, -defaultZoomLevel);
var factory = Math.pow(2, -defaultZoomLevel);
L.CRS.Minecraft = L.extend({}, L.CRS.Simple, {
projection: L.Projection.LonLat,
transformation: new L.Transformation(factorx, 0, -factory, 0),
// Scale, zoom and distance are entirely unchanged from CRS.Simple
scale: function (zoom) {
return Math.pow(2, zoom);
},
zoom: function (scale) {
return Math.log(scale) / Math.LN2;
},
distance: function (latlng1, latlng2) {
var dx = latlng2.lng - latlng1.lng;
var dy = latlng2.lat - latlng1.lat;
return Math.sqrt(dx * dx + dy * dy);
},
infinite: true
});
var map = L.map('map', {
crs: L.CRS.Minecraft,
center: [0, 0],
zoom: 10,
maxZoom: 15,
});
L.tileLayer('complex-tiles/DIM0/{z}/{x}_{y}.gif', {
tileSize: 512,
maxZoom: 15,
maxNativeZoom: L.Browser.retina ? 13 : 14,
}).addTo(map);
L.control.scale().addTo(map);
return map;
})();
</script>

0 comments on commit 710a129

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.