Example #1
0
 public override void complete(ORRouteConfig orRouteConfig, List <TrackSegment> segments, MSTSBase tileBase)
 {
     if (stationArea.Count > 0)
     {
         checkForNewConnector(orRouteConfig, segments, tileBase);
         areaCompleted = true;
     }
 }
Example #2
0
        public MSTSDataConfig(string mstsPath, string Route, TypeEditor interfaceType) : base(mstsPath, Route)
        {
            orRouteConfig = new ORRouteConfig();
            string routePath = Path.Combine(Route, TRK.Tr_RouteFile.FileName);

            TileBase = new MSTSBase(TDB);
            TileBase.reduce(TDB);
            orRouteConfig = ORRouteConfig.loadConfig(routePath, interfaceType);
            {
                orRouteConfig.SetRouteName(TRK.Tr_RouteFile.Name);
            }
            //Signals = new Signals(this);
        }
Example #3
0
        public void LoadRoute(string routePath, TypeEditor interfaceType)
        {
            Program.actEditor.DisplayStatusMessage("Simulator Loading...");
            mstsDataConfig = new MSTSDataConfig(Program.aePreference.MSTSPath, routePath, interfaceType);
            Program.actEditor.DisplayStatusMessage("Load route Metadata ...");

            orRouteConfig = ORRouteConfig.LoadConfig(TRK.Tr_RouteFile.FileName, routePath, interfaceType);
            //AESignals = new AESignals(this);
            orRouteConfig.SetTraveller(TSectionDat, TDB);
            orRouteConfig.SetTileBase(mstsDataConfig.TileBase);
            orRouteConfig.ReduceItems();

            LoadItemsFromMSTS();
            ReAlignData();
        }
Example #4
0
        public void checkForNewConnector(ORRouteConfig orRouteConfig, List <TrackSegment> segments, MSTSBase tileBase)
        {
            PointF pointIntersect;
            int    realPosit = 0;
            int    ii        = 0;

            //  First, we remove all un configured connectors
            //foreach (StationAreaItem SAWidget in stationArea)
            for (int cnt = 0; cnt < stationArea.Count; cnt++)
            {
                var SAWidget = stationArea[cnt];
                if (SAWidget.IsInterface() && !SAWidget.getStationConnector().isConfigured())
                {
                    removeConnector(orRouteConfig, SAWidget);
                    cnt--;
                }
            }
            //  Next, we search for new connectors and add them
            List <AESegment> polySegment = getPolySegment();

            for (int cntPointEdge = 0; cntPointEdge < polySegment.Count; cntPointEdge++)
            {
                List <System.Drawing.PointF> pointsIntersect = new List <System.Drawing.PointF>();
                foreach (var segment in segments)
                {
                    if ((segment.NodeIdx == 35 || segment.NodeIdx == 86) && cntPointEdge > 2 &&
                        (segment.SectionIdxA == 191 || segment.SectionIdxA == 40000))
                    {
                        ii = 1;
                    }
                    pointIntersect = DrawUtility.FindIntersection(polySegment[cntPointEdge], new AESegment(segment));
                    if (!pointIntersect.IsEmpty)
                    {
                        StationAreaItem newPoint = new StationAreaItem(TypeEditor.ROUTECONFIG, this);
                        MSTSCoord       coord    = tileBase.getMstsCoord(pointIntersect);
                        newPoint.configCoord(coord);
                        //newPoint.toggleSelected();
                        realPosit++;    // +1 car on doit placer après le cntEdge courant
                        List <AESegment> newPolySegment = getPolySegment();
                        insertConnector(newPolySegment, newPoint);
                        newPoint.DefineAsInterface(segment);
                    }
                }
                realPosit++;    //  On incrémente pour suivre le cntPointEdge
            }
        }
Example #5
0
 public void removeConnector(ORRouteConfig orRouteConfig, StationAreaItem connector)
 {
     stationArea.Remove(connector);
     orRouteConfig.RemoveConnectorWidget(connector);
 }
Example #6
0
 public virtual void complete(ORRouteConfig orRouteConfig, List <TrackSegment> segments, MSTSBase tileBase)
 {
 }
Example #7
0
        public AIPath(TDBFile TDB, TSectionDatFile tsectiondat, string filePath)
#endif
        {
            PathFile patFile = new PathFile(filePath);

            pathName    = patFile.Name;
            TrackDB     = TDB.TrackDB;
            TSectionDat = tsectiondat;
#if ACTIVITY_EDITOR
            orRouteConfig = orRouteConf;
#endif
            bool fatalerror = false;
            if (patFile.TrPathNodes.Count <= 0)
            {
                fatalerror = true;
                Nodes      = null;
                return;
            }
            foreach (TrPathNode tpn in patFile.TrPathNodes)
            {
                Nodes.Add(new AIPathNode(tpn, patFile.TrackPDPs[(int)tpn.fromPDP], TrackDB, isTimetableMode));
            }
            FirstNode = Nodes[0];
            //LastVisitedNode = FirstNode;

            // Connect the various nodes to each other
            for (int i = 0; i < Nodes.Count; i++)
            {
                AIPathNode node = Nodes[i];
                node.Index = i;
                TrPathNode tpn = patFile.TrPathNodes[i];

                // find TVNindex to next main node.
                if (tpn.HasNextMainNode)
                {
                    node.NextMainNode     = Nodes[(int)tpn.nextMainNode];
                    node.NextMainTVNIndex = node.FindTVNIndex(node.NextMainNode, TDB, tsectiondat);
                    if (node.JunctionIndex >= 0)
                    {
                        node.IsFacingPoint = TestFacingPoint(node.JunctionIndex, node.NextMainTVNIndex);
                    }
                    if (node.NextMainTVNIndex < 0)
                    {
                        node.NextMainNode = null;
                        Trace.TraceWarning("Cannot find main track for node {1} in path {0}", filePath, i);
                        fatalerror = true;
                    }
                }

                // find TVNindex to next siding node
                if (tpn.HasNextSidingNode)
                {
                    node.NextSidingNode     = Nodes[(int)tpn.nextSidingNode];
                    node.NextSidingTVNIndex = node.FindTVNIndex(node.NextSidingNode, TDB, tsectiondat);
                    if (node.JunctionIndex >= 0)
                    {
                        node.IsFacingPoint = TestFacingPoint(node.JunctionIndex, node.NextSidingTVNIndex);
                    }
                    if (node.NextSidingTVNIndex < 0)
                    {
                        node.NextSidingNode = null;
                        Trace.TraceWarning("Cannot find siding track for node {1} in path {0}", filePath, i);
                        fatalerror = true;
                    }
                }

                if (node.NextMainNode != null && node.NextSidingNode != null)
                {
                    node.Type = AIPathNodeType.SidingStart;
                }
            }

            FindSidingEnds();

            if (fatalerror)
            {
                Nodes = null;             // invalid path - do not return any nodes
            }
        }
Example #8
0
        public string pathName; //name of the path to be able to print it.

        /// <summary>
        /// Creates an AIPath from PAT file information.
        /// First creates all the nodes and then links them together into a main list
        /// with optional parallel siding list.
        /// </summary>
#if ACTIVITY_EDITOR
        public AIPath(TrackDatabaseFile TDB, TrackSectionsFile tsectiondat, string filePath, bool isTimetableMode, ORRouteConfig orRouteConf)