${IS6_ProximityParam_Title}

${IS6_ProximityParam_Description}

        internal static string ToJson(ProximityParam param)
        {
            if (param == null)
            {
                return null;
            }

            string json = "{";
            List<string> list = new List<string>();
            list.Add(string.Format("\"highlight\":null"));

            if (param.NetworkParams != null)
            {
                list.Add(string.Format("\"networkParams\":{0}", NetworkParams.ToJson(param.NetworkParams)));
            }
            else
            {
                list.Add(string.Format("\"networkParams\":null"));
            }

            if (!string.IsNullOrEmpty(param.FacilityFilter))
            {
                list.Add(string.Format("\"facilityFilter\":\"{0}\"", param.FacilityFilter));
            }
            else
            {
                list.Add("\"facilityFilter\":\"\"");
            }

            if (!string.IsNullOrEmpty(param.FacilityLayer))
            {
                list.Add(string.Format("\"facilityLayer\":\"{0}\"", param.FacilityLayer));
            }
            else
            {
                list.Add("\"facilityLayer\":\"\"");
            }

            list.Add(string.Format("\"isFromEvent\":{0}", param.IsFromEvent.ToString().ToLower()));

            list.Add(string.Format("\"maxRadius\":{0}", param.MaxRadius));
            list.Add(string.Format("\"facilityCount\":{0}", param.FacilityCount));

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }
        private void FindClosestFacility_Click(object sender, RoutedEventArgs e)
        {
            //为最近设施分析设置参数
            NetworkSetting networkSetting = new NetworkSetting
            {
                NodeIDField = "SmNodeID",
                NetworkLayerName = "RoadNet@changchun",
                EdgeIDField = "SmEdgeID",
                FTWeightField = "SmLength",
                TFWeightField = "SmLength"
            };

            NetworkParams networkParams = new NetworkParams
            {
                Tolerance = 1000,
                NetworkSetting = networkSetting
            };
            ProximityParam proximityParam = new ProximityParam
            {
                FacilityCount = 2,
                MaxRadius = 100000,
                FacilityLayer = "School@changchun",
                IsFromEvent = true,
                NetworkParams = networkParams,
            };

            ClosestFacilityParameters closestFacilityParamters = new ClosestFacilityParameters
            {
                MapName = "changchun",
                Point = eventp,
                ProximityParam = proximityParam
            };

            //最近设施分析
            ClosestFacilityService service = new ClosestFacilityService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(closestFacilityParamters);
            service.ProcessCompleted += new EventHandler<ProximityEventArgs>(service_ProcessCompleted);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
        }