map-ol-utils 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -5,6 +5,8 @@ import { CRSTypes } from "gcoord";
5
5
  import { Source, WMTS, XYZ } from "ol/source.js";
6
6
  import { Coordinate } from "ol/coordinate.js";
7
7
  import Feature$1, { FeatureLike } from "ol/Feature.js";
8
+ import { NormalizeStats, RestoreMode, TdtDecoderWorkerClient, TdtDecoderWorkerClientOptions } from "tdt-vts-core";
9
+ import VectorTileLayer from "ol/layer/VectorTile.js";
8
10
  import VectorTileSource from "ol/source/VectorTile.js";
9
11
  import { Emitter, EventType } from "mitt";
10
12
  import TileLayer from "ol/layer/Tile.js";
@@ -24,6 +26,7 @@ import { StyleLike } from "ol/style/Style.js";
24
26
  import Collection from "ol/Collection.js";
25
27
  import Point$1 from "ol/geom/Point.js";
26
28
  import Cluster from "ol/source/Cluster.js";
29
+ export * from "tdt-vts-core";
27
30
  //#region src/core/types.d.ts
28
31
  interface CustomMap extends Map$1 {
29
32
  activeBaseLayer?: string;
@@ -149,206 +152,6 @@ interface ElasticDataItemConfig extends DataItemConfig {
149
152
  largeImg: string;
150
153
  }
151
154
  //#endregion
152
- //#region src/tdt-vts/pk.d.ts
153
- interface TileCoordinate {
154
- z: number;
155
- x: number;
156
- y: number;
157
- }
158
- interface TdtVtsUrlOptions {
159
- token: string;
160
- type?: string;
161
- version?: string;
162
- maxZoom?: number;
163
- hosts?: readonly string[];
164
- wrapX?: boolean;
165
- }
166
- /**
167
- * 将 XYZ 瓦片坐标编码为天地图 VTS 使用的 pk 参数。
168
- *
169
- * 算法按 main.0f98e6f9.js 中的实现还原:
170
- * 1. 从 bit=z 到 bit=0 交织 x/y 位;
171
- * 2. 反转;
172
- * 3. 将 0-based 位置 9、8、7、6 加一;
173
- * 4. 0/1/2/3/4 映射为 a/d/g/j/m;
174
- * 5. 连续字符使用“额外重复次数”压缩。
175
- */
176
- declare const encodeTdtPk: (x: number, y: number, z: number) => string;
177
- /** 反解 pk;用于调试、单元测试和核对网络请求。 */
178
- declare const decodeTdtPk: (pk: string) => TileCoordinate;
179
- /**
180
- * 根据 OpenLayers 的 [z, x, y] 生成最终 VTS 地址,不依赖字符串替换。
181
- */
182
- declare const createTdtVtsUrl: (tileCoord: readonly [number, number, number], options: TdtVtsUrlOptions) => string | undefined;
183
- declare const redactTdtToken: (url: string) => string;
184
- //#endregion
185
- //#region src/tdt-vts/private-mvt.d.ts
186
- declare const TDT_XOR_BYTE_INDEXES: readonly [1, 2, 3, 4, 99];
187
- type MvtLayout = 'private' | 'standard';
188
- type RestoreMode = 'auto' | 'header' | 'always' | 'never';
189
- type MvtGeometryType = 0 | 1 | 2 | 3 | 4;
190
- type MvtValue = {
191
- kind: 'string';
192
- value: string;
193
- } | {
194
- kind: 'float';
195
- value: number;
196
- } | {
197
- kind: 'double';
198
- value: number;
199
- } | {
200
- kind: 'int64';
201
- value: bigint;
202
- } | {
203
- kind: 'uint64';
204
- value: bigint;
205
- } | {
206
- kind: 'sint64';
207
- value: bigint;
208
- } | {
209
- kind: 'boolean';
210
- value: boolean;
211
- } | {
212
- kind: 'null';
213
- value: null;
214
- };
215
- interface MvtFeature {
216
- id?: bigint;
217
- tags: number[];
218
- type: MvtGeometryType;
219
- geometry: number[];
220
- }
221
- interface MvtLayer {
222
- version: number;
223
- name: string;
224
- extent: number;
225
- features: MvtFeature[];
226
- keys: string[];
227
- values: MvtValue[];
228
- }
229
- interface MvtTile {
230
- layers: MvtLayer[];
231
- }
232
- interface LayerStats {
233
- name: string;
234
- featureCount: number;
235
- pointCount: number;
236
- lineCount: number;
237
- polygonCount: number;
238
- extent: number;
239
- version: number;
240
- }
241
- interface NormalizeStats {
242
- restored: boolean;
243
- pragma: string | null;
244
- inputBytes: number;
245
- outputBytes: number;
246
- layerCount: number;
247
- featureCount: number;
248
- layers: LayerStats[];
249
- }
250
- interface NormalizeOptions {
251
- pragma?: string | null;
252
- restoreMode?: RestoreMode;
253
- }
254
- interface NormalizeResult {
255
- data: Uint8Array;
256
- stats: NormalizeStats;
257
- }
258
- declare const restoreTdtBytes: (input: ArrayBuffer | ArrayBufferView | Uint8Array) => Uint8Array;
259
- declare const decodeMvt: (input: ArrayBuffer | ArrayBufferView | Uint8Array, layout: MvtLayout) => MvtTile;
260
- declare const privateTypeToStandard: (type: MvtGeometryType) => MvtGeometryType;
261
- declare const normalizePrivateGeometry: (geometry: readonly number[]) => number[];
262
- declare const encodeStandardMvt: (privateTile: MvtTile) => Uint8Array;
263
- declare const normalizePrivateMvt: (input: ArrayBuffer | ArrayBufferView | Uint8Array, options?: NormalizeOptions) => NormalizeResult;
264
- declare const resolveFeatureProperties: (layer: MvtLayer, feature: MvtFeature) => Record<string, string | number | boolean | bigint | null>;
265
- //#endregion
266
- //#region src/tdt-vts/style-loader.d.ts
267
- declare const TDT_VECTOR_SOURCE_ID = "base-tdt-vector-tile";
268
- interface JsonStyleLayer {
269
- id: string;
270
- type: string;
271
- source?: string;
272
- 'source-layer'?: string;
273
- beforeLayerId?: string;
274
- minzoom?: number;
275
- maxzoom?: number;
276
- layout?: Record<string, unknown>;
277
- paint?: Record<string, unknown>;
278
- filter?: unknown;
279
- metadata?: Record<string, unknown>;
280
- [key: string]: unknown;
281
- }
282
- interface JsonStyleDocument {
283
- version: 8;
284
- name?: string;
285
- metadata?: Record<string, unknown>;
286
- sources: Record<string, Record<string, unknown>>;
287
- sprite?: unknown;
288
- glyphs?: string;
289
- layers: JsonStyleLayer[];
290
- [key: string]: unknown;
291
- }
292
- interface TdtStyleBundle {
293
- style: JsonStyleDocument;
294
- style0LayerCount: number;
295
- style1LayerCount: number;
296
- skippedLayerIds: string[];
297
- }
298
- interface LoadStyleOptions {
299
- style0Url: string;
300
- style1Url: string;
301
- sourceId?: string;
302
- signal?: AbortSignal;
303
- }
304
- /** 按原 bundle 的 beforeLayerId 语义逐层插入。 */
305
- declare const mergeTdtStyleLayers: (baseLayers: readonly JsonStyleLayer[], extraLayers: readonly JsonStyleLayer[]) => JsonStyleLayer[];
306
- declare const loadTdtStyleBundle: (options: LoadStyleOptions) => Promise<TdtStyleBundle>;
307
- declare const getConstantBackgroundColor: (style: JsonStyleDocument) => string | undefined;
308
- //#endregion
309
- //#region src/tdt-vts/tile-loader.d.ts
310
- interface TdtTileResponseStats extends NormalizeStats {
311
- contentType: string | null;
312
- cacheControl: string | null;
313
- }
314
- interface LoadedTdtTile {
315
- buffer: ArrayBuffer;
316
- stats: TdtTileResponseStats;
317
- }
318
- interface LoadTdtVtsOptions {
319
- restoreMode?: RestoreMode;
320
- signal?: AbortSignal;
321
- fetch?: typeof globalThis.fetch;
322
- }
323
- /** Fetch a private Tianditu VTS tile and return a standard MVT buffer. */
324
- declare const loadAndNormalizeTdtVts: (url: string, options?: LoadTdtVtsOptions) => Promise<LoadedTdtTile>;
325
- //#endregion
326
- //#region src/tdt-vts/worker-client.d.ts
327
- type DecodedTile = LoadedTdtTile;
328
- interface DecodeTileOptions {
329
- signal?: AbortSignal;
330
- }
331
- interface TdtDecoderWorkerClientOptions {
332
- requestTimeoutMs?: number;
333
- workerFactory?: () => Worker;
334
- }
335
- declare class TdtDecoderWorkerClient {
336
- private readonly restoreMode;
337
- private readonly worker;
338
- private readonly pending;
339
- private nextId;
340
- private disposed;
341
- private readonly requestTimeoutMs;
342
- constructor(restoreMode: RestoreMode, options?: TdtDecoderWorkerClientOptions);
343
- decode(url: string, options?: DecodeTileOptions): Promise<DecodedTile>;
344
- dispose(): void;
345
- private takePending;
346
- private cancelRequest;
347
- private fail;
348
- private readonly handleMessage;
349
- private readonly handleWorkerError;
350
- }
351
- //#endregion
352
155
  //#region src/tdt-vts/source.d.ts
353
156
  interface SourceDiagnostics {
354
157
  onDecoded?: (stats: NormalizeStats & {
@@ -358,8 +161,9 @@ interface SourceDiagnostics {
358
161
  onError?: (error: Error, redactedUrl: string) => void;
359
162
  }
360
163
  interface CreateTdtSourceOptions {
361
- token: string;
164
+ token?: string;
362
165
  restoreMode: RestoreMode;
166
+ hosts: readonly [string, ...string[]];
363
167
  minZoom?: number;
364
168
  maxZoom?: number;
365
169
  diagnostics?: SourceDiagnostics;
@@ -369,7 +173,24 @@ interface TdtSourceBundle {
369
173
  source: VectorTileSource<FeatureLike>;
370
174
  decoder: TdtDecoderWorkerClient;
371
175
  }
176
+ interface CreateTdtVtsLayerOptions {
177
+ token?: string;
178
+ hosts: readonly [string, ...string[]];
179
+ style: string | TdtVtsStyle;
180
+ }
181
+ interface TdtVtsStyle {
182
+ version: 8;
183
+ sources: Record<string, Record<string, unknown>>;
184
+ layers: Array<{
185
+ id: string;
186
+ type: string;
187
+ layout?: Record<string, unknown>;
188
+ [key: string]: unknown;
189
+ }>;
190
+ [key: string]: unknown;
191
+ }
372
192
  declare const createTdtVectorSource: (options: CreateTdtSourceOptions) => TdtSourceBundle;
193
+ declare const createTdtVtsLayer: (options: CreateTdtVtsLayerOptions) => Promise<VectorTileLayer<VectorTileSource<FeatureLike>>>;
373
194
  //#endregion
374
195
  //#region src/core/emitter.d.ts
375
196
  declare const emitter: Emitter<Record<EventType, any>>;
@@ -416,7 +237,7 @@ declare const createZheJiangLayer: (layerName?: ZheJiangType, tk?: string) => Ti
416
237
  * 根据图层名称获取图层
417
238
  * @param name
418
239
  */
419
- declare const getLayerByName: (name: string) => Layer<import("node_modules/ol/source").Source, import("node_modules/ol/renderer/Layer").default<any>, {
240
+ declare const getLayerByName: (name: string) => Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>, {
420
241
  [x: string]: any;
421
242
  }> | undefined;
422
243
  /**
@@ -511,9 +332,9 @@ declare const createDrawInteraction: (type: Type | undefined, vectorLayer: Vecto
511
332
  //#endregion
512
333
  //#region src/layer/geojson-layer.d.ts
513
334
  /** 直接从 GeoJSON 创建矢量图层。 */
514
- declare const createGeoJsonLayer: (geoJson: any, style: StyleLike | FlatStyleLike | null | undefined, config?: LayerConfig) => VectorLayer<VectorSource<import("node_modules/ol").Feature<import("node_modules/ol/geom").Geometry, {
335
+ declare const createGeoJsonLayer: (geoJson: any, style: StyleLike | FlatStyleLike | null | undefined, config?: LayerConfig) => VectorLayer<VectorSource<import("ol").Feature<import("ol/geom").Geometry, {
515
336
  [x: string]: any;
516
- }>>, import("node_modules/ol").Feature<import("node_modules/ol/geom").Geometry, {
337
+ }>>, import("ol").Feature<import("ol/geom").Geometry, {
517
338
  [x: string]: any;
518
339
  }>>;
519
340
  //#endregion
@@ -574,9 +395,9 @@ declare const activeFeatureByUid: (uid: string) => void;
574
395
  * @param dataList
575
396
  * @param config
576
397
  */
577
- declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
398
+ declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
578
399
  [x: string]: any;
579
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
400
+ }>>, Feature<import("ol/geom").Geometry, {
580
401
  [x: string]: any;
581
402
  }>>;
582
403
  /**
@@ -591,9 +412,9 @@ declare const appendFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassDa
591
412
  * @param dataList
592
413
  * @param config
593
414
  */
594
- declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
415
+ declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
595
416
  [x: string]: any;
596
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
417
+ }>>, Feature<import("ol/geom").Geometry, {
597
418
  [x: string]: any;
598
419
  }>>;
599
420
  /**
@@ -601,9 +422,9 @@ declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config:
601
422
  * @param dataList
602
423
  * @param config
603
424
  */
604
- declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
425
+ declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
605
426
  [x: string]: any;
606
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
427
+ }>>, Feature<import("ol/geom").Geometry, {
607
428
  [x: string]: any;
608
429
  }>>;
609
430
  //#endregion
@@ -654,8 +475,8 @@ declare const updateMarksLayersByStatus: (checkedStatusList?: string[]) => MassD
654
475
  */
655
476
  declare const createClusterLayer: (dataList: ClusterData[], config: ClusterConfig) => VectorLayer<Cluster<Feature<Point, {
656
477
  [x: string]: any;
657
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
478
+ }>>, Feature<import("ol/geom").Geometry, {
658
479
  [x: string]: any;
659
480
  }>>;
660
481
  //#endregion
661
- export { ClusterConfig, ClusterData, type CreateTdtSourceOptions, CustomMap, DataItemConfig, type DecodedTile, ElasticDataItemConfig, GeometryCoordinates, GeometryType, GetImgUrl, GetImgUrlFn, HzsyType, IconConfig, type JsonStyleDocument, type JsonStyleLayer, LayerConfig, type LayerStats, type LoadStyleOptions, type LoadTdtVtsOptions, type LoadedTdtTile, MassData, type MvtFeature, type MvtGeometryType, type MvtLayer, type MvtLayout, type MvtTile, type MvtValue, type NormalizeOptions, type NormalizeResult, type NormalizeStats, type RestoreMode, type SourceDiagnostics, TDT_VECTOR_SOURCE_ID, TDT_XOR_BYTE_INDEXES, TdtDecoderWorkerClient, type TdtSourceBundle, type TdtStyleBundle, type TdtTileResponseStats, type TdtVtsUrlOptions, type TileCoordinate, VectorConfig, WmtsSourceOptions, WorldLayerType, ZheJiangType, activeFeatureByUid, addFeaturesByLayer, addMassMarksLayer, appendFeaturesByLayer, baseLayers, buildMassMarksStyles, changeLayer, changeSource, changeUnselectStyle, createAnimationMarker, createBaseLayer, createBusinessLayer, createClusterLayer, createDrawInteraction, createElasticMarkerLayer, createGeoJsonLayer, createIconStyle, createLayerSelectByNames, createMap, createMapInstance, createMapWorldLayer, createMarker, createMarkersLayer, createMassMarksLayer, createMoveMarkerLayer, createOverlay, createSelectByLayer, createTdtVectorSource, createTdtVtsUrl, createText, createVectorFaceLayer, createVectorLineLayer, createWmtsLayer, createZheJiangLayer, decodeMvt, decodeTdtPk, disposeInstance, disposeMap, emitter, encodeStandardMvt, encodeTdtPk, flyToAnimate, getConstantBackgroundColor, getDrawStyle, getLayerByName, getLayersDataList, getMapInstance, instance, loadAndNormalizeTdtVts, loadTdtStyleBundle, mergeTdtStyleLayers, normalizePrivateGeometry, normalizePrivateMvt, privateTypeToStandard, redactTdtToken, removeAllLayers, removeLayerByName, removeOverlays, resetActiveFeature, resetActiveVector, resetMap, resetZoomAndCenter, resolveFeatureProperties, restoreTdtBytes, setFitViewByCoords, setFitViewByGeom, setFitViewByLayer, updateMarksLayersByStatus };
482
+ export { ClusterConfig, ClusterData, type CreateTdtSourceOptions, type CreateTdtVtsLayerOptions, CustomMap, DataItemConfig, ElasticDataItemConfig, GeometryCoordinates, GeometryType, GetImgUrl, GetImgUrlFn, HzsyType, IconConfig, LayerConfig, MassData, type SourceDiagnostics, type TdtSourceBundle, type TdtVtsStyle, VectorConfig, WmtsSourceOptions, WorldLayerType, ZheJiangType, activeFeatureByUid, addFeaturesByLayer, addMassMarksLayer, appendFeaturesByLayer, baseLayers, buildMassMarksStyles, changeLayer, changeSource, changeUnselectStyle, createAnimationMarker, createBaseLayer, createBusinessLayer, createClusterLayer, createDrawInteraction, createElasticMarkerLayer, createGeoJsonLayer, createIconStyle, createLayerSelectByNames, createMap, createMapInstance, createMapWorldLayer, createMarker, createMarkersLayer, createMassMarksLayer, createMoveMarkerLayer, createOverlay, createSelectByLayer, createTdtVectorSource, createTdtVtsLayer, createText, createVectorFaceLayer, createVectorLineLayer, createWmtsLayer, createZheJiangLayer, disposeInstance, disposeMap, emitter, flyToAnimate, getDrawStyle, getLayerByName, getLayersDataList, getMapInstance, instance, removeAllLayers, removeLayerByName, removeOverlays, resetActiveFeature, resetActiveVector, resetMap, resetZoomAndCenter, setFitViewByCoords, setFitViewByGeom, setFitViewByLayer, updateMarksLayersByStatus };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { NormalizeStats, RestoreMode, TdtDecoderWorkerClient, TdtDecoderWorkerClientOptions } from "tdt-vts-core";
2
+ import VectorTileLayer from "ol/layer/VectorTile.js";
1
3
  import VectorTileSource from "ol/source/VectorTile.js";
2
4
  import { Emitter, EventType } from "mitt";
3
5
  import { Source, WMTS, XYZ } from "ol/source.js";
@@ -24,6 +26,7 @@ import Geometry, { Type } from "ol/geom/Geometry.js";
24
26
  import { FlatStyleLike } from "ol/style/flat.js";
25
27
  import { StyleLike } from "ol/style/Style.js";
26
28
  import Collection from "ol/Collection.js";
29
+ export * from "tdt-vts-core";
27
30
  //#region src/core/types.d.ts
28
31
  interface CustomMap extends Map$1 {
29
32
  activeBaseLayer?: string;
@@ -149,206 +152,6 @@ interface ElasticDataItemConfig extends DataItemConfig {
149
152
  largeImg: string;
150
153
  }
151
154
  //#endregion
152
- //#region src/tdt-vts/pk.d.ts
153
- interface TileCoordinate {
154
- z: number;
155
- x: number;
156
- y: number;
157
- }
158
- interface TdtVtsUrlOptions {
159
- token: string;
160
- type?: string;
161
- version?: string;
162
- maxZoom?: number;
163
- hosts?: readonly string[];
164
- wrapX?: boolean;
165
- }
166
- /**
167
- * 将 XYZ 瓦片坐标编码为天地图 VTS 使用的 pk 参数。
168
- *
169
- * 算法按 main.0f98e6f9.js 中的实现还原:
170
- * 1. 从 bit=z 到 bit=0 交织 x/y 位;
171
- * 2. 反转;
172
- * 3. 将 0-based 位置 9、8、7、6 加一;
173
- * 4. 0/1/2/3/4 映射为 a/d/g/j/m;
174
- * 5. 连续字符使用“额外重复次数”压缩。
175
- */
176
- declare const encodeTdtPk: (x: number, y: number, z: number) => string;
177
- /** 反解 pk;用于调试、单元测试和核对网络请求。 */
178
- declare const decodeTdtPk: (pk: string) => TileCoordinate;
179
- /**
180
- * 根据 OpenLayers 的 [z, x, y] 生成最终 VTS 地址,不依赖字符串替换。
181
- */
182
- declare const createTdtVtsUrl: (tileCoord: readonly [number, number, number], options: TdtVtsUrlOptions) => string | undefined;
183
- declare const redactTdtToken: (url: string) => string;
184
- //#endregion
185
- //#region src/tdt-vts/private-mvt.d.ts
186
- declare const TDT_XOR_BYTE_INDEXES: readonly [1, 2, 3, 4, 99];
187
- type MvtLayout = 'private' | 'standard';
188
- type RestoreMode = 'auto' | 'header' | 'always' | 'never';
189
- type MvtGeometryType = 0 | 1 | 2 | 3 | 4;
190
- type MvtValue = {
191
- kind: 'string';
192
- value: string;
193
- } | {
194
- kind: 'float';
195
- value: number;
196
- } | {
197
- kind: 'double';
198
- value: number;
199
- } | {
200
- kind: 'int64';
201
- value: bigint;
202
- } | {
203
- kind: 'uint64';
204
- value: bigint;
205
- } | {
206
- kind: 'sint64';
207
- value: bigint;
208
- } | {
209
- kind: 'boolean';
210
- value: boolean;
211
- } | {
212
- kind: 'null';
213
- value: null;
214
- };
215
- interface MvtFeature {
216
- id?: bigint;
217
- tags: number[];
218
- type: MvtGeometryType;
219
- geometry: number[];
220
- }
221
- interface MvtLayer {
222
- version: number;
223
- name: string;
224
- extent: number;
225
- features: MvtFeature[];
226
- keys: string[];
227
- values: MvtValue[];
228
- }
229
- interface MvtTile {
230
- layers: MvtLayer[];
231
- }
232
- interface LayerStats {
233
- name: string;
234
- featureCount: number;
235
- pointCount: number;
236
- lineCount: number;
237
- polygonCount: number;
238
- extent: number;
239
- version: number;
240
- }
241
- interface NormalizeStats {
242
- restored: boolean;
243
- pragma: string | null;
244
- inputBytes: number;
245
- outputBytes: number;
246
- layerCount: number;
247
- featureCount: number;
248
- layers: LayerStats[];
249
- }
250
- interface NormalizeOptions {
251
- pragma?: string | null;
252
- restoreMode?: RestoreMode;
253
- }
254
- interface NormalizeResult {
255
- data: Uint8Array;
256
- stats: NormalizeStats;
257
- }
258
- declare const restoreTdtBytes: (input: ArrayBuffer | ArrayBufferView | Uint8Array) => Uint8Array;
259
- declare const decodeMvt: (input: ArrayBuffer | ArrayBufferView | Uint8Array, layout: MvtLayout) => MvtTile;
260
- declare const privateTypeToStandard: (type: MvtGeometryType) => MvtGeometryType;
261
- declare const normalizePrivateGeometry: (geometry: readonly number[]) => number[];
262
- declare const encodeStandardMvt: (privateTile: MvtTile) => Uint8Array;
263
- declare const normalizePrivateMvt: (input: ArrayBuffer | ArrayBufferView | Uint8Array, options?: NormalizeOptions) => NormalizeResult;
264
- declare const resolveFeatureProperties: (layer: MvtLayer, feature: MvtFeature) => Record<string, string | number | boolean | bigint | null>;
265
- //#endregion
266
- //#region src/tdt-vts/style-loader.d.ts
267
- declare const TDT_VECTOR_SOURCE_ID = "base-tdt-vector-tile";
268
- interface JsonStyleLayer {
269
- id: string;
270
- type: string;
271
- source?: string;
272
- 'source-layer'?: string;
273
- beforeLayerId?: string;
274
- minzoom?: number;
275
- maxzoom?: number;
276
- layout?: Record<string, unknown>;
277
- paint?: Record<string, unknown>;
278
- filter?: unknown;
279
- metadata?: Record<string, unknown>;
280
- [key: string]: unknown;
281
- }
282
- interface JsonStyleDocument {
283
- version: 8;
284
- name?: string;
285
- metadata?: Record<string, unknown>;
286
- sources: Record<string, Record<string, unknown>>;
287
- sprite?: unknown;
288
- glyphs?: string;
289
- layers: JsonStyleLayer[];
290
- [key: string]: unknown;
291
- }
292
- interface TdtStyleBundle {
293
- style: JsonStyleDocument;
294
- style0LayerCount: number;
295
- style1LayerCount: number;
296
- skippedLayerIds: string[];
297
- }
298
- interface LoadStyleOptions {
299
- style0Url: string;
300
- style1Url: string;
301
- sourceId?: string;
302
- signal?: AbortSignal;
303
- }
304
- /** 按原 bundle 的 beforeLayerId 语义逐层插入。 */
305
- declare const mergeTdtStyleLayers: (baseLayers: readonly JsonStyleLayer[], extraLayers: readonly JsonStyleLayer[]) => JsonStyleLayer[];
306
- declare const loadTdtStyleBundle: (options: LoadStyleOptions) => Promise<TdtStyleBundle>;
307
- declare const getConstantBackgroundColor: (style: JsonStyleDocument) => string | undefined;
308
- //#endregion
309
- //#region src/tdt-vts/tile-loader.d.ts
310
- interface TdtTileResponseStats extends NormalizeStats {
311
- contentType: string | null;
312
- cacheControl: string | null;
313
- }
314
- interface LoadedTdtTile {
315
- buffer: ArrayBuffer;
316
- stats: TdtTileResponseStats;
317
- }
318
- interface LoadTdtVtsOptions {
319
- restoreMode?: RestoreMode;
320
- signal?: AbortSignal;
321
- fetch?: typeof globalThis.fetch;
322
- }
323
- /** Fetch a private Tianditu VTS tile and return a standard MVT buffer. */
324
- declare const loadAndNormalizeTdtVts: (url: string, options?: LoadTdtVtsOptions) => Promise<LoadedTdtTile>;
325
- //#endregion
326
- //#region src/tdt-vts/worker-client.d.ts
327
- type DecodedTile = LoadedTdtTile;
328
- interface DecodeTileOptions {
329
- signal?: AbortSignal;
330
- }
331
- interface TdtDecoderWorkerClientOptions {
332
- requestTimeoutMs?: number;
333
- workerFactory?: () => Worker;
334
- }
335
- declare class TdtDecoderWorkerClient {
336
- private readonly restoreMode;
337
- private readonly worker;
338
- private readonly pending;
339
- private nextId;
340
- private disposed;
341
- private readonly requestTimeoutMs;
342
- constructor(restoreMode: RestoreMode, options?: TdtDecoderWorkerClientOptions);
343
- decode(url: string, options?: DecodeTileOptions): Promise<DecodedTile>;
344
- dispose(): void;
345
- private takePending;
346
- private cancelRequest;
347
- private fail;
348
- private readonly handleMessage;
349
- private readonly handleWorkerError;
350
- }
351
- //#endregion
352
155
  //#region src/tdt-vts/source.d.ts
353
156
  interface SourceDiagnostics {
354
157
  onDecoded?: (stats: NormalizeStats & {
@@ -358,8 +161,9 @@ interface SourceDiagnostics {
358
161
  onError?: (error: Error, redactedUrl: string) => void;
359
162
  }
360
163
  interface CreateTdtSourceOptions {
361
- token: string;
164
+ token?: string;
362
165
  restoreMode: RestoreMode;
166
+ hosts: readonly [string, ...string[]];
363
167
  minZoom?: number;
364
168
  maxZoom?: number;
365
169
  diagnostics?: SourceDiagnostics;
@@ -369,7 +173,24 @@ interface TdtSourceBundle {
369
173
  source: VectorTileSource<FeatureLike>;
370
174
  decoder: TdtDecoderWorkerClient;
371
175
  }
176
+ interface CreateTdtVtsLayerOptions {
177
+ token?: string;
178
+ hosts: readonly [string, ...string[]];
179
+ style: string | TdtVtsStyle;
180
+ }
181
+ interface TdtVtsStyle {
182
+ version: 8;
183
+ sources: Record<string, Record<string, unknown>>;
184
+ layers: Array<{
185
+ id: string;
186
+ type: string;
187
+ layout?: Record<string, unknown>;
188
+ [key: string]: unknown;
189
+ }>;
190
+ [key: string]: unknown;
191
+ }
372
192
  declare const createTdtVectorSource: (options: CreateTdtSourceOptions) => TdtSourceBundle;
193
+ declare const createTdtVtsLayer: (options: CreateTdtVtsLayerOptions) => Promise<VectorTileLayer<VectorTileSource<FeatureLike>>>;
373
194
  //#endregion
374
195
  //#region src/core/emitter.d.ts
375
196
  declare const emitter: Emitter<Record<EventType, any>>;
@@ -416,7 +237,7 @@ declare const createZheJiangLayer: (layerName?: ZheJiangType, tk?: string) => Ti
416
237
  * 根据图层名称获取图层
417
238
  * @param name
418
239
  */
419
- declare const getLayerByName: (name: string) => Layer<import("node_modules/ol/source").Source, import("node_modules/ol/renderer/Layer").default<any>, {
240
+ declare const getLayerByName: (name: string) => Layer<import("ol/source").Source, import("ol/renderer/Layer").default<any>, {
420
241
  [x: string]: any;
421
242
  }> | undefined;
422
243
  /**
@@ -511,9 +332,9 @@ declare const createDrawInteraction: (type: Type | undefined, vectorLayer: Vecto
511
332
  //#endregion
512
333
  //#region src/layer/geojson-layer.d.ts
513
334
  /** 直接从 GeoJSON 创建矢量图层。 */
514
- declare const createGeoJsonLayer: (geoJson: any, style: StyleLike | FlatStyleLike | null | undefined, config?: LayerConfig) => VectorLayer<VectorSource<import("node_modules/ol").Feature<import("node_modules/ol/geom").Geometry, {
335
+ declare const createGeoJsonLayer: (geoJson: any, style: StyleLike | FlatStyleLike | null | undefined, config?: LayerConfig) => VectorLayer<VectorSource<import("ol").Feature<import("ol/geom").Geometry, {
515
336
  [x: string]: any;
516
- }>>, import("node_modules/ol").Feature<import("node_modules/ol/geom").Geometry, {
337
+ }>>, import("ol").Feature<import("ol/geom").Geometry, {
517
338
  [x: string]: any;
518
339
  }>>;
519
340
  //#endregion
@@ -574,9 +395,9 @@ declare const activeFeatureByUid: (uid: string) => void;
574
395
  * @param dataList
575
396
  * @param config
576
397
  */
577
- declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
398
+ declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
578
399
  [x: string]: any;
579
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
400
+ }>>, Feature<import("ol/geom").Geometry, {
580
401
  [x: string]: any;
581
402
  }>>;
582
403
  /**
@@ -591,9 +412,9 @@ declare const appendFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassDa
591
412
  * @param dataList
592
413
  * @param config
593
414
  */
594
- declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
415
+ declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
595
416
  [x: string]: any;
596
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
417
+ }>>, Feature<import("ol/geom").Geometry, {
597
418
  [x: string]: any;
598
419
  }>>;
599
420
  /**
@@ -601,9 +422,9 @@ declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config:
601
422
  * @param dataList
602
423
  * @param config
603
424
  */
604
- declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
425
+ declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("ol/geom").Geometry, {
605
426
  [x: string]: any;
606
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
427
+ }>>, Feature<import("ol/geom").Geometry, {
607
428
  [x: string]: any;
608
429
  }>>;
609
430
  //#endregion
@@ -654,8 +475,8 @@ declare const updateMarksLayersByStatus: (checkedStatusList?: string[]) => MassD
654
475
  */
655
476
  declare const createClusterLayer: (dataList: ClusterData[], config: ClusterConfig) => VectorLayer<Cluster<Feature<Point$1, {
656
477
  [x: string]: any;
657
- }>>, Feature<import("node_modules/ol/geom").Geometry, {
478
+ }>>, Feature<import("ol/geom").Geometry, {
658
479
  [x: string]: any;
659
480
  }>>;
660
481
  //#endregion
661
- export { ClusterConfig, ClusterData, type CreateTdtSourceOptions, CustomMap, DataItemConfig, type DecodedTile, ElasticDataItemConfig, GeometryCoordinates, GeometryType, GetImgUrl, GetImgUrlFn, HzsyType, IconConfig, type JsonStyleDocument, type JsonStyleLayer, LayerConfig, type LayerStats, type LoadStyleOptions, type LoadTdtVtsOptions, type LoadedTdtTile, MassData, type MvtFeature, type MvtGeometryType, type MvtLayer, type MvtLayout, type MvtTile, type MvtValue, type NormalizeOptions, type NormalizeResult, type NormalizeStats, type RestoreMode, type SourceDiagnostics, TDT_VECTOR_SOURCE_ID, TDT_XOR_BYTE_INDEXES, TdtDecoderWorkerClient, type TdtSourceBundle, type TdtStyleBundle, type TdtTileResponseStats, type TdtVtsUrlOptions, type TileCoordinate, VectorConfig, WmtsSourceOptions, WorldLayerType, ZheJiangType, activeFeatureByUid, addFeaturesByLayer, addMassMarksLayer, appendFeaturesByLayer, baseLayers, buildMassMarksStyles, changeLayer, changeSource, changeUnselectStyle, createAnimationMarker, createBaseLayer, createBusinessLayer, createClusterLayer, createDrawInteraction, createElasticMarkerLayer, createGeoJsonLayer, createIconStyle, createLayerSelectByNames, createMap, createMapInstance, createMapWorldLayer, createMarker, createMarkersLayer, createMassMarksLayer, createMoveMarkerLayer, createOverlay, createSelectByLayer, createTdtVectorSource, createTdtVtsUrl, createText, createVectorFaceLayer, createVectorLineLayer, createWmtsLayer, createZheJiangLayer, decodeMvt, decodeTdtPk, disposeInstance, disposeMap, emitter, encodeStandardMvt, encodeTdtPk, flyToAnimate, getConstantBackgroundColor, getDrawStyle, getLayerByName, getLayersDataList, getMapInstance, instance, loadAndNormalizeTdtVts, loadTdtStyleBundle, mergeTdtStyleLayers, normalizePrivateGeometry, normalizePrivateMvt, privateTypeToStandard, redactTdtToken, removeAllLayers, removeLayerByName, removeOverlays, resetActiveFeature, resetActiveVector, resetMap, resetZoomAndCenter, resolveFeatureProperties, restoreTdtBytes, setFitViewByCoords, setFitViewByGeom, setFitViewByLayer, updateMarksLayersByStatus };
482
+ export { ClusterConfig, ClusterData, type CreateTdtSourceOptions, type CreateTdtVtsLayerOptions, CustomMap, DataItemConfig, ElasticDataItemConfig, GeometryCoordinates, GeometryType, GetImgUrl, GetImgUrlFn, HzsyType, IconConfig, LayerConfig, MassData, type SourceDiagnostics, type TdtSourceBundle, type TdtVtsStyle, VectorConfig, WmtsSourceOptions, WorldLayerType, ZheJiangType, activeFeatureByUid, addFeaturesByLayer, addMassMarksLayer, appendFeaturesByLayer, baseLayers, buildMassMarksStyles, changeLayer, changeSource, changeUnselectStyle, createAnimationMarker, createBaseLayer, createBusinessLayer, createClusterLayer, createDrawInteraction, createElasticMarkerLayer, createGeoJsonLayer, createIconStyle, createLayerSelectByNames, createMap, createMapInstance, createMapWorldLayer, createMarker, createMarkersLayer, createMassMarksLayer, createMoveMarkerLayer, createOverlay, createSelectByLayer, createTdtVectorSource, createTdtVtsLayer, createText, createVectorFaceLayer, createVectorLineLayer, createWmtsLayer, createZheJiangLayer, disposeInstance, disposeMap, emitter, flyToAnimate, getDrawStyle, getLayerByName, getLayersDataList, getMapInstance, instance, removeAllLayers, removeLayerByName, removeOverlays, resetActiveFeature, resetActiveVector, resetMap, resetZoomAndCenter, setFitViewByCoords, setFitViewByGeom, setFitViewByLayer, updateMarksLayersByStatus };