Пример #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"));



                //   string strUri = "api/Routing/FindShortPathWithArrayNodes?ScenarioId=" + ScenarioId + "&highwayFilter=" + (int)highwayFilter + "&x=" + x + "&y=" + y + "&NodeidFromTo=" + NodeidFromTo + "&isPointFrom=" + isPointFrom;
                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 = null;
                shPath tmp = JsonConvert.DeserializeObject <shPath>(v);
                return(tmp);
            }
        }
Пример #2
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"));



                //   string strUri = "api/Routing/FindShortPathWithArrayNodes?ScenarioId=" + ScenarioId + "&highwayFilter=" + (int)highwayFilter + "&x=" + x + "&y=" + y + "&NodeidFromTo=" + NodeidFromTo + "&isPointFrom=" + isPointFrom;
                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 = null;
                shPath tmp = JsonConvert.DeserializeObject<shPath>(v);
                return tmp;
            }
        
        }