예제 #1
0
        public void RegisterRoutes_tests()
        {
            var repo = RouteRepository.New();

            var r1 = new SingleRoute {Path = "/reports/bfp/data.xml"};
            var r2 = new SingleRoute {Path = "/repORts/bfp/data2.xml"};

            var r3 = new SingleRoute {Path = "/reports/bfp/test/data.xml"};
            var r4 = new SingleRoute {Path = "/rePorts/bfp/tesT/daTa2.xml"};

            repo.AddRoute(r1);
            repo.AddRoute(r2);
            repo.AddRoute(r3);
            repo.AddRoute(r4);

            Assert.That(repo.FindRoute("/reports/bfp/data.xml"), Is.SameAs(r1));
            Assert.That(repo.FindRoute("/reports/bfp/data2.xml"), Is.SameAs(r2));

            Assert.That(repo.FindRoute("/reports/bfp/dbg/data.xml"), Is.SameAs(r1));
            Assert.That(repo.FindRoute("/reports/bfp/dbg/data2.xml"), Is.SameAs(r2));

            Assert.That(repo.FindRoute("/reports/bfp/test/data.xml"), Is.SameAs(r3));
            Assert.That(repo.FindRoute("/reports/bfp/test/data2.xml"), Is.SameAs(r4));

            Assert.That(repo.FindRoute("/reports/test/bfp/data.xml"), Is.SameAs(r3));
            Assert.That(repo.FindRoute("/reports/test/bfp/data2.xml"), Is.SameAs(r4));

            Assert.That(repo.FindRoute("/reports/bfp/tEst/dbg/data.xml"), Is.SameAs(r3));
            Assert.That(repo.FindRoute("/reports/bfp/dbg/test/data2.xml"), Is.SameAs(r4));

            Assert.That(repo.FindRoute("/reports/bfp/id/{id}/DATA.XML"), Is.SameAs(r1));
            Assert.That(repo.FindRoute("/reports/BFP/id/{id}/test/data.xml"), Is.SameAs(r3));
        }
        private bool IsValidRoute(SingleRoute route)
        {
            string server = route.ForwardServer;
            string url    = route.ForwardUrl;

            throw new NotImplementedException();
        }
예제 #3
0
        public NewRouteAnimation(SingleRoute route, Action <BaseAnimation> onFinish)
        {
            this.route    = route;
            this.OnFinish = onFinish;

            if (route.Graphic.Symbol == null)
            {
                route.Graphic.Symbol = GeneralRenderers.AltRouteSymbol.Clone();
                ViewModel.Instance.RouteOverlay.Graphics.Add(route.Graphic);
            }
        }
예제 #4
0
        public static SingleRoute GetRouteFromMidRoad(string subquery1, string subquery2, MobileUnit obj, Road currentRoad, Crossing target)
        {
            // needs refactoring after testing
            string table = Model.Managers[obj.GetType()].GetTable();

            string query1 = string.Format(queryRoadToCrossing, subquery1, table, currentRoad.ID, obj.ID);
            string query2 = string.Format(queryRoadToCrossing, subquery2, table, currentRoad.ID, obj.ID);

            DataTable dt1 = PostGisUtils.Query(query1);
            DataTable dt2 = PostGisUtils.Query(query2);

            SingleRoute route   = new SingleRoute();
            double      length1 = double.MaxValue;
            double      length2 = double.MaxValue;

            if (dt1.Rows.Count == 1)
            {
                length1 = (double)dt1.Rows[0].ItemArray[1];
            }
            if (dt2.Rows.Count == 1)
            {
                length2 = (double)dt2.Rows[0].ItemArray[1];
            }


            Console.WriteLine("route lengths: {0} {1}", length1, length2);

            if (length1 < length2)
            {
                route.Length = length1;
                string ewkb = ReverseIfNeeded((string)dt1.Rows[0].ItemArray[0], PostGisUtils.GetEWKB(obj));
                route.Geom = GeoTypeExtensions.FromEWKB(ewkb) as LineString;
            }
            else if (length1 > length2)
            {
                route.Length = length2;
                string ewkb = ReverseIfNeeded((string)dt2.Rows[0].ItemArray[0], PostGisUtils.GetEWKB(obj));
                route.Geom = GeoTypeExtensions.FromEWKB(ewkb) as LineString;
            }
            else
            {
                //throw new GsecException("can't find any route");
                Console.WriteLine("NO ROUTE SHOULD THROW EXCEPTION");
                return(null);
            }

            return(route);
        }
예제 #5
0
        public static List <Polyline> CutRouteAtPoint(SingleRoute route, double prc)
        {
            List <Polyline> polylines = new List <Polyline>();

            string query = string.Format(queryCutRouteAtPoint, prc, route.ID);

            DataTable dt = PostGisUtils.Query(query);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                LineString line = GeoTypeExtensions.FromEWKB((string)(dt.Rows[i].ItemArray[0])) as LineString;
                polylines.Add(line.ToEsriPolyline());
            }

            return(polylines);
        }
예제 #6
0
        public static SingleRoute GetRouteFromCrossing(string subquery, MobileUnit obj, Crossing source, Crossing target)
        {
            string    query = string.Format(queryCrossingToCrossing, subquery);
            DataTable dt    = PostGisUtils.Query(query);

            if (dt.Rows.Count == 0 || dt.Rows[0].ItemArray[0] is DBNull)
            {
                //throw new GsecException("can't find any route");
                Console.WriteLine("NO ROUTE SHOULD THROW EXCEPTION");
                return(null);
            }

            string ewkb = (string)dt.Rows[0].ItemArray[0];

            ewkb = ReverseIfNeeded(ewkb, PostGisUtils.GetEWKB(source));

            SingleRoute route = new SingleRoute();

            route.Geom   = GeoTypeExtensions.FromEWKB(ewkb) as LineString;
            route.Length = (double)dt.Rows[0].ItemArray[1];

            return(route);
        }
예제 #7
0
 public void RegisterRoutes_optional_terms()
 {
     var repo = RouteRepository.New();
     var r1 = new SingleRoute {Path = "/reports/bfp/dbg/data.xml"};
 }
예제 #8
0
 IRequestSpecifier IMapRoute.MapTo(IBlController listener, RouteHandler handler)
 {
     _route = _server.AddRoute(_props.Route, listener, handler);
     return this;
 }