vis-core 0.31.23 → 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
  }
@@ -250,7 +251,6 @@ declare interface BaseOptions {
250
251
  css2DContainer?: HTMLElement;
251
252
  controlsContainer?: HTMLElement;
252
253
  pencil?: any;
253
- pencil2?: any;
254
254
  pencilConfig?: Record<string, any>;
255
255
  disableInitShow?: boolean;
256
256
  logarithmicDepthBuffer?: boolean;
@@ -267,8 +267,8 @@ declare class Box extends MeshObject {
267
267
 
268
268
  declare class Building extends GroupObject {
269
269
  objectType: string;
270
- options: Options_5;
271
- constructor(options: Options_5);
270
+ options: Options_9;
271
+ constructor(options: Options_9);
272
272
  create(): Promise<void>;
273
273
  rebuildFromScene(): void;
274
274
  worldPositionZ: {
@@ -307,25 +307,23 @@ declare class Circle extends MeshObject {
307
307
  create(): void;
308
308
  }
309
309
 
310
- export declare class City extends Base {
311
- static VisName: string;
310
+ declare class City {
312
311
  adcode: number;
313
312
  pcenter: [number, number];
314
313
  pscale: number;
315
- projection: ReturnType<typeof getProjection>;
314
+ projection: ReturnType<typeof getProjection_2>;
316
315
  options: CityOptions;
317
316
  group: GroupObject;
318
317
  building: Building;
319
318
  road: Road;
319
+ pencil: Pencil;
320
+ lead: Pencil['lead'];
321
+ mList: Pencil['mList'];
322
+ constructor(pencil: Pencil);
320
323
  setOptions(options: CityOptions): void;
321
324
  multiplyScalar: number;
322
- disableSSAO(): void;
323
- enabledSSAO(): void;
324
- initGroup(): Promise<void>;
325
- beforeInit(): Promise<void>;
326
- getInvert(vector3: THREE.Vector3): [number, number] | null | undefined;
327
- fitTo(obj: BaseObject, enableTransition?: boolean): Promise<void>;
328
- initVis(): Promise<void>;
325
+ fixNearFar(n?: number, f?: number): void;
326
+ init(): Promise<void>;
329
327
  drawCityPlane(adcode: number, target?: BaseObject): Promise<void>;
330
328
  drawBuilding(options?: {
331
329
  jsonUrl?: string;
@@ -346,56 +344,13 @@ export declare class City extends Base {
346
344
  z?: number;
347
345
  grey?: boolean;
348
346
  }): Promise<Road | undefined>;
349
- getWorldPosition(longitude: number, latitude: number): {
350
- x: number;
351
- y: number;
352
- };
353
- restoreScene(str: string, objectsMap?: {
354
- Building: typeof Building;
355
- Road: typeof Road;
356
- Area: Area;
357
- CityPlane: CityPlane;
358
- Target: Target;
359
- Point: Point;
360
- Arc: Arc;
361
- Model: Model;
362
- Plane: Plane;
363
- PlaneShadow: PlaneShadow;
364
- Sphere: Sphere;
365
- Sprite: Sprite;
366
- Box: Box;
367
- Circle: Circle;
368
- Tube: Tube;
369
- Ring: Ring;
370
- AmbientLight: AmbientLight;
371
- DirectionalLight: DirectionalLight;
372
- PointLight: PointLight;
373
- SpotLight: SpotLight;
374
- HemisphereLight: HemisphereLight;
375
- RectAreaLight: RectAreaLight;
376
- Node: NodeObject;
377
- ExtrudePolygon: ExtrudePolygonObject;
378
- Line: LineObject;
379
- Group: typeof GroupObject;
380
- }): Promise<void>;
381
- rebuildFromScene(): Promise<void>;
382
- }
383
-
384
- declare class city extends City {
385
- multiplyScalar: number;
386
- fixNearFar(n?: number, f?: number): void;
387
347
  }
388
348
 
389
- declare interface CityOptions extends BaseOptions {
349
+ declare interface CityOptions {
390
350
  adcode: number;
391
351
  jsonName: string;
392
352
  cacheKey?: string;
393
353
  center?: [number, number];
394
- fitTo?: boolean;
395
- coordtransformFunc?: (lng: number, lat: number) => {
396
- longitude: number;
397
- latitude: number;
398
- };
399
354
  plane?: boolean;
400
355
  grey?: boolean;
401
356
  showBuilding?: boolean;
@@ -405,13 +360,12 @@ declare interface CityOptions extends BaseOptions {
405
360
  showGrassland?: boolean;
406
361
  showRiver?: boolean;
407
362
  setWaterMaterial?: boolean;
408
- ssao?: boolean;
409
363
  }
410
364
 
411
365
  declare class CityPlane extends MeshObject {
412
366
  objectType: string;
413
- options: Options_8;
414
- constructor(options: Options_8);
367
+ options: Options_13;
368
+ constructor(options: Options_13);
415
369
  plane: THREE.PlaneGeometry;
416
370
  water?: Water;
417
371
  create(): Promise<void>;
@@ -421,9 +375,9 @@ declare class CityPlane extends MeshObject {
421
375
 
422
376
  declare class ContinentsBg extends GroupObject {
423
377
  objectType: string;
424
- options: Options_12;
378
+ options: Options_8;
425
379
  mapArr: PlaneMap[];
426
- constructor(options: Options_12);
380
+ constructor(options: Options_8);
427
381
  create(): Promise<void>;
428
382
  getLocationPosition(location: [number, number], name?: string): [number, number, number] | undefined;
429
383
  render(): void;
@@ -511,8 +465,8 @@ export declare class Earth extends Base {
511
465
 
512
466
  declare class Earth_2 extends Sphere {
513
467
  objectType: string;
514
- options: Required<Options_10>;
515
- constructor(options: Options_10);
468
+ options: Required<Options_6>;
469
+ constructor(options: Options_6);
516
470
  create(): void;
517
471
  rebuildFromScene(): void;
518
472
  }
@@ -565,16 +519,6 @@ declare type GeoJSON_3 = FeatureCollection<Polygon | MultiPolygon>;
565
519
 
566
520
  declare type GeoJSON_4 = FeatureCollection<Polygon | MultiPolygon>;
567
521
 
568
- /**
569
- * 获取城市配置
570
- * @param adcode 区域代码
571
- */
572
- export declare const getCityConfig: (adcode: number) => {
573
- center: number[];
574
- adcode: number;
575
- jsonName: string;
576
- };
577
-
578
522
  declare const getProjection: (options: {
579
523
  center: [number, number];
580
524
  scale: number;
@@ -597,14 +541,6 @@ declare class HemisphereLight extends HemisphereLightObject {
597
541
  render(): void;
598
542
  }
599
543
 
600
- /**
601
- * 加载模板纹理图片,直接返回图片用于设置到材质上
602
- */
603
- export declare const loadTemplateImages: (templateId: string, adcode: number, base?: string, customTemplateConfigs?: Record<string, TemplateConfig>) => Promise<{
604
- map?: HTMLImageElement;
605
- emissiveMap?: HTMLImageElement;
606
- }>;
607
-
608
544
  declare class Map_2 extends Base {
609
545
  static VisName: string;
610
546
  options: Required<MapCityOptions>;
@@ -663,11 +599,11 @@ declare class Map_2 extends Base {
663
599
  parentBg: PlaneMap[];
664
600
  continentsBg?: ContinentsBg;
665
601
  group: GroupObject;
666
- projection: ReturnType<typeof getProjection_2>;
602
+ projection: ReturnType<typeof getProjection>;
667
603
  pcenter: [number, number];
668
604
  pscale: number;
669
605
  meters: number;
670
- cityVis: city[];
606
+ cityVis: City[];
671
607
  cityGroup: GroupObject[];
672
608
  extendsOptions: Record<string, any>;
673
609
  setOptions(options: MapOptions): void;
@@ -679,7 +615,7 @@ declare class Map_2 extends Base {
679
615
  private clickHandleDrillDownMark;
680
616
  private clickOusideBackMark;
681
617
  afterInit(): Promise<void>;
682
- initCityVis(adcode: number, grey?: boolean): Promise<city>;
618
+ initCityVis(adcode: number, grey?: boolean): Promise<City>;
683
619
  initCityOnMap(adcode: number): Promise<void>;
684
620
  initVisBg(): Promise<void>;
685
621
  initVis(): Promise<void>;
@@ -842,6 +778,12 @@ declare class Map_2 extends Base {
842
778
  Line: LineObject;
843
779
  Group: typeof GroupObject;
844
780
  }): Promise<void>;
781
+ private _removeLiveExtrudeLines;
782
+ private _initPlaneMapExtrudeLines;
783
+ private _syncExtrudeLineToLivePlaneMaps;
784
+ private _clearCityOnMapInScene;
785
+ private _syncCityOnMapFeaturesToLiveScene;
786
+ private _syncCityOnMapInnerLineToLivePlaneMaps;
845
787
  /**
846
788
  * Called from Viewport.setExtendsOptions immediately before toJSON().
847
789
  * Updates the live PlaneMap / ExtrudePolygon / Line objects' .options so
@@ -1112,9 +1054,9 @@ declare class Model extends GroupObject {
1112
1054
 
1113
1055
  declare class Mountain extends GroupObject {
1114
1056
  objectType: string;
1115
- options: Required<Omit<Options_13, 'bbox'>> & Pick<Options_13, 'bbox'>;
1057
+ options: Required<Omit<Options_12, 'bbox'>> & Pick<Options_12, 'bbox'>;
1116
1058
  extrudePolygon: ExtrudePolygonObject;
1117
- constructor(options: Options_13);
1059
+ constructor(options: Options_12);
1118
1060
  geojson2Meta(geojson: GeoJSON_4): {
1119
1061
  coords: Position[][];
1120
1062
  properties: GeoJsonProperties;
@@ -1125,30 +1067,36 @@ declare class Mountain extends GroupObject {
1125
1067
  rebuildFromScene(): void;
1126
1068
  }
1127
1069
 
1128
- declare interface Opt {
1129
- scale?: number;
1130
- }
1131
-
1132
1070
  declare interface Options {
1133
1071
  sprite?: boolean;
1134
1072
  }
1135
1073
 
1136
1074
  declare interface Options_10 {
1137
- radius?: number;
1138
- 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;
1139
1084
  }
1140
1085
 
1141
1086
  declare interface Options_11 {
1142
- 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[];
1143
1097
  }
1144
1098
 
1145
1099
  declare interface Options_12 {
1146
- scale: number;
1147
- depth: number;
1148
- assetsPrefix?: string;
1149
- }
1150
-
1151
- declare interface Options_13 {
1152
1100
  geojson: GeoJSON_4;
1153
1101
  projection: {
1154
1102
  center: [number, number];
@@ -1160,6 +1108,14 @@ declare interface Options_13 {
1160
1108
  bbox?: number[];
1161
1109
  }
1162
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
+
1163
1119
  declare interface Options_2 extends NonNullable<ConstructorParameters<typeof LineObject>[0]> {
1164
1120
  from: number[];
1165
1121
  to: number[];
@@ -1185,54 +1141,6 @@ declare interface Options_4 {
1185
1141
  }
1186
1142
 
1187
1143
  declare interface Options_5 {
1188
- uuid?: string;
1189
- jsonUrl: string;
1190
- projection: {
1191
- center: [number, number];
1192
- scale: number;
1193
- };
1194
- cacheKey?: string;
1195
- material?: THREE.Material | THREE.Material[];
1196
- meters?: number;
1197
- hasSide?: boolean;
1198
- sideGradient?: boolean;
1199
- grey?: boolean;
1200
- }
1201
-
1202
- declare interface Options_6 {
1203
- uuid?: string;
1204
- jsonUrl: string;
1205
- projection: {
1206
- center: [number, number];
1207
- scale: number;
1208
- };
1209
- cacheKey?: string;
1210
- meters?: number;
1211
- grey?: boolean;
1212
- }
1213
-
1214
- declare interface Options_7 {
1215
- uuid?: string;
1216
- jsonUrl: string;
1217
- projection: {
1218
- center: [number, number];
1219
- scale: number;
1220
- };
1221
- material: THREE.Material;
1222
- type: string;
1223
- cacheKey?: string;
1224
- oArr?: number[];
1225
- }
1226
-
1227
- declare interface Options_8 {
1228
- width: number;
1229
- height: number;
1230
- material?: THREE.Material;
1231
- color?: string;
1232
- map?: THREE.Texture | null;
1233
- }
1234
-
1235
- declare interface Options_9 {
1236
1144
  uuid?: string;
1237
1145
  areaGroup?: boolean;
1238
1146
  geojson: GeoJSON_2;
@@ -1254,6 +1162,7 @@ declare interface Options_9 {
1254
1162
  conic?: boolean;
1255
1163
  castShadow?: boolean;
1256
1164
  mergeSide?: boolean;
1165
+ hasExtrudeLine?: boolean;
1257
1166
  materialOptions: {
1258
1167
  topMat: THREE.Material;
1259
1168
  sideMat?: THREE.Material;
@@ -1268,6 +1177,36 @@ declare interface Options_9 {
1268
1177
  bloom?: boolean;
1269
1178
  }
1270
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
+
1271
1210
  declare class Plane extends MeshObject {
1272
1211
  objectType: string;
1273
1212
  create(): void;
@@ -1275,7 +1214,7 @@ declare class Plane extends MeshObject {
1275
1214
 
1276
1215
  declare class PlaneMap extends GroupObject {
1277
1216
  objectType: string;
1278
- 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'>;
1279
1218
  isActive: boolean;
1280
1219
  groupArr: GroupObject[];
1281
1220
  areaArr: ExtrudePolygonObject[];
@@ -1283,8 +1222,12 @@ declare class PlaneMap extends GroupObject {
1283
1222
  mergeSideArea: ExtrudePolygonObject | null;
1284
1223
  extrudelineArr?: LineObject[];
1285
1224
  splitPolygons: number;
1286
- constructor(options: Options_9);
1225
+ constructor(options: Options_5);
1287
1226
  create(): Promise<void>;
1227
+ private ensureExtrudeLineMaterials;
1228
+ createExtrudeLines(): Promise<void>;
1229
+ clearExtrudeLines(): void;
1230
+ syncExtrudeLines(hasExtrudeLine?: boolean): Promise<void>;
1288
1231
  mergeAreaSide(): Promise<void>;
1289
1232
  unmergeAreaSide(): Promise<void>;
1290
1233
  addArea(geojson: GeoJSON_2, options: {
@@ -1305,7 +1248,7 @@ declare class PlaneMap extends GroupObject {
1305
1248
  coords: Position[][];
1306
1249
  properties: GeoJsonProperties;
1307
1250
  }[];
1308
- update(delta: number, elapsed: number): void;
1251
+ update(_delta: number, elapsed: number): void;
1309
1252
  findGroup(adcode: string | number, fix?: boolean): GroupObject | undefined;
1310
1253
  setAreaMaterial(key: string, material: THREE.Material[] | THREE.Material): void;
1311
1254
  useAreaMaterial(key: string): void;
@@ -1358,8 +1301,8 @@ declare class Ring extends MeshObject {
1358
1301
 
1359
1302
  declare class Road extends GroupObject {
1360
1303
  objectType: string;
1361
- options: Options_6;
1362
- constructor(options: Options_6);
1304
+ options: Options_10;
1305
+ constructor(options: Options_10);
1363
1306
  linePrimary: LineObject[];
1364
1307
  lineSecondary: LineObject[];
1365
1308
  create(): Promise<void>;
@@ -1405,8 +1348,8 @@ declare class Sphere extends MeshObject {
1405
1348
 
1406
1349
  declare class SphereShadow extends MeshObject {
1407
1350
  objectType: string;
1408
- options: Required<Options_11>;
1409
- constructor(options: Options_11);
1351
+ options: Required<Options_7>;
1352
+ constructor(options: Options_7);
1410
1353
  create(): Promise<void>;
1411
1354
  rebuildFromScene(): void;
1412
1355
  }
@@ -1438,37 +1381,6 @@ declare interface SwitchFixConfig {
1438
1381
  r?: string[];
1439
1382
  }
1440
1383
 
1441
- declare class Target extends GroupObject {
1442
- objectType: string;
1443
- options: Opt;
1444
- time: {
1445
- value: number;
1446
- };
1447
- offset: THREE.Vector2;
1448
- timer: ReturnType<typeof setTimeout> | null;
1449
- inTween: Tween<any> | null;
1450
- outTween: Tween<any> | null;
1451
- constructor(options: Opt);
1452
- createWave(color: string): THREE.Mesh<THREE.PlaneGeometry, THREE.ShaderMaterial, THREE.Object3DEventMap>;
1453
- createRipple(texture: THREE.Texture): THREE.Mesh<THREE.CylinderGeometry, THREE.ShaderMaterial, THREE.Object3DEventMap>;
1454
- createCylinder(texture: THREE.Texture): THREE.Object3D<THREE.Object3DEventMap>;
1455
- createTorus(color: string): THREE.Mesh<THREE.TorusGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
1456
- create(): Promise<void>;
1457
- rebuildFromScene(): void;
1458
- erase(): void;
1459
- update(delta: number, elapsed: number): void;
1460
- }
1461
-
1462
- /**
1463
- * 模板配置接口
1464
- */
1465
- declare interface TemplateConfig {
1466
- id: string;
1467
- map?: boolean;
1468
- emissiveMap?: boolean | 'map';
1469
- cityOnly?: boolean;
1470
- }
1471
-
1472
1384
  export { THREE }
1473
1385
 
1474
1386
  declare const timeOut: (ms: number) => Promise<any>;
@@ -1484,7 +1396,7 @@ export { TWEEN }
1484
1396
 
1485
1397
  export { Tween }
1486
1398
 
1487
- export declare const VERSION = "0.31.23";
1399
+ export declare const VERSION = "0.31.24";
1488
1400
 
1489
1401
  export { }
1490
1402