${IS6_CompositeThemeParameters_Title}

${IS6_CompositeThemeParameters_Description}

Inheritance: ParametersBase
        //制作满足条件国家的人口密度专题图,并显示国家标签
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            //标签专题图
            ThemeLabel label = new ThemeLabel()
            {
                Caption = "标签专题图",
                Expression = "Country",
                Display = new ServerTextStyle()
                {
                    FontHeight = 10,
                    FontWidth = 0,
                    Color = new ServerColor(0, 0, 0),
                    FontName = "微软雅黑"
                },
                Filter = "SmID > 220",
            };

            ThemeDotDensity dotDensity = new ThemeDotDensity()
            {
                Caption = "点密度专题图",
                Expression = "Pop_1994",
                DotStyle = new ServerStyle()
                {
                    SymbolSize = 20,
                    SymbolStyle = 1,
                },
                DotValue = 11281396.89000,
                Filter = "SmID > 220",
            };

            CompositeParam composite = new CompositeParam()
            {
                ThemeLayer = "World@world",
                Themes = new List<Theme> { label, dotDensity },
            };

            CompositeThemeParameters parameters = new CompositeThemeParameters()
            {
                LayerNames = layerNames,
                MapName = "World",
                ParamList = new List<CompositeParam>(){composite},
            };

            //与服务器交互
            CompositeThemeService service = new CompositeThemeService("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)
        {
            CompositeThemeParameters clearThemeParameters = new CompositeThemeParameters()
            {
                LayerNames = layerNames,
                MapName = "World",
                ParamList = null,
            };

            //与服务器交互
            CompositeThemeService service = new CompositeThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(clearThemeParameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
 /// <summary>${IS6_CompositeThemeService_method_ProcessAsync_D}</summary>
 /// <overloads>${IS6_CompositeThemeService_method_ProcessAsync_overloads_D}</overloads>
 /// <param name="parameters">${IS6_CompositeThemeService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(CompositeThemeParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
 /// <summary>${IS6_CompositeThemeService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${IS6_CompositeThemeService_method_ProcessAsync_param_parameters}</param>
 /// <param name="state">${IS6_CompositeThemeService_method_ProcessAsync_param_state}</param>
 public void ProcessAsync(CompositeThemeParameters parameters, object state)
 {
     if (parameters == null)
     {
         //TODO:资源
         //throw new ArgumentNullException("CompositeThemeParameters 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);
 }
        private Dictionary<string, string> GetParameters(CompositeThemeParameters 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.LayerNames != null && parameters.LayerNames.Count > 0 && parameters.ParamList != null && parameters.ParamList.Count > 0)
            {
                //遍历每个图层;
                for (int k = 0; k < parameters.LayerNames.Count; k++)
                {
                    for (int i = 0; i < parameters.ParamList.Count; i++)
                    {
                        //找要做专题图的图层;
                        if (parameters.LayerNames[k] == parameters.ParamList[i].ThemeLayer)
                        {
                            List<string> temp = new List<string>();
                            //遍历图层上的每个专题图;
                            for (int j = 0; j < parameters.ParamList[i].Themes.Count; j++)
                            {
                                #region
                                if (parameters.ParamList[i].Themes[j] is ThemeUnique)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeUnique\":{0}", ThemeUnique.ToJson((ThemeUnique)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeRange)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeRange\":{0}", ThemeRange.ToJson((ThemeRange)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeLabel)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeLabel\":{0}", ThemeLabel.ToJson((ThemeLabel)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeGraph)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeGraph\":{0}", ThemeGraph.ToJson((ThemeGraph)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeDotDensity)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeDotDensity\":{0}", ThemeDotDensity.ToJson((ThemeDotDensity)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeGraduatedSymbol)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeGraduatedSymbol\":{0}", ThemeGraduatedSymbol.ToJson((ThemeGraduatedSymbol)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                else if (parameters.ParamList[i].Themes[j] is ThemeGridRange)
                                {
                                    StringBuilder sb = new StringBuilder();
                                    sb.AppendFormat("\"themeGridRange\":{0}", ThemeGridRange.ToJson((ThemeGridRange)parameters.ParamList[i].Themes[j]));
                                    temp.Add(sb.ToString());
                                }
                                #endregion
                            }

                            string str = "{";
                            str += string.Join(",", temp.ToArray());
                            str += "}";
                            list.Add(str);
                        }
                        else
                        {
                            list.Add(string.Format("\"{0}\"", "!@"));
                        }
                    }
                }
            }

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

            dictionary.Add("layers", json);
            dictionary.Add("layersKey", "0");
            dictionary.Add("bModifiedByServer", "false");

            return dictionary;
        }