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,116 @@
1
+ import Feature from 'ol/Feature';
2
+ import { Geometry } from 'ol/geom';
3
+ import VectorLayer from 'ol/layer/Vector';
4
+ import { default as OlMap } from 'ol/Map';
5
+ import VectorSource from 'ol/source/Vector';
6
+ import { ILineSymbol, IOverlayParam, IPointSymbol, IPolygonSymbol, IResult } from '../../../types';
7
+ interface IOverlayOptions {
8
+ id?: string;
9
+ }
10
+ export default class OverlayController {
11
+ private map;
12
+ overlayLayer: VectorLayer<VectorSource<Feature<Geometry>>>;
13
+ private vectorSource;
14
+ constructor(map: OlMap, options?: IOverlayOptions);
15
+ private defaultPointSymbol;
16
+ /**
17
+ * 添加覆盖物
18
+ * @param params
19
+ */
20
+ addOverlays(params: IOverlayParam): IResult;
21
+ /**
22
+ * 添加或更新单个覆盖物
23
+ * @param overlay 覆盖物对象
24
+ * @param symbol 符号
25
+ * @param properties 属性
26
+ * @param visible 是否可见
27
+ */
28
+ private addOverlay;
29
+ /**
30
+ * 创建几何对象
31
+ * @param geometryConfig 几何配置
32
+ */
33
+ private createGeometry;
34
+ /**
35
+ * 获取样式
36
+ * @param geometryType 几何类型
37
+ * @param symbol 符号配置
38
+ * @param attributes 属性
39
+ */
40
+ private getStyle;
41
+ /**
42
+ * 按type移除覆盖物
43
+ * @param types
44
+ */
45
+ removeOverlaysByType(types: string[] | string): IResult;
46
+ /**
47
+ * 按id移除覆盖物
48
+ * @param ids
49
+ */
50
+ removeOverlaysById(ids: string[] | string): IResult;
51
+ /**
52
+ * 按id显示或隐藏覆盖物
53
+ * @param ids
54
+ * @param isShow
55
+ */
56
+ isShowOverlaysByIds(ids: string[], isShow: boolean): void;
57
+ /**
58
+ * 显示全部覆盖物
59
+ */
60
+ showAllOverlays(): void;
61
+ /**
62
+ * 删除全部覆盖物
63
+ * @returns
64
+ */
65
+ removeAllOverlays(): IResult;
66
+ /**
67
+ * 更新覆盖物符号
68
+ * @param ids 覆盖物id数组
69
+ * @param symbol 新的符号配置
70
+ */
71
+ updateOverlaysSymbol(ids: string[], symbol: IPointSymbol | ILineSymbol | IPolygonSymbol): IResult;
72
+ /**
73
+ * 按type更新覆盖物符号
74
+ * @param types 类型数组
75
+ * @param symbol 新的符号配置
76
+ */
77
+ updateOverlaysSymbolByType(types: string[], symbol: IPointSymbol | ILineSymbol | IPolygonSymbol): IResult;
78
+ /**
79
+ * 获取几何类型字符串
80
+ * @param geometry
81
+ */
82
+ private getGeometryType;
83
+ /**
84
+ * 按id获取覆盖物Feature
85
+ * @param id
86
+ */
87
+ getOverlayById(id: string): Feature<Geometry> | undefined;
88
+ /**
89
+ * 按type获取覆盖物Feature数组
90
+ * @param type
91
+ */
92
+ getOverlaysByType(type: string): Feature<Geometry>[];
93
+ /**
94
+ * 隐藏图层
95
+ */
96
+ hideLayer(): void;
97
+ /**
98
+ * 显示图层
99
+ */
100
+ showLayer(): void;
101
+ /**
102
+ * 删除指定的Feature
103
+ * @param features
104
+ */
105
+ removeFeatures(features: Feature<Geometry> | Feature<Geometry>[]): void;
106
+ /**
107
+ * 查找屏幕坐标处的覆盖物
108
+ * @param pixel 屏幕像素坐标 [x, y]
109
+ */
110
+ findFeaturesAtPixel(pixel: number[]): Feature<Geometry>[];
111
+ /**
112
+ * 销毁
113
+ */
114
+ destroy(): void;
115
+ }
116
+ export {};
@@ -0,0 +1,276 @@
1
+ import u from "ol/Feature";
2
+ import { Polygon as h, LineString as y, MultiLineString as d, Point as p } from "ol/geom";
3
+ import v from "ol/layer/Vector";
4
+ import g from "ol/source/Vector";
5
+ import c from "ol/style/Style";
6
+ import { getLineStyle as S } from "../style/line-style.mjs";
7
+ import { getPointStyle as f } from "../style/point-style.mjs";
8
+ import { getPolygonStyle as m } from "../style/polygon-style.mjs";
9
+ class G {
10
+ constructor(e, s) {
11
+ this.defaultPointSymbol = {
12
+ type: "simple-marker",
13
+ style: "circle",
14
+ color: "yellow",
15
+ size: 10
16
+ }, this.map = e, this.vectorSource = new g(), this.overlayLayer = new v({
17
+ source: this.vectorSource,
18
+ properties: {
19
+ id: (s == null ? void 0 : s.id) ?? "overlay-layer"
20
+ }
21
+ }), this.map.addLayer(this.overlayLayer);
22
+ }
23
+ /**
24
+ * 添加覆盖物
25
+ * @param params
26
+ */
27
+ addOverlays(e) {
28
+ let s = 0, r = 0;
29
+ e.defaultVisible = e.defaultVisible ?? !0;
30
+ for (const t of e.overlays) {
31
+ t.properties ? (t.properties.type || (t.properties.type = e.type), t.properties.id || (t.properties.id = t.id)) : t.properties = { type: e.type, id: t.id };
32
+ const i = t.symbol || e.defaultSymbol || this.defaultPointSymbol, o = t.visible == null ? e.defaultVisible : t.visible;
33
+ this.addOverlay(
34
+ t,
35
+ i,
36
+ t.properties,
37
+ o
38
+ ).message === "add" ? s++ : r++;
39
+ }
40
+ return e.needZoom === !0 && this.map.getView().fit(this.vectorSource.getExtent(), {
41
+ padding: [50, 50, 50, 50]
42
+ }), { status: 0, message: `新增${s}, 更新${r}` };
43
+ }
44
+ /**
45
+ * 添加或更新单个覆盖物
46
+ * @param overlay 覆盖物对象
47
+ * @param symbol 符号
48
+ * @param properties 属性
49
+ * @param visible 是否可见
50
+ */
51
+ addOverlay(e, s, r, t) {
52
+ let i, o = !0;
53
+ e.id && (i = this.vectorSource.getFeatures().find((l) => l.get("id") === e.id));
54
+ const n = this.createGeometry(e.geometry);
55
+ if (!n)
56
+ return { status: -1, message: "不支持的几何类型" };
57
+ i ? (i.setGeometry(n), o = !1) : (i = new u({
58
+ geometry: n
59
+ }), this.vectorSource.addFeature(i), o = !0);
60
+ const a = this.getStyle(e.geometry.type, s, r);
61
+ return a && i.setStyle(a), i.setProperties(r), t || i.setStyle(new c({})), i.set("_visible", t), i.set("_originalStyle", a), { status: 0, message: o ? "add" : "update" };
62
+ }
63
+ /**
64
+ * 创建几何对象
65
+ * @param geometryConfig 几何配置
66
+ */
67
+ createGeometry(e) {
68
+ var r;
69
+ switch ((r = e.type) == null ? void 0 : r.toLowerCase()) {
70
+ case "point":
71
+ return new p([e.x, e.y]);
72
+ case "line":
73
+ case "polyline":
74
+ if (e.paths && e.paths.length > 0) {
75
+ const t = e.paths[0];
76
+ return Array.isArray(t) && Array.isArray(t[0]) ? e.paths.length === 1 ? new y(e.paths[0]) : new d(e.paths) : new y(e.paths);
77
+ }
78
+ return null;
79
+ case "polygon":
80
+ return e.rings && e.rings.length > 0 ? new h(e.rings) : null;
81
+ default:
82
+ return null;
83
+ }
84
+ }
85
+ /**
86
+ * 获取样式
87
+ * @param geometryType 几何类型
88
+ * @param symbol 符号配置
89
+ * @param attributes 属性
90
+ */
91
+ getStyle(e, s, r) {
92
+ switch (e == null ? void 0 : e.toLowerCase()) {
93
+ case "point":
94
+ return f(s, r);
95
+ case "line":
96
+ case "polyline":
97
+ return S(s, r);
98
+ case "polygon":
99
+ return m(s, r);
100
+ default:
101
+ return null;
102
+ }
103
+ }
104
+ /**
105
+ * 按type移除覆盖物
106
+ * @param types
107
+ */
108
+ removeOverlaysByType(e) {
109
+ const r = this.vectorSource.getFeatures().filter((t) => {
110
+ const i = t.get("type");
111
+ return Array.isArray(e) ? e.includes(i) : i === e;
112
+ });
113
+ return r.forEach((t) => {
114
+ this.vectorSource.removeFeature(t);
115
+ }), { status: 0, message: `删除${r.length}` };
116
+ }
117
+ /**
118
+ * 按id移除覆盖物
119
+ * @param ids
120
+ */
121
+ removeOverlaysById(e) {
122
+ const r = this.vectorSource.getFeatures().filter((t) => {
123
+ const i = t.get("id");
124
+ return Array.isArray(e) ? e.includes(i) : i === e;
125
+ });
126
+ return r.forEach((t) => {
127
+ this.vectorSource.removeFeature(t);
128
+ }), { status: 0, message: `删除${r.length}` };
129
+ }
130
+ /**
131
+ * 按id显示或隐藏覆盖物
132
+ * @param ids
133
+ * @param isShow
134
+ */
135
+ isShowOverlaysByIds(e, s) {
136
+ this.vectorSource.getFeatures().forEach((r) => {
137
+ const t = r.get("id");
138
+ if (e.includes(t)) {
139
+ if (s) {
140
+ const i = r.get("_originalStyle");
141
+ i && r.setStyle(i);
142
+ } else
143
+ r.setStyle(new c({}));
144
+ r.set("_visible", s);
145
+ } else {
146
+ if (s)
147
+ r.setStyle(new c({}));
148
+ else {
149
+ const i = r.get("_originalStyle");
150
+ i && r.setStyle(i);
151
+ }
152
+ r.set("_visible", !s);
153
+ }
154
+ });
155
+ }
156
+ /**
157
+ * 显示全部覆盖物
158
+ */
159
+ showAllOverlays() {
160
+ this.vectorSource.getFeatures().forEach((e) => {
161
+ const s = e.get("_originalStyle");
162
+ s && e.setStyle(s), e.set("_visible", !0);
163
+ });
164
+ }
165
+ /**
166
+ * 删除全部覆盖物
167
+ * @returns
168
+ */
169
+ removeAllOverlays() {
170
+ const e = this.vectorSource.getFeatures().length;
171
+ return this.vectorSource.clear(), { status: 0, message: `删除${e}` };
172
+ }
173
+ /**
174
+ * 更新覆盖物符号
175
+ * @param ids 覆盖物id数组
176
+ * @param symbol 新的符号配置
177
+ */
178
+ updateOverlaysSymbol(e, s) {
179
+ let r = 0;
180
+ return this.vectorSource.getFeatures().forEach((t) => {
181
+ const i = t.get("id");
182
+ if (e.includes(i)) {
183
+ const o = t.getGeometry();
184
+ if (o) {
185
+ const n = this.getGeometryType(o), a = t.getProperties(), l = this.getStyle(n, s, a);
186
+ l && (t.setStyle(l), t.set("_originalStyle", l), r++);
187
+ }
188
+ }
189
+ }), { status: 0, message: `更新${r}个覆盖物符号` };
190
+ }
191
+ /**
192
+ * 按type更新覆盖物符号
193
+ * @param types 类型数组
194
+ * @param symbol 新的符号配置
195
+ */
196
+ updateOverlaysSymbolByType(e, s) {
197
+ let r = 0;
198
+ return this.vectorSource.getFeatures().forEach((t) => {
199
+ const i = t.get("type");
200
+ if (e.includes(i)) {
201
+ const o = t.getGeometry();
202
+ if (o) {
203
+ const n = this.getGeometryType(o), a = t.getProperties(), l = this.getStyle(n, s, a);
204
+ l && (t.setStyle(l), t.set("_originalStyle", l), r++);
205
+ }
206
+ }
207
+ }), { status: 0, message: `更新${r}个覆盖物符号` };
208
+ }
209
+ /**
210
+ * 获取几何类型字符串
211
+ * @param geometry
212
+ */
213
+ getGeometryType(e) {
214
+ return e instanceof p ? "point" : e instanceof y ? "polyline" : e instanceof h ? "polygon" : "";
215
+ }
216
+ /**
217
+ * 按id获取覆盖物Feature
218
+ * @param id
219
+ */
220
+ getOverlayById(e) {
221
+ return this.vectorSource.getFeatures().find((s) => s.get("id") === e);
222
+ }
223
+ /**
224
+ * 按type获取覆盖物Feature数组
225
+ * @param type
226
+ */
227
+ getOverlaysByType(e) {
228
+ return this.vectorSource.getFeatures().filter((s) => s.get("type") === e);
229
+ }
230
+ /**
231
+ * 隐藏图层
232
+ */
233
+ hideLayer() {
234
+ this.overlayLayer.setVisible(!1);
235
+ }
236
+ /**
237
+ * 显示图层
238
+ */
239
+ showLayer() {
240
+ this.overlayLayer.setVisible(!0);
241
+ }
242
+ /**
243
+ * 删除指定的Feature
244
+ * @param features
245
+ */
246
+ removeFeatures(e) {
247
+ Array.isArray(e) || (e = [e]), e.forEach((s) => {
248
+ this.vectorSource.removeFeature(s);
249
+ });
250
+ }
251
+ /**
252
+ * 查找屏幕坐标处的覆盖物
253
+ * @param pixel 屏幕像素坐标 [x, y]
254
+ */
255
+ findFeaturesAtPixel(e) {
256
+ const s = [];
257
+ return this.map.forEachFeatureAtPixel(
258
+ e,
259
+ (r, t) => {
260
+ t === this.overlayLayer && r instanceof u && s.push(r);
261
+ },
262
+ {
263
+ layerFilter: (r) => r === this.overlayLayer
264
+ }
265
+ ), s;
266
+ }
267
+ /**
268
+ * 销毁
269
+ */
270
+ destroy() {
271
+ this.vectorSource.clear(), this.map.removeLayer(this.overlayLayer), this.overlayLayer.dispose();
272
+ }
273
+ }
274
+ export {
275
+ G as default
276
+ };
@@ -0,0 +1,16 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { IShowJurisdictionParams } from '../../types';
3
+ export default class PoliceAreaController {
4
+ private map;
5
+ private source;
6
+ private policeAreaLayer;
7
+ private zdBoundaryLayer;
8
+ private initialized;
9
+ private ddMap;
10
+ private zdMap;
11
+ constructor(map: OlMap);
12
+ initialize(): Promise<void>;
13
+ private isMultiPolygon;
14
+ showJurisdiction(params: IShowJurisdictionParams): Promise<void>;
15
+ clearJurisdiction(): void;
16
+ }
@@ -0,0 +1,155 @@
1
+ import h from "ol/Feature";
2
+ import { Polygon as y, Point as D } from "ol/geom";
3
+ import m from "ol/layer/Vector";
4
+ import z from "ol/source/Vector";
5
+ import { Style as g, Stroke as w, Text as L, Fill as E } from "ol/style";
6
+ import { getLineStyle as P } from "./style/line-style.mjs";
7
+ class V {
8
+ constructor(s) {
9
+ this.initialized = !1, this.ddMap = /* @__PURE__ */ new Map(), this.zdMap = /* @__PURE__ */ new Map(), this.map = s, this.source = new z(), this.policeAreaLayer = new m({
10
+ source: this.source
11
+ }), this.policeAreaLayer.set("id", "police-area-layer"), this.map.addLayer(this.policeAreaLayer), this.zdBoundaryLayer = new m({
12
+ source: new z()
13
+ }), this.zdBoundaryLayer.set("id", "zd-boundary-layer"), this.map.addLayer(this.zdBoundaryLayer);
14
+ }
15
+ async initialize() {
16
+ (await (await fetch("/GisViewerAssets/ShangHai/Layers/dd.json")).json()).features.forEach((t) => {
17
+ this.ddMap.set(t.properties.DD_CODE, {
18
+ name: t.properties.DD_NAME,
19
+ coordinates: t.geometry.coordinates,
20
+ zdCode: t.properties.ZD_CODE
21
+ });
22
+ }), (await (await fetch("/GisViewerAssets/ShangHai/Layers/zd.json")).json()).features.forEach((t) => {
23
+ this.zdMap.set(t.properties.ZD_CODE, {
24
+ name: t.properties.ZD_NAME,
25
+ coordinates: t.geometry.coordinates
26
+ });
27
+ }), this.zdMap.forEach((t, c) => {
28
+ var a;
29
+ const e = [];
30
+ this.isMultiPolygon(t.coordinates) ? t.coordinates.forEach((n) => {
31
+ n.forEach((l) => e.push(l));
32
+ }) : t.coordinates.forEach((n) => {
33
+ e.push(n);
34
+ });
35
+ const o = new y(e), r = new h({
36
+ geometry: o,
37
+ type: "zd-boundary",
38
+ id: c,
39
+ name: t.name
40
+ });
41
+ r.setStyle(
42
+ new g({
43
+ stroke: new w({
44
+ color: "rgba(30, 144, 255, 0.8)",
45
+ width: 2,
46
+ lineDash: [10, 20]
47
+ })
48
+ })
49
+ ), (a = this.zdBoundaryLayer.getSource()) == null || a.addFeature(r);
50
+ });
51
+ }
52
+ // 判断 coordinates 是 Polygon(三维)还是 MultiPolygon(四维)
53
+ isMultiPolygon(s) {
54
+ return Array.isArray(s) && Array.isArray(s[0]) && Array.isArray(s[0][0]) && Array.isArray(s[0][0][0]);
55
+ }
56
+ async showJurisdiction(s) {
57
+ this.initialized || (await this.initialize(), this.initialized = !0), this.source.clear();
58
+ const d = [
59
+ [
60
+ [-180, -90],
61
+ [-180, 90],
62
+ [180, 90],
63
+ [180, -90],
64
+ [-180, -90]
65
+ ]
66
+ ], i = [], p = (e) => {
67
+ this.isMultiPolygon(e) ? e.forEach((o) => {
68
+ o.forEach((r) => {
69
+ i.push(r);
70
+ });
71
+ }) : e.forEach((o) => {
72
+ i.push(o);
73
+ });
74
+ };
75
+ if (s.type === "zd") {
76
+ const e = this.zdMap.get(s.id);
77
+ e && p(e.coordinates), this.ddMap.forEach((o, r) => {
78
+ if (o.zdCode === s.id) {
79
+ const a = [];
80
+ this.isMultiPolygon(o.coordinates) ? o.coordinates.forEach((u) => {
81
+ u.forEach((M) => a.push(M));
82
+ }) : o.coordinates.forEach((u) => {
83
+ a.push(u);
84
+ });
85
+ const n = new y(a), l = new h({
86
+ geometry: n,
87
+ type: "dd-boundary",
88
+ id: r,
89
+ name: o.name
90
+ });
91
+ l.setStyle(
92
+ P({
93
+ type: "simple-line",
94
+ style: "dash",
95
+ width: 2,
96
+ color: [30, 144, 255, 0.8]
97
+ })
98
+ ), this.source.addFeature(l);
99
+ const A = n.getInteriorPoint().getCoordinates(), f = new h({
100
+ geometry: new D(A),
101
+ type: "dd-label",
102
+ id: r,
103
+ name: o.name
104
+ });
105
+ f.setStyle(
106
+ new g({
107
+ text: new L({
108
+ text: o.name,
109
+ font: "bold 14px sans-serif",
110
+ fill: new E({
111
+ color: "rgba(30, 144, 255, 1)"
112
+ }),
113
+ stroke: new w({
114
+ color: "#fff",
115
+ width: 3
116
+ })
117
+ })
118
+ })
119
+ ), this.source.addFeature(f);
120
+ }
121
+ });
122
+ } else if (s.type === "dd") {
123
+ const e = this.ddMap.get(s.id);
124
+ e && p(e.coordinates);
125
+ }
126
+ console.log("holesToCut:", i), i.forEach((e) => {
127
+ d.push(e);
128
+ });
129
+ const t = new y(d), c = new h({
130
+ geometry: t
131
+ });
132
+ if (console.log("maskCoords:", d), c.setStyle(
133
+ new g({
134
+ fill: new E({
135
+ color: "rgba(128, 128, 128, 0.6)"
136
+ }),
137
+ stroke: new w({
138
+ color: "rgba(30, 144, 255, 1)",
139
+ width: 2
140
+ })
141
+ })
142
+ ), this.source.addFeature(c), i.length > 0) {
143
+ const o = new y(i).getExtent();
144
+ this.map.getView().fit(o, {
145
+ padding: [50, 50, 50, 50]
146
+ });
147
+ }
148
+ }
149
+ clearJurisdiction() {
150
+ this.source.clear();
151
+ }
152
+ }
153
+ export {
154
+ V as default
155
+ };
@@ -0,0 +1,33 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { IResult, IShowSignalCrossParams } from '../../../types';
3
+ export default class SignalCrossController {
4
+ private map;
5
+ private crossLayer;
6
+ private source;
7
+ private view;
8
+ private clusterCalculator;
9
+ private showName;
10
+ private showStyle;
11
+ private viewChangeKey;
12
+ private mapMoveKey;
13
+ private resolutionChangeTimeout;
14
+ private locations;
15
+ constructor(map: OlMap);
16
+ showSignalCross(params: IShowSignalCrossParams): IResult;
17
+ private calculateCluster;
18
+ clearSignalCross(): void;
19
+ changeShowName(showName: string): void;
20
+ private updateScatterSymbol;
21
+ /**
22
+ * 配置矢量图层样式:复用 Icon,并为不同 feature 渲染不同 Text。
23
+ * - 使用 resolution 判断是否显示文字(在指定缩放级别后才显示)
24
+ * - 使用缓存避免每次渲染都创建新的 Style/Icon/数组对象
25
+ */
26
+ private configureVectorLayerStyle;
27
+ private createCrossFeature;
28
+ private getClusterStyle;
29
+ private getBrandLabel;
30
+ private getOnlineLabel;
31
+ private getMalfunctionLabel;
32
+ private showClusterResult;
33
+ }