@teeechina/teee-map 0.0.25 → 0.0.26

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/teee-map.mjs CHANGED
@@ -37133,7 +37133,7 @@ var S = x, C = async () => {
37133
37133
  filter: [
37134
37134
  "==",
37135
37135
  ["get", "category"],
37136
- it.FOULINGPOST
37136
+ 3
37137
37137
  ],
37138
37138
  paint: {
37139
37139
  "circle-radius": [
@@ -37141,9 +37141,11 @@ var S = x, C = async () => {
37141
37141
  ["linear"],
37142
37142
  ["zoom"],
37143
37143
  10,
37144
- 0,
37144
+ 1,
37145
+ 15,
37146
+ 3,
37145
37147
  22,
37146
- 8
37148
+ 5
37147
37149
  ],
37148
37150
  "circle-color": "red"
37149
37151
  }
@@ -37395,148 +37397,6 @@ var S = x, C = async () => {
37395
37397
  0
37396
37398
  ]
37397
37399
  }
37398
- },
37399
- {
37400
- id: `${e.id}_${t}_white_label`,
37401
- type: "symbol",
37402
- source: e.id,
37403
- "source-layer": t,
37404
- filter: [
37405
- "!=",
37406
- ["get", "category"],
37407
- 2
37408
- ],
37409
- layout: {
37410
- "text-field": ["get", "name"],
37411
- "text-size": [
37412
- "interpolate",
37413
- ["linear"],
37414
- ["zoom"],
37415
- 15,
37416
- [
37417
- "case",
37418
- [
37419
- "==",
37420
- ["get", "category"],
37421
- 50
37422
- ],
37423
- 12,
37424
- [
37425
- "==",
37426
- ["get", "category"],
37427
- 96
37428
- ],
37429
- 10,
37430
- 9
37431
- ],
37432
- 22,
37433
- [
37434
- "case",
37435
- [
37436
- "==",
37437
- ["get", "category"],
37438
- 50
37439
- ],
37440
- 18,
37441
- [
37442
- "==",
37443
- ["get", "category"],
37444
- 96
37445
- ],
37446
- 14,
37447
- 15
37448
- ]
37449
- ],
37450
- "text-font": ["Open Sans Regular"],
37451
- "text-anchor": "bottom",
37452
- "text-offset": [0, -1],
37453
- "symbol-placement": "point",
37454
- "text-allow-overlap": !0
37455
- },
37456
- paint: {
37457
- "text-color": "white",
37458
- "text-opacity": [
37459
- "case",
37460
- [
37461
- "==",
37462
- ["feature-state", "state"],
37463
- "2"
37464
- ],
37465
- 1,
37466
- 0
37467
- ]
37468
- }
37469
- },
37470
- {
37471
- id: `${e.id}_${t}_red_label`,
37472
- type: "symbol",
37473
- source: e.id,
37474
- "source-layer": t,
37475
- filter: [
37476
- "!=",
37477
- ["get", "category"],
37478
- 2
37479
- ],
37480
- layout: {
37481
- "text-field": ["get", "name"],
37482
- "text-size": [
37483
- "interpolate",
37484
- ["linear"],
37485
- ["zoom"],
37486
- 15,
37487
- [
37488
- "case",
37489
- [
37490
- "==",
37491
- ["get", "category"],
37492
- 50
37493
- ],
37494
- 12,
37495
- [
37496
- "==",
37497
- ["get", "category"],
37498
- 96
37499
- ],
37500
- 10,
37501
- 9
37502
- ],
37503
- 22,
37504
- [
37505
- "case",
37506
- [
37507
- "==",
37508
- ["get", "category"],
37509
- 50
37510
- ],
37511
- 18,
37512
- [
37513
- "==",
37514
- ["get", "category"],
37515
- 96
37516
- ],
37517
- 14,
37518
- 15
37519
- ]
37520
- ],
37521
- "text-font": ["Open Sans Regular"],
37522
- "text-anchor": "bottom",
37523
- "text-offset": [0, -1],
37524
- "symbol-placement": "point",
37525
- "text-allow-overlap": !0
37526
- },
37527
- paint: {
37528
- "text-color": "red",
37529
- "text-opacity": [
37530
- "case",
37531
- [
37532
- "==",
37533
- ["feature-state", "state"],
37534
- "1"
37535
- ],
37536
- 1,
37537
- 0
37538
- ]
37539
- }
37540
37400
  }
37541
37401
  ], yt = (e, t) => {
37542
37402
  let n = [
@@ -37623,7 +37483,8 @@ var S = x, C = async () => {
37623
37483
  ],
37624
37484
  "bottom-left",
37625
37485
  "bottom-right"
37626
- ]
37486
+ ],
37487
+ "icon-offset": [0, 6.4]
37627
37488
  },
37628
37489
  paint: { "icon-opacity": [
37629
37490
  "case",
@@ -38177,13 +38038,13 @@ var S = x, C = async () => {
38177
38038
  ["get", "category"],
38178
38039
  50
38179
38040
  ],
38180
- 10,
38041
+ 14,
38181
38042
  [
38182
38043
  "==",
38183
38044
  ["get", "category"],
38184
38045
  96
38185
38046
  ],
38186
- 8,
38047
+ 10,
38187
38048
  6
38188
38049
  ],
38189
38050
  20,
@@ -38206,7 +38067,18 @@ var S = x, C = async () => {
38206
38067
  ],
38207
38068
  "text-font": ["Arial Unicode MS Bold"],
38208
38069
  "symbol-placement": "point",
38209
- "text-allow-overlap": !0
38070
+ "text-allow-overlap": !0,
38071
+ "text-offset": [0, .5],
38072
+ "text-anchor": [
38073
+ "case",
38074
+ [
38075
+ "==",
38076
+ ["get", "category"],
38077
+ 1
38078
+ ],
38079
+ "top",
38080
+ "bottom"
38081
+ ]
38210
38082
  },
38211
38083
  paint: { "text-color": [
38212
38084
  "case",
@@ -39622,7 +39494,7 @@ var S = x, C = async () => {
39622
39494
  [
39623
39495
  "==",
39624
39496
  ["feature-state", "state"],
39625
- 0
39497
+ 2
39626
39498
  ],
39627
39499
  "red",
39628
39500
  [
@@ -39634,7 +39506,7 @@ var S = x, C = async () => {
39634
39506
  [
39635
39507
  "==",
39636
39508
  ["feature-state", "state"],
39637
- 2
39509
+ 255
39638
39510
  ],
39639
39511
  "white",
39640
39512
  "yellow"
@@ -39671,7 +39543,7 @@ var S = x, C = async () => {
39671
39543
  [
39672
39544
  "==",
39673
39545
  ["feature-state", "state"],
39674
- 0
39546
+ 2
39675
39547
  ],
39676
39548
  "red",
39677
39549
  [
@@ -39683,7 +39555,7 @@ var S = x, C = async () => {
39683
39555
  [
39684
39556
  "==",
39685
39557
  ["feature-state", "state"],
39686
- 2
39558
+ 255
39687
39559
  ],
39688
39560
  "white",
39689
39561
  "yellow"
@@ -39724,7 +39596,7 @@ var S = x, C = async () => {
39724
39596
  [
39725
39597
  "==",
39726
39598
  ["feature-state", "state"],
39727
- 0
39599
+ 2
39728
39600
  ],
39729
39601
  "red",
39730
39602
  [
@@ -39736,7 +39608,7 @@ var S = x, C = async () => {
39736
39608
  [
39737
39609
  "==",
39738
39610
  ["feature-state", "state"],
39739
- 2
39611
+ 255
39740
39612
  ],
39741
39613
  "white",
39742
39614
  "yellow"
@@ -42019,6 +41891,7 @@ var Fn = class {
42019
41891
  signalEnable = !1;
42020
41892
  onSendSignal;
42021
41893
  stationSignalState = [];
41894
+ filterCodes = [];
42022
41895
  constructor(e) {
42023
41896
  this.firstSwitches = e.firstSwitches ?? [], this.updateFeatureState = e.updateFeatureState, this.queryGeojsonFeatures = e.queryGeojsonFeatures, this.getFeatureState = e.getFeatureState, this.layers = e.sourceIds;
42024
41897
  }
@@ -42077,10 +41950,14 @@ var Fn = class {
42077
41950
  this.updateFeatureState(e.properties.code, { state: t.state });
42078
41951
  });
42079
41952
  }
41953
+ for (let t of e.switchInterlock) {
41954
+ let e = t.name.split(":")[0], n = t.name.split(":")[1], r = this.getSwitchFeatures(e, n);
41955
+ r && this.updateFeatureState(r.properties.code, { state: t.state });
41956
+ }
42080
41957
  for (let t of e.circuitInterlock) {
42081
41958
  let e = t.name.split(":")[0], n = t.name.split(":")[1], r = this.getCircuitFeature(e, n);
42082
41959
  r && this.updateFeatureState(r.properties.code, {
42083
- state: Number(t.state),
41960
+ state: t.state,
42084
41961
  visiable: !0
42085
41962
  });
42086
41963
  }
@@ -42281,6 +42158,9 @@ var Fn = class {
42281
42158
  let i = String(r.properties?.code ?? ""), a = this.queryFeatures("switch_loc");
42282
42159
  return n === "4" ? a.filter((e) => String(e.properties?.s_code ?? "") === i) : a.filter((e) => String(e.properties?.s_code ?? "") === i && (String(e.properties?.location ?? "") === n || String(e.properties?.location ?? "") === "1"));
42283
42160
  }
42161
+ getSwitchFeatures(e, t) {
42162
+ return this.queryFeatures("switch").find((n) => n.properties?.name === e && String(n.properties?.code ?? "").includes(t));
42163
+ }
42284
42164
  getSwitchByCode(e) {
42285
42165
  return this.queryFeatures("switch").find((t) => String(t.id ?? t.properties?.code ?? "") === e);
42286
42166
  }
@@ -42331,8 +42211,8 @@ var Fn = class {
42331
42211
  setSendSignalCallback(e) {
42332
42212
  this.onSendSignal = e;
42333
42213
  }
42334
- setStationSignalState(e) {
42335
- this.stationSignalState = e;
42214
+ setStationSignalState(e, t = []) {
42215
+ this.stationSignalState = e, this.filterCodes = t;
42336
42216
  }
42337
42217
  sendSignal() {
42338
42218
  if (!this.signalEnable || this.interLockState.signal.size === 0 && this.interLockState.switch.size === 0 && this.interLockState.circuit.size === 0) return;
@@ -42382,6 +42262,7 @@ var Fn = class {
42382
42262
  collectStateAndSend() {
42383
42263
  if (!this.signalEnable) return;
42384
42264
  let e = Math.floor(Date.now() / 1e3), t = /* @__PURE__ */ new Map(), n = [], r = {
42265
+ unset: "0",
42385
42266
  red: "1",
42386
42267
  green: "2",
42387
42268
  white: "3",
@@ -42391,7 +42272,7 @@ var Fn = class {
42391
42272
  for (let e of this.queryFeatures(n.signal.replace("geojson_station_", ""))) {
42392
42273
  let n = String(e.properties?.name ?? ""), i = String(e.properties?.code ?? ""), a = String(e.properties?.stcode ?? i.substring(0, 9));
42393
42274
  if (!n || !i || !a || !this.stationSignalState.includes(a)) continue;
42394
- let o = String(this.getFeatureState(i)?.state ?? "");
42275
+ let o = this.filterCodes.length && !this.filterCodes.includes(i) ? "unset" : String(this.getFeatureState(i)?.state ?? "");
42395
42276
  if (!o) continue;
42396
42277
  let s = r[o] ?? o, c = t.get(a);
42397
42278
  t.set(a, c ? c + n + ":" + s + ";" : n + ":" + s + ";");
@@ -42403,7 +42284,7 @@ var Fn = class {
42403
42284
  if (!n || !i || !a || !this.stationSignalState.includes(a)) continue;
42404
42285
  let o = e.find((e) => String(e.properties?.s_code ?? "") === i && String(e.properties?.location ?? "") === "1") ?? e.find((e) => String(e.properties?.s_code ?? "") === i);
42405
42286
  if (!o) continue;
42406
- let s = String(this.getFeatureState(String(o.properties?.code ?? ""))?.state ?? "");
42287
+ let s = this.filterCodes.length && !this.filterCodes.includes(i) ? "0" : String(this.getFeatureState(String(o.properties?.code ?? ""))?.state ?? "");
42407
42288
  if (!s) continue;
42408
42289
  let c = Number(s), l = t.get(a);
42409
42290
  l === void 0 ? l = "&" + (c === 5 || c === 6 ? n + ":" + (c === 5 ? 2 : 3) + ";" + n + "-F:" + s + ";" : n + ":" + s + ";") : l += c === 5 || c === 6 ? n + ":" + (c === 5 ? 2 : 3) + ";" + n + "-F:" + s + ";" : n + ":" + s + ";", t.set(a, l);
@@ -42413,7 +42294,7 @@ var Fn = class {
42413
42294
  for (let e of this.queryFeatures(n.track_circuit.replace("geojson_station_", ""))) {
42414
42295
  let t = String(e.properties?.name ?? ""), n = String(e.properties?.code ?? ""), r = String(e.properties?.stcode ?? n.substring(0, 9));
42415
42296
  if (!t || !n || !r || !this.stationSignalState.includes(r)) continue;
42416
- let a = String(this.getFeatureState(n)?.state ?? "");
42297
+ let a = this.filterCodes.length && !this.filterCodes.includes(n) ? "0" : String(this.getFeatureState(n)?.state ?? "");
42417
42298
  if (!a) continue;
42418
42299
  let o = r + "_" + t;
42419
42300
  i.get(o) ? (a === "1" || a === "2") && i.set(o, {
@@ -51800,7 +51681,8 @@ var Vs = class {
51800
51681
  style: t,
51801
51682
  center: [0, 0],
51802
51683
  zoom: 14,
51803
- attributionControl: !1
51684
+ attributionControl: !1,
51685
+ maxZoom: 24
51804
51686
  }), As.base(this), this.map.on("load", () => {
51805
51687
  this.cursorTool = new As.cursor(this.map), this.drawTool = new As.draw(this), this.injectTeeeGeoJson = As.injectTeeeGeoJson, this.snaps = new As.snaps(this), this.drawRoute = new As.drawRoute(this);
51806
51688
  });
@@ -51974,7 +51856,8 @@ var Vs = class {
51974
51856
  this.map.addSource(e, {
51975
51857
  type: "raster",
51976
51858
  tiles: ["https://wprd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}"],
51977
- tileSize: 256
51859
+ tileSize: 256,
51860
+ maxzoom: 18
51978
51861
  }), this.map.addLayer({
51979
51862
  id: "gaode-satellite-layer",
51980
51863
  type: "raster",
@@ -52042,7 +51925,8 @@ var Vs = class {
52042
51925
  this.map.addSource(e, {
52043
51926
  type: "raster",
52044
51927
  tiles: ["https://wprd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}"],
52045
- tileSize: 256
51928
+ tileSize: 256,
51929
+ maxzoom: 18
52046
51930
  }), this.map.addLayer({
52047
51931
  id: "gaode-satellite-layer",
52048
51932
  type: "raster",
@@ -52233,22 +52117,27 @@ var Vs = class {
52233
52117
  }
52234
52118
  async stashAllFeature() {
52235
52119
  if (!this.mapConfigs) return;
52236
- let e = this.mapConfigs.sourceLayers, t = this.mapConfigs.id;
52237
- this.stashFeatures.clear(), e?.forEach((e) => {
52238
- e.includes("prevention") || this.map.querySourceFeatures(t, { sourceLayer: e }).forEach((t) => {
52239
- t.properties.code && this.stashFeatures.set(t.properties.code, { sourceLayer: e });
52120
+ let e = this.mapConfigs.sourceLayers, t = this.mapConfigs.layers ?? [], n = this.mapConfigs.id;
52121
+ this.stashFeatures.clear(), e?.forEach((e, r) => {
52122
+ if (e.includes("prevention")) return;
52123
+ let i = this.map.querySourceFeatures(n, { sourceLayer: e }), a = /* @__PURE__ */ new Map();
52124
+ i.forEach((t) => {
52125
+ let n = t.properties?.code;
52126
+ n && (this.stashFeatures.set(n, { sourceLayer: e }), a.set(String(n), t));
52240
52127
  });
52241
- });
52242
- let n = this.mapConfigs.layers ?? [];
52243
- await Promise.all(n.map(async (e) => {
52128
+ let o = t[r];
52129
+ o && this.layerFeaturesCache.set(o, Array.from(a.values()));
52130
+ }), await Promise.all(t.map(async (e) => {
52244
52131
  let t = `geojson_${e}`, n = this.map.getSource(t);
52245
- n && (await n.getData()).features?.forEach((e) => {
52132
+ if (!n) return;
52133
+ let r = await n.getData(), i = r.features ?? [];
52134
+ r.features?.forEach((e) => {
52246
52135
  let n = e.properties?.code;
52247
52136
  n && !this.stashFeatures.get(n) && this.stashFeatures.set(n, {
52248
52137
  sourceLayer: t,
52249
52138
  properties: e.properties
52250
52139
  });
52251
- });
52140
+ }), i.length && this.layerFeaturesCache.set(e, i);
52252
52141
  }));
52253
52142
  }
52254
52143
  updateFeatureState(e, t) {