SuperMap.Web.iServerJava2.ServerStyle.ToJson C# (CSharp) Method

ToJson() static private method

static private ToJson ( ServerStyle serverStyle ) : string
serverStyle ServerStyle
return string
        internal static string ToJson(ServerStyle serverStyle)
        {
            if (serverStyle == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();

            list.Add(string.Format("\"fillGradientAngle\":{0}", serverStyle.FillGradientAngle));

            if (ServerColor.ToJson(serverStyle.FillBackColor) != null)
            {
                list.Add(string.Format("\"fillBackColor\":{0}", ServerColor.ToJson(serverStyle.FillBackColor)));
            }

            list.Add(string.Format("\"fillBackOpaque\":{0}", serverStyle.FillBackOpaque));

            list.Add(string.Format("\"fillGradientOffsetRatioX\":{0}", serverStyle.FillGradientOffsetRatioX));

            list.Add(string.Format("\"fillGradientOffsetRatioY\":{0}", serverStyle.FillGradientOffsetRatioY));

            if (ServerColor.ToJson(serverStyle.FillForeColor) != null)
            {
                list.Add(string.Format("\"fillForeColor\":{0}", ServerColor.ToJson(serverStyle.FillForeColor)));
            }

            list.Add(string.Format("\"fillOpaqueRate\":{0}", serverStyle.FillOpaqueRate));

            list.Add(string.Format("\"fillSymbolID\":{0}", serverStyle.FillSymbolID));

            if (ServerColor.ToJson(serverStyle.LineColor) != null)
            {
                list.Add(string.Format("\"lineColor\":{0}", ServerColor.ToJson(serverStyle.LineColor)));
            }
            list.Add(string.Format("\"lineSymbolID\":{0}", serverStyle.LineSymbolID));

            list.Add(string.Format("\"lineWidth\":{0}", serverStyle.LineWidth));

            list.Add(string.Format("\"markerAngle\":{0}", serverStyle.MarkerAngle));

            list.Add(string.Format("\"markerSize\":{0}", serverStyle.MarkerSize));
            list.Add(string.Format("\"fillGradientMode\":{0}", (int)serverStyle.FillGradientMode));

            list.Add(string.Format("\"markerSymbolID\":{0}", serverStyle.MarkerSymbolID));

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