map-ol-utils 0.1.30 → 0.2.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/README.md +223 -45
- package/dist/index.cjs +1907 -1120
- package/dist/index.d.cts +475 -134
- package/dist/index.d.mts +661 -0
- package/dist/index.mjs +1830 -0
- package/dist/tdt-vts/decoder.worker.cjs +46 -0
- package/dist/tdt-vts/decoder.worker.d.cts +1 -0
- package/dist/tdt-vts/decoder.worker.d.mts +1 -0
- package/dist/tdt-vts/decoder.worker.mjs +47 -0
- package/dist/tile-loader-CtZwCurI.mjs +630 -0
- package/dist/tile-loader-D4cn6nMU.cjs +683 -0
- package/package.json +20 -12
- package/dist/index.d.ts +0 -320
- package/dist/index.js +0 -1096
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import VectorTileSource from "ol/source/VectorTile.js";
|
|
2
|
+
import { Emitter, EventType } from "mitt";
|
|
3
|
+
import { Source, WMTS, XYZ } from "ol/source.js";
|
|
4
|
+
import TileLayer from "ol/layer/Tile.js";
|
|
5
|
+
import { Layer, Tile } from "ol/layer.js";
|
|
6
|
+
import VectorImageLayer from "ol/layer/Image.js";
|
|
7
|
+
import RasterSource from "ol/source/Raster.js";
|
|
8
|
+
import { AnimationOptions, FitOptions } from "ol/View.js";
|
|
9
|
+
import { CRSTypes } from "gcoord";
|
|
10
|
+
import { Feature, Map as Map$1, Overlay } from "ol";
|
|
11
|
+
import { Select } from "ol/interaction.js";
|
|
12
|
+
import Feature$1, { FeatureLike } from "ol/Feature.js";
|
|
13
|
+
import Point from "ol/geom/Point.js";
|
|
14
|
+
import VectorLayer from "ol/layer/Vector.js";
|
|
15
|
+
import VectorSource from "ol/source/Vector.js";
|
|
16
|
+
import { Style, Text } from "ol/style.js";
|
|
17
|
+
import Draw from "ol/interaction/Draw.js";
|
|
18
|
+
import { Point as Point$1, SimpleGeometry } from "ol/geom.js";
|
|
19
|
+
import Cluster from "ol/source/Cluster.js";
|
|
20
|
+
import { Coordinate } from "ol/coordinate.js";
|
|
21
|
+
import Layer$1 from "ol/layer/Layer.js";
|
|
22
|
+
import { Options } from "ol/Overlay.js";
|
|
23
|
+
import Geometry, { Type } from "ol/geom/Geometry.js";
|
|
24
|
+
import { FlatStyleLike } from "ol/style/flat.js";
|
|
25
|
+
import { StyleLike } from "ol/style/Style.js";
|
|
26
|
+
import Collection from "ol/Collection.js";
|
|
27
|
+
//#region src/core/types.d.ts
|
|
28
|
+
interface CustomMap extends Map$1 {
|
|
29
|
+
activeBaseLayer?: string;
|
|
30
|
+
changeBaseLayer?: () => void;
|
|
31
|
+
removeLayerByName?: (name: string) => void;
|
|
32
|
+
getLayerByName?: (name: string) => Layer<Source> | undefined;
|
|
33
|
+
changeLayersByNames?: (activeNames: Array<string>, allLayerNames: Array<string>) => void;
|
|
34
|
+
}
|
|
35
|
+
type GetImgUrl = (name: string, ext?: string) => string;
|
|
36
|
+
type GetImgUrlFn = (baseUrl: string) => GetImgUrl;
|
|
37
|
+
type VectorConfig = {
|
|
38
|
+
key: string;
|
|
39
|
+
zIndex?: number;
|
|
40
|
+
isRaw?: boolean;
|
|
41
|
+
isLine: boolean;
|
|
42
|
+
colorKey?: string;
|
|
43
|
+
layerName?: string;
|
|
44
|
+
openClick?: boolean;
|
|
45
|
+
fillColor?: string;
|
|
46
|
+
isAutoFit?: boolean;
|
|
47
|
+
crsForm?: CRSTypes;
|
|
48
|
+
fillOpacity?: number;
|
|
49
|
+
strokeColor?: string;
|
|
50
|
+
strokeStyle?: string;
|
|
51
|
+
strokeWeight?: number;
|
|
52
|
+
needTransform?: boolean;
|
|
53
|
+
activeFillColor?: string;
|
|
54
|
+
activeStrokeColor?: string;
|
|
55
|
+
activeFillOpacity?: number;
|
|
56
|
+
activeStrokeWeight?: number;
|
|
57
|
+
colorMap?: Map<string, string>;
|
|
58
|
+
};
|
|
59
|
+
type ClusterData = {
|
|
60
|
+
_uuid: string;
|
|
61
|
+
name: string;
|
|
62
|
+
style: number;
|
|
63
|
+
lnglat: Array<number>;
|
|
64
|
+
rawData: {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type ClusterConfig = {
|
|
69
|
+
distance: number;
|
|
70
|
+
layerName?: string;
|
|
71
|
+
openClick?: boolean;
|
|
72
|
+
minDistance: number;
|
|
73
|
+
singleStyles: Style[];
|
|
74
|
+
computedRadius?: (size: number) => number;
|
|
75
|
+
buildStyle?: (feature: FeatureLike) => Style;
|
|
76
|
+
};
|
|
77
|
+
type IconConfig = {
|
|
78
|
+
baseUrl: string;
|
|
79
|
+
hasLine?: boolean;
|
|
80
|
+
layerName?: string;
|
|
81
|
+
hasFace?: boolean;
|
|
82
|
+
statusNum?: number;
|
|
83
|
+
isDynamic?: boolean;
|
|
84
|
+
markerIcon: string;
|
|
85
|
+
activeScale?: number;
|
|
86
|
+
isAutoFit?: boolean;
|
|
87
|
+
marksStyles?: Style[];
|
|
88
|
+
offset?: [number, number];
|
|
89
|
+
vectorConfig?: VectorConfig;
|
|
90
|
+
markerSize: [number, number];
|
|
91
|
+
};
|
|
92
|
+
type MassData = {
|
|
93
|
+
_uuid?: string;
|
|
94
|
+
id: string;
|
|
95
|
+
style: number;
|
|
96
|
+
name: string;
|
|
97
|
+
status: string;
|
|
98
|
+
width?: number;
|
|
99
|
+
height?: number;
|
|
100
|
+
crsForm?: CRSTypes;
|
|
101
|
+
rawData: {
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
};
|
|
104
|
+
lnglat: [string, string] | [number, number];
|
|
105
|
+
};
|
|
106
|
+
type WmtsSourceOptions = {
|
|
107
|
+
style?: string;
|
|
108
|
+
format?: string;
|
|
109
|
+
version?: string;
|
|
110
|
+
layerName: string;
|
|
111
|
+
matrixSet?: string;
|
|
112
|
+
};
|
|
113
|
+
declare enum GeometryType {
|
|
114
|
+
LineString = "LineString",
|
|
115
|
+
MultiLineString = "MultiLineString",
|
|
116
|
+
Polygon = "Polygon",
|
|
117
|
+
MultiPolygon = "MultiPolygon",
|
|
118
|
+
Invalid = "Invalid"
|
|
119
|
+
}
|
|
120
|
+
type GeometryCoordinates = Coordinate[] | Coordinate[][] | Coordinate[][][];
|
|
121
|
+
type HzsyType = 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark';
|
|
122
|
+
type ZheJiangType = 'emap' | 'emap_lab' | 'imgmap' | 'imgmap_lab';
|
|
123
|
+
type WorldLayerType = 'vec_c' | 'cva_c' | 'img_c' | 'cia_c' | 'ter_c' | 'cta_c' | 'ibo_c';
|
|
124
|
+
/** 通用图层配置。 */
|
|
125
|
+
type LayerConfig = {
|
|
126
|
+
zIndex?: number;
|
|
127
|
+
visible?: boolean;
|
|
128
|
+
minZoom?: number;
|
|
129
|
+
maxZoom?: number;
|
|
130
|
+
layerName: string;
|
|
131
|
+
};
|
|
132
|
+
/** Marker 数据结构。 */
|
|
133
|
+
type DataItemConfig = {
|
|
134
|
+
lng: string | number;
|
|
135
|
+
lat: string | number;
|
|
136
|
+
img: string | undefined;
|
|
137
|
+
activeImg?: string | undefined;
|
|
138
|
+
text?: string;
|
|
139
|
+
offsetX?: number;
|
|
140
|
+
offsetY?: number;
|
|
141
|
+
scale?: number;
|
|
142
|
+
showText?: boolean;
|
|
143
|
+
anchor?: Array<number>;
|
|
144
|
+
rawData?: any;
|
|
145
|
+
rotation?: number;
|
|
146
|
+
};
|
|
147
|
+
interface ElasticDataItemConfig extends DataItemConfig {
|
|
148
|
+
smallImg: string;
|
|
149
|
+
largeImg: string;
|
|
150
|
+
}
|
|
151
|
+
//#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
|
+
//#region src/tdt-vts/source.d.ts
|
|
353
|
+
interface SourceDiagnostics {
|
|
354
|
+
onDecoded?: (stats: NormalizeStats & {
|
|
355
|
+
contentType: string | null;
|
|
356
|
+
cacheControl: string | null;
|
|
357
|
+
}, redactedUrl: string) => void;
|
|
358
|
+
onError?: (error: Error, redactedUrl: string) => void;
|
|
359
|
+
}
|
|
360
|
+
interface CreateTdtSourceOptions {
|
|
361
|
+
token: string;
|
|
362
|
+
restoreMode: RestoreMode;
|
|
363
|
+
minZoom?: number;
|
|
364
|
+
maxZoom?: number;
|
|
365
|
+
diagnostics?: SourceDiagnostics;
|
|
366
|
+
decoderOptions?: TdtDecoderWorkerClientOptions;
|
|
367
|
+
}
|
|
368
|
+
interface TdtSourceBundle {
|
|
369
|
+
source: VectorTileSource<FeatureLike>;
|
|
370
|
+
decoder: TdtDecoderWorkerClient;
|
|
371
|
+
}
|
|
372
|
+
declare const createTdtVectorSource: (options: CreateTdtSourceOptions) => TdtSourceBundle;
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/core/emitter.d.ts
|
|
375
|
+
declare const emitter: Emitter<Record<EventType, any>>;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/core/helper.d.ts
|
|
378
|
+
declare const getLayersDataList: () => any[];
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/layer/ogc-utils.d.ts
|
|
381
|
+
/**
|
|
382
|
+
* 创建WMTS图层
|
|
383
|
+
* @param serverUrl
|
|
384
|
+
*/
|
|
385
|
+
declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions) => Promise<TileLayer>;
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/layer/base-layer.d.ts
|
|
388
|
+
/**
|
|
389
|
+
* 创建杭州规自地图
|
|
390
|
+
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
391
|
+
*/
|
|
392
|
+
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
393
|
+
/**
|
|
394
|
+
* 创建全国天地图
|
|
395
|
+
* @param layerName - 图层名称
|
|
396
|
+
* @param tk - 天地图TK
|
|
397
|
+
*/
|
|
398
|
+
declare const createMapWorldLayer: (layerName: WorldLayerType, tk?: string) => Tile<WMTS>;
|
|
399
|
+
/**
|
|
400
|
+
* 创建天地图矢量/影像底图组合。
|
|
401
|
+
* @param tk - 天地图访问令牌
|
|
402
|
+
*/
|
|
403
|
+
declare const baseLayers: (tk: string) => {
|
|
404
|
+
baseImgLayer: Tile<XYZ>;
|
|
405
|
+
baseCiaLayer: Tile<XYZ>;
|
|
406
|
+
baseVecLayer: Tile<XYZ>;
|
|
407
|
+
baseCvaLayer: Tile<XYZ>;
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* 浙江省天地图
|
|
411
|
+
* @param layerName - 图层名称
|
|
412
|
+
* @param tk -
|
|
413
|
+
*/
|
|
414
|
+
declare const createZheJiangLayer: (layerName?: ZheJiangType, tk?: string) => Tile<XYZ>;
|
|
415
|
+
/**
|
|
416
|
+
* 根据图层名称获取图层
|
|
417
|
+
* @param name
|
|
418
|
+
*/
|
|
419
|
+
declare const getLayerByName: (name: string) => Layer<import("node_modules/ol/source").Source, import("node_modules/ol/renderer/Layer").default<any>, {
|
|
420
|
+
[x: string]: any;
|
|
421
|
+
}> | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* 根据图层名称删除图层
|
|
424
|
+
* @param name
|
|
425
|
+
*/
|
|
426
|
+
declare const removeLayerByName: (name: string) => void;
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/layer/raster-layer.d.ts
|
|
429
|
+
interface RasterTransformOptions {
|
|
430
|
+
threads?: number;
|
|
431
|
+
}
|
|
432
|
+
/** 使用 RGB 比例和目标颜色转换栅格图层。 */
|
|
433
|
+
declare const changeSource: (layer: Layer$1, rgbColorArray: number[], ratioArray: number[], options?: RasterTransformOptions) => RasterSource;
|
|
434
|
+
/** 使用 changeSource 创建可显示的 VectorImageLayer。 */
|
|
435
|
+
declare const changeLayer: (layer: Layer$1, rgbColorArray: number[], ratioArray: number[], options?: RasterTransformOptions) => VectorImageLayer<RasterSource>;
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/core/map-context.d.ts
|
|
438
|
+
/** 当前 OpenLayers 单例。集中存放以避免业务模块之间互相引用。 */
|
|
439
|
+
declare let instance: CustomMap;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/map/create-map.d.ts
|
|
442
|
+
declare const createMapInstance: (config?: {}) => CustomMap;
|
|
443
|
+
declare const createMap: (config?: {}) => CustomMap;
|
|
444
|
+
declare const disposeMap: () => void;
|
|
445
|
+
/** 兼容别名;复用 map-ol-utils 现有的完整销毁语义。 */
|
|
446
|
+
declare const disposeInstance: () => void;
|
|
447
|
+
declare const getMapInstance: () => CustomMap;
|
|
448
|
+
declare const resetZoomAndCenter: (center?: [number, number]) => void;
|
|
449
|
+
declare const resetMap: (config?: {
|
|
450
|
+
center: [number, number];
|
|
451
|
+
isClearAll: boolean;
|
|
452
|
+
}) => void;
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/overlay/overlay.d.ts
|
|
455
|
+
/**
|
|
456
|
+
* 移除带指定属性键的 Overlay(默认按 'position')
|
|
457
|
+
* @param key
|
|
458
|
+
*/
|
|
459
|
+
declare const removeOverlays: (key?: string) => void;
|
|
460
|
+
/**
|
|
461
|
+
* 创建动画标注 Overlay
|
|
462
|
+
* @param imgUrl
|
|
463
|
+
* @param data
|
|
464
|
+
*/
|
|
465
|
+
declare const createAnimationMarker: (imgUrl: string, data: MassData) => void;
|
|
466
|
+
/**
|
|
467
|
+
* 创建 Overlay
|
|
468
|
+
* @param config
|
|
469
|
+
*/
|
|
470
|
+
declare const createOverlay: (config?: Options) => Overlay;
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/map/view-fit.d.ts
|
|
473
|
+
/**
|
|
474
|
+
* 根据 Array<Coordinate> Fit
|
|
475
|
+
* @param coords
|
|
476
|
+
* @param mapInstance
|
|
477
|
+
* @param fitOptions
|
|
478
|
+
*/
|
|
479
|
+
declare const setFitViewByCoords: (coords: Array<Coordinate>, mapInstance?: CustomMap, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
480
|
+
/**
|
|
481
|
+
* 根据 SimpleGeometry Fit
|
|
482
|
+
* @param geom
|
|
483
|
+
* @param mapInstance
|
|
484
|
+
* @param fitOptions
|
|
485
|
+
*/
|
|
486
|
+
declare const setFitViewByGeom: (geom: SimpleGeometry, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
487
|
+
/**
|
|
488
|
+
* 根据 VectorLayer 要素的四至信息 Fit
|
|
489
|
+
* @param layer
|
|
490
|
+
* @param mapInstance
|
|
491
|
+
* @param fitOptions
|
|
492
|
+
*/
|
|
493
|
+
declare const setFitViewByLayer: (layer: VectorLayer, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
494
|
+
/** 使用两段缩放动画飞到目标位置。 */
|
|
495
|
+
declare const flyToAnimate: (center: Array<any>[number], zoom?: number) => void;
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/interaction/select.d.ts
|
|
498
|
+
/**
|
|
499
|
+
* 创建点击交互
|
|
500
|
+
* @param vectorLayer
|
|
501
|
+
*/
|
|
502
|
+
declare const createSelectByLayer: (vectorLayer: VectorLayer) => Select;
|
|
503
|
+
/** 按多个 className 创建选择交互。 */
|
|
504
|
+
declare const createLayerSelectByNames: (layerNames: Array<string>, selectedHandler?: (feature: Feature) => void, unSelectHandler?: (feature: Feature) => void) => Select;
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region src/interaction/draw.d.ts
|
|
507
|
+
/** 为绘制中的线和面追加长度/面积标签。 */
|
|
508
|
+
declare const getDrawStyle: (feature: FeatureLike, drawStyle?: Style | undefined) => Style[];
|
|
509
|
+
/** 创建绘制交互。 */
|
|
510
|
+
declare const createDrawInteraction: (type: Type | undefined, vectorLayer: VectorLayer, openTip?: boolean) => Draw;
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/layer/geojson-layer.d.ts
|
|
513
|
+
/** 直接从 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, {
|
|
515
|
+
[x: string]: any;
|
|
516
|
+
}>>, import("node_modules/ol").Feature<import("node_modules/ol/geom").Geometry, {
|
|
517
|
+
[x: string]: any;
|
|
518
|
+
}>>;
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/layer/marker-layer.d.ts
|
|
521
|
+
/** 创建 Marker 文本标注。 */
|
|
522
|
+
declare const createText: (item: DataItemConfig) => Text;
|
|
523
|
+
/** 创建 Marker 默认态或激活态样式。 */
|
|
524
|
+
declare const createIconStyle: (item: DataItemConfig, active?: boolean) => Style;
|
|
525
|
+
/** 创建带 data 属性约定的 Marker Feature。 */
|
|
526
|
+
declare const createMarker: (item: DataItemConfig, config: LayerConfig) => Feature$1<Point, {
|
|
527
|
+
[x: string]: any;
|
|
528
|
+
}>;
|
|
529
|
+
/** 批量创建 Marker 矢量图层。 */
|
|
530
|
+
declare const createMarkersLayer: (dataList: Array<DataItemConfig>, config: LayerConfig) => VectorLayer<VectorSource<Feature$1<Geometry, {
|
|
531
|
+
[x: string]: any;
|
|
532
|
+
}>>, Feature$1<Geometry, {
|
|
533
|
+
[x: string]: any;
|
|
534
|
+
}>>;
|
|
535
|
+
/** 清空外部选择集合并恢复 Marker 未选中样式。 */
|
|
536
|
+
declare const changeUnselectStyle: (featureList: Collection<Feature$1>) => void;
|
|
537
|
+
/** 创建随缩放级别切换小图/大图的 Marker 图层。 */
|
|
538
|
+
declare const createElasticMarkerLayer: (dataList: Array<ElasticDataItemConfig>, config: LayerConfig) => VectorLayer<VectorSource<Feature$1<Geometry, {
|
|
539
|
+
[x: string]: any;
|
|
540
|
+
}>>, Feature$1<Geometry, {
|
|
541
|
+
[x: string]: any;
|
|
542
|
+
}>>;
|
|
543
|
+
/** 创建单 Marker 图层并直接加入当前地图实例。 */
|
|
544
|
+
declare const createMoveMarkerLayer: (dataItem: DataItemConfig, config: LayerConfig) => {
|
|
545
|
+
vectorLayer: VectorLayer<VectorSource<Feature$1<Point, {
|
|
546
|
+
[x: string]: any;
|
|
547
|
+
}>>, Feature$1<Point, {
|
|
548
|
+
[x: string]: any;
|
|
549
|
+
}>>;
|
|
550
|
+
};
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/layer/layer-manager.d.ts
|
|
553
|
+
/**
|
|
554
|
+
* 重置激活的矢量数据(清空 overlay 与各图层选择交互的要素集合)
|
|
555
|
+
*/
|
|
556
|
+
declare const resetActiveVector: () => void;
|
|
557
|
+
/**
|
|
558
|
+
* 移除覆盖物以及所有非底图自定义图层
|
|
559
|
+
*/
|
|
560
|
+
declare const removeAllLayers: () => void;
|
|
561
|
+
/**
|
|
562
|
+
* 重置激活 Feature
|
|
563
|
+
*/
|
|
564
|
+
declare const resetActiveFeature: () => void;
|
|
565
|
+
/**
|
|
566
|
+
* 按 _uuid 激活要素
|
|
567
|
+
* @param uid
|
|
568
|
+
*/
|
|
569
|
+
declare const activeFeatureByUid: (uid: string) => void;
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/layer/vector-layer.d.ts
|
|
572
|
+
/**
|
|
573
|
+
* 创建业务矢量图层(自动推断线/面,生成默认/激活样式)
|
|
574
|
+
* @param dataList
|
|
575
|
+
* @param config
|
|
576
|
+
*/
|
|
577
|
+
declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
|
|
578
|
+
[x: string]: any;
|
|
579
|
+
}>>, Feature<import("node_modules/ol/geom").Geometry, {
|
|
580
|
+
[x: string]: any;
|
|
581
|
+
}>>;
|
|
582
|
+
/**
|
|
583
|
+
* 追加 Features
|
|
584
|
+
* @param targetLayer
|
|
585
|
+
* @param dataList
|
|
586
|
+
* @param crsForm
|
|
587
|
+
*/
|
|
588
|
+
declare const appendFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassData[], crsForm?: CRSTypes) => void;
|
|
589
|
+
/**
|
|
590
|
+
* 创建面状图层
|
|
591
|
+
* @param dataList
|
|
592
|
+
* @param config
|
|
593
|
+
*/
|
|
594
|
+
declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
|
|
595
|
+
[x: string]: any;
|
|
596
|
+
}>>, Feature<import("node_modules/ol/geom").Geometry, {
|
|
597
|
+
[x: string]: any;
|
|
598
|
+
}>>;
|
|
599
|
+
/**
|
|
600
|
+
* 创建矢量线图层
|
|
601
|
+
* @param dataList
|
|
602
|
+
* @param config
|
|
603
|
+
*/
|
|
604
|
+
declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<import("node_modules/ol/geom").Geometry, {
|
|
605
|
+
[x: string]: any;
|
|
606
|
+
}>>, Feature<import("node_modules/ol/geom").Geometry, {
|
|
607
|
+
[x: string]: any;
|
|
608
|
+
}>>;
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/layer/mass-marks.d.ts
|
|
611
|
+
/**
|
|
612
|
+
* 构建 MassMarks 样式数组(默认段 + 激活段,长度 statusNum * 2)
|
|
613
|
+
*/
|
|
614
|
+
declare const buildMassMarksStyles: (getImgUrlFn: GetImgUrlFn) => (iconConfig: IconConfig) => any[];
|
|
615
|
+
/**
|
|
616
|
+
* 向海量点图层增量添加 Features
|
|
617
|
+
* @param targetLayer
|
|
618
|
+
* @param dataList
|
|
619
|
+
* @param config
|
|
620
|
+
*/
|
|
621
|
+
declare const addFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassData[], config?: {
|
|
622
|
+
clear?: boolean;
|
|
623
|
+
}) => void;
|
|
624
|
+
/**
|
|
625
|
+
* 创建 massMarksLayer
|
|
626
|
+
* @param dataList
|
|
627
|
+
* @param styleList
|
|
628
|
+
*/
|
|
629
|
+
declare const createMassMarksLayer: (dataList: MassData[], styleList?: StyleLike[]) => VectorLayer<VectorSource<Feature<Point$1, {
|
|
630
|
+
[x: string]: any;
|
|
631
|
+
}>>, Feature<Point$1, {
|
|
632
|
+
[x: string]: any;
|
|
633
|
+
}>>;
|
|
634
|
+
/**
|
|
635
|
+
* 添加 massMarksLayer(按需附带线/面图层)
|
|
636
|
+
* @param getImgUrlFn
|
|
637
|
+
*/
|
|
638
|
+
declare const addMassMarksLayer: (getImgUrlFn: GetImgUrlFn) => (dataList: never[] | undefined, iconConfig: IconConfig, openClick?: boolean) => VectorLayer<VectorSource<Feature<Point$1, {
|
|
639
|
+
[x: string]: any;
|
|
640
|
+
}>>, Feature<Point$1, {
|
|
641
|
+
[x: string]: any;
|
|
642
|
+
}>>;
|
|
643
|
+
/**
|
|
644
|
+
* 按选中状态列表更新海量点显隐
|
|
645
|
+
* @param checkedStatusList
|
|
646
|
+
*/
|
|
647
|
+
declare const updateMarksLayersByStatus: (checkedStatusList?: string[]) => MassData[];
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/layer/cluster-layer.d.ts
|
|
650
|
+
/**
|
|
651
|
+
* 创建聚合图层(半径/颜色随聚合数量动态计算)
|
|
652
|
+
* @param dataList
|
|
653
|
+
* @param config
|
|
654
|
+
*/
|
|
655
|
+
declare const createClusterLayer: (dataList: ClusterData[], config: ClusterConfig) => VectorLayer<Cluster<Feature<Point$1, {
|
|
656
|
+
[x: string]: any;
|
|
657
|
+
}>>, Feature<import("node_modules/ol/geom").Geometry, {
|
|
658
|
+
[x: string]: any;
|
|
659
|
+
}>>;
|
|
660
|
+
//#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 };
|