示例#1
0
 /// <summary>
 /// Returns the <strong>Well Known Text</strong> string representation of the specified <paramref name="lineString"/>.
 /// </summary>
 /// <param name="lineString">The line string to be converted.</param>
 /// <param name="formatting">The formatting to be used.</param>
 /// <param name="indentation">The indendatation to be used.</param>
 /// <returns>The line string formatted as a <strong>Well Known Text</strong> string.</returns>
 protected string ToString(WktLineString lineString, WktFormatting formatting, int indentation)
 {
     if (formatting == WktFormatting.Indented)
     {
         throw new NotImplementedException("Indented formatting is currently not supported");
     }
     return("(" + string.Join(formatting == WktFormatting.Indented ? "," : ", ", from point in lineString select string.Format(CultureInfo.InvariantCulture, "{0} {1}", point.X, point.Y)) + ")");
 }
示例#2
0
 /// <summary>
 /// Returns the <strong>Well Known Text</strong> string representation of the specified <paramref name="point"/>.
 /// </summary>
 /// <param name="point">The point to be converted.</param>
 /// <param name="formatting">The formatting to be used.</param>
 /// <param name="indentation">The indendatation to be used.</param>
 /// <returns>The point formatted as a <strong>Well Known Text</strong> string.</returns>
 protected string ToString(WktPoint point, WktFormatting formatting, int indentation)
 {
     if (formatting == WktFormatting.Indented)
     {
         throw new NotImplementedException("Indented formatting is currently not supported");
     }
     return(string.Format(CultureInfo.InvariantCulture, "({0} {1})", point.X, point.Y));
 }
        /// <summary>
        /// Returns the <strong>Well Known Text</strong> string representation of this polygon.
        /// </summary>
        /// <param name="formatting">The formatting to be used.</param>
        /// <returns>The polygon formatted as a <strong>Well Known Text</strong> string.</returns>
        public string ToString(WktFormatting formatting)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("POLYGON");

            if (formatting != WktFormatting.Minified || Outer.Length == 0)
            {
                sb.Append(" ");
            }

            sb.Append(Outer.Length == 0 ? "EMPTY" : ToString(this, formatting, 0));

            return(sb.ToString());
        }
        /// <summary>
        /// Returns the <strong>Well Known Text</strong> string representation of this multi polygon geometry.
        /// </summary>
        /// <param name="formatting">The formatting to be used.</param>
        /// <returns>The line string formatted as a <strong>Well Known Text</strong> string.</returns>
        public string ToString(WktFormatting formatting)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("MULTIPOLYGON ");

            if (_polygons.Count == 0)
            {
                sb.Append("EMPTY");
            }
            else
            {
                sb.Append("(" + string.Join(formatting == WktFormatting.Minified ? "," : ", ", from polygon in _polygons select ToString(polygon, formatting, 1)) + ")");
            }

            return(sb.ToString());
        }
示例#5
0
        /// <summary>
        /// Returns the <strong>Well Known Text</strong> string representation of the specified <paramref name="polygon"/>.
        /// </summary>
        /// <param name="polygon">The polygon to be converted.</param>
        /// <param name="formatting">The formatting to be used.</param>
        /// <param name="indentation">The indendatation to be used.</param>
        /// <returns>The polygon formatted as a <strong>Well Known Text</strong> string.</returns>
        protected string ToString(WktPolygon polygon, WktFormatting formatting, int indentation)
        {
            if (formatting == WktFormatting.Indented)
            {
                throw new NotImplementedException("Indented formatting is currently not supported");
            }

            List <string> temp = new List <string>();

            temp.Add(ToString(polygon.Outer, formatting, indentation));

            foreach (WktPoint[] array in polygon.Inner)
            {
                temp.Add(ToString(array, formatting, indentation));
            }

            return("(" + string.Join(formatting == WktFormatting.Minified ? "," : ", ", temp) + ")");
        }
示例#6
0
        /// <summary>
        /// Returns the <strong>Well Known Text</strong> string representation of this multi point geometry.
        /// </summary>
        /// <param name="formatting">The formatting to be used.</param>
        /// <returns>The multi point geometry formatted as a <strong>Well Known Text</strong> string.</returns>
        public string ToString(WktFormatting formatting)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("MULTIPOINT");

            if (_points.Count == 0)
            {
                sb.Append(" EMPTY");
            }
            else
            {
                if (formatting != WktFormatting.Minified)
                {
                    sb.Append(" ");
                }

                sb.Append("(" + string.Join(", ", from point in _points select string.Format(CultureInfo.InvariantCulture, "{0} {1}", point.X, point.Y)) + ")");
            }

            return(sb.ToString());
        }
 /// <summary>
 /// Returns the <strong>Well Known Text</strong> string representation of this line string.
 /// </summary>
 /// <param name="formatting">The formatting to be used.</param>
 /// <returns>The line string formatted as a <strong>Well Known Text</strong> string.</returns>
 public string ToString(WktFormatting formatting)
 {
     return("LINESTRING " + (_points.Count == 0 ? "EMPTY" : ToString(this, formatting, 0)));
 }
示例#8
0
 /// <summary>
 /// Returns the <strong>Well Known Text</strong> string representation of the multi line string.
 /// </summary>
 /// <param name="formatting">The formatting to be used.</param>
 /// <returns>The multi line string formatted as a <strong>Well Known Text</strong> string.</returns>
 public string ToString(WktFormatting formatting)
 {
     return("MULTILINESTRING " + (_lines.Count == 0 ? "EMPTY" : "(" + string.Join(", ", from line in _lines select ToString(line, formatting, 0)) + ")"));
 }