${iServerJava6R_FindLocationParameters_Title}

${iServerJava6R_FindLocationParameters_Description}

        /// <summary>${iServerJava6R_FindLocationService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServerJava6R_FindLocationService_method_ProcessAsync_param_Parameters}</param>
        /// <param name="state">${iServerJava6R_FindLocationService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(FindLocationAnalystParameters parameters, object state)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(this.Url))
            {
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            if (!base.Url.EndsWith("/"))
            {
                base.Url += '/';
            }
            //参数必须放在 URI 中
            base.Url += "location.json?debug=true&_method=GET";

            base.SubmitRequest(base.Url, GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, true);
        }
        private void LocationAnalyst_Click(object sender, RoutedEventArgs e)
        {
            FindLocationAnalystParameters param = new FindLocationAnalystParameters
            {
                SupplyCenters = new List<SupplyCenter>
                {
                    new SupplyCenter
                    {
                        NodeID=7,
                        MaxWeight=3,
                        ResourceValue=100,
                        Type= SupplyCenterType.OPTIONALCENTER
                    },
                     new SupplyCenter
                    {
                        NodeID=8,
                        MaxWeight=3,
                        ResourceValue=100,
                        Type= SupplyCenterType.OPTIONALCENTER
                    }
                },
                ExpectedSupplyCenterCount = 1,
                WeightName = "length",
                TurnWeightField = "TurnCost",
                ReturnNodeFeature = true,
                ReturnEdgeGeometry = true,
                ReturnEdgeFeature = true,
                IsFromCenter = false,
            };

            FindLocationAnalystService locationAnalystService = new FindLocationAnalystService(networkUrl);
            locationAnalystService.ProcessAsync(param);
            locationAnalystService.Failed += Failed;
            locationAnalystService.ProcessCompleted += new EventHandler<FindLocationAnalystEventArgs>(locationAnalystService_ProcessCompleted);
        }
        private Dictionary<string, string> GetParameters(FindLocationAnalystParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            if (parameters.SupplyCenters != null && parameters.SupplyCenters.Count > 0)
            {
                List<string> temp = new List<string>();
                for (int i = 0; i < parameters.SupplyCenters.Count; i++)
                {
                    temp.Add(string.Format("{0}", SupplyCenter.ToJson(parameters.SupplyCenters[i])));
                }
                dictionary.Add("supplyCenters",string.Format("[{0}]", string.Join(",", temp.ToArray())));
            }

            dictionary.Add("isFromCenter", parameters.IsFromCenter.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
            dictionary.Add("expectedSupplyCenterCount", parameters.ExpectedSupplyCenterCount.ToString(System.Globalization.CultureInfo.InvariantCulture));
               // dictionary.Add("nodeDemandField", parameters.NodeDemandField);
            dictionary.Add("weightName", parameters.WeightName);
            dictionary.Add("turnWeightField", parameters.TurnWeightField);
            dictionary.Add("returnEdgeFeatures", parameters.ReturnEdgeFeature.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
            dictionary.Add("returnEdgeGeometry", parameters.ReturnEdgeGeometry.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
            dictionary.Add("returnNodeFeatures", parameters.ReturnNodeFeature.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());

            return dictionary;
        }
 /// <summary>${iServerJava6R_FindLocationService_method_ProcessAsync_D}</summary>
 /// <overloads>${iServerJava6R_FindLocationService_method_ProcessAsync_overloads_D}</overloads>
 public void ProcessAsync(FindLocationAnalystParameters parameters)
 {
     this.ProcessAsync(parameters, null);
 }