1
0
Fork 0

Add STAMEN layer. Patch by Slawek MIKULA.

This commit is contained in:
Stuart Buchanan 2017-10-02 20:34:31 +01:00
parent 1d85d3dedf
commit e38ec03c60
3 changed files with 59 additions and 2 deletions

View file

@ -83,7 +83,7 @@ var MapStructure_selfTest = func() {
TestMap.addLayer(factory: canvas.SymbolLayer, type_arg: type.name,
visible: type.vis, priority: type.zindex,
);
foreach(var type; [ r('OSM'), r('OpenAIP') ]) {
foreach(var type; [ r('OSM'), r('OpenAIP'), r('STAMEN') ]) {
TestMap.addLayer(factory: canvas.OverlayLayer, type_arg: type.name,
visible: type.vis, priority: type.zindex,
style: Styles.get(type.name),

View file

@ -0,0 +1,43 @@
# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'STAMEN';
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: [],
};
layer.makeURL = string.compileTemplate('http://b.tile.stamen.com/terrain/{z}/{x}/{y}.png');
layer.makePath = string.compileTemplate(layer.maps_base ~ '/stamen-terrain/{z}/{x}/{y}.png');
#layer.makeURL = string.compileTemplate('http://b.tile.stamen.com/terrain-background/{z}/{x}/{y}.png');
#layer.makePath = string.compileTemplate(layer.maps_base ~ '/stamen-terrain-background/{z}/{x}/{y}.png');
#layer.makeURL = string.compileTemplate('http://b.tile.stamen.com/toner/{z}/{x}/{y}.png');
#layer.makePath = string.compileTemplate(layer.maps_base ~ '/stamen-toner/{z}/{x}/{y}.png');
m.addVisibilityListener();
m.addRangeListener();
m.addScreenRangeListener();
return m;
};
var updateLayer = func() {
}
var del = func() {
foreach (var l; me.listeners)
removelistener(l);
};

View file

@ -296,6 +296,20 @@
</binding>
</checkbox>
<checkbox>
<label>STAMEN</label>
<halign>left</halign>
<property>/sim/gui/dialogs/map-canvas/draw-STAMEN</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
<!-- layer only supported if tutorial system is active and targets specified-->
<!--
@ -547,7 +561,7 @@
})();
}
foreach(var type; [ r('OSM'), r('VFRChart'), r('OpenAIP') ]) {
foreach(var type; [ r('OSM'), r('VFRChart'), r('OpenAIP'), r('STAMEN') ]) {
TestMap.addLayer(factory: canvas.OverlayLayer, type_arg: type.name,
visible: 0, priority: 1,
style: Styles.get(type.name),