Add STAMEN layer. Patch by Slawek MIKULA.
This commit is contained in:
parent
1d85d3dedf
commit
e38ec03c60
3 changed files with 59 additions and 2 deletions
|
@ -83,7 +83,7 @@ var MapStructure_selfTest = func() {
|
||||||
TestMap.addLayer(factory: canvas.SymbolLayer, type_arg: type.name,
|
TestMap.addLayer(factory: canvas.SymbolLayer, type_arg: type.name,
|
||||||
visible: type.vis, priority: type.zindex,
|
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,
|
TestMap.addLayer(factory: canvas.OverlayLayer, type_arg: type.name,
|
||||||
visible: type.vis, priority: type.zindex,
|
visible: type.vis, priority: type.zindex,
|
||||||
style: Styles.get(type.name),
|
style: Styles.get(type.name),
|
||||||
|
|
43
Nasal/canvas/map/STAMEN.lcontroller
Normal file
43
Nasal/canvas/map/STAMEN.lcontroller
Normal 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);
|
||||||
|
};
|
|
@ -296,6 +296,20 @@
|
||||||
</binding>
|
</binding>
|
||||||
</checkbox>
|
</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-->
|
<!-- 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,
|
TestMap.addLayer(factory: canvas.OverlayLayer, type_arg: type.name,
|
||||||
visible: 0, priority: 1,
|
visible: 0, priority: 1,
|
||||||
style: Styles.get(type.name),
|
style: Styles.get(type.name),
|
||||||
|
|
Loading…
Reference in a new issue