This commit is contained in:
Thomas Rudin 2019-01-29 21:07:29 +01:00
parent a1e74bd190
commit 5f8887e8b6
5 changed files with 44 additions and 1 deletions

View File

@ -13,6 +13,8 @@
<script src="js/lib/leaflet.js"></script>
<script src="js/lib/mithril.min.js"></script>
<script src="js/api.js"></script>
<script src="js/LayerManager.js"></script>
<script src="js/WebSocketChannel.js"></script>
<script src="js/RealtimeTileLayer.js"></script>
<script src="js/CoordinatesDisplay.js"></script>

View File

@ -0,0 +1,11 @@
var LayerManager = (function(){
return {
init: function(layers){
}
};
}());

16
server/static/js/api.js Normal file
View File

@ -0,0 +1,16 @@
var api = {
getMapObjects: function(x1,y1,z1,x2,y2,z2,type){
return m.request("/api/mapobjects/" +
x1 + "/" + y1 + "/" + z1 + "/" +
x2 + "/" + y2 + "/" + z2 + "/" +
type
);
},
getConfig: function(){
return m.request("/api/config");
}
};

View File

@ -2,6 +2,11 @@
(function(){
'use strict';
api.getConfig().then(function(cfg){
LayerManager.init(cfg.layers);
});
var crs = L.Util.extend({}, L.CRS.Simple, {
//transformation: L.transformation(0.001, 0, -0.001, 0),
scale: function (zoom) {

View File

@ -11,7 +11,16 @@ var TravelnetOverlay = (function(){
return L.LayerGroup.extend({
onAdd: function(map) {
console.log("TravelnetOverlay.onAdd");
console.log("TravelnetOverlay.onAdd", map);
map.on('baselayerchange', function (e) {
console.log("baselayerchange", e.layer);
});
api.getMapObjects(-10,-10,-10,10,10,10,"travelnet")
.then(function(list){
console.log(list);
})
},
onRemove: function(map) {