gis-common 5.1.36 → 5.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,6 +136,101 @@ class AudioPlayer {
136
136
  this.audio.muted = val;
137
137
  }
138
138
  }
139
+ class BinaryReader {
140
+ // 是否为小端字节序
141
+ constructor(buffer, littleEndian = true) {
142
+ __publicField(this, "_buffer");
143
+ __publicField(this, "_view");
144
+ __publicField(this, "_offset");
145
+ __publicField(this, "_littleEndian");
146
+ this._buffer = buffer;
147
+ this._littleEndian = littleEndian;
148
+ this._view = new DataView(buffer);
149
+ this._offset = 0;
150
+ }
151
+ /** 当前读取位置 */
152
+ get offset() {
153
+ return this._offset;
154
+ }
155
+ /** 原始 ArrayBuffer */
156
+ get buffer() {
157
+ return this._buffer;
158
+ }
159
+ /** 底层 DataView */
160
+ get dataView() {
161
+ return this._view;
162
+ }
163
+ /** 重置读取位置到开头 */
164
+ reset() {
165
+ this._offset = 0;
166
+ }
167
+ /** 跳转到指定位置 */
168
+ seek(offset) {
169
+ this._offset = offset;
170
+ }
171
+ /** 跳过指定字节数 */
172
+ skip(bytes) {
173
+ this._offset += bytes;
174
+ }
175
+ /** 读取 1 字节无符号整数 */
176
+ readUint8() {
177
+ const value = this._view.getUint8(this._offset);
178
+ this._offset += 1;
179
+ return value;
180
+ }
181
+ /** 读取 2 字节无符号整数 */
182
+ readUint16() {
183
+ const value = this._view.getUint16(this._offset, this._littleEndian);
184
+ this._offset += 2;
185
+ return value;
186
+ }
187
+ /** 读取 4 字节无符号整数 */
188
+ readUint32() {
189
+ const value = this._view.getUint32(this._offset, this._littleEndian);
190
+ this._offset += 4;
191
+ return value;
192
+ }
193
+ /** 读取 1 字节有符号整数 */
194
+ readInt8() {
195
+ const value = this._view.getInt8(this._offset);
196
+ this._offset += 1;
197
+ return value;
198
+ }
199
+ /** 读取 2 字节有符号整数 */
200
+ readInt16() {
201
+ const value = this._view.getInt16(this._offset, this._littleEndian);
202
+ this._offset += 2;
203
+ return value;
204
+ }
205
+ /** 读取 4 字节有符号整数 */
206
+ readInt32() {
207
+ const value = this._view.getInt32(this._offset, this._littleEndian);
208
+ this._offset += 4;
209
+ return value;
210
+ }
211
+ /** 读取 4 字节浮点数 (float32) */
212
+ readFloat32() {
213
+ const value = this._view.getFloat32(this._offset, this._littleEndian);
214
+ this._offset += 4;
215
+ return value;
216
+ }
217
+ /** 读取 8 字节浮点数 (float64) */
218
+ readFloat64() {
219
+ const value = this._view.getFloat64(this._offset, this._littleEndian);
220
+ this._offset += 8;
221
+ return value;
222
+ }
223
+ /** 读取指定长度的 buffer 片段 */
224
+ readBuffer(length) {
225
+ const slice = this._buffer.slice(this._offset, this._offset + length);
226
+ this._offset += length;
227
+ return slice;
228
+ }
229
+ /** 读取指定长度的字符串 */
230
+ readString(length) {
231
+ return String.fromCharCode.apply(null, new Uint8Array(this.readBuffer(length)));
232
+ }
233
+ }
139
234
  const ExceptionUtil = {
140
235
  getException(type, message = "") {
141
236
  const _Exception = function() {
@@ -2672,9 +2767,9 @@ const OptimizeUtil = {
2672
2767
  *
2673
2768
  * @param fun 要递归调用的函数。
2674
2769
  * @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
2675
- * @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
2770
+ * @param duration 函数递归调用的总时长,单位为毫秒,默认为不限制。
2676
2771
  */
2677
- recurve(fun, frequency = 500, duration = 5e3) {
2772
+ recurve(fun, frequency = 500, duration = Infinity) {
2678
2773
  let timer = 0;
2679
2774
  setTimeout(() => {
2680
2775
  timer++;
@@ -18453,6 +18548,7 @@ export {
18453
18548
  AjaxUtil,
18454
18549
  ArrayUtil,
18455
18550
  AudioPlayer,
18551
+ BinaryReader,
18456
18552
  BrowserUtil,
18457
18553
  CanvasDrawer,
18458
18554
  CaseType,