@maptalks/3dtiles 0.97.4 → 0.99.0

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.
@@ -0,0 +1,515 @@
1
+ /// <reference types="gl-matrix/index.js" />
2
+ /*!
3
+ * @maptalks/3dtiles v0.99.0
4
+ * LICENSE : UNLICENSED
5
+ * (c) 2016-2024 maptalks.org
6
+ */
7
+ import * as gl_matrix from 'gl-matrix';
8
+ import { vec3 } from 'gl-matrix';
9
+ import * as maptalks from 'maptalks';
10
+ import { LayerJSONType } from 'maptalks';
11
+ import { ClipOutsideMask, mat4 } from '@maptalks/gl';
12
+
13
+ type BBOX = [number, number, number, number];
14
+ declare const Geo3DTilesLayer_base: (new (...args: any[]) => {
15
+ _maskProjViewMatrix: mat4;
16
+ _maskExtentInWorld: gl_matrix.vec4;
17
+ removeMask(masks: any): any;
18
+ setMask(masks: any): any;
19
+ onAdd(): void;
20
+ getMasks(): any;
21
+ onGeometryEvent(param: any): void;
22
+ identifyMask(point: any, options: any): any[];
23
+ remove(): void;
24
+ updateMask(extent: any): {
25
+ projViewMatrix: mat4;
26
+ extentInWorld: gl_matrix.vec4;
27
+ };
28
+ updateMaskExtent(type: string): void;
29
+ getMaskExtent(): {
30
+ extent: maptalks.Extent;
31
+ ratio: number;
32
+ minHeight: any;
33
+ };
34
+ }) & typeof maptalks.Layer;
35
+ /**
36
+ * A layer to stream AnalyticalGraphicsInc's 3d-tiles geospatial data
37
+ * 3d-tiles 规范:https://github.com/AnalyticalGraphicsInc/3d-tiles/
38
+ */
39
+ declare class Geo3DTilesLayer extends Geo3DTilesLayer_base {
40
+ /**
41
+ * 用layer的JSON对象反序列一个Geo3DTilesLayer对象
42
+ * @english
43
+ * Reproduce a Geo3DTilesLayer from layer's profile JSON.
44
+ * @param layerJSON - layer's profile JSON
45
+ */
46
+ static fromJSON(layerJSON: object): Geo3DTilesLayer | null;
47
+ options: Geo3DTilesLayerOptions;
48
+ constructor(id: string, options: Geo3DTilesLayerOptions);
49
+ showService(idx: number): this;
50
+ hideService(idx: number): this;
51
+ setToRedraw(): this;
52
+ addService(info: Geo3DTilesService): this;
53
+ updateService(idx: number, info: Geo3DTilesServiceOptions): this;
54
+ removeService(idx: number): this;
55
+ getTileUrl(url: string, rootNode: RootTileNode): string;
56
+ getExtent(index: number): maptalks.Extent | null;
57
+ boundingVolumeToExtent(node: RootTileNode): maptalks.Extent | null;
58
+ getRootTiles(): RootTileNode[];
59
+ getTiles(): QueriedTiles;
60
+ onTileLoad(tile: TileNode, node: TileNode): void;
61
+ onTilesetLoad(tileset: any, parent: TileNode, url: string): void;
62
+ _isVisible(node: TileNode, maxExtent: maptalks.Extent, projectionView: number[], mapExtentBBOX: BBOX, clipMasks: ClipOutsideMask[]): TileVisibility;
63
+ /**
64
+ * Identify the data on the given coordinate
65
+ * @param point - point to identify
66
+ * @param [options=null] - options
67
+ * @param [options.tolerance=0] - identify tolerance in pixel
68
+ * @param [options.count=null] - result count
69
+ * @return data identified
70
+ */
71
+ identify(coordinate: [number, number] | maptalks.Coordinate, options?: IdentifyOptions): any[];
72
+ /**
73
+ * Identify the data on the given container point
74
+ * @param {maptalks.Point} point - point to identify
75
+ * @param {Object} [options=null] - options
76
+ * @param {Object} [options.tolerance=0] - identify tolerance in pixel
77
+ * @return {Object[]} data identified
78
+ */
79
+ identifyAtPoint(point: maptalks.Point, options?: IdentifyOptions): any[];
80
+ getCurrentBatchIDs(): number[];
81
+ highlight(highlights: HighlightItem | HighlightItem[]): this;
82
+ cancelHighlight(serviceIndex: number, ids: number[]): this;
83
+ cancelAllHighlight(): this;
84
+ showOnly(items: ShowOnlyItem[]): this;
85
+ cancelShowOnly(serviceIndex: number): this;
86
+ setServiceOpacity(idx: number, opacity: number): this;
87
+ setServiceDebug(idx: number, debug: boolean): this;
88
+ /**
89
+ * Export the Geo3DTilesLayer's profile json. <br>
90
+ * Layer's profile is a snapshot of the layer in JSON format. <br>
91
+ * It can be used to reproduce the instance by [fromJSON]{@link Layer#fromJSON} method
92
+ */
93
+ toJSON(): LayerJSONType;
94
+ }
95
+ type OffsetFunction = (center: maptalks.Coordinate) => number[];
96
+ type Geo3DTilesLayerOptions = {
97
+ 'services': Geo3DTilesService[];
98
+ 'maxGPUMemory'?: number;
99
+ 'retireInterval'?: number;
100
+ 'loadingLimitOnInteracting'?: number;
101
+ 'loadingLimit'?: number;
102
+ 'debug'?: boolean;
103
+ 'meshLimitPerFrame'?: number;
104
+ 'i3sNodepageLimitPerFrame'?: number;
105
+ 'enableI3SCompressedGeometry'?: boolean;
106
+ 'forceI3SCompressedGeometry'?: boolean;
107
+ 'picking'?: boolean;
108
+ 'pickingPoint'?: boolean;
109
+ 'geometryEvents'?: boolean;
110
+ 'alwaysShowTopTiles'?: boolean;
111
+ 'antialias'?: boolean;
112
+ 'offset'?: number[] | OffsetFunction;
113
+ 'renderer'?: 'gl';
114
+ 'forceRenderOnZooming'?: true;
115
+ 'forceRenderOnRotating'?: true;
116
+ 'forceRenderOnMoving'?: true;
117
+ 'optionalExtensions'?: [
118
+ 'ANGLE_instanced_arrays',
119
+ 'OES_element_index_uint',
120
+ 'OES_standard_derivatives',
121
+ 'OES_vertex_array_object',
122
+ 'OES_texture_half_float',
123
+ 'OES_texture_half_float_linear',
124
+ 'OES_texture_float',
125
+ 'OES_texture_float_linear',
126
+ 'WEBGL_depth_texture',
127
+ 'EXT_shader_texture_lod',
128
+ 'WEBGL_compressed_texture_astc',
129
+ 'WEBGL_compressed_texture_etc',
130
+ 'WEBGL_compressed_texture_etc1',
131
+ 'WEBGL_compressed_texture_pvrtc',
132
+ 'WEBGL_compressed_texture_s3tc',
133
+ 'WEBGL_compressed_texture_s3tc_srgb'
134
+ ];
135
+ };
136
+ type Geo3DTilesService = {
137
+ /**
138
+ * 数据服务地址
139
+ * @english
140
+ * service url
141
+ */
142
+ url: string;
143
+ maxExtent?: maptalks.Extent;
144
+ } & Geo3DTilesServiceOptions;
145
+ /**
146
+ * service的属性定义
147
+ * @english
148
+ * Service property definitions
149
+ */
150
+ type Geo3DTilesServiceOptions = {
151
+ /**
152
+ * 最大的屏幕空间误差,默认为8。当模型瓦片在屏幕上大小超过设定时会尝试请求下一级瓦片,数字越小请求的模型瓦片越精细
153
+ * @english
154
+ * maximum screen space error, default is 8
155
+ */
156
+ maximumScreenSpaceError?: number;
157
+ /**
158
+ * 是否开启 debug
159
+ * @english
160
+ * Enable debug
161
+ */
162
+ debug?: boolean;
163
+ /**
164
+ * 设置材质中的alphaTest,默认为0.1
165
+ * @english
166
+ * Set alphaTest in material, default is 0.1
167
+ */
168
+ alphaTest?: number;
169
+ /**
170
+ * 模型的缩放比例
171
+ * @english
172
+ * Model scaling
173
+ */
174
+ scale?: number;
175
+ /**
176
+ * 模型在xy平面上的偏移量,与地图的坐标系一致。
177
+ * @english
178
+ * The offset of the model on the xy plane, consistent with the coordinate system of the map.
179
+ */
180
+ coordOffset?: number[];
181
+ /**
182
+ * 模型在z轴上的偏移量,单位为米
183
+ * @english
184
+ * Offset of the model on the z-axis in meters
185
+ */
186
+ heightOffset?: number;
187
+ /**
188
+ * 模型在xyz轴上旋转角度,单位为度,取值范围-180到180
189
+ * @english
190
+ * Angle of rotation of the model on the xyz-axis in degrees, ranging from -180 to 180.
191
+ */
192
+ rotation?: [number, number, number];
193
+ /**
194
+ * 服务子域,用于替换url中的{s}
195
+ * @english
196
+ * Service subdomain to replace {s} in the url
197
+ */
198
+ subdomains?: string[];
199
+ /**
200
+ * 透明度,取值范围0-1
201
+ * @english
202
+ * opacity,ranging from 0 to 1
203
+ */
204
+ opacity?: number;
205
+ /**
206
+ * 是否可见
207
+ * @english
208
+ * Whether is visible
209
+ */
210
+ visible?: boolean;
211
+ /**
212
+ * fetch 请求的设置
213
+ * @english
214
+ * fetch options
215
+ */
216
+ fetchOptions?: any;
217
+ /**
218
+ * 点云数据的 pointSize,单位像素,支持zoom级别的 function-type
219
+ * @english
220
+ * pointSize of the point cloud data in pixels, supports function-type at zoom level.
221
+ */
222
+ pointSize?: number;
223
+ /**
224
+ * 点云数据的透明度,取值范围0-1,支持zoom级别的 function-type
225
+ * @english
226
+ * Transparency of the point cloud data, value range 0-1, supports zoom level function-type.
227
+ */
228
+ pointOpacity?: number;
229
+ /**
230
+ * 模型设置为unlit,渲染时忽略全局灯光设置,适用于倾斜摄影等模型中已经包含灯光信息的场景
231
+ * @english
232
+ * The model is set to unlit, and the global lighting settings are ignored when rendering, for scenes where lighting information is already included in the model, such as photometry modeling.
233
+ */
234
+ unlit?: boolean;
235
+ /**
236
+ *
237
+ */
238
+ polygonFill?: number[];
239
+ /**
240
+ * 环境光曝光参数
241
+ * @english
242
+ * environment exposure
243
+ */
244
+ environmentExposure?: number;
245
+ /**
246
+ * 模型是否双面绘制,默认为false
247
+ * @english
248
+ * Whether the model is rendered double-sided, default is false
249
+ */
250
+ doubleSided?: boolean;
251
+ /**
252
+ * 模型纹理尺寸最大值,默认为1024
253
+ * @english
254
+ * Maximum model texture size, default is 1024.
255
+ */
256
+ maxTextureSize?: number;
257
+ /**
258
+ * 材质 uniform 变量的预设值
259
+ * @english
260
+ * The preset value of the material uniforms
261
+ */
262
+ material?: any;
263
+ };
264
+ type TileNode = {
265
+ id?: string;
266
+ transform?: number[];
267
+ matrix: number[];
268
+ refine: string;
269
+ boundingVolume?: BoundingVolume;
270
+ viewerRequestVolume?: BoundingVolume;
271
+ geometricError?: number;
272
+ children?: TileNode[];
273
+ visible?: boolean;
274
+ parent?: TileNode;
275
+ baseUrl?: string;
276
+ content?: {
277
+ url?: string;
278
+ uri?: string;
279
+ };
280
+ maxExtent?: maptalks.Extent;
281
+ hasParentContent?: boolean;
282
+ extent?: maptalks.Extent;
283
+ };
284
+ type RootTileNode = {
285
+ version: number;
286
+ service: Geo3DTilesService;
287
+ domainKey?: string | null;
288
+ } & TileNode;
289
+ type BoundingVolume = {
290
+ box?: number[];
291
+ region?: number[];
292
+ sphere?: number[];
293
+ coordOffset?: number[];
294
+ heightOffset?: number;
295
+ originalVolume?: number[];
296
+ };
297
+ type CandinateNode = {
298
+ id?: string;
299
+ node?: TileNode;
300
+ children: CandinateNode[];
301
+ level: number;
302
+ parent?: CandinateNode;
303
+ content?: string;
304
+ };
305
+ type HighlightItem = {
306
+ color?: number[];
307
+ filter?: (object: any) => boolean;
308
+ bloom?: boolean;
309
+ id?: number;
310
+ opacity: number;
311
+ };
312
+ type ShowOnlyItem = {
313
+ id: number;
314
+ service?: number;
315
+ };
316
+ type IdentifyOptions = {
317
+ /**
318
+ * 像素冗余,默认为0
319
+ * @english
320
+ * tolerance in pixel, default is 0
321
+ */
322
+ tolerance?: number;
323
+ count?: number;
324
+ filter?: (picked: any) => boolean;
325
+ };
326
+ type QueriedTiles = {
327
+ tiles: CandinateNode[];
328
+ root?: CandinateNode;
329
+ };
330
+ declare enum TileVisibility {
331
+ OUT_OF_FRUSTUM = 0,
332
+ SCREEN_ERROR_TOO_SMALL = 1,
333
+ VISIBLE = 2
334
+ }
335
+
336
+ declare function isNil(v: any): boolean;
337
+ declare function extend(dest: any, ...args: any[]): any;
338
+ declare function isFunction(obj: any): boolean;
339
+ /**
340
+ * Whether the obj is a javascript object.
341
+ * @param {Object} obj - object
342
+ * @return {Boolean}
343
+ * @memberOf Util
344
+ */
345
+ declare function isObject(obj: any): boolean;
346
+ /**
347
+ * Whether val is a number and not a NaN.
348
+ * @param {Object} val - val
349
+ * @return {Boolean}
350
+ * @memberOf Util
351
+ */
352
+ declare function isNumber(val: any): boolean;
353
+ declare function toRadian(d: any): number;
354
+ declare function toDegree(d: any): number;
355
+ declare function getAbsoluteURL(url: any): any;
356
+ declare function sign(x: any): number;
357
+ declare function stringFromUTF8Array(data: any): string;
358
+ declare function setColumn3(out: any, arr: any, col: any): any;
359
+ declare function flatArr(arr: any): any;
360
+ declare function getBatchIdArrayType(max: any): Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor;
361
+ declare function isBase64(url: any): boolean;
362
+ declare function base64URLToArrayBuffer(url: any): ArrayBufferLike;
363
+ declare function pushIn(dest: any, ...args: any[]): any;
364
+ declare function normalizeColor(out: any, color: any): any;
365
+
366
+ declare const Util_d_base64URLToArrayBuffer: typeof base64URLToArrayBuffer;
367
+ declare const Util_d_extend: typeof extend;
368
+ declare const Util_d_flatArr: typeof flatArr;
369
+ declare const Util_d_getAbsoluteURL: typeof getAbsoluteURL;
370
+ declare const Util_d_getBatchIdArrayType: typeof getBatchIdArrayType;
371
+ declare const Util_d_isBase64: typeof isBase64;
372
+ declare const Util_d_isFunction: typeof isFunction;
373
+ declare const Util_d_isNil: typeof isNil;
374
+ declare const Util_d_isNumber: typeof isNumber;
375
+ declare const Util_d_isObject: typeof isObject;
376
+ declare const Util_d_normalizeColor: typeof normalizeColor;
377
+ declare const Util_d_pushIn: typeof pushIn;
378
+ declare const Util_d_setColumn3: typeof setColumn3;
379
+ declare const Util_d_sign: typeof sign;
380
+ declare const Util_d_stringFromUTF8Array: typeof stringFromUTF8Array;
381
+ declare const Util_d_toDegree: typeof toDegree;
382
+ declare const Util_d_toRadian: typeof toRadian;
383
+ declare namespace Util_d {
384
+ export { Util_d_base64URLToArrayBuffer as base64URLToArrayBuffer, Util_d_extend as extend, Util_d_flatArr as flatArr, Util_d_getAbsoluteURL as getAbsoluteURL, Util_d_getBatchIdArrayType as getBatchIdArrayType, Util_d_isBase64 as isBase64, Util_d_isFunction as isFunction, Util_d_isNil as isNil, Util_d_isNumber as isNumber, Util_d_isObject as isObject, Util_d_normalizeColor as normalizeColor, Util_d_pushIn as pushIn, Util_d_setColumn3 as setColumn3, Util_d_sign as sign, Util_d_stringFromUTF8Array as stringFromUTF8Array, Util_d_toDegree as toDegree, Util_d_toRadian as toRadian };
385
+ }
386
+
387
+ /**
388
+ * from Cesium
389
+ * Convert radians to Cartesian3 coordinate
390
+ * from Cesium Cartesian3.fromRadians
391
+ * @param {Number} longitude in radians
392
+ * @param {Number} latitude in radians
393
+ * @param {Number} height in meters
394
+ * @param {Number} radius earth sphere's radius
395
+ * @returns {Number[]} coordinate in Cartesian3
396
+ */
397
+ declare function radianToCartesian3(out: any, longitude: number, latitude: number, height: number): number[];
398
+ /**
399
+ * from Cesium
400
+ * Creates a new Cartographic instance from a Cartesian position. The values in the
401
+ * resulting object will be in radians.
402
+ *
403
+ * @param cartesian The Cartesian position to convert to cartographic representation.
404
+ * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
405
+ */
406
+ declare function cartesian3ToDegree(result: any, cartesian: any): Cartographic;
407
+ declare function normalizeCartesian(out: any, a: any): any;
408
+ declare function geodeticSurfaceNormal(origin: any, out: any): vec3;
409
+ declare function geodeticSurfaceNormalCartographic(cartographic: any, result: any): vec3;
410
+
411
+ declare const Transform_d_cartesian3ToDegree: typeof cartesian3ToDegree;
412
+ declare const Transform_d_geodeticSurfaceNormal: typeof geodeticSurfaceNormal;
413
+ declare const Transform_d_geodeticSurfaceNormalCartographic: typeof geodeticSurfaceNormalCartographic;
414
+ declare const Transform_d_normalizeCartesian: typeof normalizeCartesian;
415
+ declare const Transform_d_radianToCartesian3: typeof radianToCartesian3;
416
+ declare namespace Transform_d {
417
+ export { Transform_d_cartesian3ToDegree as cartesian3ToDegree, Transform_d_geodeticSurfaceNormal as geodeticSurfaceNormal, Transform_d_geodeticSurfaceNormalCartographic as geodeticSurfaceNormalCartographic, Transform_d_normalizeCartesian as normalizeCartesian, Transform_d_radianToCartesian3 as radianToCartesian3 };
418
+ }
419
+
420
+ declare class B3DMLoader {
421
+ static createEmptyB3DM(): {
422
+ featureTable: any;
423
+ batchTable: any;
424
+ gltf: {};
425
+ };
426
+ constructor(requestImage: any, loaderCtor: any, supportedFormats: any);
427
+ _requestImage: any;
428
+ _loaderCtor: any;
429
+ _supportedFormats: any;
430
+ _decoders: any;
431
+ /**
432
+ * 载入b3dm模型,返回一个promise,promise中的参数是 gltf 模型对象
433
+ * @param {String} url - url of b3dm
434
+ * @param {ArrayBuffer} [arraybuffer=null] - optional b3dm arraybuffer content
435
+ * @returns {Promise}
436
+ */
437
+ load(url: string, arraybuffer?: ArrayBuffer, offset: number, byteLength: number, options: any): Promise<any>;
438
+ _parse(url: any, b3dm: any, offset: any, b3dmByteLength: any, options: any): any;
439
+ /**
440
+ * 解析b3dm数据,返回数据块:
441
+ * 1. feature table
442
+ * 2. batch table
443
+ * 3. gltf
444
+ * @param {ArrayBuffer} b3dm
445
+ */
446
+ _readB3DM(b3dm: ArrayBuffer, offset: any, byteLength: any, url: any): {
447
+ error: string;
448
+ count?: undefined;
449
+ transferables?: undefined;
450
+ featureTable?: undefined;
451
+ batchTable?: undefined;
452
+ batchTableBin?: undefined;
453
+ b3dm?: undefined;
454
+ glb?: undefined;
455
+ } | {
456
+ count: any;
457
+ transferables: ArrayBuffer[];
458
+ featureTable: any;
459
+ batchTable: any;
460
+ batchTableBin: ArrayBuffer;
461
+ b3dm: {
462
+ BATCH_ID: {
463
+ byteStride: number;
464
+ byteOffset: any;
465
+ itemSize: any;
466
+ count: number;
467
+ componentType: any;
468
+ array: any;
469
+ };
470
+ };
471
+ glb: {
472
+ buffer: ArrayBuffer;
473
+ byteOffset: any;
474
+ byteLength: number;
475
+ };
476
+ error?: undefined;
477
+ };
478
+ _readBatchTable(): any;
479
+ }
480
+
481
+ declare class CMPTLoader {
482
+ constructor(requestImage: any, GLTFloaderCtor: any, supportedFormats: any, maxTextureSize: any);
483
+ _supportedFormats: any;
484
+ _requestImage: any;
485
+ _loaderCtor: any;
486
+ _maxTextureSize: any;
487
+ /**
488
+ * 载入b3dm模型,返回一个promise,promise中的参数是 gltf 模型对象
489
+ * @param {String} url - url of b3dm
490
+ * @param {ArrayBuffer} [arraybuffer=null] - optional b3dm arraybuffer content
491
+ * @returns {Promise}
492
+ */
493
+ load(url: string, arraybuffer?: ArrayBuffer, offset: number, byteLength: number, options: any): Promise<any>;
494
+ _parse(url: any, cmpt: any, offset: any, byteLength: any, options: any): Promise<{
495
+ magic: string;
496
+ tiles: any[];
497
+ }>;
498
+ /**
499
+ * 解析b3dm数据,返回数据块:
500
+ * 1. feature table
501
+ * 2. batch table
502
+ * 3. gltf
503
+ * @param {ArrayBuffer} b3dm
504
+ */
505
+ _readCMPT(cmpt: any, url: any, byteOffset: any, byteLength: any): {
506
+ error: string;
507
+ } | {
508
+ magic: string;
509
+ buffer: any;
510
+ offset: any;
511
+ byteLength: number;
512
+ }[];
513
+ }
514
+
515
+ export { B3DMLoader, CMPTLoader, Geo3DTilesLayer, Util_d as Geo3DTilesUtil, Transform_d as Geo3DTransform };