Index: src/Common/SharpMap/Converters/WellKnownBinary/GeometryToWKB.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/SharpMap/Converters/WellKnownBinary/GeometryToWKB.cs (.../GeometryToWKB.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/SharpMap/Converters/WellKnownBinary/GeometryToWKB.cs (.../GeometryToWKB.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -40,56 +40,55 @@ namespace SharpMap.Converters.WellKnownBinary { + /// + /// Converts a instance to a Well-known Binary string representation. + /// + /// + /// The Well-known Binary Representation for (WKBGeometry) provides a portable + /// representation of a value as a contiguous stream of bytes. It permits + /// values to be exchanged between an ODBC client and an SQL database in binary form. + /// The Well-known Binary Representation for is obtained by serializing a + /// instance as a sequence of numeric types drawn from the set {Unsigned Integer, Double} and + /// then serializing each numeric type as a sequence of bytes using one of two well defined, + /// standard, binary representations for numeric types (NDR, XDR). The specific binary encoding + /// (NDR or XDR) used for a geometry byte stream is described by a one byte tag that precedes + /// the serialized bytes. The only difference between the two encodings of geometry is one of + /// byte order, the XDR encoding is Big Endian, the NDR encoding is Little Endian. + /// + public class GeometryToWKB + { + //private const byte WKBByteOrder = 0; - /// - /// Converts a instance to a Well-known Binary string representation. - /// - /// - /// The Well-known Binary Representation for (WKBGeometry) provides a portable - /// representation of a value as a contiguous stream of bytes. It permits - /// values to be exchanged between an ODBC client and an SQL database in binary form. - /// The Well-known Binary Representation for is obtained by serializing a - /// instance as a sequence of numeric types drawn from the set {Unsigned Integer, Double} and - /// then serializing each numeric type as a sequence of bytes using one of two well defined, - /// standard, binary representations for numeric types (NDR, XDR). The specific binary encoding - /// (NDR or XDR) used for a geometry byte stream is described by a one byte tag that precedes - /// the serialized bytes. The only difference between the two encodings of geometry is one of - /// byte order, the XDR encoding is Big Endian, the NDR encoding is Little Endian. - /// - public class GeometryToWKB - { - //private const byte WKBByteOrder = 0; + /// + /// Writes a geometry to a byte array using little endian byte encoding + /// + /// The geometry to write + /// WKB representation of the geometry + public static byte[] Write(IGeometry geometry) + { + return Write(geometry, WkbByteOrder.Ndr); + } - /// - /// Writes a geometry to a byte array using little endian byte encoding - /// - /// The geometry to write - /// WKB representation of the geometry - public static byte[] Write(IGeometry geometry) - { - return Write(geometry, WkbByteOrder.Ndr); - } + /// + /// Writes a geometry to a byte array using the specified encoding. + /// + /// The geometry to write + /// Byte order + /// WKB representation of the geometry + public static byte[] Write(IGeometry geometry, WkbByteOrder wkbByteOrder) + { + byte[] result = null; + switch (wkbByteOrder) + { + case WkbByteOrder.Ndr: + result = new WKBWriter(ByteOrder.LittleEndian).Write(geometry); + break; + case WkbByteOrder.Xdr: + result = new WKBWriter(ByteOrder.BigEndian).Write(geometry); + break; + } + return result; - /// - /// Writes a geometry to a byte array using the specified encoding. - /// - /// The geometry to write - /// Byte order - /// WKB representation of the geometry - public static byte[] Write(IGeometry geometry, WkbByteOrder wkbByteOrder) - { - byte[] result = null; - switch (wkbByteOrder) - { - case WkbByteOrder.Ndr: - result = new WKBWriter(ByteOrder.LittleEndian).Write(geometry); - break; - case WkbByteOrder.Xdr: - result = new WKBWriter(ByteOrder.BigEndian).Write(geometry); - break; - } - return result; - // MemoryStream ms = new MemoryStream(); // BinaryWriter bw = new BinaryWriter(ms); // @@ -103,9 +102,10 @@ // WriteGeometry(g, bw, wkbByteOrder); // // return ms.ToArray(); - } -// #region Methods + } + // +// #region Methods // /// // /// Writes the type number for this geometry. // /// @@ -379,5 +379,5 @@ // else // writer.Write(value); // } - } -} + } +} \ No newline at end of file