1
0
Fork 0
fgdata/Nasal/canvas/map/OpenAIP.lcontroller
2017-10-02 20:25:11 +01:00

47 lines
1.3 KiB
Text

# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'OpenAIP';
var parents = [OverlayLayer.Controller];
var __self__ = caller(0)[0];
OverlayLayer.Controller.add(name, __self__);
TileLayer.add(name, {
parents: [TileLayer],
type: name, # Layer type
df_controller: __self__, # controller to use by default -- this one
});
var new = func(layer) {
var m = {
parents: [__self__],
layer: layer,
map: layer.map,
listeners: [],
};
# http://1.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/6/30/43.png
if (rand() < 0.5) {
layer.makeURL = string.compileTemplate('http://1.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{tms_y}.png');
} else {
layer.makeURL = string.compileTemplate('http://2.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{tms_y}.png');
}
layer.makePath = string.compileTemplate(layer.maps_base ~ '/openaip_basemap/{z}/{x}/{tms_y}.png');
layer.max_zoom = 14;
layer.min_zoom = 4;
m.addVisibilityListener();
m.addRangeListener();
m.addScreenRangeListener();
return m;
};
var updateLayer = func() {
}
var del = func() {
#print(name~".lcontroller.del()");
foreach (var l; me.listeners)
removelistener(l);
};