internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(GeometryThiessenAnalystParameters geometryThiessenParams) { System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>(); if (geometryThiessenParams.ClipRegion != null) { dict.Add("clipRegion", ServerGeometry.ToJson(geometryThiessenParams.ClipRegion)); } dict.Add("createResultDataset", geometryThiessenParams.CreateResultDataset.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()); dict.Add("resultDatasetName", geometryThiessenParams.ResultDatasetName.ToString(System.Globalization.CultureInfo.InvariantCulture)); dict.Add("resultDatasourceName", geometryThiessenParams.ResultDatasourceName.ToString(System.Globalization.CultureInfo.InvariantCulture)); dict.Add("returnResultRegion", geometryThiessenParams.ReturnResultRegion.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()); if (geometryThiessenParams.Points.Count > 0) { string points_str = "["; int count = geometryThiessenParams.Points.Count; for (int i = 0; i < count; i++) { Point2D point = geometryThiessenParams.Points[i]; var point_str = "{"; point_str+=String.Format("\"y\":{0},\"x\":{1}", point.Y, point.X); point_str += "}"; points_str += point_str; if (i == count - 1) { points_str += "]"; } else { points_str+=","; } } dict.Add("points", points_str); } return dict; }
private void GeometryThiessenAnalyst_Click(object sender, RoutedEventArgs e) { Point2DCollection points = new Point2DCollection(); points.Add(new Point2D(5472.712382, -2189.15344)); points.Add(new Point2D(4707.299652, -1229.476725)); points.Add(new Point2D(5450.34263, -2070.794081)); points.Add(new Point2D(5447.671615, -2255.928819)); points.Add(new Point2D(5357.895026, -1965.022579)); points.Add(new Point2D(5317.70775, -2521.162355)); GeometryThiessenAnalystParameters thiessenParams = new GeometryThiessenAnalystParameters(); thiessenParams.Points = points; thiessenParams.CreateResultDataset = true; thiessenParams.ResultDatasetName = ""; thiessenParams.ResultDatasourceName = "Changchun"; thiessenParams.ReturnResultRegion = true; thiessenParams.ClipRegion = null; ThiessenAnalystService thiessenService = new ThiessenAnalystService(url2); thiessenService.ProcessAsync(thiessenParams); thiessenService.ProcessCompleted += new EventHandler<ThiessenAnalystEventArgs>(ThiessenAnalyst_ProcessCompleted); thiessenService.Failed += new EventHandler<ServiceFailedEventArgs>(ThiessenAnalyst_Failed); }