${iServer2_Theme_ThemeGraphItem_Title}
${iServer2_Theme_ThemeGraphItem_Description}
internal static string ToJson(ThemeGraphItem themeGraphItem) { if (themeGraphItem == null) { return null; } string json = "{"; List<string> list = new List<string>(); if (themeGraphItem.GraphExpression != null) { list.Add(string.Format("\"graphExpression\":\"{0}\"", themeGraphItem.GraphExpression)); } if (themeGraphItem.UniformStyle != null) { list.Add(string.Format("\"uniformStyle\":{0}", ServerStyle.ToJson(themeGraphItem.UniformStyle))); } if (themeGraphItem.Caption != null) { list.Add(string.Format("\"caption\":\"{0}\"", themeGraphItem.Caption)); } if (themeGraphItem.RangeSetting != null) { list.Add(string.Format("\"rangeSetting\":\"{0}\"", ThemeRange.ToJson(themeGraphItem.RangeSetting))); } json += string.Join(",", list.ToArray()); json += "}"; return json; }
/// <summary>${iServer2_ThemeGraphItem_method_FromJson_D}</summary> /// <returns>${iServer2_ThemeGraphItem_method_FromJson_return}</returns> /// <param name="jsonObject">${iServer2_ThemeGraphItem_method_FromJson_param_jsonObject}</param> public static ThemeGraphItem FromJson(JsonObject jsonObject) { if (jsonObject == null) { return null; } ThemeGraphItem result = new ThemeGraphItem(); result.Caption = (string)jsonObject["caption"]; result.GraphExpression = (string)jsonObject["graphExpression"]; result.UniformStyle = ServerStyle.FromJson((JsonObject)jsonObject["uniformStyle"]); result.RangeSetting = ThemeRange.FromJson((JsonObject)jsonObject["rangeSetting"]); return result; }
//制作统计专题图 private void commit_Click(object sender, RoutedEventArgs e) { //设置了二个子项 ThemeGraphItem item1 = new ThemeGraphItem() { Caption = "面积", GraphExpression = "SmArea", UniformStyle = new ServerStyle() { FillForeColor = new ServerColor(255, 209, 173) }, }; ThemeGraphItem item2 = new ThemeGraphItem() { Caption = "人口", GraphExpression = "Pop_1994", UniformStyle = new ServerStyle() { FillForeColor = new ServerColor(233, 150, 127) }, }; SuperMap.Web.iServerJava2.ThemeGraph themeGraph = new SuperMap.Web.iServerJava2.ThemeGraph() { Items = new List<ThemeGraphItem>() { item1, item2 }, AxesColor = new ServerColor(255, 0, 0), GraduatedMode = GraduatedMode.Constant, GraphTextFormat = GraphTextFormat.Caption, GraphType = GraphType.Bar3D, IsGraphTextDisplayed = true, IsFlowEnabled = false, IsLeaderLineDisplayed = true, LeaderLineStyle = new ServerStyle { LineColor = new ServerColor { Red = 0, Green = 255, Blue = 0 } }, }; ThemeParameters parameters = new ThemeParameters() { LayerName = "World@world", MapName = "World", Theme = themeGraph, }; //与服务器交互 ThemeService themeService = new ThemeService(url) { DisableClientCaching = true }; themeService.ProcessAsync(parameters); themeService.ProcessCompleted += new EventHandler<ThemeEventArgs>(themeService_ProcessCompleted); themeService.Failed += new EventHandler<ServiceFailedEventArgs>(themeService_Failed); }