That KML file is essentially a XML file and contains stations and tracks as placemarks:
The coordinates for Lund_C are highlighted. |
The coordinates for Stångby are highlighted |
The tracks are represented as an array of coordinates:
The coordinate for the track from Lund C to Stångby |
The track is shown below.
The track dLunStaN leaves from Lund_C and arrices at Stangby. |
I created a script that mapped the start and end of each track to the closest station. In this case, Lund C and Stånby were connected to LunStaN.
For this example, the script created three eight lines of code that will be used in TrafficControl:
ADD STATION Lund_C
ADD STATION Stångby
ADD TRACK dLun-StaN 5159
ADD TRACK dLun-StaS 5159
CONNECT TRACK dLun-StaN FROM Lund_C TO Stångby WITH PRIORITY
CONNECT TRACK dLun-StaN FROM Stångby TO Lund_C
CONNECT TRACK dLun-StaN FROM Stångby TO Lund_C
CONNECT TRACK dLun-StaS FROM Stångby TO Lund_C WITH PRIORITY
CONNECT TRACK dLun-StaN FROM Stångby TO Lund_C
CONNECT TRACK dLun-StaS FROM Stångby TO Lund_C WITH PRIORITY
The "WITH PRIORITY" tag indicates that the track will have the prioritized direction from Lund_C to Stångby.
The naming convention of the tracks is for example: dCph-JHylWW
- d indicates that the track is a double track (create a corresponding track in the eastbound direction).
- Cph indicates the first station is a station.
- JHylW is the name of the end junction. J indicates junction and W indicates the location related to Hyllie.
- W is the direction of the track.
I'll discuss the algorithm in detail in a future blog post.
You could also take a look at the qt Map Viewer example (http://doc.qt.io/qt-5/qtlocation-mapviewer-example.html). It's great that you have the code in Github, thanks for that.
ReplyDeleteThanks and thanks for the contribution! I'll study the documentation for qt Map Viewer and check how that I can use it for the project!
ReplyDelete