Other Apps


JMRI provides powerful tools for working with your layout.

Layout Automation

Donate to JMRI

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:


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: For a particular "SensorIcon" at some spot on the screen, PanelPro associates a different picture with each of these states. When the state changes, the correct picture is placed on the screen.

So the basic problem is getting the correct pictures to put on the screen.

Step-by-Step Instructions

  1. Draw the basic background 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.
  2. Take your favorite paint program and cut out the little pieces of the image that correspond to blocks. If you've got multiple blocks of the exact same shape and size, you don't have to make separate copies of them.
  3. 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)
  4. Now create the panel using these images, as described in the tutorials.
For turnouts, the situation is a little more complicated. Most people want to represent both the occupancy and the position of the turnout. We need a couple more steps to do that.
  1. Create sensor images for the trackwork as described above.
  2. 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.
  3. 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.
  4. 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).
  5. 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" attributes that are set to 7 and 10 respectively. (Higher numbers are more toward the "front", and hide things with "lower" values.) Just swap those values, and save the file.
Since you cut the little images from your track diagram, it should all go back together seamlessly on the screen.

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.