forked from MTSR/mapserver
working train signals
This commit is contained in:
parent
16a4fff708
commit
5a383eaae1
@ -48,6 +48,8 @@
|
||||
* advtrains_wagon_japan_inv.png
|
||||
* advtrains_wagon_tank_inv.png
|
||||
* advtrains_wagon_wood_inv.png
|
||||
* advtrains_signal_on.png
|
||||
* advtrains_signal_off.png
|
||||
* License: CC BY-SA 3.0
|
||||
* Source [advtrains](http://advtrains.bleipb.de/)
|
||||
|
||||
|
@ -1,4 +1,20 @@
|
||||
|
||||
var IconOn = L.icon({
|
||||
iconUrl: "pics/advtrains/advtrains_signal_on.png",
|
||||
iconSize: [16, 16],
|
||||
iconAnchor: [8, 8],
|
||||
popupAnchor: [0, -16]
|
||||
});
|
||||
|
||||
var IconOff = L.icon({
|
||||
iconUrl: "pics/advtrains/advtrains_signal_off.png",
|
||||
iconSize: [16, 16],
|
||||
iconAnchor: [8, 8],
|
||||
popupAnchor: [0, -16]
|
||||
});
|
||||
|
||||
|
||||
|
||||
export default L.LayerGroup.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
L.LayerGroup.prototype.initialize.call(this);
|
||||
@ -20,7 +36,9 @@ export default L.LayerGroup.extend({
|
||||
|
||||
createPopup: function(signal){
|
||||
var html = "<b>Signal</b><hr>";
|
||||
html += "<b>State:</b> " + signal.green + "<br>";
|
||||
html += "<b>State:</b> " +
|
||||
(signal.green ? "Green" : "Red") +
|
||||
"<br>";
|
||||
|
||||
return html;
|
||||
},
|
||||
@ -35,14 +53,7 @@ export default L.LayerGroup.extend({
|
||||
|
||||
createMarker: function(signal){
|
||||
|
||||
var Icon = L.icon({
|
||||
iconUrl: "TODO",
|
||||
|
||||
iconSize: [16, 16],
|
||||
iconAnchor: [8, 8],
|
||||
popupAnchor: [0, -16]
|
||||
});
|
||||
|
||||
var Icon = signal.green ? IconOn : IconOff;
|
||||
var marker = L.marker([signal.pos.z, signal.pos.x], {icon: Icon});
|
||||
marker.bindPopup(this.createPopup(signal));
|
||||
|
||||
@ -84,6 +95,7 @@ export default L.LayerGroup.extend({
|
||||
let marker = this.currentObjects[signalId];
|
||||
marker.setLatLng([signal.pos.z, signal.pos.x]);
|
||||
marker.setPopupContent(this.createPopup(signal));
|
||||
marker.setIcon(signal.green ? IconOn : IconOff);
|
||||
|
||||
} else {
|
||||
//marker does not exist
|
||||
|
BIN
static/pics/advtrains/advtrains_signal_off.png
Executable file
BIN
static/pics/advtrains/advtrains_signal_off.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 856 B |
BIN
static/pics/advtrains/advtrains_signal_on.png
Executable file
BIN
static/pics/advtrains/advtrains_signal_on.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue
Block a user