Beispiel #1
0
 private static void WriteMultiPolygon(ShapeData polys, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     sb.Append("MULTIPOLYGON ");
     if (polys.Shapes.Length < 2)
     {
         sb.Append("EMPTY");
     }
     else
     {
         sb.Append('(');
         for (int i = 1; i < polys.Shapes.Length; i++)
         {
             if (i > 1)
             {
                 sb.Append(", ");
             }
             var poly = polys.GetGeometryN(i);
             if (poly.IsEmpty)
             {
                 sb.Append("EMPTY");
             }
             else
             {
                 sb.Append('(');
                 WritePolygonContents(poly, sb, includeZ, includeM, order);
                 sb.Append(')');
             }
         }
         sb.Append(')');
     }
 }
Beispiel #2
0
 private static void WriteMultiLineString(ShapeData lines, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     sb.Append("MULTILINESTRING ");
     if (lines.Shapes.Length < 2)
     {
         sb.Append("EMPTY");
     }
     else
     {
         sb.Append('(');
         for (int i = 1; i < lines.Shapes.Length; i++)
         {
             if (i > 1)
             {
                 sb.Append(", ");
             }
             var line = lines.GetGeometryN(i);
             if (line.IsEmpty)
             {
                 sb.Append("EMPTY");
             }
             else
             {
                 sb.Append('(');
                 WriteCoordinateCollection(GetVertices(line), sb, includeZ, includeM, order);
                 sb.Append(')');
             }
         }
         sb.Append(')');
     }
 }
Beispiel #3
0
 private static void WriteMultiPoint(ShapeData points, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     sb.Append("MULTIPOINT ");
     if (points.Shapes.Length < 2)
     {
         sb.Append("EMPTY");
     }
     else
     {
         sb.Append('(');
         for (int i = 1; i < points.Shapes.Length; i++)
         {
             if (i > 1)
             {
                 sb.Append(", ");
             }
             var p = points.GetGeometryN(i);
             if (p.IsEmpty)
             {
                 sb.Append("EMPTY");
             }
             else
             {
                 sb.Append('(');
                 WriteCoordinate(p.GetPointN(1), sb, includeZ, includeM, order);
                 sb.Append(')');
             }
         }
         sb.Append(')');
     }
 }
 private static void WriteGeometryCollection(ShapeData geoms, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     for (int i = 0; i < geoms.NumGeometries; i++)
     {
         if (i > 0)
         {
             sb.Append(",");
         }
         WriteGeometry(geoms.GetGeometryN(i + 1), sb, includeZ, includeM, order);
     }
 }
 private static void WriteMultiPolygon(ShapeData polys, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     sb.Append('(');
     for (int i = 0; i < polys.NumGeometries; i++)
     {
         if (i > 0)
         {
             sb.Append("),(");
         }
         WritePolygonContents(polys.GetGeometryN(i + 1), sb, includeZ, includeM, order);
     }
     sb.Append(')');
 }
Beispiel #6
0
 private static void WriteGeometryCollection(ShapeData geoms, StringBuilder sb, bool includeZ, bool includeM, CoordinateOrder order)
 {
     sb.Append("GEOMETRYCOLLECTION ");
     if (geoms.Shapes.Length < 2)
     {
         sb.Append("EMPTY");
     }
     else
     {
         sb.Append('(');
         for (int i = 1; i < geoms.Shapes.Length; i++)
         {
             if (i > 1)
             {
                 sb.Append(", ");
             }
             var geom = geoms.GetGeometryN(i);
             WriteGeometry(geom, sb, includeZ, includeM, order);
             i += geom.Shapes.Length - 1;
         }
         sb.Append(')');
     }
 }