JMRI: Displaying Colored Trackwork
People who model modern railroad might want a control panel that shows a "schematic" view of the railroad, with individual segments changing color to show where trains are occupying the track. PanelPro can do this for your panels. There are two basic approaches:- Use the new "Layout Editor" to create your panel. It allows you to draw track segments and place turnouts on the screen, then configure them so they change color with occupancy.
- If using the original "Panel Editor", you can also configure sensor icons to change the color of your track. This technique is described on this page.
Background
PanelPro detects the status of things on the layout, including whether a track is occupied, using "Sensors". Depending on what hardware (DCC system, etc) you have on your layout, these might be different devices, but as far as the program cares they all basically work the same: The tell the program that the block detector is in one of four states:- INACTIVE - The segment of track is empty
- ACTIVE - The segment of track contains all or part of a train
- UNKNOWN - The program does not currently know the status of this Sensor, typically because the program has just started up and hasn't seen a message from it yet
- INCONSISTENT - Some error has happened, and rather than giving you a value that might be wrong, we're just saying that we're confused
So the basic problem is getting the correct pictures to put on the screen.
Step-by-Step Instructions
-
Draw the basic bacground for your panel, including the trackwork. Get the
colors, positions, etc right, because going back to it later will require redoing
a couple of steps.
-
Take your favorite paint program and cut out the little pieces of the image that
correspond to blocks. If you've got mutiple blocks of the exact same
shape and size, you don't have to make separate copies of them.
-
You'll use those to make colored images to show occupancy. For example, if
you want to have yellow indicate occupied track, white indicate unoccupied
track, and red indicate errors, you need to copy those new images and create versions
with the appropriate colors. (Note: Make sure to keep a copy of the original
little image for any track segments that contains a turnout)
- Now create the panel using these images, as described in the tutorials.
-
Create sensor images for the trackwork as described above.
-
Now, we create images that will modify those to show the turnout
position. We want to create images that are transparent where
the trackwork is, except for a little more background color to
represent the position of the turnout.
Here the gray color represents transparent parts of the image; if we put it over one of the sensor images, the sensor's track color will shine through. - Now create the panel using these images, as described in the tutorials. The normal operation (which we'll change below) is to have sensors in front of turnouts on the screen. That means it'll be easier if you add and position the turnout icons first, then the sensor icons.
- To move the sensor icons behind the turnout icons, you have to edit the panel file and change their "level". Open your file in a text editor (Not Microsoft Word, which will try to interpret the XML and do amazingly stupid things).
-
Find the lines for your sensor and turnout by looking for the name of the
sensor and turnout, e.g. LS33 and LT120. You find two lines (which may be
separated, depending on how you created the panel) that look like this:
<turnouticon turnout="LT120" x="20" y="30" level="7" closed="resources/icons/smallschematics/tracksegments/os-righthand-west-closed.gif" thrown="resources/icons/smallschematics/tracksegments/os-righthand-west-thrown.gif" unknown="resources/icons/smallschematics/tracksegments/os-righthand-west-unknown.gif" inconsistent="resources/icons/smallschematics/tracksegments/os-righthand-west-error.gif" rotate="0" forcecontroloff="false" class="jmri.jmrit.display.configurexml.TurnoutIconXml" /> <sensoricon sensor="LS33" x="20" y="30" level="10" active="resources/icons/smallschematics/tracksegments/circuit-occupied.gif" inactive="resources/icons/smallschematics/tracksegments/circuit-empty.gif" unknown="resources/icons/smallschematics/tracksegments/circuit-error.gif" inconsistent="resources/icons/smallschematics/tracksegments/circuit-error.gif" rotate="0" forcecontroloff="false" momentary="false" class="jmri.jmrit.display.configurexml.SensorIconXml" />Note the "level" attribures that are set to 7 aand 10 respectively. (Higher numbers are more toward the "front", and hide things with "lower" values.) Just swap those values, and save the file.
Now that panel should show icons for the occupancy sensor and turnout that work independently to show both the position (by following the line) and the occupancy (through the color) of that turnout.