Google.Maps.StaticMaps.StaticMapRequest.GetPathsStr C# (CSharp) Méthode

GetPathsStr() private méthode

Builds path uri parameter
private GetPathsStr ( ) : string
Résultat string
        private string GetPathsStr()
        {
            if(this.Paths == null || this.Paths.Count == 0) return null;

            string[] pathParam = new string[this.Paths.Count];
            int pathParamIndex = 0;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            foreach(Path currentPath in this.Paths)
            {
                sb.Length = 0;

                if(currentPath.Color.Equals(Color.Empty) == false)
                {
                    sb.Append("color:").Append(GetColorEncoded(currentPath.Color, true));
                }

                if(currentPath.FillColor.Equals(Color.Empty) == false)
                {
                    if(sb.Length > 0) sb.Append(Constants.PIPE_URL_ENCODED);
                    sb.Append("fillcolor:").Append(GetColorEncoded(currentPath.FillColor, false));
                }

                if(currentPath.Encode.GetValueOrDefault() == true)
                {
                    string encodedValue = GetPathEncoded(currentPath);

                    if(sb.Length > 0) sb.Append(Constants.PIPE_URL_ENCODED);
                    sb.Append(Constants.PATH_ENCODED_PREFIX).Append(encodedValue);
                }
                else
                {
                    if(currentPath.Encode == null && currentPath.Points.Count > 10)
                    {
                        IEnumerable<LatLng> positionCollection;
                        if(ConvertUtil.TryCast<Location, LatLng>(currentPath.Points, out positionCollection) == true)
                        {
                            string encodedValue = PolylineEncoder.EncodeCoordinates(positionCollection);
                            if(sb.Length > 0) sb.Append(Constants.PIPE_URL_ENCODED);
                            sb.Append(Constants.PATH_ENCODED_PREFIX).Append(encodedValue);
                        }

                    }

                    foreach(Location loc in currentPath.Points)
                    {
                        if(sb.Length > 0) sb.Append(Constants.PIPE_URL_ENCODED);
                        sb.Append(loc.GetAsUrlParameter());
                    }

                }

            skipster:
                pathParam[pathParamIndex++] = "path=" + sb.ToString();
            }

            return string.Join("&", pathParam);
        }