gisviewer-vue3-arcgis 1.0.285 → 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 (67) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +2 -2
  2. package/es/src/gis-map/index.d.ts +2 -2
  3. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +6 -2
  4. package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +5 -3
  5. package/es/src/gis-map/utils/overlay.d.ts +2 -2
  6. package/es/src/gis-map/utils/overlay.mjs +2 -2
  7. package/es/src/gis-map/utils/police-jurisdiction.mjs +1 -1
  8. package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +2 -2
  9. package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
  10. package/es/src/gis-map-ol/gis-map-ol.vue.mjs +69 -43
  11. package/es/src/gis-map-ol/index.d.ts +25 -0
  12. package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
  13. package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
  14. package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
  15. package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
  16. package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +95 -41
  17. package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
  18. package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
  19. package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
  20. package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
  21. package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
  22. package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
  23. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
  24. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +124 -166
  25. package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
  26. package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
  27. package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
  28. package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
  29. package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
  30. package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
  31. package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
  32. package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
  33. package/es/src/types/index.d.ts +2 -1
  34. package/lib/src/gis-map/gis-map.vue.d.ts +2 -2
  35. package/lib/src/gis-map/index.d.ts +2 -2
  36. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
  37. package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
  38. package/lib/src/gis-map/utils/overlay.d.ts +2 -2
  39. package/lib/src/gis-map/utils/overlay.js +1 -1
  40. package/lib/src/gis-map/utils/police-jurisdiction.js +1 -1
  41. package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -1
  42. package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
  43. package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -1
  44. package/lib/src/gis-map-ol/index.d.ts +25 -0
  45. package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
  46. package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
  47. package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
  48. package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
  49. package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -1
  50. package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
  51. package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
  52. package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
  53. package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
  54. package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
  55. package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
  56. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
  57. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -1
  58. package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
  59. package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
  60. package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
  61. package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
  62. package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
  63. package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
  64. package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
  65. package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
  66. package/lib/src/types/index.d.ts +2 -1
  67. package/package.json +1 -1
@@ -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
+ };
@@ -5,16 +5,12 @@ export default class SignalCrossController {
5
5
  private crossLayer;
6
6
  private source;
7
7
  private view;
8
+ private clusterCalculator;
8
9
  private showName;
9
10
  private showStyle;
10
11
  private viewChangeKey;
11
12
  private mapMoveKey;
12
13
  private resolutionChangeTimeout;
13
- private readonly clusterRadius;
14
- private readonly minClusterPoints;
15
- private readonly maxClusterSymbolSize;
16
- private readonly minClusterSymbolSize;
17
- private clusteredLocations;
18
14
  private locations;
19
15
  constructor(map: OlMap);
20
16
  showSignalCross(params: IShowSignalCrossParams): IResult;
@@ -33,10 +29,5 @@ export default class SignalCrossController {
33
29
  private getBrandLabel;
34
30
  private getOnlineLabel;
35
31
  private getMalfunctionLabel;
36
- private locationToScreen;
37
- private doPixelCluster;
38
- private getNeighbors;
39
- private getDistance;
40
- private createClusters;
41
32
  private showClusterResult;
42
33
  }