${IS6_ThemeRange_Title}

${IS6_ThemeRange_Description}

${IS6_ThemeRange_Description_1}

상속: Theme
        //范围分段专题图
        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);
        }
        /// <summary>${IS6_ThemeRange_method_FromJson_D}</summary>
        /// <returns>${IS6_ThemeRange_method_FromJson_return}</returns>
        /// <param name="jsonObject">${IS6_ThemeRange_method_FromJson_param_jsonObject}</param>
        public static ThemeRange FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            ThemeRange result = new ThemeRange
            {
                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("breakValues") && jsonObject["breakValues"] != null && jsonObject["breakValues"].Count > 0)
            {
                result.BreakValues = new List<double>();
                for (int i = 0; i < jsonObject["breakValues"].Count; i++)
                {
                    result.BreakValues.Add((double)jsonObject["breakValues"][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]));
                }
            }

            result.Expression = (string)jsonObject["expression"];

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

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

            if (param.Displays.Count > 0 && param.Displays != null)
            {
                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)));
            }

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

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

            return json;
        }