SuperMap.Web.iServerJava6R.ThemeGridRange.ToJson C# (CSharp) Method

ToJson() static private method

static private ToJson ( ThemeGridRange themeGridRange ) : string
themeGridRange ThemeGridRange
return string
        internal static string ToJson(ThemeGridRange themeGridRange)
        {
            string json = "{";
            List<string> list = new List<string>();

            if (themeGridRange.Items != null && themeGridRange.Items.Count >= 1)
            {
                List<string> tempTUI = new List<string>();
                foreach (var item in themeGridRange.Items)
                {
                    tempTUI.Add(ThemeGridRangeItem.ToJson(item));
                }

                list.Add(string.Format("\"items\":[{0}]", String.Join(",", tempTUI.ToArray())));
            }
            else
            {
                list.Add("\"items\":[]");
            }

            list.Add(string.Format("\"rangeParameter\":\"{0}\"", themeGridRange.RangeParameter.ToString(System.Globalization.CultureInfo.InvariantCulture)));

            list.Add(string.Format("\"rangeMode\":\"{0}\"", themeGridRange.RangeMode));
            list.Add(string.Format("\"colorGradientType\":\"{0}\"", themeGridRange.ColorGradientType.ToString()));

            list.Add("\"type\":\"GRIDRANGE\"");
            list.Add(string.Format("\"reverseColor\":\"{0}\"",themeGridRange.ReverseColor.ToString()));

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

            return json;
        }