@teeechina/teee-map 0.0.10 → 0.0.12

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Map as MaplibreMap, LngLat, GeoJSONFeature, LngLatLike } from 'maplibre-gl';
2
2
  import type { LayerSpecification, SourceSpecification } from 'maplibre-gl';
3
+ import type { FeatureCollection } from 'geojson';
3
4
 
4
5
  // ─────────────────────────────────────────────
5
6
  // 基础枚举 & 联合类型
@@ -281,6 +282,7 @@ export interface InterlockVisualizationGraphOptions {
281
282
  };
282
283
  firstSwitches?: string[];
283
284
  updateFeatureState?: (code: string | number, state: any) => void;
285
+ queryGeojsonFeatures?: (key: string) => GeoJSONFeature[];
284
286
  }
285
287
 
286
288
  export interface InterlockVisualizationGeoJsonOptions {
@@ -296,6 +298,7 @@ export interface InterlockVisualizationGeoJsonOptions {
296
298
  };
297
299
  firstSwitches?: string[];
298
300
  updateFeatureState?: (code: string | number, state: any) => void;
301
+ queryGeojsonFeatures?: (key: string) => GeoJSONFeature[];
299
302
  }
300
303
 
301
304
  export interface InterlockVisualizationLegacyOptions {
@@ -311,13 +314,48 @@ export interface InterlockVisualizationLegacyOptions {
311
314
  };
312
315
  firstSwitches?: string[];
313
316
  updateFeatureState?: (code: string | number, state: any) => void;
317
+ queryGeojsonFeatures?: (key: string) => GeoJSONFeature[];
314
318
  }
315
319
 
316
320
  export type InterlockVisualizationOptions = InterlockVisualizationGraphOptions | InterlockVisualizationGeoJsonOptions | InterlockVisualizationLegacyOptions;
317
321
 
318
322
  export declare class InterLockVisualization {
319
323
  constructor(options: InterlockVisualizationOptions);
324
+
325
+ /** 初始化绝缘节与信号机的映射关系,构造后需调用一次 */
326
+ initInsulation(): void;
327
+
328
+ /** 处理一帧联锁信号数据字符串,自动识别 ZK01 / YD 协议并刷新要素状态 */
329
+ handleSignalData(res: string): void;
330
+
331
+ /** 清空所有联锁状态缓存,将所有要素状态还原为初始值 */
332
+ turnOffSignals(): void;
333
+
334
+ /** 启用信号发送模式 */
335
+ startRunning(): void;
336
+
337
+ /** 禁用信号发送模式 */
338
+ stopRunning(): void;
339
+
340
+ /** 设置信号发送回调,回调参数为按协议格式组装的字符串数组 */
341
+ setSendSignalCallback(callback: (dataList: string[]) => void): void;
342
+
343
+ /** 设置站场信号状态列表 */
344
+ setStationSignalState(stationSignalState: string[]): void;
345
+
346
+ /** 将 interLockState 缓存中的状态按协议格式组装后触发回调 */
347
+ sendSignal(): void;
348
+
349
+ /** 将所有状态置零后发送一次清空帧,用于暂停场景 */
350
+ pauseSignal(): void;
351
+
352
+ /** 直接读取 MapLibre 图层 feature state 生成信号字符串并发送,不依赖缓存 */
353
+ collectStateAndSend(): void;
354
+
355
+ /** @deprecated 请改用 handleSignalData */
320
356
  setInterlockData(protocol: InterlockProtocol): void;
357
+
358
+ /** @deprecated 请改用 turnOffSignals */
321
359
  clear(): void;
322
360
  }
323
361
 
@@ -372,16 +410,23 @@ export declare class TeeeMap {
372
410
  createGraphEncryptedMap(stcode: string, url: string, layers: LayerType[]): void;
373
411
  createGeomEncryptedMap(stcode: string, url: string, layers: LayerType[]): void;
374
412
  createCTCEncryptedMap(stcode: string, url: string, layers: LayerType[]): void;
375
- createGeoJsonStationMap(
376
- stationDatas: {
377
- name: string;
378
- data: GeoJSON.FeatureCollection | string;
379
- }[],
380
- ): Promise<void>;
413
+ createGeoJsonStationMap(stationDatas: GeojsonStationDatas[]): Promise<void>;
381
414
 
382
415
  // ── 其他工具方法 ──
383
416
  getMap(): MaplibreMap;
384
417
  getMapConfigs(): MapForgeConfig;
418
+ getFeatureState(code: string | number): Record<string, unknown> | undefined;
419
+ locateGeojsonFeature(data: GeoJSON.FeatureCollection): void;
420
+
421
+ // 信号解析与模拟
422
+ interLockVisualization?: InterLockVisualization;
385
423
  }
386
424
 
387
425
  export default TeeeMap;
426
+
427
+ export interface GeojsonStationDatas {
428
+ name: string;
429
+ data: GeoJSON.FeatureCollection | string;
430
+ }
431
+
432
+ export declare function transformGeoJsonFrom3857(geojson: FeatureCollection): FeatureCollection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teeechina/teee-map",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "",
5
5
  "main": "dist/teee-map.umd.js",
6
6
  "module": "dist/teee-map.mjs",