Пример #1
0
        void test_RouteSegment()
        {
            Prepare.ReloadGlobalSydb(".//input//Routes_fromHHHT2.xml");
            {
                var          sydbroute = sydb.routeInfoList.Find(x => x.ID == 224);//this route has no points
                RouteSegment newr      = new RouteSegment(sydbroute);
                Debug.Assert(newr.m_PtLst.Count == 0);
            }

            {                                                                       //check length for oginal route
                var          sydbroute = sydb.routeInfoList.Find(x => x.ID == 231); //this route has points
                RouteSegment newr      = new RouteSegment(sydbroute);

                List <string> pnames = new List <string>()
                {
                    "P01D-N","P07D-R","P09D-R"
                };                              //the pts in route 231
                int i = 0;
                foreach (var p in newr.m_PtLst) //check for route get points info
                {
                    Debug.Assert(pnames[i] == p.getNamePosStr());
                    ++i;
                }
                Debug.Assert((626856 - 615248 + 41374 - 26856) == newr.GetLength());
            }

            {                                                                            //check length for the splitted routes
                var            sydbroute    = sydb.routeInfoList.Find(x => x.ID == 183); //this route has Spacing_Signal_ID_List
                RouteSegConfig SyDBRouteCfg = new RouteSegConfig(sydb);
                clearlist(SyDBRouteCfg);
                SyDBRouteCfg.splitRoute(sydbroute);
                SyDBRouteCfg.m_RouteSpacing_routeLst.AddRange(SyDBRouteCfg.m_Spacing_routeLst);
                int[] lengths = { 1170639 - 906 - (1058617 - 747),1058617 - 747 - (1041880 - 747),(1041880 - 747) - (963697 + 176) };//length for the splitted route
                int   i       = 0;
                foreach (var r in SyDBRouteCfg.m_RouteSpacing_routeLst)
                {
                    Debug.Assert(lengths [i] == r.GetLength());
                    ++i;
                }
            }
        }
Пример #2
0
        void test_RouteSegmentLenVariantPts()
        {
            Prepare.ReloadGlobalSydb(".//input//RouteLength_fromTestLine.xml");
            Dictionary <int, int[]> routes = new Dictionary <int, int[]>()
            {
                //id                //ptnum     //length
                { 234, new int[] { 13, 451833 - 393833 + 600100 - 592163 + 611317 - 606247 + 4000 + 626856 - 611317 + 632996 - 626856 + 961697 - 632996 } },
                { 233, new int[] { 8, 451833 - 393833 + 600100 - 592163 + 611317 - 606247 + 4000 + 626856 - 611317 + 632996 - 626856 + 641374 - 632996 } },
                { 50, new int[] { 5, 451833 - 446833 + 604100 - 592163 + 641374 - 605177 } },
                { 400, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 401, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 402, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 403, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 404, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 405, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 445, new int[] { 2, 1035200 - 1000000 } },
                { 61, new int[] { 2, 613473 - 842 - 485281 } },
                { 66, new int[] { 2, 613473 - 842 - 485281 } },
            };

            Dictionary <string, string[]> pts = new Dictionary <string, string[]>()
            {
                //NAME                       //ORIEN
                { "P02D", new string[] { Sys.Divergent } },
                { "P20D", new string[] { Sys.Divergent } },
                { "P08D", new string[] { Sys.Convergent } },
                { "P21D", new string[] { Sys.Convergent } },
                { "P10D", new string[] { Sys.Convergent } },
                { "P14D", new string[] { Sys.Convergent } },
                { "P09D", new string[] { Sys.Divergent } },
                { "P07D", new string[] { Sys.Convergent } },
                { "P01D", new string[] { Sys.Convergent } },
                { "P16D", new string[] { Sys.Divergent } },
                { "P18D", new string[] { Sys.Convergent } },
                { "P02E", new string[] { Sys.Divergent } },
                { "P20E", new string[] { Sys.Convergent } },
                { "P01E", new string[] { Sys.Convergent } },
                { "P08B", new string[] { Sys.Divergent } },
                { "P02B", new string[] { Sys.Convergent } },
                { "P12D", new string[] { Sys.Convergent } },
                { "P06D", new string[] { Sys.Divergent } },
            };

            haschecked = false;
            foreach (var r in sydb.routeInfoList)
            {
                RouteSegment route = new RouteSegment(r);

                if (route.GetPointLstFromBlkLst() == false)
                {
                    haschecked = true;
                }

                foreach (var pt in route.m_PtLst)
                {
                    Debug.Assert(pts[pt.Point.Name][0] == pt.Orientation);
                }

                List <Variant> vlist = new List <Variant>();
                Debug.Assert(route.CalVariants(vlist, false) == true);
                Debug.Assert(vlist.Count == routes[(int)(r.ID)][0] * 2);

                Debug.Assert(route.GetLength() == routes[(int)(r.ID)][1]);
            }

            Debug.Assert(haschecked == true);//if the route of pt more than 10, retur false
        }