1
0
Fork 0
fgdata/Nasal/canvas/map/OpenAIP.lcontroller

48 lines
1.3 KiB
Text
Raw Normal View History

# 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
2017-10-02 19:25:11 +00:00
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');
2017-10-02 19:25:11 +00:00
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);
};