${iServerJava6R_MeasureParameters_Tile}

${iServerJava6R_MeasureParameters_Description}

        /// <summary>${iServerJava6R_MeasureService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServerJava6R_MeasureService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${iServerJava6R_MeasureService_method_processAsync_param_state}</param>
        public void ProcessAsync(MeasureParameters 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 += '/';
            }

            //将错误抛给服务器,让其返回错误结果,出发我们的Failed事件;
            if (parameters.Geometry is GeoLine)
            {
                base.Url += "distance.json?debug=true&_method=GET&";
            }
            else if (parameters.Geometry is GeoRegion)
            {
                base.Url += "area.json?debug=true&_method=GET&";
            }
            else
            {
                base.Url += "distance.json?debug=true&_method=GET&";
            }

            base.SubmitRequest(base.Url, GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, true);
        }
 private void Measure(SuperMap.Web.Core.Geometry geo)
 {
     MeasureParameters parameters = new MeasureParameters { Geometry = geo, Unit = Unit.Kilometer };
     MeasureService measureService = new MeasureService(url);
     measureService.ProcessAsync(parameters);
     measureService.ProcessCompleted += new EventHandler<MeasureEventArgs>(measureService_ProcessCompleted);
     measureService.Failed += new EventHandler<ServiceFailedEventArgs>(measureService_Failed);
 }
 /// <summary>${iServerJava6R_MeasureService_method_ProcessAsync_D}</summary>
 /// <overloads>${iServerJava6R_MeasureService_method_ProcessAsync_overloads}</overloads>
 /// <param name="parameters">${iServerJava6R_MeasureService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(MeasureParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
        private Dictionary<string, string> GetParameters(MeasureParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            Point2DCollection ps = new Point2DCollection();
            ObservableCollection<Point2DCollection> og = new ObservableCollection<Point2DCollection>();
            if (parameters.Geometry is GeoLine)
            {
                og = (parameters.Geometry as GeoLine).Parts;
            }
            else if (parameters.Geometry is GeoRegion)
            {
                og = (parameters.Geometry as GeoRegion).Parts;
            }
            else
            {
                dictionary.Add("point2Ds", "[]");
                dictionary.Add("unit", parameters.Unit.ToString().ToUpper());
                return dictionary;
            }

            foreach (Point2DCollection g in og)
            {
                for (int i = 0; i < g.Count; i++)
                {
                    ps.Add(g[i]);
                }
            }
            dictionary.Add("point2Ds", JsonHelper.FromPoint2DCollection(ps));
            dictionary.Add("unit", parameters.Unit.ToString().ToUpper());
            return dictionary;
        }