${IS6_ThemeParameters_Title}

${IS6_ThemeParameters_Description}

Inheritance: ParametersBase
        //对1994年人口字段制作标签专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            ThemeLabel label = new ThemeLabel()
            {
                Caption = "标签专题图",
                Expression = "Country",
                Display = new ServerTextStyle()
                {
                    FontHeight = 5,
                    FontWidth = 0,
                    Color = new ServerColor(100, 100, 220),
                    FontName = "微软雅黑" ,
                },
                AutoAvoidOverlapped = true,
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = label,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //等级符号专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            ThemeGraduatedSymbol graduatedSymbol = new ThemeGraduatedSymbol()
            {
                Caption = "等级符号专题图",
                Expression = "Pop_1994",
                DefinitionValue = 1000000000,
                GraduatedMode = GraduatedMode.Constant,
                StyleForPositive = new ServerStyle() { SymbolSize = 200, SymbolStyle = 63, PenColor = new ServerColor(228, 142, 48) }
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = graduatedSymbol,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            //与服务器交互
            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //点密度专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            //如果字段表达式为空则用下拉列表中选择字段来制作单值专题图
            string str;
            if (!string.IsNullOrEmpty(filterField.Text) && !(filterField.Text == ""))
            {
                str = filterField.Text;
            }
            else
            {
                str = setField.SelectedItem.ToString();
            }

            ThemeDotDensity dotDensity = new ThemeDotDensity()
            {
                Caption = "点密度专题图",
                Expression = str,
                DotStyle = new ServerStyle()
                {
                    SymbolSize = 20,
                    SymbolStyle = 1,
                },
                DotValue = Convert.ToDouble(baseValue.Text)
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = dotDensity,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            //与服务器交互
            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //范围分段专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            List<ServerStyle> themeStyles = new List<ServerStyle>();
            ServerStyle themeStyle1 = new ServerStyle() { BrushColor = new ServerColor(216, 244, 254) };
            ServerStyle themeStyle2 = new ServerStyle() { BrushColor = new ServerColor(131, 232, 252) };
            ServerStyle themeStyle3 = new ServerStyle() { BrushColor = new ServerColor(112, 212, 243) };
            ServerStyle themeStyle4 = new ServerStyle() { BrushColor = new ServerColor(23, 198, 238) };
            ServerStyle themeStyle5 = new ServerStyle() { BrushColor = new ServerColor(0, 187, 236) };
            ServerStyle themeStyle6 = new ServerStyle() { BrushColor = new ServerColor(0, 133, 236) };

            themeStyles.Add(themeStyle1);
            themeStyles.Add(themeStyle2);
            themeStyles.Add(themeStyle3);
            themeStyles.Add(themeStyle4);
            themeStyles.Add(themeStyle5);
            themeStyles.Add(themeStyle6);

            ThemeRange range = new ThemeRange()
            {
                BreakValues = new List<double>() { 6000000, 10000000, 50000000, 100000000, 500000000 },
                Caption = "范围分段专题图",
                Displays = themeStyles,
                Expression = "Pop_1994",
            };

            ThemeParameters parameters = new ThemeParameters
            {
                MapName = "World",
                Theme = range,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            //与服务器交互
            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //栅格范围分段专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            List<ServerColor> colors = new List<ServerColor>();
            ServerColor color1 = new ServerColor(255, 0, 0);
            ServerColor color2 = new ServerColor(0, 255, 0);
            ServerColor color3 = new ServerColor(0, 0, 255);
            ServerColor color4 = new ServerColor(255, 255, 0);
            ServerColor color5 = new ServerColor(255, 0, 255);
            ServerColor color6 = new ServerColor(0, 255, 255);

            colors.Add(color1);
            colors.Add(color2);
            colors.Add(color3);
            colors.Add(color4);
            colors.Add(color5);
            colors.Add(color6);

            ThemeGridRange gridRange = new ThemeGridRange()
            {
                BreakValues = new List<double>() { 1200, 1250, 1300, 1350, 1400 },
                Caption = "栅格范围分段专题图",
                Displays = colors
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "DEM",
                Theme = gridRange,
                LayerNames = layerNames,
                ThemeLayer = "DEM@dem"
            };

            //与服务器交互
            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //单值专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            List<ServerStyle> themeStyle = new List<ServerStyle>();
            ServerStyle themeStyle1 = new ServerStyle() { BrushColor = new ServerColor(157, 127, 255), PenColor = new ServerColor(197, 17, 21) };
            ServerStyle themeStyle2 = new ServerStyle() { BrushColor = new ServerColor(250, 237, 195), PenColor = new ServerColor(33, 180, 40) };
            ServerStyle themeStyle3 = new ServerStyle() { BrushColor = new ServerColor(59, 188, 230), PenColor = new ServerColor(116, 122, 235) };
            ServerStyle themeStyle4 = new ServerStyle() { BrushColor = new ServerColor(1, 128, 171), PenColor = new ServerColor(16, 122, 235) };
            ServerStyle themeStyle5 = new ServerStyle() { BrushColor = new ServerColor(167, 219, 232), PenColor = new ServerColor(116, 122, 25) };
            ServerStyle themeStyle6 = new ServerStyle() { BrushColor = new ServerColor(192, 214, 54), PenColor = new ServerColor(116, 12, 235) };

            themeStyle.Add(themeStyle1);
            themeStyle.Add(themeStyle2);
            themeStyle.Add(themeStyle3);
            themeStyle.Add(themeStyle4);
            themeStyle.Add(themeStyle5);
            themeStyle.Add(themeStyle6);

            SuperMap.Web.ISDotNET6.ThemeUnique unique = new SuperMap.Web.ISDotNET6.ThemeUnique()
            {
                Caption = "制作国家的单值专题图",
                Expression = "Country",
                Displays = themeStyle,
                Values = new List<string>() { "俄罗斯", "中华人民共和国", "印度", "美国", "巴西", "澳大利亚" },
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = unique,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //制作统计专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            List<ServerStyle> themeStyles = new List<ServerStyle>();
            themeStyles.Add(new ServerStyle() { BrushColor = new ServerColor(125, 0, 0) });
            themeStyles.Add(new ServerStyle() { BrushColor = new ServerColor(220, 50, 127) });

            ThemeGraph graph = new ThemeGraph()
            {
                Caption = "统计专题图",
                Expressions = new List<string>() { "SmArea", "Pop_1994" },
                GraduatedMode = (GraduatedMode)setGradutedMode.SelectedIndex,
                GraphStyles = themeStyles,
                GraphType = (GraphType)setGraphType.SelectedItem,
                OnTop = true,
                ShowItemText = (bool)isItemText.IsChecked,
                ItemTextFormat = (GraphTextFormat)(setGraphTextFormat.SelectedIndex + 1),
                ItemCaptions = new List<string>() { "面积", "人口" },
                ShowAxes = (bool)isAxes.IsChecked,
                ShowAxisGrid = (bool)isAxesGrid.IsChecked,
                MaxSumSize = 100,
                MinSumSize = 20,
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = graph,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
        //移除专题图,即生成一个空专题图
        private void remove_Click(object sender, RoutedEventArgs e)
        {
            ThemeParameters clearDotDensityParameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = null,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            //与服务器交互
            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(clearDotDensityParameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
 /// <summary>${IS6_ThemeService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${IS6_ThemeService_method_ProcessAsync_param_parameters}</param>
 /// <param name="state">${IS6_ThemeService_method_ProcessAsync_param_state}</param>
 public void ProcessAsync(ThemeParameters parameters, object state)
 {
     if (parameters == null)
     {
         //TODO:资源
         //throw new ArgumentNullException("ThemeParameters is Null");
         throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
     }
     if (string.IsNullOrEmpty(this.Url))
     {
         //TODO:资源
         //throw new InvalidOperationException("Url is not set");
         throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
     }
     base.SubmitRequest(base.Url + "/common.ashx?", GetParameters(parameters),
         new EventHandler<RequestEventArgs>(request_Completed), state, false);
 }
 /// <summary>${IS6_ThemeService_method_ProcessAsync_D}</summary>
 /// <overloads>${IS6_ThemeService_method_ProcessAsync_overloads_D}</overloads>
 /// <param name="parameters">${IS6_ThemeService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(ThemeParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
        private Dictionary<string, string> GetParameters(ThemeParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            string method = "UpdateLayers";
            dictionary.Add("map", parameters.MapName);
            dictionary.Add("method", method);

            string json = "[";
            List<string> list = new List<string>();
            if (parameters.Theme != null)
            {
                for (int i = 0; i < parameters.LayerNames.Count; i++)
                {
                    if (i == parameters.LayerNames.IndexOf(parameters.ThemeLayer))
                    {
                        if (parameters.Theme is ThemeUnique)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeUnique\":{0}", ThemeUnique.ToJson((ThemeUnique)parameters.Theme));
                            //sb.Append(",\"themeRange\": null,\"themeLabel\": null,\"themeGraph\": null,\"themeGridRange\": null,\"themeGraduatedSymbol\": null,\"themeDotDensity\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeRange)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeRange\":{0}", ThemeRange.ToJson((ThemeRange)parameters.Theme));
                            //sb.Append(",\"themeUnique\": null,\"themeLabel\": null,\"themeGraph\": null,\"themeGridRange\": null,\"themeGraduatedSymbol\": null,\"themeDotDensity\": null}");
                            sb.Append(",\"themeUnique\": null}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeLabel)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeLabel\":{0}", ThemeLabel.ToJson((ThemeLabel)parameters.Theme));
                            //sb.Append(",\"themeUnique\": null,\"themeRange\": null,\"themeGraph\": null,\"themeGridRange\": null,\"themeGraduatedSymbol\": null,\"themeDotDensity\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeGraph)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeGraph\":{0}", ThemeGraph.ToJson((ThemeGraph)parameters.Theme));
                            // sb.Append(",\"themeUnique\": null,\"themeRange\": null,\"themeLabel\": null,\"themeGridRange\": null,\"themeGraduatedSymbol\": null,\"themeDotDensity\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeDotDensity)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeDotDensity\":{0}", ThemeDotDensity.ToJson((ThemeDotDensity)parameters.Theme));
                            // sb.Append(",\"themeUnique\": null,\"themeRange\": null,\"themeLabel\": null,\"themeGridRange\": null,\"themeGraph\": null,\"themeGraduatedSymbol\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeGraduatedSymbol)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeGraduatedSymbol\":{0}", ThemeGraduatedSymbol.ToJson((ThemeGraduatedSymbol)parameters.Theme));
                            //sb.Append(",\"themeUnique\": null,\"themeRange\": null,\"themeLabel\": null,\"themeGridRange\": null,\"themeGraph\": null,\"themeDotDensity\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                        if (parameters.Theme is ThemeGridRange)
                        {
                            StringBuilder sb = new StringBuilder("{");
                            sb.AppendFormat("\"themeGridRange\":{0}", ThemeGridRange.ToJson((ThemeGridRange)parameters.Theme));
                            //sb.Append(",\"themeUnique\": null,\"themeRange\": null,\"themeLabel\": null,\"themeGraduatedSymbol\": null,\"themeGraph\": null,\"themeDotDensity\": null}");
                            sb.Append("}");
                            list.Add(sb.ToString());
                        }
                    }
                    else
                    {
                        list.Add(string.Format("\"{0}\"", "!@"));
                    }
                }
            }
            else
            {
                for (int i = 0; i < parameters.LayerNames.Count; i++)
                {
                    if (i == parameters.LayerNames.IndexOf(parameters.ThemeLayer))
                    {
                        parameters.Theme = new ThemeUnique();
                        StringBuilder sb = new StringBuilder("{");
                        sb.AppendFormat("\"themeGraduatedSymbol\":{0}", ThemeUnique.ToJson((ThemeUnique)parameters.Theme));
                        sb.Append("}");
                        list.Add(sb.ToString());

                        //list.Add("{\"themeGridRange\":null\",\"themeUnique\": null,\"themeRange\": null,\"themeLabel\": null,\"themeGraduatedSymbol\": null,\"themeGraph\": null,\"themeDotDensity\": null}");
                    }
                    else
                    {
                        list.Add(string.Format("\"{0}\"", "!@"));
                    }
                }
            }

            json += string.Join(",", list.ToArray());
            json += "]";

            dictionary.Add("layers", json);

            if (string.IsNullOrEmpty(parameters.LayersKey))
            {
                parameters.LayersKey = "0";
            }

            dictionary.Add("layersKey", parameters.LayersKey);
            dictionary.Add("bModifiedByServer", "false");

            return dictionary;
        }