/// <summary> /// Make sure the junction nodes of have the exact location of the junctions in the track database. /// This is to make sure changes in the track database are taken over in the path /// </summary> void SnapAllJunctionNodes() { TrainpathNode mainNode = CurrentTrainPath.FirstNode; while (mainNode != null) { //siding path. For this routine we do not care if junctions are done twice TrainpathNode sidingNode = mainNode.NextSidingNode; while (sidingNode != null) { TrainpathJunctionNode sidingNodeAsJunction = sidingNode as TrainpathJunctionNode; if ((sidingNodeAsJunction != null) && !sidingNode.IsBroken) { sidingNode.Location = DrawTrackDB.UidLocation(trackDB.TrackNodes[sidingNodeAsJunction.JunctionIndex].UiD); } sidingNode = sidingNode.NextSidingNode; } TrainpathJunctionNode mainNodeAsJunction = mainNode as TrainpathJunctionNode; if ((mainNodeAsJunction != null) && !mainNode.IsBroken) { mainNode.Location = DrawTrackDB.UidLocation(trackDB.TrackNodes[mainNodeAsJunction.JunctionIndex].UiD); } mainNode = mainNode.NextMainNode; } }
/// <summary> /// Set the location from the tracknode database. /// </summary> public void SetLocationFromTrackNode() { Location = DrawTrackDB.UidLocation(TrackDB.TrackNodes[JunctionIndex].UiD); }