${IS6_ClosestFacilityParameters_Title}

${IS6_ClosestFacilityParameters_Description}

${IS6_ClosestFacilityParameters_Remarks}
Inheritance: ParametersBase
        /// <summary>${IS6_ClosestFacilityService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${IS6_ClosestFacilityService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${IS6_ClosestFacilityService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(ClosestFacilityParameters parameters, object state)
        {
            if (parameters == null)
            {
                //TODO:资源
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
                //throw new ArgumentNullException("ClosestFacilityParameters is Null");
            }
            if (string.IsNullOrEmpty(this.Url))
            {
                //TODO:资源
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
                //throw new InvalidOperationException("Url is not set");
            }

            base.SubmitRequest(base.Url + "/path.ashx?", GetParameters(parameters),
                new EventHandler<RequestEventArgs>(request_Completed), state, false);
        }
        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);
        }
 private Dictionary<string, string> GetParameters(ClosestFacilityParameters parameters)
 {
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     string method = "ClosestFacility";
     dictionary.Add("map", parameters.MapName);
     dictionary.Add("method", method);
     dictionary.Add("point", JsonHelper.FromPoint2D(parameters.Point));
     dictionary.Add("proximityParam", ProximityParam.ToJson(parameters.ProximityParam));
     dictionary.Add("trackingLayerIndex", "-1");
     dictionary.Add("userID", Guid.NewGuid().ToString());
     return dictionary;
 }
 /// <summary>${IS6_ClosestFacilityService_method_ProcessAsync_D}</summary>
 /// <overloads>${IS6_ClosestFacilityService_method_ProcessAsync_overloads_D}</overloads>
 /// <param name="parameters">${IS6_ClosestFacilityService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(ClosestFacilityParameters parameters)
 {
     ProcessAsync(parameters, null);
 }