gisviewer-vue3-arcgis 1.0.284 → 1.0.286

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.
Files changed (135) hide show
  1. package/es/index.mjs +6 -5
  2. package/es/src/gis-map/gis-map.vue.d.ts +126 -3
  3. package/es/src/gis-map/gis-map.vue.mjs +63 -63
  4. package/es/src/gis-map/index.d.ts +126 -3
  5. package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
  6. package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
  7. package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
  8. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
  9. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
  10. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
  11. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
  12. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +240 -0
  13. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
  14. package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +578 -0
  15. package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
  16. package/es/src/gis-map/utils/index.mjs +2 -2
  17. package/es/src/gis-map/utils/overlay.d.ts +2 -2
  18. package/es/src/gis-map/utils/overlay.mjs +2 -2
  19. package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
  20. package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
  21. package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
  22. package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
  23. package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
  24. package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
  25. package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
  26. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
  27. package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
  28. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
  29. package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
  30. package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
  31. package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
  32. package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
  33. package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
  34. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
  35. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
  36. package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
  37. package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
  38. package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
  39. package/es/src/gis-map-ol/gis-map-ol.vue.mjs +93 -0
  40. package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
  41. package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
  42. package/es/src/gis-map-ol/index.d.ts +69 -1
  43. package/es/src/gis-map-ol/index.mjs +8 -0
  44. package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
  45. package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
  46. package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
  47. package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
  48. package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +183 -0
  49. package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
  50. package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
  51. package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
  52. package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
  53. package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
  54. package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
  55. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
  56. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +221 -0
  57. package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
  58. package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
  59. package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
  60. package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
  61. package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
  62. package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
  63. package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
  64. package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
  65. package/es/src/index.mjs +4 -4
  66. package/es/src/types/index.d.ts +2 -1
  67. package/es/src/types/index.mjs +5 -0
  68. package/lib/index.js +1 -1
  69. package/lib/src/gis-map/gis-map.vue.d.ts +126 -3
  70. package/lib/src/gis-map/gis-map.vue.js +1 -1
  71. package/lib/src/gis-map/index.d.ts +126 -3
  72. package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
  73. package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
  74. package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
  75. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
  76. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
  77. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
  78. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
  79. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
  80. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
  81. package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
  82. package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
  83. package/lib/src/gis-map/utils/index.js +1 -1
  84. package/lib/src/gis-map/utils/overlay.d.ts +2 -2
  85. package/lib/src/gis-map/utils/overlay.js +1 -1
  86. package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
  87. package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
  88. package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
  89. package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
  90. package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
  91. package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
  92. package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
  93. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
  94. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
  95. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
  96. package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
  97. package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
  98. package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
  99. package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
  100. package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
  101. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
  102. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
  103. package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
  104. package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
  105. package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
  106. package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
  107. package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
  108. package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
  109. package/lib/src/gis-map-ol/index.d.ts +69 -1
  110. package/lib/src/gis-map-ol/index.js +1 -0
  111. package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
  112. package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
  113. package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
  114. package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
  115. package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
  116. package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
  117. package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
  118. package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
  119. package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
  120. package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
  121. package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
  122. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
  123. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
  124. package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
  125. package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
  126. package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
  127. package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
  128. package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
  129. package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
  130. package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
  131. package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
  132. package/lib/src/index.js +1 -1
  133. package/lib/src/types/index.d.ts +2 -1
  134. package/lib/src/types/index.js +1 -0
  135. package/package.json +1 -1
@@ -0,0 +1,221 @@
1
+ import L from "ol/Feature";
2
+ import x from "ol/geom/Point";
3
+ import U from "ol/layer/Vector";
4
+ import { unByKey as N } from "ol/Observable";
5
+ import X from "ol/source/Vector";
6
+ import F from "ol/style/Circle";
7
+ import h from "ol/style/Fill";
8
+ import v from "ol/style/Icon";
9
+ import m from "ol/style/Stroke";
10
+ import a from "ol/style/Style";
11
+ import K from "ol/style/Text";
12
+ import { PixelClusterCalculator as $ } from "../cluster/pixel-cluster-calculator.mjs";
13
+ class re {
14
+ constructor(e) {
15
+ this.showName = "detail", this.showStyle = "scatter", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.locations = [], this.map = e, this.view = e.getView(), this.clusterCalculator = new $(e), this.source = new X(), this.crossLayer = new U({
16
+ source: this.source
17
+ }), this.crossLayer.set("id", "signal-control-cross-layer"), this.map.addLayer(this.crossLayer), this.configureVectorLayerStyle();
18
+ }
19
+ showSignalCross(e) {
20
+ if (this.source.clear(), this.showName = e.showName || "detail", this.showStyle = e.style || "scatter", this.viewChangeKey || (this.viewChangeKey = this.view.on("change:resolution", () => {
21
+ this.showStyle === "cluster" && (this.resolutionChangeTimeout && clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = setTimeout(() => {
22
+ this.calculateCluster(), this.resolutionChangeTimeout = null;
23
+ }, 150));
24
+ })), this.mapMoveKey || (this.mapMoveKey = this.map.on("moveend", () => {
25
+ this.showStyle === "cluster" && this.calculateCluster();
26
+ })), this.showStyle === "scatter") {
27
+ const t = [], i = [];
28
+ e.points.forEach((l) => {
29
+ const c = this.createCrossFeature(l);
30
+ l.isMalfunction === !0 || l.isOnline === !1 ? i.push(c) : t.push(c);
31
+ }), this.source.addFeatures(t), this.source.addFeatures(i), this.crossLayer.changed();
32
+ } else
33
+ this.locations = e.points.map((t) => ({
34
+ id: t.crossId,
35
+ x: t.x,
36
+ y: t.y,
37
+ visited: !1,
38
+ clusterId: void 0,
39
+ properties: t
40
+ })), this.calculateCluster();
41
+ return {
42
+ status: 0,
43
+ message: "success"
44
+ };
45
+ }
46
+ calculateCluster() {
47
+ const e = this.clusterCalculator.calculate(this.locations), t = this.clusterCalculator.calculateSymbolSizes(e);
48
+ this.showClusterResult(t);
49
+ }
50
+ clearSignalCross() {
51
+ this.source.clear(), this.viewChangeKey && (N(this.viewChangeKey), this.viewChangeKey = null), this.mapMoveKey && (N(this.mapMoveKey), this.mapMoveKey = null), this.resolutionChangeTimeout && (clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = null);
52
+ }
53
+ changeShowName(e) {
54
+ this.showName = e, this.showStyle === "scatter" && this.updateScatterSymbol();
55
+ }
56
+ updateScatterSymbol() {
57
+ this.crossLayer.changed();
58
+ }
59
+ /**
60
+ * 配置矢量图层样式:复用 Icon,并为不同 feature 渲染不同 Text。
61
+ * - 使用 resolution 判断是否显示文字(在指定缩放级别后才显示)
62
+ * - 使用缓存避免每次渲染都创建新的 Style/Icon/数组对象
63
+ */
64
+ configureVectorLayerStyle() {
65
+ const y = this.map.getView(), E = y.getResolutionForZoom(13), Z = y.getResolutionForZoom(15), z = y.getResolutionForZoom(17), k = (s, o, n) => `/GisViewerAssets/Images/cross/ic_${(s ?? "gc").toLowerCase() === "scats" ? "scats" : "gc"}_${o === !1 ? "offline" : "online"}_${n ? "malfunction" : "normal"}.png`, w = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new WeakMap(), C = {
66
+ online: "#22c55e",
67
+ // 绿色 - 在线
68
+ offline: "#9ca3af"
69
+ // 灰色 - 离线
70
+ }, p = new m({ color: "#ffffff", width: 1.5 }), O = /* @__PURE__ */ new Map(), A = (s) => {
71
+ const o = s === !1 ? "offline" : "online", n = O.get(o);
72
+ if (n)
73
+ return n;
74
+ const r = [
75
+ new a({
76
+ image: new F({
77
+ radius: 3,
78
+ fill: new h({ color: C[o] }),
79
+ stroke: p
80
+ }),
81
+ zIndex: 1
82
+ })
83
+ ];
84
+ return O.set(o, r), r;
85
+ }, M = /* @__PURE__ */ new Map(), B = (s) => {
86
+ const o = s === !1 ? "offline" : "online", n = M.get(o);
87
+ if (n)
88
+ return n;
89
+ const r = [
90
+ new a({
91
+ image: new F({
92
+ radius: 6,
93
+ fill: new h({ color: C[o] }),
94
+ stroke: p
95
+ }),
96
+ zIndex: 1
97
+ })
98
+ ];
99
+ return M.set(o, r), r;
100
+ }, R = new h({ color: "#1f2937" }), V = new m({ color: "#ffffff", width: 3 }), I = (s) => {
101
+ const o = w.get(s);
102
+ if (o)
103
+ return o;
104
+ const n = new a({
105
+ image: new v({
106
+ src: s,
107
+ scale: 0.5,
108
+ anchor: [0.5, 1],
109
+ anchorXUnits: "fraction",
110
+ anchorYUnits: "fraction"
111
+ }),
112
+ zIndex: 1
113
+ });
114
+ return w.set(s, n), n;
115
+ }, D = (s) => {
116
+ const o = d.get(s);
117
+ if (o)
118
+ return o;
119
+ const n = [I(s)];
120
+ return d.set(s, n), n;
121
+ };
122
+ this.crossLayer.setStyle((s, o) => {
123
+ if ((s.get("type") ?? "") === "signal-cluster")
124
+ return this.getClusterStyle(s.getProperties());
125
+ const r = this.showName === "crossName" ? s.get("name") : this.showName === "signalId" ? s.get("signalId") : `${s.get("name")}(${s.get("signalId")})`, b = s.get("brand") ?? "gc", u = s.get("isOnline"), T = s.get("isMalfunction"), f = k(b, u, T);
126
+ if (o > E)
127
+ return A(u);
128
+ if (o > Z)
129
+ return B(u);
130
+ if (o > z)
131
+ return D(f);
132
+ const g = S.get(s);
133
+ if (g && g.label === r && g.iconKey === f)
134
+ return g.styles;
135
+ const P = I(f), Y = new a({
136
+ text: new K({
137
+ text: r,
138
+ font: '12px "Microsoft YaHei"',
139
+ textAlign: "center",
140
+ textBaseline: "bottom",
141
+ offsetY: -28,
142
+ fill: R,
143
+ stroke: V
144
+ }),
145
+ zIndex: 2
146
+ }), _ = [P, Y];
147
+ return S.set(s, {
148
+ label: r,
149
+ iconKey: f,
150
+ styles: _
151
+ }), _;
152
+ });
153
+ }
154
+ createCrossFeature(e) {
155
+ return e.brand = e.brand.toLowerCase(), new L({
156
+ geometry: new x([e.x, e.y]),
157
+ type: "signal-cross",
158
+ id: e.crossId,
159
+ brandLabel: this.getBrandLabel(e.brand),
160
+ isOnlineLabel: this.getOnlineLabel(e.isOnline),
161
+ isMalfunctionLabel: this.getMalfunctionLabel(e.isMalfunction),
162
+ ...e
163
+ });
164
+ }
165
+ getClusterStyle(e) {
166
+ const t = e.clusterSymbolSize, i = new v({
167
+ src: "/GisViewerAssets/Images/cross/gis_xhj_blue.png",
168
+ scale: t / 32
169
+ // 近似缩放
170
+ }), l = -(t + 10), c = new K({
171
+ text: String(e.count ?? 0),
172
+ font: "16px Arial Unicode MS",
173
+ fill: new h({ color: [255, 255, 255, 255] }),
174
+ backgroundFill: new h({ color: [2, 72, 200, 1] }),
175
+ backgroundStroke: new m({ color: [2, 72, 200, 0.5], width: 2 }),
176
+ padding: [1, 2, 1, 2],
177
+ offsetY: l,
178
+ textAlign: "center",
179
+ justify: "center",
180
+ textBaseline: "middle"
181
+ });
182
+ return [new a({ image: i }), new a({ text: c })];
183
+ }
184
+ // private formatCrossName(name?: string) {
185
+ // return (name || '').replace(/与/g, '/');
186
+ // }
187
+ getBrandLabel(e) {
188
+ const t = (e ?? "").toLowerCase();
189
+ return t === "scats" ? "SCATS" : t === "gc" ? "国产" : e ?? "";
190
+ }
191
+ getOnlineLabel(e) {
192
+ return e ? "在线" : "离线";
193
+ }
194
+ getMalfunctionLabel(e) {
195
+ return e ? "故障" : "正常";
196
+ }
197
+ showClusterResult(e) {
198
+ this.source.clear(), e.forEach((t) => {
199
+ if (t.id !== -1 && t.center && t.symbolSize) {
200
+ const i = new L({
201
+ geometry: new x([t.center.x, t.center.y]),
202
+ type: "signal-cluster",
203
+ count: t.count,
204
+ clusterSymbolSize: t.symbolSize
205
+ });
206
+ this.source.addFeature(i);
207
+ } else
208
+ t.items.forEach((i) => {
209
+ const l = this.createCrossFeature({
210
+ ...i.properties,
211
+ x: i.x,
212
+ y: i.y
213
+ });
214
+ this.source.addFeature(l);
215
+ });
216
+ }), this.crossLayer.changed();
217
+ }
218
+ }
219
+ export {
220
+ re as default
221
+ };
@@ -0,0 +1,49 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { IResult, IShowSignalSystemParams, IShowSubSignalSystemParams } from 'packages/components/src/types';
3
+ /**
4
+ * 信号系统控制器
5
+ * 用于在 OpenLayers 地图上展示和管理信号子区系统
6
+ * 包括子区道路线(LineString)和路口节点(Point)的渲染
7
+ */
8
+ export default class SignalSystemController {
9
+ /** OpenLayers 地图实例 */
10
+ private map;
11
+ /** 矢量数据源,存储所有信号系统要素 */
12
+ private source;
13
+ /** 信号系统图层 */
14
+ private signalSystemLayer;
15
+ /**
16
+ * 构造函数
17
+ * @param map - OpenLayers 地图实例
18
+ */
19
+ constructor(map: OlMap);
20
+ showSignalSystem(params: IShowSignalSystemParams): Promise<IResult> | {
21
+ status: number;
22
+ message: string;
23
+ };
24
+ removeSignalSystem(areaCode?: string): void;
25
+ private showSystem;
26
+ /**
27
+ * 展示多个信号子区系统
28
+ * 遍历所有子区并渲染,完成后自动缩放地图视角以显示所有子区
29
+ *
30
+ * @param params - 展示参数,包含子区列表
31
+ * @returns 操作结果
32
+ */
33
+ showSubSignalSystem(params: IShowSubSignalSystemParams): Promise<IResult>;
34
+ /**
35
+ * 移除信号子区系统
36
+ * 若不传 subCode,则清除所有子区;否则只清除指定子区
37
+ *
38
+ * @param subCode - 可选,子区编码。不传则清除全部
39
+ */
40
+ removeSubSignalSystem(subCode?: string): void;
41
+ /**
42
+ * 渲染单个信号子区系统
43
+ * 包括子区道路线和路口节点的渲染
44
+ *
45
+ * @param subSystem - 信号子区系统数据
46
+ * @param areaCode - 区域编码,用于关联要素
47
+ */
48
+ private showSubSystem;
49
+ }
@@ -0,0 +1,127 @@
1
+ import n from "ol/Feature";
2
+ import { LineString as u, Point as l } from "ol/geom";
3
+ import h from "ol/layer/Vector";
4
+ import f from "ol/source/Vector";
5
+ import { getLineStyle as c } from "../style/line-style.mjs";
6
+ import { getPointStyle as m } from "../style/point-style.mjs";
7
+ class F {
8
+ /**
9
+ * 构造函数
10
+ * @param map - OpenLayers 地图实例
11
+ */
12
+ constructor(e) {
13
+ this.map = e, this.source = new f(), this.signalSystemLayer = new h({
14
+ source: this.source
15
+ }), this.signalSystemLayer.set("id", "signal-system-layer"), this.map.addLayer(this.signalSystemLayer);
16
+ }
17
+ showSignalSystem(e) {
18
+ e.areaList.forEach((t) => {
19
+ this.showSystem(t);
20
+ });
21
+ const r = this.source.getExtent();
22
+ return r && r[0] !== 1 / 0 ? new Promise((t) => {
23
+ this.map.getView().fit(r, {
24
+ padding: [50, 50, 50, 50],
25
+ callback: () => {
26
+ t({ status: 0, message: "success" });
27
+ }
28
+ });
29
+ }) : { status: 1, message: "No features to display" };
30
+ }
31
+ removeSignalSystem(e) {
32
+ if (!e) {
33
+ this.source.clear();
34
+ return;
35
+ }
36
+ this.source.getFeatures().filter((t) => t.get("areaCode") === e).forEach((t) => {
37
+ this.source.removeFeature(t);
38
+ });
39
+ }
40
+ showSystem(e) {
41
+ if (e.shape) {
42
+ let r;
43
+ typeof e.shape == "string" ? r = JSON.parse(e.shape) : r = e.shape;
44
+ const t = c(e.lineSymbol, e), s = new n({
45
+ geometry: new u(r),
46
+ areaCode: e.areaCode
47
+ });
48
+ s.setStyle(t), this.source.addFeature(s);
49
+ }
50
+ e.children && e.children.forEach((r) => {
51
+ this.showSubSystem(r, e.areaCode);
52
+ });
53
+ }
54
+ /**
55
+ * 展示多个信号子区系统
56
+ * 遍历所有子区并渲染,完成后自动缩放地图视角以显示所有子区
57
+ *
58
+ * @param params - 展示参数,包含子区列表
59
+ * @returns 操作结果
60
+ */
61
+ async showSubSignalSystem(e) {
62
+ e.areaList.forEach((t) => {
63
+ this.showSubSystem(t);
64
+ });
65
+ const r = this.source.getExtent();
66
+ return r && r[0] !== 1 / 0 ? new Promise((t) => {
67
+ this.map.getView().fit(r, {
68
+ padding: [50, 50, 50, 50],
69
+ callback: () => {
70
+ t({ status: 0, message: "success" });
71
+ }
72
+ });
73
+ }) : { status: 1, message: "No features to display" };
74
+ }
75
+ /**
76
+ * 移除信号子区系统
77
+ * 若不传 subCode,则清除所有子区;否则只清除指定子区
78
+ *
79
+ * @param subCode - 可选,子区编码。不传则清除全部
80
+ */
81
+ removeSubSignalSystem(e) {
82
+ if (!e) {
83
+ this.source.clear();
84
+ return;
85
+ }
86
+ this.source.getFeatures().filter((t) => t.get("subCode") === e).forEach((t) => {
87
+ this.source.removeFeature(t);
88
+ });
89
+ }
90
+ /**
91
+ * 渲染单个信号子区系统
92
+ * 包括子区道路线和路口节点的渲染
93
+ *
94
+ * @param subSystem - 信号子区系统数据
95
+ * @param areaCode - 区域编码,用于关联要素
96
+ */
97
+ showSubSystem(e, r) {
98
+ if (e.subShape) {
99
+ let t;
100
+ typeof e.subShape == "string" ? t = JSON.parse(e.subShape) : t = e.subShape;
101
+ const s = c(e.roadSymbol, e), o = t.map((i) => {
102
+ const a = new n({
103
+ geometry: new u(i),
104
+ subCode: e.subAreaCode,
105
+ areaCode: r || ""
106
+ });
107
+ return a.setStyle(s), a;
108
+ });
109
+ this.source.addFeatures(o);
110
+ }
111
+ if (e.children) {
112
+ const t = e.children.map((s) => {
113
+ const o = s.symbol || e.nodeSymbol, i = m(o, s), a = new n({
114
+ ...s,
115
+ subCode: e.subAreaCode,
116
+ areaCode: r || "",
117
+ geometry: new l([s.x, s.y])
118
+ });
119
+ return a.setStyle(i), a;
120
+ });
121
+ this.source.addFeatures(t);
122
+ }
123
+ }
124
+ }
125
+ export {
126
+ F as default
127
+ };
@@ -0,0 +1,64 @@
1
+ import Style from 'ol/style/Style';
2
+ /**
3
+ * 根据 ArcGIS simple-line 的 style 获取 lineDash 配置
4
+ * @param style ArcGIS line style
5
+ * @param width 线宽,用于计算 dash 长度
6
+ */
7
+ export declare function getLineDashByStyle(style: string, width: number): number[] | undefined;
8
+ /**
9
+ * 清除样式缓存
10
+ */
11
+ export declare function clearStyleCache(): void;
12
+ /**
13
+ * 获取当前缓存大小
14
+ */
15
+ export declare function getStyleCacheSize(): number;
16
+ /**
17
+ * 获取线样式
18
+ * 支持 symbol 数组配置(line + text),或单个 symbol 配置
19
+ * 若 symbol 为空则显示蓝色线
20
+ *
21
+ * @example
22
+ * // 简单线样式配置
23
+ * { symbol: { strokeColor: '#ff0000', strokeWidth: 3 } }
24
+ *
25
+ * // 虚线样式配置
26
+ * { symbol: { strokeColor: '#2563eb', strokeWidth: 2, lineDash: [10, 5] } }
27
+ *
28
+ * // 带边框的线样式配置
29
+ * { symbol: { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#000000', borderWidth: 1 } }
30
+ *
31
+ * // 数组配置(线 + 文字)
32
+ * {
33
+ * symbol: [
34
+ * { type: 'line', strokeColor: '#2563eb', strokeWidth: 3 },
35
+ * { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], placement: 'line' }
36
+ * ]
37
+ * }
38
+ *
39
+ * // 数组配置(带边框线 + 文字)
40
+ * {
41
+ * symbol: [
42
+ * { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#333333', borderWidth: 1 },
43
+ * { type: 'text', field: 'roadName', font: '12px Arial', fillColor: [0,0,0], placement: 'line', overflow: true }
44
+ * ]
45
+ * }
46
+ *
47
+ * // ArcGIS simple-line 配置
48
+ * // style 可选值: 'solid', 'dash', 'dot', 'dash-dot', 'long-dash', 'long-dash-dot',
49
+ * // 'long-dash-dot-dot', 'short-dash', 'short-dot', 'short-dash-dot', 'short-dash-dot-dot', 'none'
50
+ * { symbol: { type: 'simple-line', style: 'solid', color: [255, 0, 0, 1], width: 2 } }
51
+ * { symbol: { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3 } }
52
+ * { symbol: { type: 'simple-line', style: 'dot', color: [0, 128, 0, 1], width: 2 } }
53
+ * { symbol: { type: 'simple-line', style: 'dash-dot', color: [255, 128, 0, 1], width: 2 } }
54
+ * { symbol: { type: 'simple-line', style: 'long-dash-dot-dot', color: [128, 0, 128, 1], width: 2 } }
55
+ *
56
+ * // 数组配置(ArcGIS simple-line + 文字)
57
+ * {
58
+ * symbol: [
59
+ * { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3, cap: 'butt', join: 'miter' },
60
+ * { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], placement: 'line' }
61
+ * ]
62
+ * }
63
+ */
64
+ export declare function getLineStyle(symbol: any, attributes?: any): Style | Style[];
@@ -0,0 +1,151 @@
1
+ import S from "ol/style/Fill";
2
+ import f from "ol/style/Stroke";
3
+ import a from "ol/style/Style";
4
+ import g from "ol/style/Text";
5
+ const c = /* @__PURE__ */ new Map();
6
+ let d = null;
7
+ function x(e, n) {
8
+ return e ? Array.isArray(e) ? e.map((i) => {
9
+ if (i.type === "text" && i.field) {
10
+ const r = (n == null ? void 0 : n[i.field]) ?? "";
11
+ return JSON.stringify({ ...i, __textContent__: r });
12
+ }
13
+ return JSON.stringify(i);
14
+ }).join("|") : JSON.stringify(e) : "__default__";
15
+ }
16
+ function u() {
17
+ return d || (d = new a({
18
+ stroke: new f({
19
+ color: "#2563eb",
20
+ width: 2
21
+ })
22
+ })), d;
23
+ }
24
+ function p(e) {
25
+ return new a({
26
+ stroke: new f({
27
+ color: e.color ?? "#2563eb",
28
+ width: e.width ?? 2,
29
+ lineCap: e.lineCap ?? "round",
30
+ lineJoin: e.lineJoin ?? "round",
31
+ lineDash: e.lineDash,
32
+ lineDashOffset: e.lineDashOffset ?? 0
33
+ })
34
+ });
35
+ }
36
+ function s(e) {
37
+ const n = new a({
38
+ stroke: new f({
39
+ color: e.borderColor ?? "#000000",
40
+ width: (e.width ?? 2) + (e.borderWidth ?? 2) * 2,
41
+ lineCap: e.lineCap ?? "round",
42
+ lineJoin: e.lineJoin ?? "round",
43
+ lineDash: e.lineDash,
44
+ lineDashOffset: e.lineDashOffset ?? 0
45
+ })
46
+ }), t = new a({
47
+ stroke: new f({
48
+ color: e.color ?? "#2563eb",
49
+ width: e.width ?? 2,
50
+ lineCap: e.lineCap ?? "round",
51
+ lineJoin: e.lineJoin ?? "round",
52
+ lineDash: e.lineDash,
53
+ lineDashOffset: e.lineDashOffset ?? 0
54
+ })
55
+ });
56
+ return [n, t];
57
+ }
58
+ function D(e, n) {
59
+ const t = n || 2;
60
+ switch (e) {
61
+ case "solid":
62
+ return;
63
+ case "dash":
64
+ return [t * 4, t * 2];
65
+ case "dot":
66
+ return [t, t * 2];
67
+ case "dash-dot":
68
+ return [t * 4, t * 2, t, t * 2];
69
+ case "long-dash":
70
+ return [t * 6, t * 3];
71
+ case "long-dash-dot":
72
+ return [t * 6, t * 2, t, t * 2];
73
+ case "long-dash-dot-dot":
74
+ return [t * 6, t * 2, t, t * 2, t, t * 2];
75
+ case "short-dash":
76
+ return [t * 2, t];
77
+ case "short-dot":
78
+ return [t, t];
79
+ case "short-dash-dot":
80
+ return [t * 2, t, t, t];
81
+ case "short-dash-dot-dot":
82
+ return [t * 2, t, t, t, t, t];
83
+ case "none":
84
+ return [0, 1];
85
+ default:
86
+ return;
87
+ }
88
+ }
89
+ function w(e) {
90
+ const n = e.width ?? 2, t = D(e.style ?? "solid", n);
91
+ return new a({
92
+ stroke: new f({
93
+ color: e.color ?? [0, 0, 0, 1],
94
+ width: n,
95
+ lineCap: e.cap ?? "round",
96
+ lineJoin: e.join ?? "round",
97
+ lineDash: t,
98
+ lineDashOffset: 0
99
+ })
100
+ });
101
+ }
102
+ function C(e, n) {
103
+ const t = new g({
104
+ text: String(n),
105
+ font: e.font ?? "14px Arial Unicode MS",
106
+ fill: new S({
107
+ color: e.fillColor ?? [0, 0, 0]
108
+ }),
109
+ stroke: new f({
110
+ color: e.strokeColor ?? [255, 255, 255],
111
+ width: e.strokeWidth ?? 3
112
+ }),
113
+ offsetX: e.offsetX ?? 0,
114
+ offsetY: e.offsetY ?? 0,
115
+ textAlign: e.textAlign ?? "center",
116
+ textBaseline: e.textBaseline ?? "middle",
117
+ placement: e.placement ?? "point",
118
+ overflow: e.overflow ?? !1,
119
+ maxAngle: e.maxAngle ?? Math.PI / 4
120
+ });
121
+ return new a({ text: t });
122
+ }
123
+ function _(e, n) {
124
+ if (!e)
125
+ return u();
126
+ const t = x(e, n), i = c.get(t);
127
+ if (i)
128
+ return i;
129
+ let r;
130
+ if (Array.isArray(e) && e.length > 0) {
131
+ const l = [];
132
+ if (e.forEach((o) => {
133
+ if (o.type === "line")
134
+ l.push(p(o));
135
+ else if (o.type === "simple-line")
136
+ l.push(w(o));
137
+ else if (o.type === "bordered")
138
+ l.push(...s(o));
139
+ else if (o.type === "text" && o.field) {
140
+ const h = (n == null ? void 0 : n[o.field]) ?? "";
141
+ h && l.push(C(o, h));
142
+ }
143
+ }), l.length > 0)
144
+ return r = l, c.set(t, r), r;
145
+ }
146
+ return e && e.type === "bordered" ? (r = s(e), c.set(t, r), r) : e && e.type === "simple-line" ? (r = w(e), c.set(t, r), r) : e ? (r = p(e), c.set(t, r), r) : u();
147
+ }
148
+ export {
149
+ D as getLineDashByStyle,
150
+ _ as getLineStyle
151
+ };
@@ -0,0 +1,78 @@
1
+ import Style from 'ol/style/Style';
2
+ /**
3
+ * 清除样式缓存
4
+ */
5
+ export declare function clearStyleCache(): void;
6
+ /**
7
+ * 获取当前缓存大小
8
+ */
9
+ export declare function getStyleCacheSize(): number;
10
+ /**
11
+ * 获取单点样式
12
+ * 支持 symbol 数组配置(icon + text + circle + shape),或单个 symbol 配置
13
+ * 若 symbol 为空则显示蓝色圆点
14
+ *
15
+ * @example
16
+ * // 单个图标配置
17
+ * { symbol: { url: '/path/to/icon.png', scale: 1 } }
18
+ *
19
+ * // 圆点样式配置
20
+ * { symbol: { type: 'circle', radius: 8, fillColor: '#ff0000', strokeColor: '#ffffff', strokeWidth: 2 } }
21
+ *
22
+ * // 规则图形样式配置(三角形)
23
+ * { symbol: { type: 'shape', points: 3, radius: 10, fillColor: 'red', strokeColor: 'black', strokeWidth: 1 } }
24
+ *
25
+ * // 规则图形样式配置(正方形,旋转45度)
26
+ * { symbol: { type: 'shape', points: 4, radius: 10, angle: Math.PI / 4, fillColor: 'blue' } }
27
+ *
28
+ * // 规则图形样式配置(五角星)
29
+ * { symbol: { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' } }
30
+ *
31
+ * // 规则图形样式配置(十字形)
32
+ * { symbol: { type: 'shape', points: 4, radius: 10, radius2: 0, strokeColor: 'red', strokeWidth: 2 } }
33
+ *
34
+ * // ArcGIS picture-marker 配置 (转换为 OpenLayers Icon)
35
+ * { symbol: { type: 'picture-marker', url: '/path/to/icon.png', width: 24, height: 24, angle: 0, xoffset: 0, yoffset: 0 } }
36
+ *
37
+ * // ArcGIS simple-marker 配置 (根据 style 返回对应的 OpenLayers 样式)
38
+ * // style 可选值: 'circle', 'square', 'diamond', 'triangle', 'cross', 'x', 'path'
39
+ * { symbol: { type: 'simple-marker', style: 'circle', size: 12, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 1 } } }
40
+ * { symbol: { type: 'simple-marker', style: 'square', size: 12, color: [0, 128, 255, 1], outline: { color: [0, 0, 0, 1], width: 2 } } }
41
+ * { symbol: { type: 'simple-marker', style: 'diamond', size: 14, color: [255, 215, 0, 1], outline: { color: [139, 69, 19, 1], width: 1 } } }
42
+ * { symbol: { type: 'simple-marker', style: 'triangle', size: 12, color: [0, 255, 0, 1], outline: { color: [0, 100, 0, 1], width: 1 } } }
43
+ * { symbol: { type: 'simple-marker', style: 'cross', size: 12, outline: { color: [255, 0, 0, 1], width: 2 } } }
44
+ * { symbol: { type: 'simple-marker', style: 'x', size: 12, outline: { color: [0, 0, 255, 1], width: 2 } } }
45
+ *
46
+ * // 数组配置(图标 + 文字)
47
+ * {
48
+ * symbol: [
49
+ * { type: 'icon', url: '/path/to/icon.png', scale: 1 },
50
+ * { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], offsetY: 20 }
51
+ * ]
52
+ * }
53
+ *
54
+ * // 数组配置(圆点 + 文字)
55
+ * {
56
+ * symbol: [
57
+ * { type: 'circle', radius: 10, fillColor: 'rgba(255,0,0,0.8)', strokeColor: '#fff', strokeWidth: 2 },
58
+ * { type: 'text', field: 'label', font: '12px Arial', fillColor: [255,255,255], offsetY: 0 }
59
+ * ]
60
+ * }
61
+ *
62
+ * // 数组配置(五角星 + 文字)
63
+ * {
64
+ * symbol: [
65
+ * { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' },
66
+ * { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 18 }
67
+ * ]
68
+ * }
69
+ *
70
+ * // 数组配置(ArcGIS simple-marker + 文字)
71
+ * {
72
+ * symbol: [
73
+ * { type: 'simple-marker', style: 'diamond', size: 16, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 2 } },
74
+ * { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 20 }
75
+ * ]
76
+ * }
77
+ */
78
+ export declare function getPointStyle(symbol: any, attributes?: any): Style | Style[];