How to use isLittleEndian method in wpt

Best JavaScript code snippet using wpt

GeoTiffUtil.js

Source:GeoTiffUtil.js Github

copy

Full Screen

1/*2 * Copyright 2003-2006, 2009, 2017, 2020 United States Government, as represented3 * by the Administrator of the National Aeronautics and Space Administration.4 * All rights reserved.5 *6 * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License,7 * Version 2.0 (the "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License9 * at http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software distributed12 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR13 * CONDITIONS OF ANY KIND, either express or implied. See the License for the14 * specific language governing permissions and limitations under the License.15 *16 * NASAWorldWind/WebWorldWind also contains the following 3rd party Open Source17 * software:18 *19 * ES6-Promise – under MIT License20 * libtess.js – SGI Free Software License B21 * Proj4 – under MIT License22 * JSZip – under MIT License23 *24 * A complete listing of 3rd Party software notices and licenses included in25 * WebWorldWind can be found in the WebWorldWind 3rd-party notices and licenses26 * PDF found in code directory.27 */28/**29 * @exports GeoTiffUtil30 */31define([32 '../../error/ArgumentError',33 '../../util/Logger',34 './TiffConstants'35 ],36 function (ArgumentError,37 Logger,38 TiffConstants) {39 "use strict";40 var GeoTiffUtil = {41 // Get bytes from an arraybuffer depending on the size. Internal use only.42 getBytes: function (geoTiffData, byteOffset, numOfBytes, isLittleEndian, isSigned) {43 if (numOfBytes <= 0) {44 throw new ArgumentError(45 Logger.logMessage(Logger.LEVEL_SEVERE, "GeoTiffReader", "getBytes", "noBytesRequested"));46 } else if (numOfBytes <= 1) {47 if (isSigned) {48 return geoTiffData.getInt8(byteOffset, isLittleEndian);49 }50 else {51 return geoTiffData.getUint8(byteOffset, isLittleEndian);52 }53 } else if (numOfBytes <= 2) {54 if (isSigned) {55 return geoTiffData.getInt16(byteOffset, isLittleEndian);56 }57 else {58 return geoTiffData.getUint16(byteOffset, isLittleEndian);59 }60 } else if (numOfBytes <= 3) {61 if (isSigned) {62 return geoTiffData.getInt32(byteOffset, isLittleEndian) >>> 8;63 }64 else {65 return geoTiffData.getUint32(byteOffset, isLittleEndian) >>> 8;66 }67 } else if (numOfBytes <= 4) {68 if (isSigned) {69 return geoTiffData.getInt32(byteOffset, isLittleEndian);70 }71 else {72 return geoTiffData.getUint32(byteOffset, isLittleEndian);73 }74 } else if (numOfBytes <= 8) {75 return geoTiffData.getFloat64(byteOffset, isLittleEndian);76 } else {77 throw new ArgumentError(78 Logger.logMessage(Logger.LEVEL_SEVERE, "GeoTiffReader", "getBytes", "tooManyBytesRequested"));79 }80 },81 // Get sample value from an arraybuffer depending on the sample format. Internal use only.82 getSampleBytes: function (geoTiffData, byteOffset, numOfBytes, sampleFormat, isLittleEndian) {83 var res;84 switch (sampleFormat) {85 case TiffConstants.SampleFormat.UNSIGNED:86 res = this.getBytes(geoTiffData, byteOffset, numOfBytes, isLittleEndian, false);87 break;88 case TiffConstants.SampleFormat.SIGNED:89 res = this.getBytes(geoTiffData, byteOffset, numOfBytes, isLittleEndian, true);90 break;91 case TiffConstants.SampleFormat.IEEE_FLOAT:92 if (numOfBytes == 3) {93 res = geoTiffData.getFloat32(byteOffset, isLittleEndian) >>> 8;94 } else if (numOfBytes == 4) {95 res = geoTiffData.getFloat32(byteOffset, isLittleEndian);96 } else if (numOfBytes == 8) {97 res = geoTiffData.getFloat64(byteOffset, isLittleEndian);98 }99 else {100 Logger.log(Logger.LEVEL_WARNING, "Do not attempt to parse the data not handled: " +101 numOfBytes);102 }103 break;104 case TiffConstants.SampleFormat.UNDEFINED:105 default:106 res = this.getBytes(geoTiffData, byteOffset, numOfBytes, isLittleEndian, false);107 break;108 }109 return res;110 },111 // Get RGBA fill style for a canvas context as a string. Internal use only.112 getRGBAFillValue: function (r, g, b, a) {113 if (typeof a === 'undefined') {114 a = 1.0;115 }116 return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";117 },118 // Clamp color sample from color sample value and number of bits per sample. Internal use only.119 clampColorSample: function (colorSample, bitsPerSample) {120 var multiplier = Math.pow(2, 8 - bitsPerSample);121 return Math.floor((colorSample * multiplier) + (multiplier - 1));122 }123 };124 return GeoTiffUtil;125 }...

Full Screen

Full Screen

nadgrid.js

Source:nadgrid.js Github

copy

Full Screen

1/**2 * Resources for details of NTv2 file formats:3 * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf4 * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm5 */6var loadedNadgrids = {};7/**8 * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file9 * as an ArrayBuffer.10 */11export default function nadgrid(key, data) {12 var view = new DataView(data);13 var isLittleEndian = detectLittleEndian(view);14 var header = readHeader(view, isLittleEndian);15 if (header.nSubgrids > 1) {16 console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored');17 }18 var subgrids = readSubgrids(view, header, isLittleEndian);19 var nadgrid = {header: header, subgrids: subgrids};20 loadedNadgrids[key] = nadgrid;21 return nadgrid;22}23/**24 * Given a proj4 value for nadgrids, return an array of loaded grids25 */26export function getNadgrids(nadgrids) {27 // Format details: http://proj.maptools.org/gen_parms.html28 if (nadgrids === undefined) { return null; }29 var grids = nadgrids.split(',');30 return grids.map(parseNadgridString);31}32function parseNadgridString(value) {33 if (value.length === 0) {34 return null;35 }36 var optional = value[0] === '@';37 if (optional) {38 value = value.slice(1);39 }40 if (value === 'null') {41 return {name: 'null', mandatory: !optional, grid: null, isNull: true};42 }43 return {44 name: value,45 mandatory: !optional,46 grid: loadedNadgrids[value] || null,47 isNull: false48 };49}50function secondsToRadians(seconds) {51 return (seconds / 3600) * Math.PI / 180;52}53function detectLittleEndian(view) {54 var nFields = view.getInt32(8, false);55 if (nFields === 11) {56 return false;57 }58 nFields = view.getInt32(8, true);59 if (nFields !== 11) {60 console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');61 }62 return true;63}64function readHeader(view, isLittleEndian) {65 return {66 nFields: view.getInt32(8, isLittleEndian),67 nSubgridFields: view.getInt32(24, isLittleEndian),68 nSubgrids: view.getInt32(40, isLittleEndian),69 shiftType: decodeString(view, 56, 56 + 8).trim(),70 fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),71 fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),72 toSemiMajorAxis: view.getFloat64(152, isLittleEndian),73 toSemiMinorAxis: view.getFloat64(168, isLittleEndian),74 };75}76function decodeString(view, start, end) {77 return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));78}79function readSubgrids(view, header, isLittleEndian) {80 var gridOffset = 176;81 var grids = [];82 for (var i = 0; i < header.nSubgrids; i++) {83 var subHeader = readGridHeader(view, gridOffset, isLittleEndian);84 var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);85 var lngColumnCount = Math.round(86 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);87 var latColumnCount = Math.round(88 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);89 // Proj4 operates on radians whereas the coordinates are in seconds in the grid90 grids.push({91 ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],92 del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],93 lim: [lngColumnCount, latColumnCount],94 count: subHeader.gridNodeCount,95 cvs: mapNodes(nodes)96 });97 }98 return grids;99}100function mapNodes(nodes) {101 return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];});102}103function readGridHeader(view, offset, isLittleEndian) {104 return {105 name: decodeString(view, offset + 8, offset + 16).trim(),106 parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),107 lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),108 upperLatitude: view.getFloat64(offset + 88, isLittleEndian),109 lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),110 upperLongitude: view.getFloat64(offset + 120, isLittleEndian),111 latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),112 longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),113 gridNodeCount: view.getInt32(offset + 168, isLittleEndian)114 };115}116function readGridNodes(view, offset, gridHeader, isLittleEndian) {117 var nodesOffset = offset + 176;118 var gridRecordLength = 16;119 var gridShiftRecords = [];120 for (var i = 0; i < gridHeader.gridNodeCount; i++) {121 var record = {122 latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),123 longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),124 latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),125 longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian),126 };127 gridShiftRecords.push(record);128 }129 return gridShiftRecords;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1function isLittleEndian() {2 var buffer = new ArrayBuffer(2);3 var bytes = new Uint8Array(buffer);4 var words = new Uint16Array(buffer);5 bytes[0] = 0xab;6 bytes[1] = 0xcd;7 return words[0] === 0xcdab;8}9function isLittleEndian() {10 var buffer = new ArrayBuffer(2);11 var bytes = new Uint8Array(buffer);12 var words = new Uint16Array(buffer);13 bytes[0] = 0xab;14 bytes[1] = 0xcd;15 return words[0] === 0xcdab;16}17function isLittleEndian() {18 var buffer = new ArrayBuffer(2);19 var bytes = new Uint8Array(buffer);20 var words = new Uint16Array(buffer);21 bytes[0] = 0xab;22 bytes[1] = 0xcd;23 return words[0] === 0xcdab;24}25function isLittleEndian() {26 var buffer = new ArrayBuffer(2);27 var bytes = new Uint8Array(buffer);28 var words = new Uint16Array(buffer);29 bytes[0] = 0xab;30 bytes[1] = 0xcd;31 return words[0] === 0xcdab;32}33function isLittleEndian() {34 var buffer = new ArrayBuffer(2);35 var bytes = new Uint8Array(buffer);36 var words = new Uint16Array(buffer);37 bytes[0] = 0xab;38 bytes[1] = 0xcd;39 return words[0] === 0xcdab;40}41function isLittleEndian() {42 var buffer = new ArrayBuffer(2);43 var bytes = new Uint8Array(buffer);44 var words = new Uint16Array(buffer);45 bytes[0] = 0xab;46 bytes[1] = 0xcd;47 return words[0] === 0xcdab;48}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var isLittleEndian = wptools.isLittleEndian;3console.log(isLittleEndian);4var wptools = require('wptools');5var isBigEndian = wptools.isBigEndian;6console.log(isBigEndian);7var wptools = require('wptools');8var toHex = wptools.toHex;9console.log(toHex(255, 2));10var wptools = require('wptools');11var toBin = wptools.toBin;12console.log(toBin(255, 8));13var wptools = require('wptools');14var toDec = wptools.toDec;15console.log(toDec("11111111"));16var wptools = require('wptools');17var toOct = wptools.toOct;18console.log(toOct(255, 3));19var wptools = require('wptools');20var toBinArray = wptools.toBinArray;21console.log(toBinArray(255, 8));22var wptools = require('wptools');23var toHexArray = wptools.toHexArray;24console.log(toHexArray(255, 2));25var wptools = require('wptools');26var toOctArray = wptools.toOctArray;27console.log(toOctArray(255, 3));28var wptools = require('wptools');29var toDecArray = wptools.toDecArray;30console.log(toDecArray("11111111"));

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require("wptools");2var isLittleEndian = wptools.isLittleEndian();3console.log("isLittleEndian: " + isLittleEndian);4var wptools = require("wptools");5var isLittleEndian = wptools.isLittleEndian();6console.log("isLittleEndian: " + isLittleEndian);7var wptools = require("wptools");8var isLittleEndian = wptools.isLittleEndian();9console.log("isLittleEndian: " + isLittleEndian);10var wptools = require("wptools");11var isLittleEndian = wptools.isLittleEndian();12console.log("isLittleEndian: " + isLittleEndian);13var wptools = require("wptools");14var isLittleEndian = wptools.isLittleEndian();15console.log("isLittleEndian: " + isLittleEndian);16var wptools = require("wptools");17var isLittleEndian = wptools.isLittleEndian();18console.log("isLittleEndian: " + isLittleEndian);19var wptools = require("wptools");20var isLittleEndian = wptools.isLittleEndian();21console.log("isLittleEndian: " + isLittleEndian);22var wptools = require("wptools");23var isLittleEndian = wptools.isLittleEndian();24console.log("isLittleEndian: " + isLittleEndian);25var wptools = require("wptools");26var isLittleEndian = wptools.isLittleEndian();27console.log("isLittleEndian: " + isLittleEndian);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.isLittleEndian(function(err, data) {4 console.log(data);5});6{ is_little_endian: true }

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var isLittleEndian = wptoolkit.isLittleEndian();3console.log('isLittleEndian: ' + isLittleEndian);4var wptoolkit = require('wptoolkit');5var isBigEndian = wptoolkit.isBigEndian();6console.log('isBigEndian: ' + isBigEndian);7var wptoolkit = require('wptoolkit');8var isNumber = wptoolkit.isNumber(0);9console.log('isNumber: ' + isNumber);10var wptoolkit = require('wptoolkit');11var isFloat = wptoolkit.isFloat(0.0);12console.log('isFloat: ' + isFloat);13var wptoolkit = require('wptoolkit');14var isInteger = wptoolkit.isInteger(0);15console.log('isInteger: ' + isInteger);16var wptoolkit = require('wptoolkit');17var isString = wptoolkit.isString('test');18console.log('isString: ' + isString);19var wptoolkit = require('wptoolkit');20var isBoolean = wptoolkit.isBoolean(true);21console.log('isBoolean: ' + isBoolean);22var wptoolkit = require('wptoolkit');23var isObject = wptoolkit.isObject({});24console.log('isObject: ' + is

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptb = require('wptb');2console.log(wptb.isLittleEndian());3var wptb = require('wptb');4console.log(wptb.isBigEndian());5var wptb = require('wptb');6console.log(wptb.getNumericRepresentation(0x0F));7var wptb = require('wptb');8console.log(wptb.getHexRepresentation(15));9var wptb = require('wptb');10console.log(wptb.getBinaryRepresentation(15));11var wptb = require('wptb');12console.log(wptb.getBit(15, 0));13var wptb = require('wptb');14console.log(wptb.setBit(15, 0));15var wptb = require('wptb');16console.log(wptb.setBit(15, 1));17var wptb = require('wptb');18console.log(wptb.setBit(15, 2));19var wptb = require('wptb');20console.log(wptb.setBit(15, 3));21var wptb = require('wptb');22console.log(wptb.setBit(15

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var isLittleEndian = wptools.isLittleEndian();3console.log(isLittleEndian);4var wptools = require('wptools');5var test = require('./test');6var isLittleEndian = test.isLittleEndian;7console.log(isLittleEndian);

Full Screen

Using AI Code Generation

copy

Full Screen

1var isLittleEndian = require('wptools/isLittleEndian');2console.log(isLittleEndian());3var wptools = require('wptools');4console.log(wptools.isLittleEndian());5var wptools = require('wptools');6console.log(wptools.isLittleEndian());7var wptools = require('wptools');8console.log(wptools.isLittleEndian());9var wptools = require('wptools');10console.log(wptools.isLittleEndian());11var wptools = require('wptools');12console.log(wptools.isLittleEndian());13var wptools = require('wptools');14console.log(wptools.isLittleEndian());15var wptools = require('wptools');16console.log(wptools.isLittleEndian());17var wptools = require('wptools');18console.log(wptools.isLittleEndian());19var wptools = require('wptools');20console.log(wptools.isLittleEndian());21var wptools = require('wptools');22console.log(wptools.isLittleEndian());23var wptools = require('wptools');24console.log(wptools.isLittleEndian());25var wptools = require('wptools');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wp-tools');2console.log(wptools.isLittleEndian());3var wptools = require('wp-tools');4console.log(wptools.getSystemEndian());5var wptools = require('wp-tools');6console.log(wptools.getSystemEndian());7var wptools = require('wp-tools');8console.log(wptools.getSystemEndian());9var wptools = require('wp-tools');10console.log(wptools.getSystemEndian());11var wptools = require('wp-tools');12console.log(wptools.getSystemEndian());13var wptools = require('wp-tools');14console.log(wptools.getSystemEndian());15var wptools = require('wp-tools');16console.log(wptools.getSystemEndian());17var wptools = require('wp-tools

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful