public override void Write(IGeometry geometry, Stream stream) { BinaryWriter writer = null; try { if (encodingType == ByteOrder.LittleEndian) { writer = new BinaryWriter(stream); } else { writer = new BEBinaryWriter(stream); } Write(geometry, writer); writer.Write(geometry.SRID); } finally { if (writer != null) { writer.Close(); } } }
/// <summary> /// Writes a binary encoded PostGIS of a given geometry. /// </summary> /// <param name="geometry"></param> /// <param name="stream"></param> /// <returns></returns> public void Write(IGeometry geometry, Stream stream) { BinaryWriter writer = null; try { if (encodingType == ByteOrder.LittleEndian) writer = new BinaryWriter(stream); else writer = new BEBinaryWriter(stream); Write(geometry, writer); } finally { if (writer != null) writer.Close(); } }
public override void Write(IGeometry geometry, Stream stream) { BinaryWriter writer; if (this.encodingType == ByteOrder.LittleEndian) { writer = new BinaryWriter(stream); } else { writer = new BEBinaryWriter(stream); } using (writer) { writer.Write(geometry.SRID < 0 ? 0 : geometry.SRID); if (geometry.IsEmpty) { WriteGeometryCollectionEmpty(geometry, writer); } else { Write(geometry, writer); } } }