Beispiel #1
0
        public TrackNode explore(MSTSItems aeItems, List <TrackSegment> listConnector, int entryNode, StationItem parent)
        {
#if false
            Stopwatch stopWatch = new Stopwatch();
            TimeSpan  ts;
            string    elapsedTime;
#endif
            TrackNode currentNode = traveller.GetCurrentNode();
            if ((currentNode.TrJunctionNode == null) && !currentNode.TrEndNode)
            {
                do
                {
                    int          sectionIdx = traveller.TrackVectorSectionIndex;
                    TrackSegment item       = (TrackSegment)aeItems.GetTrackSegment(currentNode, sectionIdx);
                    foreach (TrackSegment conSeg in listConnector)
                    {
                        if (conSeg.associateNodeIdx == entryNode)
                        {
                            continue;
                        }
                        //  Il faut tester que l'on change bien d'index de node pour quitter  mais pas pour le premier et aussi l'idx de la section
                        if (currentNode.Index == conSeg.associateNodeIdx && sectionIdx == conSeg.associateSectionIdx)
                        {
                            setComplete(conSeg);
                            break;
                        }
                    }

                    item.inStationArea = true;
                    ComponentItem.Add(item);
                    ((TrackSegment)item).InStation(parent);

                    foreach (var trItem in item.sidings)
                    {
                        SidesItem.Add(trItem);
                        if (trItem.typeSiding == (int)TypeSiding.SIDING_START)
                        {
                            PathName = trItem.Name;
                            NbrSiding++;
                            if (trItem.sizeSiding > Siding)
                            {
                                Siding = trItem.sizeSiding;
                            }
                        }
                        else if (trItem.typeSiding == (int)TypeSiding.PLATFORM_START)
                        {
                            PathName = trItem.Name;
                            NbrPlatform++;
                            if (trItem.sizeSiding > Platform)
                            {
                                Platform = trItem.sizeSiding;
                            }
                        }
                    }
                    //yard += sideItem.lengthSegment;
#if false
                    ts = stopWatch.Elapsed;

                    // Format and display the TimeSpan value.
                    elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                ts.Hours, ts.Minutes, ts.Seconds,
                                                ts.Milliseconds / 10);
                    elapse.Add(elapsedTime);
#endif
                } while (traveller.NextVectorSection() && !complete);
                if (currentNode.Index != entryNode && !complete && traveller.TrackNodeLength > PassingYard)
                {
                    PassingYard = traveller.TrackNodeLength;
                }
                traveller.NextTrackNode();
            }
            else
            {
                GlobalItem item = aeItems.GetTrackSegment(currentNode, -1);
                item.inStationArea = true;
                ComponentItem.Add(item);
            }
            if (currentNode.TrEndNode)
            {
                complete = true;
            }
            return(currentNode);
        }