Monday 3 July 2017

TrafficControl: Adding Tracks to QML Map

The next step is to add tracks to the QML map as a MapPolyLine.

As before, a KML file in Google Earth is parsed to an input file:

When scanning the input file, a typical track will look like this:

The function TrafficControl::importPredefinedNetwork() will catch the track info and call TrafficControl::addTrackToNetwork(name, length, coordinates):

After the trafficControl item is added, the QML method for creating tracks is called.

The JS function in the QML file calls a function in the separate JS source file (TODO: try to avoid this step.


The jsCreateQMLTrack creates a polyLine with two coordinates only. I am trying to make it create a polyLinr with an arbitary number of coordinates.


The final result is a map with lines between the stations.

The next step will be to make the colour and width of the tracks reflect the state of the track.
  • Width will reflect number of trains on the segment. Width will be number of trains + 1.
  • Color will reflect the state of the track:
    • Green means available with no trains on the track
    • Yellow means that there are trains on the track, but more trains may enter
    • Red means that no trains may enter (Busy or Emergency stop)
    • Grey means signal error. Only trains movements in primary direction, and with reduced speed.

No comments:

Post a Comment