${iServer2_Theme_ThemeRange_Title}

${iServer2_Theme_ThemeRange_Description}

Inheritance: Theme
        //制作范围分段专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            ThemeRange themerange = new ThemeRange
            {
                RangeExpression = "Pop_1994",
                MakeDefaultParam = new ThemeRangeParam
                {
                    LayerName = "World@world",
                    ColorGradientType = ColorGradientType.RainBow,
                    RangeMode = RangeMode.Equalinterval,
                    RangeParameter = 5
                },
            };

            ThemeParameters parameters = new ThemeParameters
            {
                MapName = "World",
                LayerName = "World@world" ,
                Theme = themerange
            };

            //与服务器交互
            ThemeService themeService = new ThemeService("http://localhost:7080/demo");
            themeService.ProcessAsync(parameters);
            themeService.Failed += new EventHandler<ServiceFailedEventArgs>(themeService_Failed);
            themeService.ProcessCompleted += new EventHandler<ThemeEventArgs>(themeService_ProcessCompleted);
        }
        internal static string ToJson(ThemeRange themeRange)
        {
            if (themeRange == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();
            if (themeRange.RangeExpression != null)
            {
                list.Add(string.Format("\"rangeExpression\":\"{0}\"", themeRange.RangeExpression));
            }

            if (themeRange.Items != null && themeRange.Items.Count > 0)
            {
                List<string> tempTUI = new List<string>();
                foreach (ThemeRangeItem item in themeRange.Items)
                {
                    tempTUI.Add(ThemeRangeItem.ToJson(item));
                }
                list.Add(string.Format("\"items\":[{0}]", string.Join(",", tempTUI.ToArray())));
            }
            else
            {
                list.Add(string.Format("\"items\":[]"));
            }

            list.Add(string.Format("\"themeType\":2"));

            if (themeRange.MakeDefaultParam != null)
            {
                list.Add(string.Format("\"makeDefaultParam\":{0}", ThemeRangeParam.ToJson(themeRange.MakeDefaultParam)));
            }
            json += string.Join(",", list.ToArray());
            json += "}";

            return json;
        }
        /// <summary>${iServer2_ThemeRange_method_FromJson_D}</summary>
        /// <returns>${iServer2_ThemeRange_method_FromJson_return}</returns>
        /// <param name="jsonObject">${iServer2_ThemeRange_method_FromJson_param_jsonObject}</param>
        public static ThemeRange FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }
            ThemeRange result = new ThemeRange();

            result.RangeExpression = (string)jsonObject["rangeExpression"];

            if (jsonObject.ContainsKey("items") && jsonObject["items"] != null)
            {
                result.Items = new List<ThemeRangeItem>();
                for (int i = 0; i < jsonObject["items"].Count; i++)
                {
                    result.Items.Add(ThemeRangeItem.FromJson((JsonObject)jsonObject["items"][i]));
                }
            }

            result.MakeDefaultParam = ThemeRangeParam.FromJson((JsonObject)jsonObject["makeDefaultParam"]);

            return result;
        }