static Position ReadPosition(NpgsqlReadBuffer buf, EwkbGeometryType type, bool littleEndian) { var position = new Position( longitude: buf.ReadDouble(littleEndian), latitude: buf.ReadDouble(littleEndian), altitude: HasZ(type) ? buf.ReadDouble() : (double?)null); if (HasM(type)) buf.ReadDouble(littleEndian); return position; }
static int SizeOfPoint(EwkbGeometryType type) { var size = SizeOfPoint2D; if (HasZ(type)) size += sizeof(double); if (HasM(type)) size += sizeof(double); return size; }
static bool HasM(EwkbGeometryType type) => (type & EwkbGeometryType.HasM) != 0;
static bool HasSrid(EwkbGeometryType type) => (type & EwkbGeometryType.HasSrid) != 0;