There could be an easier solution for this all, which I have myself been toying with for some time already ... and that would be trying to adapt this to SH4:
http://www.subsim.com/radioroom/showthread.php?t=159677
Should be easy

but I´m too busy to try it now
The idea itself is brilliant ... using the same spacing between lines as the map scale bar, the separation will always be that size, on any bearing from your sub