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); }
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); }
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)); }
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)); }