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

ToJson() static private method

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

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

            if (!string.IsNullOrEmpty(graphItem.GraphExpression))
            {
                list.Add(string.Format("\"graphExpression\":\"{0}\"", graphItem.GraphExpression));
            }
            else
            {
                list.Add("\"graphExpression\":null");
            }

            //if (graphItem.RangeSetting != null)
            //{
            //    list.Add(string.Format("\"rangeSetting\":{0}", ThemeRange.ToJson(graphItem.RangeSetting)));
            //}
            //else
            //{
            //    list.Add("\"rangeSetting\":null");
            //}

            if (graphItem.UniformStyle != null)
            {
                list.Add(string.Format("\"uniformStyle\":{0}", ServerStyle.ToJson(graphItem.UniformStyle)));
            }
            else
            {
                list.Add(string.Format("\"uniformStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (graphItem.MemoryDoubleValues != null && graphItem.MemoryDoubleValues.Count > 0)
            {
                list.Add(string.Format("\"memoryDoubleValues\":[{0}]", string.Join(",", graphItem.MemoryDoubleValues)));
            }
            else
            {
                list.Add("\"memoryDoubleValues\":null");
            }
            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }