コード例 #1
0
        public static async Task <shPath> FindShortPathWithArrayNodes(string ScenarioId, int[] arrNodeId, enOSMhighwayFilter[] arrHighwayFilter)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseAddress);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                ArrNodes nodes = new ArrNodes();
                nodes.ScenarioId       = ScenarioId;
                nodes.arrNodeId        = arrNodeId;
                nodes.arrHighwayFilter = arrHighwayFilter;

                HttpResponseMessage response = await client.PostAsJsonAsync <ArrNodes>("api/Routing/FindShortPathWithArrayNodes/", nodes); //FindShortPathWithArrayNodes

                if (response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    return(null);
                }

                HttpContent content = response.Content;
                string      v       = await content.ReadAsStringAsync();

                shPath tmp = JsonConvert.DeserializeObject <shPath>(v);
                return(tmp);
            }
        }
コード例 #2
0
ファイル: clsRoadRoutingWebApi.cs プロジェクト: ohadmanor/TDS
        public static async Task<shPath> FindShortPathWithArrayNodes(string ScenarioId, int[] arrNodeId, enOSMhighwayFilter[] arrHighwayFilter)
        {
             using(var client = new HttpClient())
             {
                 client.BaseAddress = new Uri(BaseAddress);
                 client.DefaultRequestHeaders.Accept.Clear();
                 client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                 ArrNodes nodes = new ArrNodes();
                 nodes.ScenarioId = ScenarioId;
                 nodes.arrNodeId = arrNodeId;
                 nodes.arrHighwayFilter = arrHighwayFilter;

                 HttpResponseMessage response = await client.PostAsJsonAsync<ArrNodes>("api/Routing/FindShortPathWithArrayNodes/", nodes); //FindShortPathWithArrayNodes

                 if (response.StatusCode != System.Net.HttpStatusCode.OK)
                 {
                     return null;
                 }

                 HttpContent content = response.Content;
                 string v = await content.ReadAsStringAsync();
                 
                 shPath tmp = JsonConvert.DeserializeObject<shPath>(v);
                 return tmp;
             }    
              
        }