Multiple Rocviews

ContentRocviewGeneral



Activate multiple Rocviews for a better overview.


Windows

In Rocrail larger layouts or single modules can be arranged on different layers to gain a better overview. Doing so, however, it is necessary to switch between the layers frequently in order to see what is happening on a particular part of the layout. Rocrail's client/server architecture in addition allows a more sophisticated procedure: Multiple instances of Rocview - all connected to the same server - are started, each showing a different part of the layout or user interface. This chapter explains how to set up multiple instances of Rocview step-by-step.

In this example it is shown how the following four freely arrangeable windows are configured:

  • Window 1: Locomotive table
  • Window 2: Modul 1 (Buchrain)
  • Window 3: Modul 2 (Grabtief)
  • Window 4: Switch panel (miscellaneous outputs to switch light, etc.)

Only one computer is used in this example but because of Rocrail's architecture it is easily possible to realise a similar approach with more computers, e.g. showing each module on a different (client-) computer.

Step 1: Creating the ini files

Because each window gets a different layout each window requires its own .ini-file. For this reason the existing rocview.ini is copied four times into the working directory of Rocview and renamed accordingly. In the above example the result is:

  • rocview_locos.ini
  • rocview_buchrain.ini
  • rocview_grabtief.ini
  • rocview_panel.ini

:!: Make sure the Tracing is disabled in every single rocview_*.ini.

Step 2: Setting up the windows

In this step the copied .ini-files are customised to the particular demands. To do this a command line window (DOS-Box or terminal) is opened and Rocview is started using the particular ini-file:

rocview -i rocview_locos.ini

The opened window is customized by dragging the window elements according to your needs. In the following screen-shot only the locomotive table is shown for example:

The window showing the switch pane looks like this:

After closing Rocview the window properties are saved in the respective ini-file which can be easily checked by opening the window again using the same command. To display single layers these are in a first step activated manually and the window is arranged in order to show the basic elements of the layer.

Step 3: Linking levels and windows

After finishing the work of the last step it is noticeable Rocrail always opens the first layer of a track-plan. However, this behaviour can be influenced by the parameter s during program start.

rocview -s 2 -i rocview_panel.ini

With paramter s it is possible to choose the layer to be activated in the window. The argument is the index of the layer which can be seen from the order of the displayed layers. In the example of this manual the layers are shown in the following order:

  • Buchrain –> Index 0
  • Grabtief –> Index 1
  • Panel –> Index 2

Step 4: Creating a startup script for the big view

Server is already running

The server rocrail.exe in this case must already running before starting the Rocview instances on the same or other hardware.
To avoid further starts of instances in all special rocview.ini files the option startdefaultworkspace=“false” must be set.

Note: For the case, the start of server should be done with the start of the first Rocview instance, see Server in workspace.

It is possible to create shortcuts for each call of Rocrail, however, a more elegant approach is to use a small script (see following examples for Windows and Linux):

Windows:
start rocview -i rocview_locos.ini
start rocview -s 2 -i rocview_panel.ini
start rocview -s 0 -i rocview_buchrain.ini
start rocview -s 1 -i rocview_grabtief.ini

If this script is called Rocview is started four times, each window with the corresponding content.
If you get error messages about problems with the “clipboard” while starting the Rocview instances just insert

ping -n 2 127.0.0.1 >NUL

between each call. This will add a delay of 1-2 seconds and the Rocview instances will start smoothly.

Linux:
#!/bin/bash

rocview -i rocview_locos.ini &
rocview -s 2 -i rocview_panel.ini &
rocview -s 0 -i rocview_buchrain.ini &
rocview -s 1 -i rocview_grabtief.ini

The notices to insert delays into the Windows start script apply equally well under Linux.

Server in workspace

For the case, the start of server should be done with start of the first Rocview instance1), the option startdefaultworkspace=“true” should only be set in the special rocview.ini files for the first Rocview instance.
In all other special rocview.ini files should be set the option startdefaultworkspace=“false”.
In the startup script above between the first Rocview instance and the start of all other instances should be inserted a delay, that give the server a time of 5-6 sec to start.

ping -n 6 127.0.0.1 >NUL

If this works, shorter time can be tried.
With slowly hardware and / or big layouts the time may have to be extended.

Step 5: Fine tuning the windows positions

As a last step the arrangement of the windows is remaining. In order to do this the windows are simply dragged to their desired positions. If the windows are closed after the fine tuning their respective positions are saved and the arrangement is restored after the next start:


Mac OS X

The script under Mac OS X could look like this:

#!/bin/ah
export DYLD_LIBRARY_PATH=./Rocrail.app/Contents/MacOS
./Rocrail.app/Contents/MacOS/rocview -i rocview1.ini&
./Rocrail.app/Contents/MacOS/rocview -i rocview2.ini&


How to realise 2 Rocview windows on Mac OS-X with 1 Rocrail Server

Trigger:

  1. The railplan contains more then one level, or is so big that is doesn’t fit well in one window
  2. Switching to the modular lay-out concept is not an option
  3. The usage of 2 computer screens is desirable

Step 1: Get understanding of the Rocrail architecture

For this particularly tpoic the architecture looks as follow:

Important:

  1. The two Rocview.ini files need to be in de Rocrail/Rocdata map
  2. The railplan is in a separated map (to avoid deletion with an update)
  3. The shell program Start Rocview.sh is in the Rocrail/Rocdata map

Step 2: Create one Railplan in Rocrail first with 2 Tabviews

Remark: At the beginning I was on the wrong approach by creating 2 separated rail plans in separated workspaces. This should not be done. Create one railplan in one workspace with 2 tabviews.

Later on both Rocview windows has to communicate to the same rail plan in the Rocrail server.

Step 3: Create first Rocview.ini

Create the first Rocview.ini which to initate the first window, in this situation it is called: Rocview_-1.ini

Be sure that it contains the path to the correct rail plan:

<workspace path="/Users/<your name>/Documents/De Rangeerbaan" title="De Rangeerbaan Plan"/>
</workspaces>

Remark: /<your name>/ contains the name of your Apple computer ID, mostly your logon name.

Step 4: Create the second Rocview.ini

Create the second Rocview.ini which to initate the second window, in this situation it is called: Rocview_0.ini

Be sure that it contains the path to the correct rail plan:

<workspace path="/Users/<your name>/Documents/De Rangeerbaan" title="De Rangeerbaan Plan"/>
</workspaces>

Remark: /<your name>/ contains the name of your Apple computer ID, mostly your logon name.

Step 5: Create the Shell program

The content of the shell program determines if the script will work, be sure to test the script untill it works! In this example the script has the following content:


#!/bin/sh
export DYLD_LIBRARY_PATH=/Applications/Rocrail/Rocrail.app/Contents/MacOS

/Applications/Rocrail/Rocrail.app/Contents/MacOS/rocrail&

ping -c 2 127.0.0.1 >NUL

/Applications/Rocrail/Rocrail.app/Contents/MacOS/rocview -i /Applications/Rocrail/rocdata/rocview_0.ini&

ping -c 2 127.0.0.1 >NUL

/Applications/Rocrail/Rocrail.app/Contents/MacOS/rocview -i /Applications/Rocrail/rocdata/rocview_-1.ini&

Remark: with the ping command we give the computer some time to start the Rocrail server and the 2 Rocview screens in a sequential order, this may look slow, but without the timing it doesn’t work well.

Save the Shell program script with a recognisable name like: Start dual Rocview.sh

Step 6: execute the shell program script

After double click the script it starts executing. You may get errors due to the fact that the path's in the script are not correct.

This can only be fixed by getting exaclty the correct paths in the script…and some patience…

Then after a few seconds the two Rocview windows will be opened, like:

Remark:

It may be the case that you have to select manually (tab view) in the Rocview window which Rail plan you want to see in which window. I wasn’t able to get that automated too.

Step 7: Create a shortcut form the Shell program to be placed in the Dock

Create a shortcut of the Shell program which enable you to put that in the Dock.

1. Start the Automator

2. Select in the Automator Library: execute Shellscript

3. Drag the Library script to the right panel

4. Empty the existing content in the script

5. Open in the Start Rocview.sh script (with Terminal)

6. Select the content in the script en copy

7. Past the content in the Automator empthy windown in the right panel

8. Test your Automator script with ‘push’ the execute button in the right uppercorner

9. If it correct works, save your automator script with a valid name

10. Drag the Automator script in the Dock

11. Click on the Automator icon and Rocrail will start with 2 Rocview windows.

12. Ready

1) Start in the defined workspace on the same hardware

Personal Tools