/// <summary> /// Reads Polygon from the reader. /// </summary> /// <param name="reader">The reader used to read data from input stream.</param> /// <param name="is3D">bool value indicating whether polygon beeing read has Z-dimension.</param> /// <param name="isMeasured">bool value indicating whether polygon beeing read has M-value.</param> /// <returns>Polygon read from the input.</returns> private static Polygon ReadPolygon(BinaryReader reader, bool is3D, bool isMeasured) { int ringsCount = (int)reader.ReadUInt32(); if (ringsCount == 0) { return(new Polygon()); } IEnumerable <Coordinate> exterior = WkbReader.ReadCoordinates(reader, is3D, isMeasured); Polygon result = new Polygon(new CoordinateList(exterior)); for (int i = 1; i < ringsCount; i++) { IEnumerable <Coordinate> interior = WkbReader.ReadCoordinates(reader, is3D, isMeasured); result.InteriorRings.Add(new CoordinateList(interior)); } return(result); }
/// <summary> /// Reads LineString from the reader. /// </summary> /// <param name="reader">The reader used to read data from input stream.</param> /// <param name="is3D">bool value indicating whether linestring beeing read has Z-dimension.</param> /// <param name="isMeasured">bool value indicating whether linestring beeing read has M-value.</param> /// <returns>Linestring read from the input.</returns> private static LineString ReadLineString(BinaryReader reader, bool is3D, bool isMeasured) { IEnumerable <Coordinate> coordinates = WkbReader.ReadCoordinates(reader, is3D, isMeasured); return(new LineString(coordinates)); }