${IS6_ThemeUnique_Title}

${IS6_ThemeUnique_Description}

${IS6_ThemeUnique_Description_1}

Наследование: Theme
        //单值专题图
        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);
        }
        /// <summary>${IS6_ThemeUnique_method_FromJson_D}</summary>
        /// <returns>${IS6_ThemeUnique_method_FromJson_return}</returns>
        /// <param name="jsonObject">${IS6_ThemeUnique_method_FromJson_param_jsonObject}</param>
        public static ThemeUnique FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            ThemeUnique result = new ThemeUnique
            {
                Expression = (string)jsonObject["expression"],
                DefaultStyle = ServerStyle.FromJson((JsonObject)jsonObject["defaultStyle"]),
                OnTop = (bool)jsonObject["onTop"],

                Caption = (string)jsonObject["caption"],
                Filter = (string)jsonObject["filter"],
                MaxScale = (double)jsonObject["maxScale"],
                MinScale = (double)jsonObject["minScale"],
                ForeignDataParam = ForeignDataParam.FromJson((JsonObject)jsonObject["foreignDataParam"])
            };

            if (jsonObject.ContainsKey("itemCaptions") && jsonObject["itemCaptions"] != null && jsonObject["itemCaptions"].Count > 0)
            {
                result.ItemCaptions = new List<string>();
                for (int i = 0; i < jsonObject["itemCaptions"].Count; i++)
                {
                    result.ItemCaptions.Add((string)jsonObject["itemCaptions"][i]);
                }
            }
            if (jsonObject.ContainsKey("values") && jsonObject["values"] != null && jsonObject["values"].Count > 0)
            {
                result.Values = new List<string>();
                for (int i = 0; i < jsonObject["values"].Count; i++)
                {
                    result.Values.Add((string)jsonObject["values"][i]);
                }
            }
            if (jsonObject.ContainsKey("displays") && jsonObject["displays"] != null && jsonObject["displays"].Count > 0)
            {
                result.Displays = new List<ServerStyle>();
                for (int i = 0; i < jsonObject["displays"].Count; i++)
                {
                    result.Displays.Add(ServerStyle.FromJson((JsonObject)jsonObject["displays"][i]));
                }
            }

            return result;
        }
        internal static string ToJson(ThemeUnique param)
        {
            if (param == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();

            if (!string.IsNullOrEmpty(param.Expression))
            {
                list.Add(string.Format("\"expression\":\"{0}\"", param.Expression));
            }

            if (param.DefaultStyle != null)
            {
                list.Add(string.Format("\"defaultStyle\":{0}", ServerStyle.ToJson(param.DefaultStyle)));
            }

            if (param.ItemCaptions != null)
            {
                List<string> temp = new List<string>();
                for (int i = 0; i < param.ItemCaptions.Count; i++)
                {
                    temp.Add(string.Format("\"{0}\"", param.ItemCaptions[i]));
                }
                list.Add(string.Format("\"itemCaptions\":[{0}]", string.Join(",", temp.ToArray())));

            }
            else
            {
                list.Add("\"itemCaptions\":null");
            }

            list.Add(string.Format("\"onTop\":{0}", param.OnTop.ToString().ToLower()));

            if (param.Values != null && param.Values.Count > 0)
            {
                List<string> temp = new List<string>();
                for (int i = 0; i < param.Values.Count; i++)
                {
                    temp.Add(string.Format("\"{0}\"", param.Values[i]));
                }
                list.Add(string.Format("\"values\":[{0}]", string.Join(",", temp.ToArray())));
            }

            if (param.Displays != null && param.Displays.Count > 0)
            {
                List<string> l = new List<string>();
                for (int i = 0; i < param.Displays.Count; i++)
                {
                    l.Add(ServerStyle.ToJson(param.Displays[i]));
                }
                list.Add(string.Format("\"displays\":{0}", JsonHelper.FromIList(l)));
            }

            json += string.Join(",", list.ToArray());
            json += ",";
            json += Theme.AddList(param);
            json += "}";

            return json;
        }