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

ToJson() static private method

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

            if (!string.IsNullOrEmpty(themeLabelItem.Caption))
            {
                list.Add(string.Format("\"caption\":\"{0}\"", themeLabelItem.Caption));
            }
            else
            {
                list.Add("\"caption\":\"\"");
            }

            if (themeLabelItem.Style != null)
            {
                list.Add(string.Format("\"style\":{0}", ServerTextStyle.ToJson(themeLabelItem.Style)));
            }
            else
            {
                list.Add(string.Format("\"style\":{0}", ServerTextStyle.ToJson(new ServerTextStyle())));
            }

            list.Add(string.Format("\"visible\":{0}", themeLabelItem.Visible.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));

            list.Add(string.Format("\"end\":\"{0}\"", themeLabelItem.End.ToString(System.Globalization.CultureInfo.InvariantCulture)));

            list.Add(string.Format("\"start\":\"{0}\"", themeLabelItem.Start.ToString(System.Globalization.CultureInfo.InvariantCulture)));

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