/// <summary> /// Scan the current orRouteConfig and search for items related to the given node /// </summary> /// <param name="iNode">The current node index</param> /// <param name="orRouteConfig">The Open Rail configuration coming from Editor</param> /// <param name="trackNodes">The list of MSTS Track Nodes</param> /// <param name="tsectiondat">The list of MSTS Section datas</param> public List <TrackCircuitElement> GetORItemForNode(int iNode, TrackNode[] trackNodes, TrackSectionsFile tsectiondat) { List <TrackCircuitElement> trackCircuitElements = new List <TrackCircuitElement>(); if (AllItems.Count <= 0) { return(trackCircuitElements); } foreach (var item in AllItems) { switch (item.typeItem) { case (int)TypeItem.STATION_CONNECTOR: if (item.associateNodeIdx != iNode) { continue; } TrackNode node = trackNodes[iNode]; AETraveller travel = new AETraveller(traveller); travel.place(node); float position = travel.DistanceTo(item); TrackCircuitElement element = (TrackCircuitElement) new TrackCircuitElementConnector(item, position); trackCircuitElements.Add(element); break; default: break; } } return(trackCircuitElements); }
protected List <KeyValuePair <int, int> > distributeTrItem(TrackNode node) { List <KeyValuePair <int, int> > TrItemBySectionId = new List <KeyValuePair <int, int> >(); if (node != null && node.TrVectorNode != null && node.TrVectorNode.TrItemRefs != null) { AETraveller travel = new AETraveller(traveller); travel.place(node); for (int cnt = 0; cnt < node.TrVectorNode.TrItemRefs.Length; cnt++) { var item = TDB.TrackDB.TrItemTable[node.TrVectorNode.TrItemRefs[cnt]]; travel.MoveTo(item); int idxSection = travel.TrackVectorSectionIndex; TrItemBySectionId.Add(new KeyValuePair <int, int>(idxSection, node.TrVectorNode.TrItemRefs[cnt])); } } return(TrItemBySectionId); }
public void StartSearchPath(TrackPDP startPoint) { searchTraveller = new AETraveller(this.traveller); searchTraveller.place((int)startPoint.TileX, (int)startPoint.TileZ, startPoint.X, startPoint.Z); }