// Constructor public Line(JsonRoute jRoute, StationDictionary stationDiction, LineDictionary lineDiction) // sets up line structure { foreach (var sps in jRoute.stopPointSequences) { Branches.Add(new Branch(sps, stationDiction, lineDiction)); } }
public async Task <HereMatchRouteResponse> MatchRoute(JsonRoute jsonRoute) { using (var httpClient = _clientFactory.CreateClient()) { var xml = ""; var gpx = _jsonRouteToGpxAdaptor.Convert(jsonRoute); var xsSubmit = new XmlSerializer(typeof(Gpx)); var query = _matchRouteUrl + $"?app_id={_hereAPICredentials.AppId}" + $"&app_code={_hereAPICredentials.AppCode}" + "&routemode=car" + "&filetype=GPX"; using (var sww = new StringWriter()) { using (XmlWriter writer = XmlWriter.Create(sww, new XmlWriterSettings { OmitXmlDeclaration = true })) { xsSubmit.Serialize(writer, gpx); xml = sww.ToString(); } } var httpContent = new StringContent(xml); var response = await httpClient.PostAsync(query, httpContent); return(JsonConvert.DeserializeObject <HereMatchRouteResponse>(await response.Content.ReadAsStringAsync())); } }
/* * Andoridから得られたデータをParseした結果のうちRouteを渡すメソッド * データがない場合は、空のデータ型を返す */ public JsonRoute getRouteDataFromAndroid() { if (routeDataFromAndroid != null) { JsonRoute tmp = routeDataFromAndroid; routeDataFromAndroid = null; return(tmp); } return(null); }
/* * Bluetoothから送られたメッセージをパースするメソッド * 受信したデータはJSONDataStructureの形にパースされる * データ形式はJSONDataStructureを参照のこと */ public void parseJsonMessage(string message) { JsonDataFromAndroid dataFromAndroid = JsonConvert.DeserializeObject <JsonDataFromAndroid>(message); if (dataFromAndroid != null) { taplDataFromAndroid.AddRange(dataFromAndroid.trajectory); taplIsChanged = true; routeDataFromAndroid = dataFromAndroid.global_route; } }
public Gpx Convert(JsonRoute jsonRoute) { return(new Gpx() { Version = 1.1m, Trk = new GpxTrk() { Trkseg = jsonRoute.Waypoints.Select(x => new GpxTrkTrkpt() { Lat = x.Latitude, Lon = x.Longitude }).ToList() } }); }
public IEnumerable<JsonRoute> GetAll() { var routes = new List<JsonRoute>(); var serializer = new JsonSerializer(); foreach (string fileName in Directory.GetFiles(_jsonRepositoryPath, "*.json")) { using (StreamReader streamReader = File.OpenText(fileName)) using (JsonTextReader jsonTextReader = new JsonTextReader(streamReader)) { var route = new JsonRoute { Waypoints = serializer.Deserialize<List<JsonWaypoint>>(jsonTextReader) }; routes.Add(route); } } return routes; }
public async Task <ActionResult <string> > MatchRoute([FromBody] JsonRoute jsonRoute) { var result = await _routeMatchingService.MatchRoute(jsonRoute); return(Ok(result)); }
public JsonDataFromAndroid(List <JsonTimeAndPositionLog> t, JsonRoute gr) { trajectory = t; global_route = gr; }