s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
35 lines • 2.3 kB
TypeScript
export {};
declare global {
/** Extend the DataView interface */
interface DataView {
getBigInt64: (byteOffset: number, littleEndian?: boolean) => bigint;
getBigUint64: (byteOffset: number, littleEndian?: boolean) => bigint;
getFloat32: (byteOffset: number, littleEndian?: boolean) => number;
getFloat64: (byteOffset: number, littleEndian?: boolean) => number;
getInt16: (byteOffset: number, littleEndian?: boolean) => number;
getInt32: (byteOffset: number, littleEndian?: boolean) => number;
getInt8: (byteOffset: number) => number;
getUint16: (byteOffset: number, littleEndian?: boolean) => number;
getUint32: (byteOffset: number, littleEndian?: boolean) => number;
getUint8: (byteOffset: number) => number;
/**
* Retrieves a 16-bit floating point number (Float16) at the specified byte offset from the start of the view.
* This method reads two bytes from the buffer, converts them into a 16-bit floating-point number,
* and returns the corresponding 32-bit floating-point representation.
* @param byteOffset - The offset, in bytes, from the start of the DataView to read the value from.
* @param littleEndian - If true, the value is read as little-endian. Otherwise, it's read as big-endian.
* @returns The converted 32-bit floating-point number (Float32) corresponding to the 16-bit value.
*/
getFloat16(byteOffset: number, littleEndian?: boolean): number;
/**
* Stores a 16-bit floating point number (Float16) at the specified byte offset in the DataView.
* This method converts a 32-bit floating-point number (Float32) to a 16-bit floating-point representation,
* then writes the resulting 16-bit value into the buffer at the specified offset.
* @param byteOffset - The offset, in bytes, at which to store the value.
* @param value - The 32-bit floating-point number (Float32) to be converted and stored as Float16.
* @param littleEndian - If true, the value is stored as little-endian. Otherwise, it's stored as big-endian.
*/
setFloat16(byteOffset: number, value: number, littleEndian?: boolean): void;
}
}
//# sourceMappingURL=dataview.d.ts.map