@terra.gl/core 0.0.1-alpha.6
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.
- package/README.md +0 -0
- package/dist/index.d.ts +1811 -0
- package/dist/index.js +11101 -0
- package/dist/index.umd.cjs +702 -0
- package/package.json +55 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1811 @@
|
|
|
1
|
+
import { AmbientLight } from 'three';
|
|
2
|
+
import { BaseEvent } from 'three';
|
|
3
|
+
import { BufferGeometry } from 'three';
|
|
4
|
+
import { Camera } from 'three';
|
|
5
|
+
import { Clouds } from '@pmndrs/vanilla';
|
|
6
|
+
import { Color } from 'three';
|
|
7
|
+
import { DirectionalLight } from 'three';
|
|
8
|
+
import { EventClass as EventClass_2 } from '..';
|
|
9
|
+
import { EventDispatcher } from 'three';
|
|
10
|
+
import { Group } from 'three';
|
|
11
|
+
import { Intersection } from 'three';
|
|
12
|
+
import { Line2 } from 'three-stdlib';
|
|
13
|
+
import { LineString as LineString_2 } from 'geojson';
|
|
14
|
+
import { LoadingManager } from 'three';
|
|
15
|
+
import { LocationInfo } from './util';
|
|
16
|
+
import { MapControls } from 'three-stdlib';
|
|
17
|
+
import { Material } from 'three';
|
|
18
|
+
import { Matrix4 } from 'three';
|
|
19
|
+
import { Mesh } from 'three';
|
|
20
|
+
import { MultiLineString as MultiLineString_2 } from 'geojson';
|
|
21
|
+
import { MultiPoint } from 'geojson';
|
|
22
|
+
import { MultiPolygon } from 'geojson';
|
|
23
|
+
import { NormalBufferAttributes } from 'three';
|
|
24
|
+
import { Object3D } from 'three';
|
|
25
|
+
import { Object3DEventMap } from 'three';
|
|
26
|
+
import { PerspectiveCamera } from 'three';
|
|
27
|
+
import { Point } from 'geojson';
|
|
28
|
+
import { Points } from 'three';
|
|
29
|
+
import { PointsMaterial } from 'three';
|
|
30
|
+
import { Polygon as Polygon_2 } from 'geojson';
|
|
31
|
+
import { Raycaster } from 'three';
|
|
32
|
+
import { Scene } from 'three';
|
|
33
|
+
import { Texture } from 'three';
|
|
34
|
+
import { TileLoadingManager as TileLoadingManager_2 } from './LoaderFactory';
|
|
35
|
+
import { Vector2 } from 'three';
|
|
36
|
+
import { Vector3 } from 'three';
|
|
37
|
+
import { WebGLRenderer } from 'three';
|
|
38
|
+
|
|
39
|
+
declare interface AnimationPauseParams {
|
|
40
|
+
paused: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare interface AnimationPlayParams {
|
|
44
|
+
name: string | number;
|
|
45
|
+
loop?: boolean;
|
|
46
|
+
speed?: number;
|
|
47
|
+
fadeInDuration?: number;
|
|
48
|
+
fadeOutDuration?: number;
|
|
49
|
+
startAt?: number;
|
|
50
|
+
weight?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare interface AnimationSpeedParams {
|
|
54
|
+
speed: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare interface AnimationUpdateParams {
|
|
58
|
+
deltaTime: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* ArcGis terrain datasource
|
|
63
|
+
*/
|
|
64
|
+
export declare class ArcGisDemSource extends TileSource {
|
|
65
|
+
dataType: string;
|
|
66
|
+
attribution: string;
|
|
67
|
+
minLevel: number;
|
|
68
|
+
maxLevel: number;
|
|
69
|
+
url: string;
|
|
70
|
+
constructor(options?: SourceOptions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* ArcGis datasource
|
|
75
|
+
*/
|
|
76
|
+
export declare class ArcGisSource extends TileSource {
|
|
77
|
+
dataType: string;
|
|
78
|
+
attribution: string;
|
|
79
|
+
style: string;
|
|
80
|
+
url: string;
|
|
81
|
+
constructor(options?: ArcGisSourceOptions);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare type ArcGisSourceOptions = SourceOptions & {
|
|
85
|
+
style?: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
declare interface BaseLineStyle extends BaseStyle {
|
|
89
|
+
type: 'basic-line';
|
|
90
|
+
color?: string | number | Color;
|
|
91
|
+
width?: number;
|
|
92
|
+
dashArray?: [number, number];
|
|
93
|
+
opacity?: number;
|
|
94
|
+
zIndex?: number;
|
|
95
|
+
resolution?: Vector2;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare interface BasePolygonStyle extends BaseStyle {
|
|
99
|
+
type: 'basic-polygon';
|
|
100
|
+
color?: string | number | Color;
|
|
101
|
+
opacity?: number;
|
|
102
|
+
wireframe?: boolean;
|
|
103
|
+
wireframeColor?: string | number | Color;
|
|
104
|
+
side?: 'front' | 'back' | 'double';
|
|
105
|
+
vertexColors?: boolean;
|
|
106
|
+
flatShading?: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare interface BaseStyle {
|
|
110
|
+
visible?: boolean;
|
|
111
|
+
opacity?: number;
|
|
112
|
+
zIndex?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare interface BaseWaterStyle extends BaseStyle {
|
|
116
|
+
type: 'base-water';
|
|
117
|
+
color?: number | string;
|
|
118
|
+
opacity?: number;
|
|
119
|
+
sunDirection?: Vector3;
|
|
120
|
+
sunColor?: number | string;
|
|
121
|
+
distortionScale?: number;
|
|
122
|
+
size?: number;
|
|
123
|
+
normalMap: string;
|
|
124
|
+
fog?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare interface BasicPointStyle extends BaseStyle {
|
|
128
|
+
type: 'basic-point';
|
|
129
|
+
color?: string | number | Color;
|
|
130
|
+
size: number;
|
|
131
|
+
glow?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare type CloudProps = {
|
|
135
|
+
/** 使用种子随机数可以确保云朵形态一致,默认: Math.random() */
|
|
136
|
+
seed?: number;
|
|
137
|
+
/** 云朵的分段或粒子数量,默认: 20 */
|
|
138
|
+
segments?: number;
|
|
139
|
+
/** 云朵的3D边界范围,默认: [5, 1, 1] */
|
|
140
|
+
bounds?: Vector3;
|
|
141
|
+
/** 分段体积在边界内的分布方式,默认: inside (边缘的云朵较小) */
|
|
142
|
+
concentrate?: 'random' | 'inside' | 'outside';
|
|
143
|
+
/** 分段的基础缩放比例 */
|
|
144
|
+
scale?: Vector3;
|
|
145
|
+
/** 分段体积/厚度,默认: 6 */
|
|
146
|
+
volume?: number;
|
|
147
|
+
/** 分布云朵时的最小体积,默认: 0.25 */
|
|
148
|
+
smallestVolume?: number;
|
|
149
|
+
/** 可选的自定义分布函数(会覆盖其他设置),默认: null
|
|
150
|
+
* point和volume都是比例值,point的x/y/z范围在-1到1之间,volume范围在0到1之间 */
|
|
151
|
+
distribute?: ((cloud: CloudState, index: number) => {
|
|
152
|
+
point: Vector3;
|
|
153
|
+
volume?: number;
|
|
154
|
+
}) | null;
|
|
155
|
+
/** 动态云朵的生长系数(当speed > 0时生效),默认: 4 */
|
|
156
|
+
growth?: number;
|
|
157
|
+
/** 动画速度系数,默认: 0 */
|
|
158
|
+
speed?: number;
|
|
159
|
+
/** 相机距离达到该值时云朵会渐隐,默认: 10 */
|
|
160
|
+
fade?: number;
|
|
161
|
+
/** 不透明度,默认: 1 */
|
|
162
|
+
opacity?: number;
|
|
163
|
+
/** 颜色,默认: 白色 */
|
|
164
|
+
color?: Color;
|
|
165
|
+
hexcolor?: string;
|
|
166
|
+
boundstext?: {
|
|
167
|
+
x: number;
|
|
168
|
+
y: number;
|
|
169
|
+
z: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export declare class CloudsLayer extends OverlayLayer<ICloud> {
|
|
174
|
+
_clouds: Clouds | null;
|
|
175
|
+
constructor(id: string, options: ICloudLayerOptions);
|
|
176
|
+
private _createClouds;
|
|
177
|
+
protected validateFeature(feature: ICloud): boolean;
|
|
178
|
+
protected animate(delta: number, elapsedtime: number): void;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare type CloudState = {
|
|
182
|
+
ref: Group;
|
|
183
|
+
uuid: string;
|
|
184
|
+
index: number;
|
|
185
|
+
segments: number;
|
|
186
|
+
dist: number;
|
|
187
|
+
matrix: Matrix4;
|
|
188
|
+
bounds: Vector3;
|
|
189
|
+
position: Vector3;
|
|
190
|
+
volume: number;
|
|
191
|
+
length: number;
|
|
192
|
+
speed: number;
|
|
193
|
+
growth: number;
|
|
194
|
+
opacity: number;
|
|
195
|
+
fade: number;
|
|
196
|
+
density: number;
|
|
197
|
+
rotation: number;
|
|
198
|
+
rotationFactor: number;
|
|
199
|
+
color: Color;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
declare type CloudStyle = BaseStyle & CloudProps & {
|
|
203
|
+
type: 'cloud';
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
declare type Coordinate = [number, number] | [number, number, number];
|
|
207
|
+
|
|
208
|
+
declare interface CustomStyle extends BaseStyle {
|
|
209
|
+
type: 'custom';
|
|
210
|
+
build: () => Object3D | Promise<Object3D>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class EmptyClass {
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export declare class EventClass {
|
|
217
|
+
private _dispatcher;
|
|
218
|
+
private _listenerMap;
|
|
219
|
+
on(type: string, listener: (data?: any) => void): this;
|
|
220
|
+
once(type: string, listener: (data?: any) => void): this;
|
|
221
|
+
off(type: string, listener: (...args: any[]) => void): this;
|
|
222
|
+
trigger(type: string, data?: any): this;
|
|
223
|
+
get threeEventDispatcher(): EventDispatcher;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare interface ExtrudeStyle extends BaseStyle {
|
|
227
|
+
type: 'extrude-polygon';
|
|
228
|
+
color?: number | string;
|
|
229
|
+
opacity?: number;
|
|
230
|
+
wireframe?: boolean;
|
|
231
|
+
side?: 'front' | 'back' | 'double';
|
|
232
|
+
extrude?: {
|
|
233
|
+
height: number;
|
|
234
|
+
bevelEnabled?: boolean;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
declare abstract class Feature extends Feature_base {
|
|
239
|
+
_position: Vector3 | Vector3[];
|
|
240
|
+
_threeGeometry: Object3D | Line2;
|
|
241
|
+
_geometry: GeoJSONGeometry;
|
|
242
|
+
_layer?: OverlayLayer;
|
|
243
|
+
_style?: Style_2;
|
|
244
|
+
private _styleQueue;
|
|
245
|
+
private _isApplyingStyle;
|
|
246
|
+
private _isGeometryInitializing;
|
|
247
|
+
constructor(options: FeatureOptions);
|
|
248
|
+
initializeGeometry(): Promise<void>;
|
|
249
|
+
abstract _toThreeJSGeometry(): Promise<void> | void;
|
|
250
|
+
setStyle(input: StyleInput): this;
|
|
251
|
+
getStyle(): Style_2 | undefined;
|
|
252
|
+
private _applyStyleWithRetry;
|
|
253
|
+
private _processStyleQueue;
|
|
254
|
+
_tryProcessQueue(): void;
|
|
255
|
+
addTo(layer: OverlayLayer): this;
|
|
256
|
+
getLayer(): OverlayLayer | null;
|
|
257
|
+
getMap(): Map_2 | null;
|
|
258
|
+
_bindLayer(layer: OverlayLayer): void;
|
|
259
|
+
_updateGeometry(): void;
|
|
260
|
+
/**
|
|
261
|
+
* 将其自身从图层中移除(如果有的话)。
|
|
262
|
+
* @english
|
|
263
|
+
* remove itself from the layer if any.
|
|
264
|
+
* @returns {Feature} this
|
|
265
|
+
*/
|
|
266
|
+
_remove(): this;
|
|
267
|
+
_unbind(): void;
|
|
268
|
+
_disposeGeometry(): void;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
declare const Feature_base: {
|
|
272
|
+
new (...args: any[]): {
|
|
273
|
+
eventClass: EventClass_2;
|
|
274
|
+
on: (type: string, listener: (data?: any) => void) => EventClass_2;
|
|
275
|
+
trigger: (type: string, data?: any) => EventClass_2;
|
|
276
|
+
off: (type: string, listener: (...args: any[]) => void) => EventClass_2;
|
|
277
|
+
};
|
|
278
|
+
} & {
|
|
279
|
+
new (...args: any[]): {
|
|
280
|
+
[x: string]: any;
|
|
281
|
+
options: any;
|
|
282
|
+
};
|
|
283
|
+
mergeOptions(options: {
|
|
284
|
+
[x: string]: any;
|
|
285
|
+
}): any & typeof Object3D;
|
|
286
|
+
} & typeof Object3D;
|
|
287
|
+
|
|
288
|
+
declare type FeatureOptions = {
|
|
289
|
+
id?: string;
|
|
290
|
+
geometry?: GeoJSON.Geometry;
|
|
291
|
+
visible?: boolean;
|
|
292
|
+
defaultProjection?: string;
|
|
293
|
+
style?: StyleInput;
|
|
294
|
+
userData?: {
|
|
295
|
+
[key: string]: any;
|
|
296
|
+
};
|
|
297
|
+
rotateAngle?: number;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
declare type GeoJSONGeometry = Point | MultiPoint | LineString_2 | MultiLineString_2 | Polygon_2 | MultiPolygon;
|
|
301
|
+
|
|
302
|
+
export declare class ICloud extends Point_2 {
|
|
303
|
+
_type: string;
|
|
304
|
+
constructor(options: PointOptions);
|
|
305
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
306
|
+
_updateGeometry(): void;
|
|
307
|
+
_createObject(style: Style_2): Promise<any>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
declare type ICloudLayerOptions = OverlayLayerOptions<ICloud> & {
|
|
311
|
+
texture: string | Texture;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
declare interface IconLabelStyle extends BaseStyle {
|
|
315
|
+
type: 'icon-label-point';
|
|
316
|
+
text: string;
|
|
317
|
+
iconUrl?: string;
|
|
318
|
+
iconSize?: number;
|
|
319
|
+
iconScale?: number;
|
|
320
|
+
fontSize?: number;
|
|
321
|
+
fontFamily?: string;
|
|
322
|
+
textColor?: string;
|
|
323
|
+
strokeColor?: string;
|
|
324
|
+
strokeWidth?: number;
|
|
325
|
+
renderbg?: boolean;
|
|
326
|
+
bgColor?: string;
|
|
327
|
+
padding?: {
|
|
328
|
+
top?: number;
|
|
329
|
+
right?: number;
|
|
330
|
+
bottom?: number;
|
|
331
|
+
left?: number;
|
|
332
|
+
};
|
|
333
|
+
canvasScale?: number;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
declare interface IconPointStyle extends BaseStyle {
|
|
337
|
+
type: 'icon-point';
|
|
338
|
+
color?: string | number | Color;
|
|
339
|
+
url: string;
|
|
340
|
+
size: [number, number];
|
|
341
|
+
rotation?: number;
|
|
342
|
+
anchor?: [number, number];
|
|
343
|
+
sizeAttenuation?: boolean;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Porjection interface
|
|
348
|
+
*/
|
|
349
|
+
declare interface IProjection {
|
|
350
|
+
readonly ID: ProjectionType_2;
|
|
351
|
+
readonly mapWidth: number;
|
|
352
|
+
readonly mapHeight: number;
|
|
353
|
+
readonly mapDepth: number;
|
|
354
|
+
readonly lon0: number;
|
|
355
|
+
project(lon: number, lat: number): {
|
|
356
|
+
x: number;
|
|
357
|
+
y: number;
|
|
358
|
+
};
|
|
359
|
+
unProject(x: number, y: number): {
|
|
360
|
+
lon: number;
|
|
361
|
+
lat: number;
|
|
362
|
+
};
|
|
363
|
+
getTileXWithCenterLon(x: number, z: number): number;
|
|
364
|
+
getProjBoundsFromLonLat(bounds: [number, number, number, number]): [number, number, number, number];
|
|
365
|
+
getProjBoundsFromXYZ(x: number, y: number, z: number): [number, number, number, number];
|
|
366
|
+
getLonLatBoundsFromXYZ(x: number, y: number, z: number): [number, number, number, number];
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Source interface
|
|
371
|
+
* all source implements ISource get url from x/y/z coordinate to url
|
|
372
|
+
*/
|
|
373
|
+
declare interface ISource {
|
|
374
|
+
/** A string identifies the source data type, it requires the support of the loader. */
|
|
375
|
+
dataType: string;
|
|
376
|
+
/** Source attribution info, it allows you to display attribution*/
|
|
377
|
+
attribution: string;
|
|
378
|
+
/** Data max level */
|
|
379
|
+
minLevel: number;
|
|
380
|
+
/** Data min level */
|
|
381
|
+
maxLevel: number;
|
|
382
|
+
/** Data projection */
|
|
383
|
+
projectionID: ProjectionType;
|
|
384
|
+
/** Display opacity */
|
|
385
|
+
opacity: number;
|
|
386
|
+
/** is TMS scheme */
|
|
387
|
+
isTMS?: boolean;
|
|
388
|
+
bounds: [number, number, number, number];
|
|
389
|
+
/** Data bounds in Proejction, internal use */
|
|
390
|
+
_projectionBounds: [number, number, number, number];
|
|
391
|
+
/** Get url from xyz, internal use */
|
|
392
|
+
_getUrl(x: number, y: number, z: number): string | undefined;
|
|
393
|
+
/** Any data */
|
|
394
|
+
[key: string]: unknown;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Tile Loader Interface */
|
|
398
|
+
declare interface ITileLoader<TMeshData extends MeshDateType = MeshDateType> {
|
|
399
|
+
/** Load Tile Data */
|
|
400
|
+
manager: TileLoadingManager;
|
|
401
|
+
/** Image Loader */
|
|
402
|
+
imgSource: ISource[];
|
|
403
|
+
/** Terrain Loader */
|
|
404
|
+
demSource: ISource | undefined;
|
|
405
|
+
/** Load Tile Data */
|
|
406
|
+
load(params: TileLoadParamsType): Promise<TMeshData>;
|
|
407
|
+
/** Unload Tile Data */
|
|
408
|
+
unload?(tileMesh: Mesh): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export declare class Label extends Point_2 {
|
|
412
|
+
_type: string;
|
|
413
|
+
constructor(options: MakerOptions_2);
|
|
414
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
415
|
+
_createObject(style: Style_2): Promise<Object3D>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare interface LabelStyle extends BaseStyle {
|
|
419
|
+
type: 'canvas-label' | 'canvas-label-fixed';
|
|
420
|
+
text: string;
|
|
421
|
+
fontSize?: number;
|
|
422
|
+
fontFamily?: string;
|
|
423
|
+
fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | number;
|
|
424
|
+
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
425
|
+
textColor?: string;
|
|
426
|
+
strokeColor?: string;
|
|
427
|
+
strokeWidth?: number;
|
|
428
|
+
showBackground?: boolean;
|
|
429
|
+
bgStyle?: 1 | 2;
|
|
430
|
+
bgColor?: string;
|
|
431
|
+
bgOpacity?: number;
|
|
432
|
+
shadowColor?: string;
|
|
433
|
+
shadowBlur?: number;
|
|
434
|
+
shadowOffsetX?: number;
|
|
435
|
+
shadowOffsetY?: number;
|
|
436
|
+
roundRectRadius?: number;
|
|
437
|
+
bubblePointerHeight?: number;
|
|
438
|
+
bubblePointerWidth?: number;
|
|
439
|
+
bubbleBorderColor?: string;
|
|
440
|
+
bubbleBorderWidth?: number;
|
|
441
|
+
fixedSize?: number;
|
|
442
|
+
screenSpaceSize?: number;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 抽象类,不参与实例化
|
|
447
|
+
* Layer is the base class of all layers.
|
|
448
|
+
* @class Layer
|
|
449
|
+
* @param {String} id - layer id.
|
|
450
|
+
* @param {LayerOptions} [options=null] - options of layer.
|
|
451
|
+
*/
|
|
452
|
+
declare abstract class Layer extends Layer_base {
|
|
453
|
+
private _id;
|
|
454
|
+
opacity: number;
|
|
455
|
+
private _animationCallbacks;
|
|
456
|
+
constructor(id: string, options?: LayerOptions);
|
|
457
|
+
getId(): string;
|
|
458
|
+
addTo(map: Map_2): this;
|
|
459
|
+
getZIndex(): number;
|
|
460
|
+
getOpacity(): number;
|
|
461
|
+
setOpacity(opacity: number): void;
|
|
462
|
+
getMap(): any;
|
|
463
|
+
/**
|
|
464
|
+
* 显示图层
|
|
465
|
+
* @returns
|
|
466
|
+
*/
|
|
467
|
+
show(): this;
|
|
468
|
+
/**
|
|
469
|
+
* 隐藏图层
|
|
470
|
+
* @returns this
|
|
471
|
+
*/
|
|
472
|
+
hide(): this;
|
|
473
|
+
_bindMap(map: Map_2): void;
|
|
474
|
+
/**
|
|
475
|
+
* 子类可实现的动画逻辑(可选)
|
|
476
|
+
* @param delta 帧间隔时间
|
|
477
|
+
*/
|
|
478
|
+
protected animate?(delta: number, elapsedtime: number): void;
|
|
479
|
+
/**
|
|
480
|
+
* 注册动画回调到 Viewer
|
|
481
|
+
*/
|
|
482
|
+
private _registerAnimate;
|
|
483
|
+
/**
|
|
484
|
+
* 移除动画回调
|
|
485
|
+
*/
|
|
486
|
+
protected _clearAnimationCallbacks(): void;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare const Layer_base: {
|
|
490
|
+
new (...args: any[]): {
|
|
491
|
+
eventClass: EventClass_2;
|
|
492
|
+
on: (type: string, listener: (data?: any) => void) => EventClass_2;
|
|
493
|
+
trigger: (type: string, data?: any) => EventClass_2;
|
|
494
|
+
off: (type: string, listener: (...args: any[]) => void) => EventClass_2;
|
|
495
|
+
};
|
|
496
|
+
} & {
|
|
497
|
+
new (...args: any[]): {
|
|
498
|
+
[x: string]: any;
|
|
499
|
+
options: any;
|
|
500
|
+
};
|
|
501
|
+
mergeOptions(options: {
|
|
502
|
+
[x: string]: any;
|
|
503
|
+
}): any & typeof Group;
|
|
504
|
+
} & typeof Group;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* 图层容器类,用于管理多个图层
|
|
508
|
+
*/
|
|
509
|
+
declare class LayerContainer extends Group {
|
|
510
|
+
private _layers;
|
|
511
|
+
_layerids: Set<string>;
|
|
512
|
+
add(...layers: Layer[]): this;
|
|
513
|
+
remove(...layers: Layer[]): this;
|
|
514
|
+
getLayers(): Layer[];
|
|
515
|
+
/**
|
|
516
|
+
* 根据 ID 查找 Layer
|
|
517
|
+
* @param id 要查找的 Layer ID
|
|
518
|
+
* @returns 找到的 Layer,如果不存在则返回 undefined
|
|
519
|
+
*/
|
|
520
|
+
getLayerById(id: string): Layer | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* 清空所有图层
|
|
523
|
+
* @returns this,用于链式调用
|
|
524
|
+
*/
|
|
525
|
+
clearLayers(): this;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
declare type LayerOptions = {
|
|
529
|
+
attribution?: string;
|
|
530
|
+
visible?: boolean;
|
|
531
|
+
opacity?: number;
|
|
532
|
+
zIndex?: number;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
declare interface LightWaterStyle extends BaseStyle {
|
|
536
|
+
type: 'water';
|
|
537
|
+
color?: number | string;
|
|
538
|
+
opacity?: number;
|
|
539
|
+
sunDirection?: Vector3;
|
|
540
|
+
sunColor?: number | string;
|
|
541
|
+
distortionScale?: number;
|
|
542
|
+
size?: number;
|
|
543
|
+
normalMap: string;
|
|
544
|
+
fog?: boolean;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
declare abstract class Line extends Feature {
|
|
548
|
+
readonly _baseType = "Line";
|
|
549
|
+
abstract _type: string;
|
|
550
|
+
_vertexPoints: number[];
|
|
551
|
+
constructor(options: LineOptions);
|
|
552
|
+
_coordsTransform(): any;
|
|
553
|
+
_toThreeJSGeometry(): void;
|
|
554
|
+
protected _createThreeGeometry(): Line2;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export declare class LineLayer extends OverlayLayer<Line> {
|
|
558
|
+
constructor(id: string, options?: LineLayerOptions);
|
|
559
|
+
protected validateFeature(feature: Line): boolean;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
declare type LineLayerOptions = OverlayLayerOptions<Line> & {};
|
|
563
|
+
|
|
564
|
+
declare type LineOptions = FeatureOptions & {
|
|
565
|
+
geometry?: LineString_2 | MultiLineString_2;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
export declare class LineString extends Line {
|
|
569
|
+
_type: string;
|
|
570
|
+
constructor(options: LineStringOptions);
|
|
571
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
572
|
+
_createObject(style: Style_2): Promise<Object3D>;
|
|
573
|
+
_updateGeometry(): void;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
declare type LineStringOptions = LineOptions & {};
|
|
577
|
+
|
|
578
|
+
declare enum LODAction {
|
|
579
|
+
none = 0,
|
|
580
|
+
create = 1,
|
|
581
|
+
remove = 2
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export declare class Maker extends Point_2 {
|
|
585
|
+
_type: string;
|
|
586
|
+
constructor(options: MakerOptions);
|
|
587
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
588
|
+
_createObject(style: Style_2): Promise<Object3D>;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
declare type MakerOptions = PointOptions & {};
|
|
592
|
+
|
|
593
|
+
declare type MakerOptions_2 = PointOptions & {};
|
|
594
|
+
|
|
595
|
+
declare class Map extends Map_base {
|
|
596
|
+
viewer: Viewer;
|
|
597
|
+
tilemap: TileMap;
|
|
598
|
+
readonly center: Coordinate;
|
|
599
|
+
options: Required<MapOptions>;
|
|
600
|
+
private _layerContainer;
|
|
601
|
+
private _EventMap;
|
|
602
|
+
private _canvasManager;
|
|
603
|
+
_onLoadHooks: Array<(...args: any[]) => void>;
|
|
604
|
+
constructor(container: HTMLElement | string, options: MapOptions);
|
|
605
|
+
static addOnLoadHook(fn: string | ((this: Map, ...args: any[]) => void), ...args: any[]): typeof Map;
|
|
606
|
+
_callOnLoadHooks(): void;
|
|
607
|
+
/**
|
|
608
|
+
* 初始化tilemap 地图
|
|
609
|
+
* @param options 地图配置项
|
|
610
|
+
* @returns tilemap地图对象
|
|
611
|
+
* */
|
|
612
|
+
private initTileMap;
|
|
613
|
+
/**
|
|
614
|
+
* 添加图层
|
|
615
|
+
* @param layers 图层对象或图层对象数组
|
|
616
|
+
* @param otherLayers 其他图层对象
|
|
617
|
+
* @returns 当前地图对象
|
|
618
|
+
*/
|
|
619
|
+
addLayer(layers: Layer | Array<Layer>, ...otherLayers: Array<Layer>): this;
|
|
620
|
+
/**
|
|
621
|
+
* 移除图层
|
|
622
|
+
* @param layers 要移除的图层对象或图层对象数组
|
|
623
|
+
* @returns 当前地图对象
|
|
624
|
+
*/
|
|
625
|
+
clearLayers(): LayerContainer;
|
|
626
|
+
/**
|
|
627
|
+
* 根据 ID 获取图层
|
|
628
|
+
* @param id 图层 ID
|
|
629
|
+
* @returns 找到的图层对象,如果未找到则返回 undefined
|
|
630
|
+
*/
|
|
631
|
+
getLayers(): Layer[];
|
|
632
|
+
/**
|
|
633
|
+
* 根据 ID 获取图层
|
|
634
|
+
* @param id 图层 ID
|
|
635
|
+
* @returns 找到的图层对象,如果未找到则返回 undefined
|
|
636
|
+
*/
|
|
637
|
+
getLayerById(id: string): Layer | undefined;
|
|
638
|
+
geo2world(coords: Vector3): Vector3;
|
|
639
|
+
world2geo(coords: Vector3): Vector3;
|
|
640
|
+
_getCanvas(width?: number, height?: number, keySuffix?: string): HTMLCanvasElement;
|
|
641
|
+
}
|
|
642
|
+
export { Map_2 as Map }
|
|
643
|
+
|
|
644
|
+
declare const Map_base: {
|
|
645
|
+
new (...args: any[]): {
|
|
646
|
+
eventClass: EventClass_2;
|
|
647
|
+
on: (type: string, listener: (data?: any) => void) => EventClass_2;
|
|
648
|
+
trigger: (type: string, data?: any) => EventClass_2;
|
|
649
|
+
off: (type: string, listener: (...args: any[]) => void) => EventClass_2;
|
|
650
|
+
};
|
|
651
|
+
} & {
|
|
652
|
+
new (...args: any[]): {
|
|
653
|
+
[x: string]: any;
|
|
654
|
+
options: any;
|
|
655
|
+
};
|
|
656
|
+
mergeOptions(options: {
|
|
657
|
+
[x: string]: any;
|
|
658
|
+
}): any & typeof EmptyClass;
|
|
659
|
+
} & typeof EmptyClass;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* MapBox datasource
|
|
663
|
+
*/
|
|
664
|
+
export declare class MapBoxSource extends TileSource {
|
|
665
|
+
token: string;
|
|
666
|
+
format: string;
|
|
667
|
+
style: string;
|
|
668
|
+
attribution: string;
|
|
669
|
+
maxLevel: number;
|
|
670
|
+
url: string;
|
|
671
|
+
constructor(options?: MapBoxSourceOptions);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export declare type MapBoxSourceOptions = SourceOptions & {
|
|
675
|
+
style?: string;
|
|
676
|
+
token: string;
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
declare type MapOptions = {
|
|
680
|
+
viewer?: ViewerOptions;
|
|
681
|
+
meshmap: TileMapParams;
|
|
682
|
+
center: Coordinate;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
/** Tile Mesh Data Type */
|
|
686
|
+
declare type MeshDateType = {
|
|
687
|
+
/** Tile materials */
|
|
688
|
+
materials: Material[];
|
|
689
|
+
/** Tile geometry */
|
|
690
|
+
geometry: BufferGeometry;
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
export declare class Model extends Point_2 {
|
|
694
|
+
_type: string;
|
|
695
|
+
private _emissive;
|
|
696
|
+
private _emissiveIntensity;
|
|
697
|
+
private _emissiveColor;
|
|
698
|
+
private _mixer;
|
|
699
|
+
private _currentAction;
|
|
700
|
+
private _animations;
|
|
701
|
+
private _clock;
|
|
702
|
+
private _autoUpdate;
|
|
703
|
+
private _animationRequestId;
|
|
704
|
+
private _iscity;
|
|
705
|
+
constructor(options: ModelOptions);
|
|
706
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
707
|
+
_createObject(style: Style_2): Promise<any>;
|
|
708
|
+
private _applyEmissionProperties;
|
|
709
|
+
get emissive(): boolean;
|
|
710
|
+
set emissive(value: boolean);
|
|
711
|
+
get emissiveIntensity(): number;
|
|
712
|
+
set emissiveIntensity(value: number);
|
|
713
|
+
get emissiveColor(): string;
|
|
714
|
+
set emissiveColor(value: string);
|
|
715
|
+
setEmission(enabled: boolean, intensity?: number, color?: string): void;
|
|
716
|
+
setShadows(options: {
|
|
717
|
+
cast: boolean;
|
|
718
|
+
receive: boolean;
|
|
719
|
+
}): Promise<void>;
|
|
720
|
+
playAnimation(params: AnimationPlayParams): void;
|
|
721
|
+
stopAnimation(params?: {
|
|
722
|
+
fadeDuration?: number;
|
|
723
|
+
}): void;
|
|
724
|
+
setAnimationPaused(params: AnimationPauseParams): void;
|
|
725
|
+
setAnimationSpeed(params: AnimationSpeedParams): void;
|
|
726
|
+
updateAnimation(params: AnimationUpdateParams): void;
|
|
727
|
+
getAnimationNames(): string[];
|
|
728
|
+
getCurrentAnimationName(): string | null;
|
|
729
|
+
getAnimationDuration(params: {
|
|
730
|
+
name: string | number;
|
|
731
|
+
}): number | null;
|
|
732
|
+
dispose(): void;
|
|
733
|
+
private _startAnimationLoop;
|
|
734
|
+
private _stopAnimationLoop;
|
|
735
|
+
setAutoUpdate(enabled: boolean): void;
|
|
736
|
+
private _rendercity;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
declare type ModelOptions = PointOptions & {
|
|
740
|
+
emissive?: boolean;
|
|
741
|
+
emissiveIntensity?: number;
|
|
742
|
+
emissiveColor?: string;
|
|
743
|
+
castShadow?: boolean;
|
|
744
|
+
receiveShadow?: boolean;
|
|
745
|
+
iscity?: boolean;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
declare interface ModelStyle extends BaseStyle {
|
|
749
|
+
url: string;
|
|
750
|
+
type: 'gltf' | 'fbx';
|
|
751
|
+
position?: Vector3;
|
|
752
|
+
scale?: number | Vector3 | {
|
|
753
|
+
x?: number;
|
|
754
|
+
y?: number;
|
|
755
|
+
z?: number;
|
|
756
|
+
};
|
|
757
|
+
rotation?: Vector3;
|
|
758
|
+
materialOverrides?: Record<string, Material>;
|
|
759
|
+
manager?: LoadingManager;
|
|
760
|
+
dracoOptions?: {
|
|
761
|
+
enable: boolean;
|
|
762
|
+
decoderPath?: string;
|
|
763
|
+
};
|
|
764
|
+
shadows?: {
|
|
765
|
+
cast?: boolean;
|
|
766
|
+
receive?: boolean;
|
|
767
|
+
quality?: 'low' | 'medium' | 'high';
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export declare class MultiLineString extends Line {
|
|
772
|
+
_type: string;
|
|
773
|
+
private _lineObjects;
|
|
774
|
+
private _linesContainer;
|
|
775
|
+
constructor(options: MultiLineStringOptions);
|
|
776
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
777
|
+
private _createLineObject;
|
|
778
|
+
_coordsTransform(): any;
|
|
779
|
+
private _updateContainer;
|
|
780
|
+
private clearLines;
|
|
781
|
+
_updateGeometry(): void;
|
|
782
|
+
_disposeObject(): void;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
declare type MultiLineStringOptions = LineOptions & {};
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Layer的基类, 管理features
|
|
789
|
+
* 抽象类,不能直接实例化
|
|
790
|
+
*/
|
|
791
|
+
declare abstract class OverlayLayer<T extends Feature = Feature> extends Layer {
|
|
792
|
+
private _feaList;
|
|
793
|
+
constructor(id: string, options?: OverlayLayerOptions<T>);
|
|
794
|
+
/**
|
|
795
|
+
* 子类必须实现的校验逻辑(抽象方法)
|
|
796
|
+
* @param feature 待校验的 Feature
|
|
797
|
+
* @returns 是否合法
|
|
798
|
+
**/
|
|
799
|
+
protected abstract validateFeature(feature: T): boolean;
|
|
800
|
+
/**
|
|
801
|
+
* 添加Feature到图层
|
|
802
|
+
* @param feature 要添加的Feature实例或实例数组
|
|
803
|
+
* @param fitView 是否自动调整地图视野
|
|
804
|
+
*/
|
|
805
|
+
addFeature(features: T | T[]): this;
|
|
806
|
+
/**
|
|
807
|
+
* 获取所有的Features
|
|
808
|
+
* @param filter
|
|
809
|
+
* @param context
|
|
810
|
+
* @returns
|
|
811
|
+
*/
|
|
812
|
+
getFeatures(filter?: (feature: Feature) => boolean, context?: any): Array<Feature>;
|
|
813
|
+
/**
|
|
814
|
+
* 获取 features 个数
|
|
815
|
+
*
|
|
816
|
+
* Get count of the features
|
|
817
|
+
* @return count
|
|
818
|
+
*/
|
|
819
|
+
getCount(): number;
|
|
820
|
+
/**
|
|
821
|
+
* layer 是否为空
|
|
822
|
+
*
|
|
823
|
+
* @english
|
|
824
|
+
* Whether the layer is empty.
|
|
825
|
+
* @return {Boolean}
|
|
826
|
+
*/
|
|
827
|
+
isEmpty(): boolean;
|
|
828
|
+
/**
|
|
829
|
+
* 移除一个或多个features
|
|
830
|
+
*
|
|
831
|
+
* @english
|
|
832
|
+
* Removes one or more features from the layer
|
|
833
|
+
* @param features - feature ids or features to remove
|
|
834
|
+
* @returns this
|
|
835
|
+
*/
|
|
836
|
+
removeFeature(features: Feature | Feature[]): any;
|
|
837
|
+
onRemoveFeature(feature: Feature): void;
|
|
838
|
+
_findInList(feature: Feature): number;
|
|
839
|
+
private _disposeFeatureResources;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
declare type OverlayLayerOptions<T extends Feature> = LayerOptions & {
|
|
843
|
+
features?: T[];
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
declare interface PipelineStyle extends BaseStyle {
|
|
847
|
+
type: 'tube-line';
|
|
848
|
+
color?: string | number | Color;
|
|
849
|
+
radius: number;
|
|
850
|
+
segments?: number;
|
|
851
|
+
caps?: boolean;
|
|
852
|
+
flowTexture?: string;
|
|
853
|
+
pressure?: number;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
declare abstract class Point_2 extends Feature {
|
|
857
|
+
readonly _baseType = "Point";
|
|
858
|
+
abstract _type: string;
|
|
859
|
+
constructor(options: PointOptions);
|
|
860
|
+
_coordsTransform(): Vector3;
|
|
861
|
+
_toThreeJSGeometry(): void;
|
|
862
|
+
protected _createThreeGeometry(): Points<BufferGeometry<NormalBufferAttributes>, PointsMaterial, Object3DEventMap>;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
export declare class PointLayer extends OverlayLayer<Point_2> {
|
|
866
|
+
constructor(id: string, options?: PointLayerOptions);
|
|
867
|
+
protected validateFeature(feature: Point_2): boolean;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
declare type PointLayerOptions = OverlayLayerOptions<Point_2> & {};
|
|
871
|
+
|
|
872
|
+
declare type PointOptions = FeatureOptions & {
|
|
873
|
+
geometry?: Point | MultiPoint;
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
declare type PointStyle = BasicPointStyle | IconPointStyle | IconLabelStyle;
|
|
877
|
+
|
|
878
|
+
export declare class Polygon extends Surface {
|
|
879
|
+
_type: string;
|
|
880
|
+
constructor(options: PolygonOptions);
|
|
881
|
+
_toThreeJSGeometry(): Promise<void>;
|
|
882
|
+
_createObject(style: Style_2): Promise<Object3D>;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export declare class PolygonLayer extends OverlayLayer<Polygon> {
|
|
886
|
+
constructor(id: string, options?: PolygonLayerOptions);
|
|
887
|
+
protected validateFeature(feature: Polygon): boolean;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
declare type PolygonLayerOptions = OverlayLayerOptions<Polygon> & {};
|
|
891
|
+
|
|
892
|
+
declare type PolygonOptions = SurfaceOptions & {
|
|
893
|
+
geometry?: Polygon_2 | MultiPolygon;
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Map projection center longitude type
|
|
898
|
+
* 地图投影中心经度类型
|
|
899
|
+
*/
|
|
900
|
+
declare type ProjectCenterLongitude = 0 | 90 | -90;
|
|
901
|
+
|
|
902
|
+
/** Project ID */
|
|
903
|
+
declare type ProjectionType = "3857" | "4326";
|
|
904
|
+
|
|
905
|
+
declare type ProjectionType_2 = "3857" | "4326";
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* source construtor params type
|
|
909
|
+
*/
|
|
910
|
+
declare interface SourceOptions {
|
|
911
|
+
/** A string identifies the source data type, it requires the support of the loader. */
|
|
912
|
+
dataType?: string;
|
|
913
|
+
/** Source attribution info, it allows you to display attribution*/
|
|
914
|
+
attribution?: string;
|
|
915
|
+
/** Data max level */
|
|
916
|
+
minLevel?: number;
|
|
917
|
+
/** Data min level */
|
|
918
|
+
maxLevel?: number;
|
|
919
|
+
/** Data projection */
|
|
920
|
+
projectionID?: ProjectionType;
|
|
921
|
+
/** Display opacity */
|
|
922
|
+
opacity?: number;
|
|
923
|
+
bounds?: [number, number, number, number];
|
|
924
|
+
/** Data Url template */
|
|
925
|
+
url?: string;
|
|
926
|
+
/** Url subdomains array or string */
|
|
927
|
+
subdomains?: string[] | string;
|
|
928
|
+
/** Is TMS scheme */
|
|
929
|
+
isTMS?: boolean;
|
|
930
|
+
/** Any data */
|
|
931
|
+
[key: string]: unknown;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
declare type Style = "img_w" | "cia_w" | "cva_w" | "ibo_w" | "ter_w" | "vec_w" | "cta_w" | "img_c" | "cia_c";
|
|
935
|
+
|
|
936
|
+
declare class Style_2 {
|
|
937
|
+
config: StyleConfig;
|
|
938
|
+
private static _textureCache;
|
|
939
|
+
private static _textureLoader;
|
|
940
|
+
constructor(config: StyleConfig);
|
|
941
|
+
applyTo(object: Object3D): Promise<boolean>;
|
|
942
|
+
private _applyPointStyle;
|
|
943
|
+
private _applyIconPoint;
|
|
944
|
+
private _applyBasicPoint;
|
|
945
|
+
private _applyIconLabelPoint;
|
|
946
|
+
private _applyLineStyle;
|
|
947
|
+
private _applyPolygonStyle;
|
|
948
|
+
private _applyExtrudeStyle;
|
|
949
|
+
private _applyWaterStyle;
|
|
950
|
+
private _applyCloudStyle;
|
|
951
|
+
private _applyTextSpriteStyle;
|
|
952
|
+
private _applyModelStyle;
|
|
953
|
+
private _applyCustomStyle;
|
|
954
|
+
static _loadTexture(url: string): Promise<Texture>;
|
|
955
|
+
static create(input: StyleInput): Style_2;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
declare type StyleConfig = PointStyle | BaseLineStyle | PipelineStyle | ModelStyle | CustomStyle | BasePolygonStyle | ExtrudeStyle | WaterStyle | CloudStyle | BaseWaterStyle | LabelStyle | IconLabelStyle;
|
|
959
|
+
|
|
960
|
+
declare type StyleInput = StyleConfig | Style_2;
|
|
961
|
+
|
|
962
|
+
declare abstract class Surface extends Feature {
|
|
963
|
+
readonly _baseType = "Surface";
|
|
964
|
+
abstract _type: string;
|
|
965
|
+
_vertexPoints: number[];
|
|
966
|
+
constructor(options: SurfaceOptions);
|
|
967
|
+
_coordsTransform(): any;
|
|
968
|
+
_updateGeometry(): void;
|
|
969
|
+
protected _createThreeGeometry(): Line2;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
declare type SurfaceOptions = FeatureOptions & {
|
|
973
|
+
geometry?: Polygon_2 | MultiPolygon;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
export declare class TDTQMSource extends TileSource {
|
|
977
|
+
dataType: string;
|
|
978
|
+
attribution: string;
|
|
979
|
+
token: string;
|
|
980
|
+
subdomains: string;
|
|
981
|
+
url: string;
|
|
982
|
+
constructor(options?: TDTSourceOptins);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* TianDiTu datasource
|
|
987
|
+
*/
|
|
988
|
+
export declare class TDTSource extends TileSource {
|
|
989
|
+
dataType: string;
|
|
990
|
+
attribution: string;
|
|
991
|
+
token: string;
|
|
992
|
+
style: Style;
|
|
993
|
+
subdomains: string;
|
|
994
|
+
url: string;
|
|
995
|
+
constructor(options?: TDTSourceOptins);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export declare type TDTSourceOptins = SourceOptions & {
|
|
999
|
+
style?: Style;
|
|
1000
|
+
token: string;
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Class Tile, inherit of Mesh
|
|
1005
|
+
*/
|
|
1006
|
+
/**
|
|
1007
|
+
* Represents a tile in a 3D scene.
|
|
1008
|
+
* Extends the Mesh class with BufferGeometry and Material.
|
|
1009
|
+
*/
|
|
1010
|
+
declare class Tile extends Mesh<BufferGeometry, Material[], TTileEventMap> {
|
|
1011
|
+
private static _downloadThreads;
|
|
1012
|
+
/**
|
|
1013
|
+
* Number of download threads.
|
|
1014
|
+
*/
|
|
1015
|
+
static get downloadThreads(): number;
|
|
1016
|
+
/** Coordinate of tile */
|
|
1017
|
+
readonly x: number;
|
|
1018
|
+
readonly y: number;
|
|
1019
|
+
readonly z: number;
|
|
1020
|
+
/** Is a tile? */
|
|
1021
|
+
readonly isTile = true;
|
|
1022
|
+
/** Tile parent */
|
|
1023
|
+
readonly parent: this | null;
|
|
1024
|
+
/** Children of tile */
|
|
1025
|
+
readonly children: this[];
|
|
1026
|
+
private _ready;
|
|
1027
|
+
/** return this.minLevel < map.minLevel, True mean do not needs load tile data */
|
|
1028
|
+
private _isDummy;
|
|
1029
|
+
get isDummy(): boolean;
|
|
1030
|
+
private _showing;
|
|
1031
|
+
/**
|
|
1032
|
+
* Gets the showing state of the tile.
|
|
1033
|
+
*/
|
|
1034
|
+
get showing(): boolean;
|
|
1035
|
+
/**
|
|
1036
|
+
* Sets the showing state of the tile.
|
|
1037
|
+
* @param value - The new showing state.
|
|
1038
|
+
*/
|
|
1039
|
+
set showing(value: boolean);
|
|
1040
|
+
/** Max height of tile */
|
|
1041
|
+
private _maxZ;
|
|
1042
|
+
/**
|
|
1043
|
+
* Gets the maximum height of the tile.
|
|
1044
|
+
*/
|
|
1045
|
+
get maxZ(): number;
|
|
1046
|
+
/**
|
|
1047
|
+
* Sets the maximum height of the tile.
|
|
1048
|
+
* @param value - The new maximum height.
|
|
1049
|
+
*/
|
|
1050
|
+
protected set maxZ(value: number);
|
|
1051
|
+
/** Distance to camera */
|
|
1052
|
+
distToCamera: number;
|
|
1053
|
+
sizeInWorld: number;
|
|
1054
|
+
/**
|
|
1055
|
+
* Gets the index of the tile in its parent's children array.
|
|
1056
|
+
* @returns The index of the tile.
|
|
1057
|
+
*/
|
|
1058
|
+
get index(): number;
|
|
1059
|
+
private _loaded;
|
|
1060
|
+
/**
|
|
1061
|
+
* Gets the load state of the tile.
|
|
1062
|
+
*/
|
|
1063
|
+
get loaded(): boolean;
|
|
1064
|
+
private _inFrustum;
|
|
1065
|
+
/** Is tile in frustum ?*/
|
|
1066
|
+
get inFrustum(): boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Sets whether the tile is in the frustum.
|
|
1069
|
+
* @param value - The new frustum state.
|
|
1070
|
+
*/
|
|
1071
|
+
protected set inFrustum(value: boolean);
|
|
1072
|
+
/** Tile is a leaf ? */
|
|
1073
|
+
get isLeaf(): boolean;
|
|
1074
|
+
/**
|
|
1075
|
+
* Constructor for the Tile class.
|
|
1076
|
+
* @param x - Tile X-coordinate, default: 0.
|
|
1077
|
+
* @param y - Tile Y-coordinate, default: 0.
|
|
1078
|
+
* @param z - Tile level, default: 0.
|
|
1079
|
+
*/
|
|
1080
|
+
constructor(x?: number, y?: number, z?: number);
|
|
1081
|
+
/**
|
|
1082
|
+
* Override Object3D.traverse, change the callback param type to "this".
|
|
1083
|
+
* @param callback - The callback function.
|
|
1084
|
+
*/
|
|
1085
|
+
traverse(callback: (object: this) => void): void;
|
|
1086
|
+
/**
|
|
1087
|
+
* Override Object3D.traverseVisible, change the callback param type to "this".
|
|
1088
|
+
* @param callback - The callback function.
|
|
1089
|
+
*/
|
|
1090
|
+
traverseVisible(callback: (object: this) => void): void;
|
|
1091
|
+
/**
|
|
1092
|
+
* Override Object3D.raycast, only test the tile has loaded.
|
|
1093
|
+
* @param raycaster - The raycaster.
|
|
1094
|
+
* @param intersects - The array of intersections.
|
|
1095
|
+
*/
|
|
1096
|
+
raycast(raycaster: Raycaster, intersects: Intersection[]): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* LOD (Level of Detail).
|
|
1099
|
+
* @param loader - The tile loader.
|
|
1100
|
+
* @param minLevel - The minimum level.
|
|
1101
|
+
* @param maxLevel - The maximum level.
|
|
1102
|
+
* @param threshold - The threshold.
|
|
1103
|
+
* @returns this
|
|
1104
|
+
*/
|
|
1105
|
+
protected LOD(params: TileUpdateParames): {
|
|
1106
|
+
action: LODAction;
|
|
1107
|
+
newTiles?: undefined;
|
|
1108
|
+
} | {
|
|
1109
|
+
action: LODAction;
|
|
1110
|
+
newTiles: Tile[];
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* Checks the visibility of the tile.
|
|
1114
|
+
*/
|
|
1115
|
+
private _checkVisible;
|
|
1116
|
+
/**
|
|
1117
|
+
* Asynchronously load tile data
|
|
1118
|
+
*
|
|
1119
|
+
* @param loader Tile loader
|
|
1120
|
+
* @returns this
|
|
1121
|
+
*/
|
|
1122
|
+
private _load;
|
|
1123
|
+
/** New tile init */
|
|
1124
|
+
private _init;
|
|
1125
|
+
/**
|
|
1126
|
+
* Updates the tile.
|
|
1127
|
+
* @param params - The update parameters.
|
|
1128
|
+
* @returns this
|
|
1129
|
+
*/
|
|
1130
|
+
update(params: TileUpdateParames): this;
|
|
1131
|
+
private _doAction;
|
|
1132
|
+
/**
|
|
1133
|
+
* Reloads the tile data.
|
|
1134
|
+
* @returns this
|
|
1135
|
+
*/
|
|
1136
|
+
reload(loader: ITileLoader): this;
|
|
1137
|
+
/**
|
|
1138
|
+
* Checks if the tile is ready to render.
|
|
1139
|
+
* @returns this
|
|
1140
|
+
*/
|
|
1141
|
+
private _checkReady;
|
|
1142
|
+
/**
|
|
1143
|
+
* UnLoads the tile data.
|
|
1144
|
+
* @param unLoadSelf - Whether to unload tile itself.
|
|
1145
|
+
* @returns this.
|
|
1146
|
+
*/
|
|
1147
|
+
private _unLoad;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Tile loader
|
|
1152
|
+
*/
|
|
1153
|
+
declare class TileLoader implements ITileLoader {
|
|
1154
|
+
private _imgSource;
|
|
1155
|
+
/** Get image source */
|
|
1156
|
+
get imgSource(): ISource[];
|
|
1157
|
+
/** Set image source */
|
|
1158
|
+
set imgSource(value: ISource[]);
|
|
1159
|
+
private _demSource;
|
|
1160
|
+
/** Get DEM source */
|
|
1161
|
+
get demSource(): ISource | undefined;
|
|
1162
|
+
/** Set DEM source */
|
|
1163
|
+
set demSource(value: ISource | undefined);
|
|
1164
|
+
/** Loader manager */
|
|
1165
|
+
manager: TileLoadingManager_2;
|
|
1166
|
+
/**
|
|
1167
|
+
* Load getmetry and materail of tile from x, y and z coordinate.
|
|
1168
|
+
*
|
|
1169
|
+
* @returns Promise<MeshDateType> tile data
|
|
1170
|
+
*/
|
|
1171
|
+
load(params: TileLoadParamsType): Promise<MeshDateType>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Unload tile mesh data
|
|
1174
|
+
* @param tileMesh tile mesh
|
|
1175
|
+
*/
|
|
1176
|
+
unload(tileMesh: Mesh): void;
|
|
1177
|
+
/**
|
|
1178
|
+
* Load geometry
|
|
1179
|
+
* @returns BufferGeometry
|
|
1180
|
+
*/
|
|
1181
|
+
protected loadGeometry(params: TileLoadParamsType): Promise<BufferGeometry>;
|
|
1182
|
+
/**
|
|
1183
|
+
* Load material
|
|
1184
|
+
* @param x x coordinate of tile
|
|
1185
|
+
* @param y y coordinate of tile
|
|
1186
|
+
* @param z z coordinate of tile
|
|
1187
|
+
* @returns Material[]
|
|
1188
|
+
*/
|
|
1189
|
+
protected loadMaterial(params: TileLoadParamsType): Promise<Material[]>;
|
|
1190
|
+
/**
|
|
1191
|
+
* Check the tile is in the source bounds. (projection coordinate)
|
|
1192
|
+
* @returns true in the bounds,else false
|
|
1193
|
+
*/
|
|
1194
|
+
private _isBoundsInSourceBounds;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
declare class TileLoadingManager extends LoadingManager {
|
|
1198
|
+
onParseEnd?: (url: string) => void;
|
|
1199
|
+
parseEnd(url: string): void;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Tile Load Params Type
|
|
1204
|
+
*/
|
|
1205
|
+
declare type TileLoadParamsType = {
|
|
1206
|
+
/** Tile X Coordinate */
|
|
1207
|
+
x: number;
|
|
1208
|
+
/** Tile Y Coordinate */
|
|
1209
|
+
y: number;
|
|
1210
|
+
/** Tile Z Coordinate */
|
|
1211
|
+
z: number;
|
|
1212
|
+
/** Tile projection Bounds */
|
|
1213
|
+
bounds: [number, number, number, number];
|
|
1214
|
+
/** Tile lonlat Bounds */
|
|
1215
|
+
lonLatBounds?: [number, number, number, number];
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Map Mesh
|
|
1220
|
+
* 地图模型
|
|
1221
|
+
*/
|
|
1222
|
+
declare class TileMap extends Mesh<BufferGeometry, Material, TileMapEventMap> {
|
|
1223
|
+
readonly name = "map";
|
|
1224
|
+
private readonly _clock;
|
|
1225
|
+
readonly isLOD = true;
|
|
1226
|
+
/**
|
|
1227
|
+
* Whether the LOD object is updated automatically by the renderer per frame or not.
|
|
1228
|
+
* If set to false, you have to call LOD.update() in the render loop by yourself. Default is true.
|
|
1229
|
+
* 瓦片是否在每帧渲染时自动更新,默认为真
|
|
1230
|
+
*/
|
|
1231
|
+
autoUpdate: boolean;
|
|
1232
|
+
/**
|
|
1233
|
+
* Tile tree update interval, unit: ms (default 100ms)
|
|
1234
|
+
* 瓦片树更新间隔,单位毫秒(默认100ms)
|
|
1235
|
+
*/
|
|
1236
|
+
updateInterval: number;
|
|
1237
|
+
/**
|
|
1238
|
+
* Root tile, it is the root node of tile tree.
|
|
1239
|
+
* 根瓦片
|
|
1240
|
+
*/
|
|
1241
|
+
readonly rootTile: Tile;
|
|
1242
|
+
/**
|
|
1243
|
+
* Map data loader, it used for load tile data and create tile geometry/Material
|
|
1244
|
+
* 地图数据加载器
|
|
1245
|
+
*/
|
|
1246
|
+
readonly loader: ITileLoader;
|
|
1247
|
+
readonly _loader: TileMapLoader;
|
|
1248
|
+
private _minLevel;
|
|
1249
|
+
/**
|
|
1250
|
+
* Get min level of map
|
|
1251
|
+
* 地图最小缩放级别,小于这个级别瓦片树不再更新
|
|
1252
|
+
*/
|
|
1253
|
+
get minLevel(): number;
|
|
1254
|
+
/**
|
|
1255
|
+
* Set max level of map
|
|
1256
|
+
* 设置地图最小缩放级别,小于这个级别瓦片树不再更新
|
|
1257
|
+
*/
|
|
1258
|
+
set minLevel(value: number);
|
|
1259
|
+
private _maxLevel;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get max level of map
|
|
1262
|
+
* 地图最大缩放级别,大于这个级别瓦片树不再更新
|
|
1263
|
+
*/
|
|
1264
|
+
get maxLevel(): number;
|
|
1265
|
+
/**
|
|
1266
|
+
* Set max level of map
|
|
1267
|
+
* 设置地图最大缩放级别,大于这个级别瓦片树不再更新
|
|
1268
|
+
*/
|
|
1269
|
+
set maxLevel(value: number);
|
|
1270
|
+
/**
|
|
1271
|
+
* Get central Meridian latidute
|
|
1272
|
+
* 取得中央子午线经度
|
|
1273
|
+
*/
|
|
1274
|
+
get lon0(): number;
|
|
1275
|
+
/**
|
|
1276
|
+
* Set central Meridian latidute, default:0
|
|
1277
|
+
* 设置中央子午线经度,中央子午线决定了地图的投影中心经度,可设置为-90,0,90
|
|
1278
|
+
*/
|
|
1279
|
+
set lon0(value: number);
|
|
1280
|
+
private _projection;
|
|
1281
|
+
/**
|
|
1282
|
+
* Set the map projection object
|
|
1283
|
+
* 取得地图投影对象
|
|
1284
|
+
*/
|
|
1285
|
+
get projection(): IProjection;
|
|
1286
|
+
/**
|
|
1287
|
+
* Get the map projection object
|
|
1288
|
+
* 设置地图投影对象
|
|
1289
|
+
*/
|
|
1290
|
+
private set projection(value);
|
|
1291
|
+
private _imgSource;
|
|
1292
|
+
/**
|
|
1293
|
+
* Get the image data source object
|
|
1294
|
+
* 取得影像数据源
|
|
1295
|
+
*/
|
|
1296
|
+
get imgSource(): ISource[];
|
|
1297
|
+
/**
|
|
1298
|
+
* Set the image data source object
|
|
1299
|
+
* 设置影像数据源
|
|
1300
|
+
*/
|
|
1301
|
+
set imgSource(value: ISource | ISource[]);
|
|
1302
|
+
private _demSource;
|
|
1303
|
+
/**
|
|
1304
|
+
* Get the terrain data source
|
|
1305
|
+
* 设置地形数据源
|
|
1306
|
+
*/
|
|
1307
|
+
get demSource(): ISource | undefined;
|
|
1308
|
+
/**
|
|
1309
|
+
* Set the terrain data source
|
|
1310
|
+
* 取得地形数据源
|
|
1311
|
+
*/
|
|
1312
|
+
set demSource(value: ISource | undefined);
|
|
1313
|
+
private _LODThreshold;
|
|
1314
|
+
/**
|
|
1315
|
+
* Get LOD threshold
|
|
1316
|
+
* 取得LOD阈值
|
|
1317
|
+
*/
|
|
1318
|
+
get LODThreshold(): number;
|
|
1319
|
+
/**
|
|
1320
|
+
* Set LOD threshold
|
|
1321
|
+
* 设置LOD阈值,LOD阈值越大,瓦片细化,但耗费资源越高,建议取1-2之间
|
|
1322
|
+
*/
|
|
1323
|
+
set LODThreshold(value: number);
|
|
1324
|
+
/**
|
|
1325
|
+
* Create a map using factory function
|
|
1326
|
+
* 地图创建工厂函数
|
|
1327
|
+
@param params 地图参数 {@link TileMapParams}
|
|
1328
|
+
@returns map mesh 地图模型
|
|
1329
|
+
@example
|
|
1330
|
+
``` typescript
|
|
1331
|
+
TileMap.create({
|
|
1332
|
+
// 影像数据源
|
|
1333
|
+
imgSource: [Source.mapBoxImgSource, new TestSource()],
|
|
1334
|
+
// 高程数据源
|
|
1335
|
+
demSource: source.mapBoxDemSource,
|
|
1336
|
+
// 地图投影中心经度
|
|
1337
|
+
lon0: 90,
|
|
1338
|
+
// 最小缩放级别
|
|
1339
|
+
minLevel: 1,
|
|
1340
|
+
// 最大缩放级别
|
|
1341
|
+
maxLevel: 18,
|
|
1342
|
+
});
|
|
1343
|
+
```
|
|
1344
|
+
*/
|
|
1345
|
+
static create(params: TileMapParams): TileMap;
|
|
1346
|
+
/**
|
|
1347
|
+
* Map mesh constructor
|
|
1348
|
+
*
|
|
1349
|
+
* 地图模型构造函数
|
|
1350
|
+
* @param params 地图参数 {@link TileMapParams}
|
|
1351
|
+
* @example
|
|
1352
|
+
* ``` typescript
|
|
1353
|
+
|
|
1354
|
+
const map = new TileMap({
|
|
1355
|
+
// 加载器
|
|
1356
|
+
loader: new TileLoader(),
|
|
1357
|
+
// 影像数据源
|
|
1358
|
+
imgSource: [Source.mapBoxImgSource, new TestSource()],
|
|
1359
|
+
// 高程数据源
|
|
1360
|
+
demSource: source.mapBoxDemSource,
|
|
1361
|
+
// 地图投影中心经度
|
|
1362
|
+
lon0: 90,
|
|
1363
|
+
// 最小缩放级别
|
|
1364
|
+
minLevel: 1,
|
|
1365
|
+
// 最大缩放级别
|
|
1366
|
+
maxLevel: 18,
|
|
1367
|
+
});;
|
|
1368
|
+
* ```
|
|
1369
|
+
*/
|
|
1370
|
+
constructor(params: TileMapParams);
|
|
1371
|
+
/**
|
|
1372
|
+
* Update the map, It is automatically called after mesh adding a scene
|
|
1373
|
+
* 模型更新回调函数,地图加入场景后会在每帧更新时被调用,该函数调用根瓦片实现瓦片树更新和数据加载
|
|
1374
|
+
* @param camera
|
|
1375
|
+
*/
|
|
1376
|
+
update(camera: Camera): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* reload the map data,muse called after the source has changed
|
|
1379
|
+
* 重新加载地图,在改变地图数据源后调用它才能生效
|
|
1380
|
+
*/
|
|
1381
|
+
reload(): void;
|
|
1382
|
+
/**
|
|
1383
|
+
* dispose map.
|
|
1384
|
+
* todo: remve event.
|
|
1385
|
+
* 释放地图资源,并移出场景
|
|
1386
|
+
*/
|
|
1387
|
+
dispose(): void;
|
|
1388
|
+
/**
|
|
1389
|
+
* Geo coordinates converted to map model coordinates
|
|
1390
|
+
* 地理坐标转换为地图模型坐标(与geo2map同功能)
|
|
1391
|
+
* @param geo 地理坐标(经纬度)
|
|
1392
|
+
* @returns 模型坐标
|
|
1393
|
+
* @deprecated This method is not recommended. Use geo2map() instead.
|
|
1394
|
+
*/
|
|
1395
|
+
geo2pos(geo: Vector3): Vector3;
|
|
1396
|
+
/**
|
|
1397
|
+
* Geo coordinates converted to map model coordinates
|
|
1398
|
+
* 地理坐标转换为地图模型坐标(与geo2pos同功能)
|
|
1399
|
+
* @param geo 地理坐标(经纬度)
|
|
1400
|
+
* @returns 模型坐标
|
|
1401
|
+
*/
|
|
1402
|
+
geo2map(geo: Vector3): Vector3;
|
|
1403
|
+
/**
|
|
1404
|
+
* Geo coordinates converted to world coordinates
|
|
1405
|
+
* 地理坐标转换为世界坐标
|
|
1406
|
+
*
|
|
1407
|
+
* @param geo 地理坐标(经纬度)
|
|
1408
|
+
* @returns 世界坐标
|
|
1409
|
+
*/
|
|
1410
|
+
geo2world(geo: Vector3): Vector3;
|
|
1411
|
+
/**
|
|
1412
|
+
* Map model coordinates converted to geo coordinates
|
|
1413
|
+
* 地图模型坐标转换为地理坐标(与map2geo同功能)
|
|
1414
|
+
* @param pos 模型坐标
|
|
1415
|
+
* @returns 地理坐标(经纬度)
|
|
1416
|
+
* @deprecated This method is not recommended. Use map2geo() instead.
|
|
1417
|
+
*/
|
|
1418
|
+
pos2geo(pos: Vector3): Vector3;
|
|
1419
|
+
/**
|
|
1420
|
+
* Map model coordinates converted to geo coordinates
|
|
1421
|
+
* 地图模型坐标转换为地理坐标(与pos2geo同功能)
|
|
1422
|
+
* @param map 模型坐标
|
|
1423
|
+
* @returns 地理坐标(经纬度)
|
|
1424
|
+
*/
|
|
1425
|
+
map2geo(pos: Vector3): Vector3;
|
|
1426
|
+
/**
|
|
1427
|
+
* World coordinates converted to geo coordinates
|
|
1428
|
+
* 世界坐标转换为地理坐标
|
|
1429
|
+
*
|
|
1430
|
+
* @param world 世界坐标
|
|
1431
|
+
* @returns 地理坐标(经纬度)
|
|
1432
|
+
*/
|
|
1433
|
+
world2geo(world: Vector3): Vector3;
|
|
1434
|
+
/**
|
|
1435
|
+
* Get the ground infomation from latitude and longitude
|
|
1436
|
+
* 获取指定经纬度的地面信息(法向量、高度等)
|
|
1437
|
+
* @param geo 地理坐标
|
|
1438
|
+
* @returns 地面信息
|
|
1439
|
+
*/
|
|
1440
|
+
getLocalInfoFromGeo(geo: Vector3): LocationInfo | undefined;
|
|
1441
|
+
/**
|
|
1442
|
+
* Get loacation infomation from world position
|
|
1443
|
+
* 获取指定世界坐标的地面信息
|
|
1444
|
+
* @param pos 世界坐标
|
|
1445
|
+
* @returns 地面信息
|
|
1446
|
+
*/
|
|
1447
|
+
getLocalInfoFromWorld(pos: Vector3): LocationInfo | undefined;
|
|
1448
|
+
/**
|
|
1449
|
+
* Get loacation infomation from screen pointer
|
|
1450
|
+
* 获取指定屏幕坐标的地面信息
|
|
1451
|
+
* @param camera 摄像机
|
|
1452
|
+
* @param pointer 点的屏幕坐标(-0.5~0.5)
|
|
1453
|
+
* @returns 位置信息(经纬度、高度等)
|
|
1454
|
+
*/
|
|
1455
|
+
getLocalInfoFromScreen(camera: Camera, pointer: Vector2): LocationInfo | undefined;
|
|
1456
|
+
/**
|
|
1457
|
+
* Get the number of currently downloading tiles
|
|
1458
|
+
* 取得当前正在下载的瓦片数量
|
|
1459
|
+
*/
|
|
1460
|
+
get downloading(): number;
|
|
1461
|
+
getTileCount(): {
|
|
1462
|
+
total: number;
|
|
1463
|
+
visible: number;
|
|
1464
|
+
leaf: number;
|
|
1465
|
+
maxLevel: number;
|
|
1466
|
+
downloading: number;
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* TileMap Event Map
|
|
1472
|
+
* 地图事件
|
|
1473
|
+
*/
|
|
1474
|
+
/**
|
|
1475
|
+
* Interface representing the event map for a TileMap.
|
|
1476
|
+
* Extends the Object3DEventMap interface.
|
|
1477
|
+
*
|
|
1478
|
+
* @interface TileMapEventMap
|
|
1479
|
+
*
|
|
1480
|
+
* @property {BaseEvent} ready - Event triggered when the TileMap is ready.
|
|
1481
|
+
* @property {BaseEvent & { delta: number }} update - Event triggered when the TileMap is updated.
|
|
1482
|
+
*
|
|
1483
|
+
* @property {BaseEvent & { tile: Tile }} "tile-created" - Event triggered when a tile is created.
|
|
1484
|
+
* @property {BaseEvent & { tile: Tile }} "tile-loaded" - Event triggered when a tile is loaded.
|
|
1485
|
+
*
|
|
1486
|
+
* @property {BaseEvent & { projection: IProjection }} "projection-changed" -
|
|
1487
|
+
* Event triggered when the projection changes, with the new projection.
|
|
1488
|
+
* @property {BaseEvent & { source: ISource | ISource[] | undefined }} "source-changed" -
|
|
1489
|
+
* Event triggered when the source changes, with the new source(s).
|
|
1490
|
+
*
|
|
1491
|
+
* @property {BaseEvent & { itemsLoaded: number; itemsTotal: number }} "loading-start" -
|
|
1492
|
+
* Event triggered when loading starts, with the number of items loaded and total items.
|
|
1493
|
+
* @property {BaseEvent & { url: string }} "loading-error" -
|
|
1494
|
+
* Event triggered when there is a loading error, with the URL of the failed resource.
|
|
1495
|
+
* @property {BaseEvent} "loading-complete" -
|
|
1496
|
+
* Event triggered when loading is complete.
|
|
1497
|
+
* @property {BaseEvent & { url: string; itemsLoaded: number; itemsTotal: number }} "loading-progress" -
|
|
1498
|
+
* Event triggered during loading progress, with the URL, items loaded, and total items.
|
|
1499
|
+
*
|
|
1500
|
+
* @property {BaseEvent & { url: string }} "parsing-end" -
|
|
1501
|
+
* Event triggered when parsing ends, with the URL of the parsed resource.
|
|
1502
|
+
*/
|
|
1503
|
+
declare interface TileMapEventMap extends Object3DEventMap {
|
|
1504
|
+
ready: BaseEvent;
|
|
1505
|
+
update: BaseEvent & {
|
|
1506
|
+
delta: number;
|
|
1507
|
+
};
|
|
1508
|
+
"tile-created": BaseEvent & {
|
|
1509
|
+
tile: Tile;
|
|
1510
|
+
};
|
|
1511
|
+
"tile-loaded": BaseEvent & {
|
|
1512
|
+
tile: Tile;
|
|
1513
|
+
};
|
|
1514
|
+
"tile-unload": BaseEvent & {
|
|
1515
|
+
tile: Tile;
|
|
1516
|
+
};
|
|
1517
|
+
"projection-changed": BaseEvent & {
|
|
1518
|
+
projection: IProjection;
|
|
1519
|
+
};
|
|
1520
|
+
"source-changed": BaseEvent & {
|
|
1521
|
+
source: ISource | ISource[] | undefined;
|
|
1522
|
+
};
|
|
1523
|
+
"loading-start": BaseEvent & {
|
|
1524
|
+
itemsLoaded: number;
|
|
1525
|
+
itemsTotal: number;
|
|
1526
|
+
};
|
|
1527
|
+
"loading-error": BaseEvent & {
|
|
1528
|
+
url: string;
|
|
1529
|
+
};
|
|
1530
|
+
"loading-complete": BaseEvent;
|
|
1531
|
+
"loading-progress": BaseEvent & {
|
|
1532
|
+
url: string;
|
|
1533
|
+
itemsLoaded: number;
|
|
1534
|
+
itemsTotal: number;
|
|
1535
|
+
};
|
|
1536
|
+
"parsing-end": BaseEvent & {
|
|
1537
|
+
url: string;
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** 地图瓦片加载器 */
|
|
1542
|
+
declare class TileMapLoader extends TileLoader {
|
|
1543
|
+
private _projection;
|
|
1544
|
+
attcth(loader: ITileLoader, projection: IProjection): void;
|
|
1545
|
+
load(params: TileLoadParamsType): Promise<MeshDateType>;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* Type of map create parameters
|
|
1550
|
+
* 地图创建参数
|
|
1551
|
+
*/
|
|
1552
|
+
declare type TileMapParams = {
|
|
1553
|
+
loader?: ITileLoader;
|
|
1554
|
+
rootTile?: Tile;
|
|
1555
|
+
imgSource: ISource[] | ISource;
|
|
1556
|
+
demSource?: ISource;
|
|
1557
|
+
minLevel?: number;
|
|
1558
|
+
maxLevel?: number;
|
|
1559
|
+
lon0?: ProjectCenterLongitude;
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Base class for data sources, users can customize data sources by inheriting this class
|
|
1564
|
+
*/
|
|
1565
|
+
declare class TileSource implements ISource {
|
|
1566
|
+
/** Data type that determines which loader to use for loading and processing data. Default is "image" type */
|
|
1567
|
+
dataType: string;
|
|
1568
|
+
/** Copyright attribution information for the data source, used for displaying map copyright notices */
|
|
1569
|
+
attribution: string;
|
|
1570
|
+
/** Minimum zoom level supported by the data source. Default is 0 */
|
|
1571
|
+
minLevel: number;
|
|
1572
|
+
/** Maximum zoom level supported by the data source. Default is 18 */
|
|
1573
|
+
maxLevel: number;
|
|
1574
|
+
/** Data projection type. Default is "3857" Mercator projection */
|
|
1575
|
+
projectionID: ProjectionType;
|
|
1576
|
+
/** URL template for tile data. Uses variables like {x},{y},{z} to construct tile request URLs */
|
|
1577
|
+
url: string;
|
|
1578
|
+
/** List of URL subdomains for load balancing. Can be an array of strings or a single string */
|
|
1579
|
+
subdomains: string[] | string;
|
|
1580
|
+
/** Currently used subdomain. Randomly selected from subdomains when requesting tiles */
|
|
1581
|
+
s: string;
|
|
1582
|
+
/** Layer opacity. Range 0-1, default is 1.0 (completely opaque) */
|
|
1583
|
+
opacity: number;
|
|
1584
|
+
/** Whether to use TMS tile coordinate system. Default false uses XYZ system, true uses TMS system */
|
|
1585
|
+
isTMS: boolean;
|
|
1586
|
+
/** Data bounds in format [minLon, minLat, maxLon, maxLat]. Default covers global range excluding polar regions */
|
|
1587
|
+
bounds: [number, number, number, number];
|
|
1588
|
+
/** Projected data bounds */
|
|
1589
|
+
_projectionBounds: [number, number, number, number];
|
|
1590
|
+
/** Any data */
|
|
1591
|
+
[key: string]: unknown;
|
|
1592
|
+
/**
|
|
1593
|
+
* constructor
|
|
1594
|
+
* @param options SourceOptions
|
|
1595
|
+
*/
|
|
1596
|
+
constructor(options?: SourceOptions);
|
|
1597
|
+
/**
|
|
1598
|
+
* Get url from tile coordinate, public, overwrite to custom generation tile url from xyz
|
|
1599
|
+
* @param x tile x coordinate
|
|
1600
|
+
* @param y tile y coordinate
|
|
1601
|
+
* @param z tile z coordinate
|
|
1602
|
+
* @returns url tile url
|
|
1603
|
+
*/
|
|
1604
|
+
getUrl(x: number, y: number, z: number): string | undefined;
|
|
1605
|
+
/**
|
|
1606
|
+
* Get url from tile coordinate, public,called by TileLoader
|
|
1607
|
+
* @param x tile x coordinate
|
|
1608
|
+
* @param y tile y coordinate
|
|
1609
|
+
* @param z tile z coordinate
|
|
1610
|
+
* @returns url tile url
|
|
1611
|
+
*/
|
|
1612
|
+
_getUrl(x: number, y: number, z: number): string | undefined;
|
|
1613
|
+
/**
|
|
1614
|
+
* Create source directly through factoy functions.
|
|
1615
|
+
* @param options source options
|
|
1616
|
+
* @returns ISource data source instance
|
|
1617
|
+
*/
|
|
1618
|
+
static create(options: SourceOptions): TileSource;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Tile update parameters
|
|
1623
|
+
*/
|
|
1624
|
+
declare type TileUpdateParames = {
|
|
1625
|
+
camera: Camera;
|
|
1626
|
+
loader: ITileLoader;
|
|
1627
|
+
minLevel: number;
|
|
1628
|
+
maxLevel: number;
|
|
1629
|
+
LODThreshold: number;
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* Tile event map
|
|
1634
|
+
*/
|
|
1635
|
+
declare interface TTileEventMap extends Object3DEventMap {
|
|
1636
|
+
unload: BaseEvent;
|
|
1637
|
+
ready: BaseEvent;
|
|
1638
|
+
"tile-created": BaseEvent & {
|
|
1639
|
+
tile: Tile;
|
|
1640
|
+
};
|
|
1641
|
+
"tile-loaded": BaseEvent & {
|
|
1642
|
+
tile: Tile;
|
|
1643
|
+
};
|
|
1644
|
+
"tile-unload": BaseEvent & {
|
|
1645
|
+
tile: Tile;
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Threejs scene initialize class
|
|
1651
|
+
*/
|
|
1652
|
+
export declare class Viewer extends EventDispatcher<ViewerEventMap> {
|
|
1653
|
+
readonly scene: Scene;
|
|
1654
|
+
readonly renderer: WebGLRenderer;
|
|
1655
|
+
readonly camera: PerspectiveCamera;
|
|
1656
|
+
readonly controls: MapControls;
|
|
1657
|
+
readonly ambLight: AmbientLight;
|
|
1658
|
+
readonly dirLight: DirectionalLight;
|
|
1659
|
+
clouds: Clouds | null;
|
|
1660
|
+
container?: HTMLElement;
|
|
1661
|
+
private readonly _clock;
|
|
1662
|
+
private stats;
|
|
1663
|
+
private _animationCallbacks;
|
|
1664
|
+
private _fogFactor;
|
|
1665
|
+
/** Get fog factor */
|
|
1666
|
+
get fogFactor(): number;
|
|
1667
|
+
/** Set fog factor, default 1 */
|
|
1668
|
+
set fogFactor(value: number);
|
|
1669
|
+
/** Container width */
|
|
1670
|
+
get width(): number;
|
|
1671
|
+
/** Container height */
|
|
1672
|
+
get height(): number;
|
|
1673
|
+
/**
|
|
1674
|
+
* Constructor
|
|
1675
|
+
* @param container container element or selector string
|
|
1676
|
+
* @param options GLViewer options
|
|
1677
|
+
*/
|
|
1678
|
+
constructor(container?: HTMLElement | string, options?: ViewerOptions);
|
|
1679
|
+
/**
|
|
1680
|
+
* Add the renderer to a container
|
|
1681
|
+
* @param container container element or selector string
|
|
1682
|
+
* @returns this
|
|
1683
|
+
*/
|
|
1684
|
+
addTo(container: HTMLElement | string): this;
|
|
1685
|
+
/**
|
|
1686
|
+
* Create scene
|
|
1687
|
+
* @param skyboxConfig Skybox configuration
|
|
1688
|
+
* @returns scene
|
|
1689
|
+
*/
|
|
1690
|
+
private _createScene;
|
|
1691
|
+
private _loadHDRWithPMREM;
|
|
1692
|
+
/**
|
|
1693
|
+
* Create WebGL renderer
|
|
1694
|
+
* @param antialias
|
|
1695
|
+
* @param stencil
|
|
1696
|
+
* @param logarithmicDepthBuffer
|
|
1697
|
+
* @returns renderer
|
|
1698
|
+
*/
|
|
1699
|
+
private _createRenderer;
|
|
1700
|
+
/**
|
|
1701
|
+
* Create camera
|
|
1702
|
+
* @returns camera
|
|
1703
|
+
*/
|
|
1704
|
+
private _createCamera;
|
|
1705
|
+
/**
|
|
1706
|
+
* Create map controls
|
|
1707
|
+
* @returns MapControls
|
|
1708
|
+
*/
|
|
1709
|
+
private _createControls;
|
|
1710
|
+
/**
|
|
1711
|
+
* Create ambient light
|
|
1712
|
+
* @returns AmbientLight
|
|
1713
|
+
*/
|
|
1714
|
+
private _createAmbLight;
|
|
1715
|
+
/**
|
|
1716
|
+
* Create directional light
|
|
1717
|
+
* @returns DirectionalLight
|
|
1718
|
+
*/
|
|
1719
|
+
private _createDirLight;
|
|
1720
|
+
/**
|
|
1721
|
+
* Container resize
|
|
1722
|
+
* @returns this
|
|
1723
|
+
*/
|
|
1724
|
+
resize(): this;
|
|
1725
|
+
/**
|
|
1726
|
+
* 添加动画循环回调
|
|
1727
|
+
* @param callback 回调函数,接收deltaTime参数
|
|
1728
|
+
* @returns 用于移除回调的函数
|
|
1729
|
+
*/
|
|
1730
|
+
addAnimationCallback(callback: (delta: number, elapsedtime: number) => void): () => void;
|
|
1731
|
+
/**
|
|
1732
|
+
* Threejs animation loop
|
|
1733
|
+
*/
|
|
1734
|
+
private animate;
|
|
1735
|
+
/**
|
|
1736
|
+
* Fly to a position
|
|
1737
|
+
* @param centerPostion Map center target position (world coordinate)
|
|
1738
|
+
* @param cameraPostion Camera target position (world coordinate)
|
|
1739
|
+
* @param animate animate or not
|
|
1740
|
+
*/
|
|
1741
|
+
flyTo(centerPostion: Vector3, cameraPostion: Vector3, animate?: boolean, onComplete?: (obj: Vector3) => void): void;
|
|
1742
|
+
/**
|
|
1743
|
+
* Get current scens state
|
|
1744
|
+
* @returns center position and camera position
|
|
1745
|
+
*/
|
|
1746
|
+
getState(): {
|
|
1747
|
+
centerPosition: Vector3;
|
|
1748
|
+
cameraPosition: Vector3;
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Viewer event map
|
|
1754
|
+
*/
|
|
1755
|
+
export declare interface ViewerEventMap extends Object3DEventMap {
|
|
1756
|
+
update: BaseEvent & {
|
|
1757
|
+
delta: number;
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Viewer options
|
|
1763
|
+
*/
|
|
1764
|
+
export declare type ViewerOptions = {
|
|
1765
|
+
/** Whether to use antialiasing. Default is false. */
|
|
1766
|
+
antialias?: boolean;
|
|
1767
|
+
/** Whether to use stencil buffer. Default is true. */
|
|
1768
|
+
stencil?: boolean;
|
|
1769
|
+
/** Whether to use logarithmic depth buffer. Default is true. */
|
|
1770
|
+
logarithmicDepthBuffer?: boolean;
|
|
1771
|
+
/** Skybox configuration */
|
|
1772
|
+
skybox?: {
|
|
1773
|
+
/** Path to skybox images */
|
|
1774
|
+
path?: string;
|
|
1775
|
+
hdr?: string;
|
|
1776
|
+
/**
|
|
1777
|
+
* Skybox image file names in order: [px, nx, py, ny, pz, nz]
|
|
1778
|
+
*/
|
|
1779
|
+
files?: string[];
|
|
1780
|
+
/** Default skybox color (used if skybox loading fails) */
|
|
1781
|
+
defaultColor?: number;
|
|
1782
|
+
hdrEquirectangular?: boolean;
|
|
1783
|
+
hdrExposure?: number;
|
|
1784
|
+
hdrEncoding?: number;
|
|
1785
|
+
};
|
|
1786
|
+
debug?: boolean;
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
declare type WaterStyle = BaseWaterStyle | LightWaterStyle;
|
|
1790
|
+
|
|
1791
|
+
export declare class WMTSSource extends TileSource {
|
|
1792
|
+
minLevel: number;
|
|
1793
|
+
maxLevel: number;
|
|
1794
|
+
constructor(options: WMTSSourceOptions);
|
|
1795
|
+
/**
|
|
1796
|
+
* 直接使用用户提供的URL模板
|
|
1797
|
+
* 支持以下变量替换(自动转换坐标系):
|
|
1798
|
+
* - {x}, {y}, {z}
|
|
1799
|
+
* - {tileMatrix}, {tileRow}, {tileCol}
|
|
1800
|
+
*/
|
|
1801
|
+
getUrl(x: number, y: number, z: number): string;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
export declare type WMTSSourceOptions = SourceOptions & {
|
|
1805
|
+
/** 完整的WMTS请求URL模板(必须包含{x}{y}{z}或等效参数) */
|
|
1806
|
+
urlTemplate: string;
|
|
1807
|
+
/** 是否使用TMS坐标轴朝向(Y轴反向) */
|
|
1808
|
+
isTMS?: boolean;
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1811
|
+
export { }
|