Beispiel #1
0
        /// <summary>
        /// Converts Polygon to WKT format and appends WKT representation to the output stream.
        /// </summary>
        /// <param name="polygon">The Polygon to be converted.</param>
        /// <param name="writer">The output Stream to Append WKT representation to.</param>
        private static void AppendPolygonTaggedText(IPolygon polygon, TextWriter writer)
        {
            writer.Write("polygon ");

            string dimension = WktWriter.GetDimensionText(polygon);

            if (string.IsNullOrEmpty(dimension) == false)
            {
                writer.Write(dimension);
                writer.Write(" ");
            }

            WktWriter.AppendPolygonText(polygon, writer);
        }
Beispiel #2
0
        /// <summary>
        /// Converts MultiPolygon's content to WKT format and appends WKT representation to the output stream.
        /// </summary>
        /// <param name="multipolygon">The MultiPolygon to be converted.</param>
        /// <param name="writer">The output Stream to Append WKT representation to.</param>
        private static void AppendMultiPolygonText(IMultiPolygon multipolygon, TextWriter writer)
        {
            if (multipolygon.Geometries.Count() == 0)
            {
                writer.Write("empty");
            }
            else
            {
                writer.Write("(");

                WktWriter.AppendPolygonText(multipolygon.Geometries.First(), writer);

                foreach (var polygon in multipolygon.Geometries.Skip(1))
                {
                    writer.Write(",");
                    WktWriter.AppendPolygonText(polygon, writer);
                }

                writer.Write(")");
            }
        }