Exemple #1
0
        public static async Task <MatrixResponse> GetMatrix(Core.RoutePackage task)
        {
            string responseString = await UseORS("/v2/matrix/driving-car", $"{{\"locations\":{task.reference.Locations()},\"metrics\":[\"duration\"],\"units\":\"km\"}}");

            MatrixResponse responseData = JsonSerializer.Deserialize <MatrixResponse>(responseString);

            return(responseData);
        }
Exemple #2
0
        public Core.GeoRoute GetGeoRoute(Core.RoutePackage task)
        {
            RemoteWorker worker = new RemoteWorker();

            ORS.MatrixResponse matrixResponse = ORS.ORS.GetMatrix(task).Result;
            task.matrix = new Core.AdjacencyMatrix(matrixResponse.ToFloat());
            Core.Route route = worker.GetRouteSubgraph(task);

            ORS.DirectionResponse directionResponse = ORS.ORS.GetGeometry(route).Result;

            Core.GeoRoute geoRoute = new Core.GeoRoute(route, directionResponse.features[0].geometry.ToFloat());

            return(geoRoute);
        }
Exemple #3
0
        public Core.GeoRoute GetGeoRoute(Core.RoutePackage task)
        {
            // Client (WebInterface) Side

            var channel = GrpcChannel.ForAddress("https://localhost:5002");
            var client  = new Proto.Distributor.Distributor.DistributorClient(channel);

            Proto.Distributor.RoutePackage package = new Proto.Distributor.RoutePackage {
                Data = Serialiser.Serialise(task)
            };

            var result = client.GetGeoRoute(package);

            return((Core.GeoRoute)Serialiser.Deserialise(result.Data));
        }
Exemple #4
0
        public Core.Route GetRouteSubgraph(Core.RoutePackage task)
        {
            // Client (Distributor) Side

            var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client  = new Proto.Worker.Worker.WorkerClient(channel);

            Proto.Worker.RoutePackage package = new Proto.Worker.RoutePackage {
                Data = Serialiser.Serialise(task)
            };

            var result = client.GetRouteSubgraph(package);

            return((Core.Route)Serialiser.Deserialise(result.Data));
        }