vis-core 0.31.22 → 0.31.24

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/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import { MeshLineMaterial } from 'gl-draw';
16
16
  import { MeshObject } from 'gl-draw';
17
17
  import { MultiPolygon } from 'geojson';
18
18
  import { NodeObject } from 'gl-draw';
19
+ import { Pencil } from 'gl-draw';
19
20
  import { PickFunctionsItem } from 'gl-draw';
20
21
  import { PointLightObject } from 'gl-draw';
21
22
  import { Polygon } from 'geojson';
@@ -80,9 +81,9 @@ declare class Arc extends LineObject {
80
81
 
81
82
  declare class Area extends GroupObject {
82
83
  objectType: string;
83
- options: Options_7;
84
+ options: Options_11;
84
85
  area: ExtrudePolygonObject[];
85
- constructor(options: Options_7);
86
+ constructor(options: Options_11);
86
87
  create(): Promise<void>;
87
88
  rebuildFromScene(): void;
88
89
  }
@@ -90,12 +91,6 @@ declare class Area extends GroupObject {
90
91
  export declare class Base extends Camera {
91
92
  static VisName: string;
92
93
  private static _loadingCount;
93
- private static urlCache;
94
- /**
95
- * 清除特定 URL 的缓存
96
- * @param url 要清除的 URL,如果不提供则清除所有缓存
97
- */
98
- static clearUrlCache(url?: string): void;
99
94
  playing: boolean;
100
95
  leftTruck: boolean;
101
96
  options: BaseOptions;
@@ -256,7 +251,6 @@ declare interface BaseOptions {
256
251
  css2DContainer?: HTMLElement;
257
252
  controlsContainer?: HTMLElement;
258
253
  pencil?: any;
259
- pencil2?: any;
260
254
  pencilConfig?: Record<string, any>;
261
255
  disableInitShow?: boolean;
262
256
  logarithmicDepthBuffer?: boolean;
@@ -273,8 +267,8 @@ declare class Box extends MeshObject {
273
267
 
274
268
  declare class Building extends GroupObject {
275
269
  objectType: string;
276
- options: Options_5;
277
- constructor(options: Options_5);
270
+ options: Options_9;
271
+ constructor(options: Options_9);
278
272
  create(): Promise<void>;
279
273
  rebuildFromScene(): void;
280
274
  worldPositionZ: {
@@ -313,25 +307,23 @@ declare class Circle extends MeshObject {
313
307
  create(): void;
314
308
  }
315
309
 
316
- export declare class City extends Base {
317
- static VisName: string;
310
+ declare class City {
318
311
  adcode: number;
319
312
  pcenter: [number, number];
320
313
  pscale: number;
321
- projection: ReturnType<typeof getProjection>;
314
+ projection: ReturnType<typeof getProjection_2>;
322
315
  options: CityOptions;
323
316
  group: GroupObject;
324
317
  building: Building;
325
318
  road: Road;
319
+ pencil: Pencil;
320
+ lead: Pencil['lead'];
321
+ mList: Pencil['mList'];
322
+ constructor(pencil: Pencil);
326
323
  setOptions(options: CityOptions): void;
327
324
  multiplyScalar: number;
328
- disableSSAO(): void;
329
- enabledSSAO(): void;
330
- initGroup(): Promise<void>;
331
- beforeInit(): Promise<void>;
332
- getInvert(vector3: THREE.Vector3): [number, number] | null | undefined;
333
- fitTo(obj: BaseObject, enableTransition?: boolean): Promise<void>;
334
- initVis(): Promise<void>;
325
+ fixNearFar(n?: number, f?: number): void;
326
+ init(): Promise<void>;
335
327
  drawCityPlane(adcode: number, target?: BaseObject): Promise<void>;
336
328
  drawBuilding(options?: {
337
329
  jsonUrl?: string;
@@ -352,56 +344,13 @@ export declare class City extends Base {
352
344
  z?: number;
353
345
  grey?: boolean;
354
346
  }): Promise<Road | undefined>;
355
- getWorldPosition(longitude: number, latitude: number): {
356
- x: number;
357
- y: number;
358
- };
359
- restoreScene(str: string, objectsMap?: {
360
- Building: typeof Building;
361
- Road: typeof Road;
362
- Area: Area;
363
- CityPlane: CityPlane;
364
- Target: Target;
365
- Point: Point;
366
- Arc: Arc;
367
- Model: Model;
368
- Plane: Plane;
369
- PlaneShadow: PlaneShadow;
370
- Sphere: Sphere;
371
- Sprite: Sprite;
372
- Box: Box;
373
- Circle: Circle;
374
- Tube: Tube;
375
- Ring: Ring;
376
- AmbientLight: AmbientLight;
377
- DirectionalLight: DirectionalLight;
378
- PointLight: PointLight;
379
- SpotLight: SpotLight;
380
- HemisphereLight: HemisphereLight;
381
- RectAreaLight: RectAreaLight;
382
- Node: NodeObject;
383
- ExtrudePolygon: ExtrudePolygonObject;
384
- Line: LineObject;
385
- Group: typeof GroupObject;
386
- }): Promise<void>;
387
- rebuildFromScene(): Promise<void>;
388
- }
389
-
390
- declare class city extends City {
391
- multiplyScalar: number;
392
- fixNearFar(n?: number, f?: number): void;
393
347
  }
394
348
 
395
- declare interface CityOptions extends BaseOptions {
349
+ declare interface CityOptions {
396
350
  adcode: number;
397
351
  jsonName: string;
398
352
  cacheKey?: string;
399
353
  center?: [number, number];
400
- fitTo?: boolean;
401
- coordtransformFunc?: (lng: number, lat: number) => {
402
- longitude: number;
403
- latitude: number;
404
- };
405
354
  plane?: boolean;
406
355
  grey?: boolean;
407
356
  showBuilding?: boolean;
@@ -411,13 +360,12 @@ declare interface CityOptions extends BaseOptions {
411
360
  showGrassland?: boolean;
412
361
  showRiver?: boolean;
413
362
  setWaterMaterial?: boolean;
414
- ssao?: boolean;
415
363
  }
416
364
 
417
365
  declare class CityPlane extends MeshObject {
418
366
  objectType: string;
419
- options: Options_8;
420
- constructor(options: Options_8);
367
+ options: Options_13;
368
+ constructor(options: Options_13);
421
369
  plane: THREE.PlaneGeometry;
422
370
  water?: Water;
423
371
  create(): Promise<void>;
@@ -427,12 +375,11 @@ declare class CityPlane extends MeshObject {
427
375
 
428
376
  declare class ContinentsBg extends GroupObject {
429
377
  objectType: string;
430
- options: Options_12;
378
+ options: Options_8;
431
379
  mapArr: PlaneMap[];
432
- constructor(options: Options_12);
380
+ constructor(options: Options_8);
433
381
  create(): Promise<void>;
434
- private getPointInContinentInfo;
435
- getLocationPosition(location: [number, number], tName?: string): [number, number, number] | undefined;
382
+ getLocationPosition(location: [number, number], name?: string): [number, number, number] | undefined;
436
383
  render(): void;
437
384
  rebuildFromScene(): void;
438
385
  dispose(): void;
@@ -518,8 +465,8 @@ export declare class Earth extends Base {
518
465
 
519
466
  declare class Earth_2 extends Sphere {
520
467
  objectType: string;
521
- options: Required<Options_10>;
522
- constructor(options: Options_10);
468
+ options: Required<Options_6>;
469
+ constructor(options: Options_6);
523
470
  create(): void;
524
471
  rebuildFromScene(): void;
525
472
  }
@@ -572,16 +519,6 @@ declare type GeoJSON_3 = FeatureCollection<Polygon | MultiPolygon>;
572
519
 
573
520
  declare type GeoJSON_4 = FeatureCollection<Polygon | MultiPolygon>;
574
521
 
575
- /**
576
- * 获取城市配置
577
- * @param adcode 区域代码
578
- */
579
- export declare const getCityConfig: (adcode: number) => {
580
- center: number[];
581
- adcode: number;
582
- jsonName: string;
583
- };
584
-
585
522
  declare const getProjection: (options: {
586
523
  center: [number, number];
587
524
  scale: number;
@@ -604,14 +541,6 @@ declare class HemisphereLight extends HemisphereLightObject {
604
541
  render(): void;
605
542
  }
606
543
 
607
- /**
608
- * 加载模板纹理图片,直接返回图片用于设置到材质上
609
- */
610
- export declare const loadTemplateImages: (templateId: string, adcode: number, base?: string, customTemplateConfigs?: Record<string, TemplateConfig>) => Promise<{
611
- map?: HTMLImageElement;
612
- emissiveMap?: HTMLImageElement;
613
- }>;
614
-
615
544
  declare class Map_2 extends Base {
616
545
  static VisName: string;
617
546
  options: Required<MapCityOptions>;
@@ -670,11 +599,11 @@ declare class Map_2 extends Base {
670
599
  parentBg: PlaneMap[];
671
600
  continentsBg?: ContinentsBg;
672
601
  group: GroupObject;
673
- projection: ReturnType<typeof getProjection_2>;
602
+ projection: ReturnType<typeof getProjection>;
674
603
  pcenter: [number, number];
675
604
  pscale: number;
676
605
  meters: number;
677
- cityVis: city[];
606
+ cityVis: City[];
678
607
  cityGroup: GroupObject[];
679
608
  extendsOptions: Record<string, any>;
680
609
  setOptions(options: MapOptions): void;
@@ -686,7 +615,7 @@ declare class Map_2 extends Base {
686
615
  private clickHandleDrillDownMark;
687
616
  private clickOusideBackMark;
688
617
  afterInit(): Promise<void>;
689
- initCityVis(adcode: number, grey?: boolean): Promise<city>;
618
+ initCityVis(adcode: number, grey?: boolean): Promise<City>;
690
619
  initCityOnMap(adcode: number): Promise<void>;
691
620
  initVisBg(): Promise<void>;
692
621
  initVis(): Promise<void>;
@@ -726,7 +655,7 @@ declare class Map_2 extends Base {
726
655
  getReferenceScale(bboxa: number[], bboxb: number[]): number;
727
656
  getAdcodeShowLevel(adcode: number, fix?: boolean): string | undefined;
728
657
  private handleClick;
729
- beforeShowMap(adcodes: number[]): boolean;
658
+ beforeShowMap(_adcodes: number[]): boolean;
730
659
  getAdcodes(adcode: number): number[];
731
660
  showMap({ adcode, adcodes: prevAdcodes, duration, }: {
732
661
  adcode?: number;
@@ -849,6 +778,12 @@ declare class Map_2 extends Base {
849
778
  Line: LineObject;
850
779
  Group: typeof GroupObject;
851
780
  }): Promise<void>;
781
+ private _removeLiveExtrudeLines;
782
+ private _initPlaneMapExtrudeLines;
783
+ private _syncExtrudeLineToLivePlaneMaps;
784
+ private _clearCityOnMapInScene;
785
+ private _syncCityOnMapFeaturesToLiveScene;
786
+ private _syncCityOnMapInnerLineToLivePlaneMaps;
852
787
  /**
853
788
  * Called from Viewport.setExtendsOptions immediately before toJSON().
854
789
  * Updates the live PlaneMap / ExtrudePolygon / Line objects' .options so
@@ -1119,9 +1054,9 @@ declare class Model extends GroupObject {
1119
1054
 
1120
1055
  declare class Mountain extends GroupObject {
1121
1056
  objectType: string;
1122
- options: Required<Omit<Options_13, 'bbox'>> & Pick<Options_13, 'bbox'>;
1057
+ options: Required<Omit<Options_12, 'bbox'>> & Pick<Options_12, 'bbox'>;
1123
1058
  extrudePolygon: ExtrudePolygonObject;
1124
- constructor(options: Options_13);
1059
+ constructor(options: Options_12);
1125
1060
  geojson2Meta(geojson: GeoJSON_4): {
1126
1061
  coords: Position[][];
1127
1062
  properties: GeoJsonProperties;
@@ -1132,29 +1067,36 @@ declare class Mountain extends GroupObject {
1132
1067
  rebuildFromScene(): void;
1133
1068
  }
1134
1069
 
1135
- declare interface Opt {
1136
- scale?: number;
1137
- }
1138
-
1139
1070
  declare interface Options {
1140
1071
  sprite?: boolean;
1141
1072
  }
1142
1073
 
1143
1074
  declare interface Options_10 {
1144
- radius?: number;
1145
- rotationY?: number;
1075
+ uuid?: string;
1076
+ jsonUrl: string;
1077
+ projection: {
1078
+ center: [number, number];
1079
+ scale: number;
1080
+ };
1081
+ cacheKey?: string;
1082
+ meters?: number;
1083
+ grey?: boolean;
1146
1084
  }
1147
1085
 
1148
1086
  declare interface Options_11 {
1149
- radius?: number;
1087
+ uuid?: string;
1088
+ jsonUrl: string;
1089
+ projection: {
1090
+ center: [number, number];
1091
+ scale: number;
1092
+ };
1093
+ material: THREE.Material;
1094
+ type: string;
1095
+ cacheKey?: string;
1096
+ oArr?: number[];
1150
1097
  }
1151
1098
 
1152
1099
  declare interface Options_12 {
1153
- scale: number;
1154
- depth: number;
1155
- }
1156
-
1157
- declare interface Options_13 {
1158
1100
  geojson: GeoJSON_4;
1159
1101
  projection: {
1160
1102
  center: [number, number];
@@ -1166,6 +1108,14 @@ declare interface Options_13 {
1166
1108
  bbox?: number[];
1167
1109
  }
1168
1110
 
1111
+ declare interface Options_13 {
1112
+ width: number;
1113
+ height: number;
1114
+ material?: THREE.Material;
1115
+ color?: string;
1116
+ map?: THREE.Texture | null;
1117
+ }
1118
+
1169
1119
  declare interface Options_2 extends NonNullable<ConstructorParameters<typeof LineObject>[0]> {
1170
1120
  from: number[];
1171
1121
  to: number[];
@@ -1191,54 +1141,6 @@ declare interface Options_4 {
1191
1141
  }
1192
1142
 
1193
1143
  declare interface Options_5 {
1194
- uuid?: string;
1195
- jsonUrl: string;
1196
- projection: {
1197
- center: [number, number];
1198
- scale: number;
1199
- };
1200
- cacheKey?: string;
1201
- material?: THREE.Material | THREE.Material[];
1202
- meters?: number;
1203
- hasSide?: boolean;
1204
- sideGradient?: boolean;
1205
- grey?: boolean;
1206
- }
1207
-
1208
- declare interface Options_6 {
1209
- uuid?: string;
1210
- jsonUrl: string;
1211
- projection: {
1212
- center: [number, number];
1213
- scale: number;
1214
- };
1215
- cacheKey?: string;
1216
- meters?: number;
1217
- grey?: boolean;
1218
- }
1219
-
1220
- declare interface Options_7 {
1221
- uuid?: string;
1222
- jsonUrl: string;
1223
- projection: {
1224
- center: [number, number];
1225
- scale: number;
1226
- };
1227
- material: THREE.Material;
1228
- type: string;
1229
- cacheKey?: string;
1230
- oArr?: number[];
1231
- }
1232
-
1233
- declare interface Options_8 {
1234
- width: number;
1235
- height: number;
1236
- material?: THREE.Material;
1237
- color?: string;
1238
- map?: THREE.Texture | null;
1239
- }
1240
-
1241
- declare interface Options_9 {
1242
1144
  uuid?: string;
1243
1145
  areaGroup?: boolean;
1244
1146
  geojson: GeoJSON_2;
@@ -1260,6 +1162,7 @@ declare interface Options_9 {
1260
1162
  conic?: boolean;
1261
1163
  castShadow?: boolean;
1262
1164
  mergeSide?: boolean;
1165
+ hasExtrudeLine?: boolean;
1263
1166
  materialOptions: {
1264
1167
  topMat: THREE.Material;
1265
1168
  sideMat?: THREE.Material;
@@ -1274,6 +1177,36 @@ declare interface Options_9 {
1274
1177
  bloom?: boolean;
1275
1178
  }
1276
1179
 
1180
+ declare interface Options_6 {
1181
+ radius?: number;
1182
+ rotationY?: number;
1183
+ }
1184
+
1185
+ declare interface Options_7 {
1186
+ radius?: number;
1187
+ }
1188
+
1189
+ declare interface Options_8 {
1190
+ scale: number;
1191
+ depth: number;
1192
+ assetsPrefix?: string;
1193
+ }
1194
+
1195
+ declare interface Options_9 {
1196
+ uuid?: string;
1197
+ jsonUrl: string;
1198
+ projection: {
1199
+ center: [number, number];
1200
+ scale: number;
1201
+ };
1202
+ cacheKey?: string;
1203
+ material?: THREE.Material | THREE.Material[];
1204
+ meters?: number;
1205
+ hasSide?: boolean;
1206
+ sideGradient?: boolean;
1207
+ grey?: boolean;
1208
+ }
1209
+
1277
1210
  declare class Plane extends MeshObject {
1278
1211
  objectType: string;
1279
1212
  create(): void;
@@ -1281,7 +1214,7 @@ declare class Plane extends MeshObject {
1281
1214
 
1282
1215
  declare class PlaneMap extends GroupObject {
1283
1216
  objectType: string;
1284
- options: Required<Omit<Options_9, 'bbox' | 'extrudeLineGeojson'>> & Pick<Options_9, 'bbox' | 'extrudeLineGeojson'>;
1217
+ options: Required<Omit<Options_5, 'bbox' | 'extrudeLineGeojson'>> & Pick<Options_5, 'bbox' | 'extrudeLineGeojson'>;
1285
1218
  isActive: boolean;
1286
1219
  groupArr: GroupObject[];
1287
1220
  areaArr: ExtrudePolygonObject[];
@@ -1289,8 +1222,12 @@ declare class PlaneMap extends GroupObject {
1289
1222
  mergeSideArea: ExtrudePolygonObject | null;
1290
1223
  extrudelineArr?: LineObject[];
1291
1224
  splitPolygons: number;
1292
- constructor(options: Options_9);
1225
+ constructor(options: Options_5);
1293
1226
  create(): Promise<void>;
1227
+ private ensureExtrudeLineMaterials;
1228
+ createExtrudeLines(): Promise<void>;
1229
+ clearExtrudeLines(): void;
1230
+ syncExtrudeLines(hasExtrudeLine?: boolean): Promise<void>;
1294
1231
  mergeAreaSide(): Promise<void>;
1295
1232
  unmergeAreaSide(): Promise<void>;
1296
1233
  addArea(geojson: GeoJSON_2, options: {
@@ -1311,7 +1248,7 @@ declare class PlaneMap extends GroupObject {
1311
1248
  coords: Position[][];
1312
1249
  properties: GeoJsonProperties;
1313
1250
  }[];
1314
- update(delta: number, elapsed: number): void;
1251
+ update(_delta: number, elapsed: number): void;
1315
1252
  findGroup(adcode: string | number, fix?: boolean): GroupObject | undefined;
1316
1253
  setAreaMaterial(key: string, material: THREE.Material[] | THREE.Material): void;
1317
1254
  useAreaMaterial(key: string): void;
@@ -1364,8 +1301,8 @@ declare class Ring extends MeshObject {
1364
1301
 
1365
1302
  declare class Road extends GroupObject {
1366
1303
  objectType: string;
1367
- options: Options_6;
1368
- constructor(options: Options_6);
1304
+ options: Options_10;
1305
+ constructor(options: Options_10);
1369
1306
  linePrimary: LineObject[];
1370
1307
  lineSecondary: LineObject[];
1371
1308
  create(): Promise<void>;
@@ -1411,8 +1348,8 @@ declare class Sphere extends MeshObject {
1411
1348
 
1412
1349
  declare class SphereShadow extends MeshObject {
1413
1350
  objectType: string;
1414
- options: Required<Options_11>;
1415
- constructor(options: Options_11);
1351
+ options: Required<Options_7>;
1352
+ constructor(options: Options_7);
1416
1353
  create(): Promise<void>;
1417
1354
  rebuildFromScene(): void;
1418
1355
  }
@@ -1444,37 +1381,6 @@ declare interface SwitchFixConfig {
1444
1381
  r?: string[];
1445
1382
  }
1446
1383
 
1447
- declare class Target extends GroupObject {
1448
- objectType: string;
1449
- options: Opt;
1450
- time: {
1451
- value: number;
1452
- };
1453
- offset: THREE.Vector2;
1454
- timer: ReturnType<typeof setTimeout> | null;
1455
- inTween: Tween<any> | null;
1456
- outTween: Tween<any> | null;
1457
- constructor(options: Opt);
1458
- createWave(color: string): THREE.Mesh<THREE.PlaneGeometry, THREE.ShaderMaterial, THREE.Object3DEventMap>;
1459
- createRipple(texture: THREE.Texture): THREE.Mesh<THREE.CylinderGeometry, THREE.ShaderMaterial, THREE.Object3DEventMap>;
1460
- createCylinder(texture: THREE.Texture): THREE.Object3D<THREE.Object3DEventMap>;
1461
- createTorus(color: string): THREE.Mesh<THREE.TorusGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
1462
- create(): Promise<void>;
1463
- rebuildFromScene(): void;
1464
- erase(): void;
1465
- update(delta: number, elapsed: number): void;
1466
- }
1467
-
1468
- /**
1469
- * 模板配置接口
1470
- */
1471
- declare interface TemplateConfig {
1472
- id: string;
1473
- map?: boolean;
1474
- emissiveMap?: boolean | 'map';
1475
- cityOnly?: boolean;
1476
- }
1477
-
1478
1384
  export { THREE }
1479
1385
 
1480
1386
  declare const timeOut: (ms: number) => Promise<any>;
@@ -1490,7 +1396,7 @@ export { TWEEN }
1490
1396
 
1491
1397
  export { Tween }
1492
1398
 
1493
- export declare const VERSION = "0.31.22";
1399
+ export declare const VERSION = "0.31.24";
1494
1400
 
1495
1401
  export { }
1496
1402