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
@@ -1,37 +1,53 @@
1
- import n from "ol/layer/Tile";
2
- import c from "ol/Map";
1
+ import p from "ol/layer/Image";
2
+ import c from "ol/layer/Tile";
3
+ import h from "ol/Map";
3
4
  import "ol/ol.css";
4
- import { Projection as h } from "ol/proj";
5
- import { WMTS as p, TileWMS as u } from "ol/source";
6
- import { TileGrid as l } from "ol/tilegrid";
7
- import f from "ol/tilegrid/WMTS";
8
- import d from "ol/View";
9
- class b {
5
+ import { Projection as l } from "ol/proj";
6
+ import { ImageWMS as w, WMTS as f, TileWMS as g, XYZ as d } from "ol/source";
7
+ import { TileGrid as z } from "ol/tilegrid";
8
+ import S from "ol/tilegrid/WMTS";
9
+ import M from "ol/View";
10
+ class I {
10
11
  constructor() {
11
- this.mapConfig = {};
12
+ this.mapConfig = {}, this.pointerMoveRaf = null;
12
13
  }
13
14
  initialize(e) {
14
15
  return this.mapConfig = e.mapConfig || {}, this.markerClick = e.markerClickCallback, this.map = this.createMap(e.container), this.mapConfig.baseLayers && this.loadLayers(this.mapConfig.baseLayers), this.map;
15
16
  }
16
17
  processUrl(e) {
17
- return e && (e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("{{") ? e.replace("{{geoServer}}", this.mapConfig.geoServer) : this.mapConfig.assetsRoot + e);
18
+ return e && (e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("{{") ? e.replace("{{geoServer}}", this.mapConfig.geoServer) : e);
18
19
  }
19
20
  loadLayers(e) {
20
21
  if (!this.map)
21
22
  return;
22
- const i = 1 / 0, r = 16384;
23
+ const i = 1 / 0, s = 16384;
23
24
  e.forEach((t) => {
24
25
  var o, a;
25
26
  (o = t.source) != null && o.url && (t.source.url = this.processUrl(t.source.url));
26
- let s;
27
- switch (t.type) {
27
+ let r;
28
+ switch (t.type.toLowerCase()) {
29
+ case "webtile": {
30
+ console.log(t), r = new c({
31
+ preload: i,
32
+ cacheSize: s,
33
+ source: new d({
34
+ url: t.source.url,
35
+ projection: t.source.projection || "EPSG:4326",
36
+ tileSize: t.source.tileSize || 256
37
+ // minZoom: layerConfig.source.minZoom,
38
+ // maxZoom: layerConfig.source.maxZoom,
39
+ // crossOrigin: layerConfig.source.crossOrigin || 'anonymous'
40
+ })
41
+ });
42
+ break;
43
+ }
28
44
  case "gwc-wms": {
29
- s = new n({
45
+ r = new c({
30
46
  preload: i,
31
- cacheSize: r,
32
- source: new u({
47
+ cacheSize: s,
48
+ source: new g({
33
49
  ...t.source,
34
- tileGrid: new l({
50
+ tileGrid: new z({
35
51
  ...t.source.tileGrid
36
52
  })
37
53
  }),
@@ -40,47 +56,85 @@ class b {
40
56
  break;
41
57
  }
42
58
  case "wmts": {
43
- s = new n({
59
+ const n = t.source.matrixSet || "", m = Array.from(
60
+ { length: 22 },
61
+ (V, u) => `${n}:${u}`
62
+ );
63
+ r = new c({
44
64
  preload: i,
45
- cacheSize: r,
46
- source: new p({
65
+ cacheSize: s,
66
+ source: new f({
47
67
  ...t.source,
48
- tileGrid: new f({
49
- ...t.source.tileGrid
50
- }),
51
- projection: new h({
68
+ format: "image/png",
69
+ projection: new l({
52
70
  code: t.source.projection || "EPSG:4326"
71
+ }),
72
+ tileGrid: new S({
73
+ resolutions: [
74
+ 1.4078260157100582,
75
+ 0.703913007855028,
76
+ 0.35195650392751515,
77
+ 0.17597825196375638,
78
+ 0.08798912598187819,
79
+ 0.043994562990939096,
80
+ 0.021997281495469548,
81
+ 0.010998640747734774,
82
+ 0.005499320373868577,
83
+ 0.0027496601869330985,
84
+ 0.001374830093467739,
85
+ 6874150467326798e-19,
86
+ 3437075233663399e-19,
87
+ 17185376168316996e-20,
88
+ 8592688084158498e-20,
89
+ 4296344042198222e-20,
90
+ 2148172021099111e-20,
91
+ 10740860104305824e-21,
92
+ 53704300533426425e-22,
93
+ 2685215025481591e-21,
94
+ 13426075127407955e-22,
95
+ 6713037563703978e-22
96
+ ],
97
+ matrixIds: m,
98
+ tileSize: 256,
99
+ origin: [-400, 400]
53
100
  })
54
101
  }),
55
102
  ...t.options
56
103
  });
57
104
  break;
58
105
  }
106
+ case "image-wms": {
107
+ r = new p({
108
+ source: new w({ ...t.source }),
109
+ ...t.options
110
+ });
111
+ break;
112
+ }
59
113
  }
60
- s && (s.set("id", t.id), (a = this.map) == null || a.addLayer(s));
114
+ r && (r.set("id", t.id), r.set("group", t.group), (a = this.map) == null || a.addLayer(r));
61
115
  });
62
116
  }
63
117
  createMap(e) {
64
118
  const i = this.mapConfig.view;
65
- this.mapView = new d({ ...i }), this.mapConfig.camera ? this.mapConfig.camera.home = i : this.mapConfig.camera = {
119
+ this.mapView = new M({ ...i }), this.mapConfig.camera ? this.mapConfig.camera.home = i : this.mapConfig.camera = {
66
120
  home: i
67
121
  };
68
- const r = new c({
122
+ const s = new h({
69
123
  target: e,
70
124
  view: this.mapView
71
125
  });
72
- return r.on("pointermove", (t) => {
73
- if (t.dragging)
74
- return;
75
- const s = r.hasFeatureAtPixel(t.pixel), o = r.getTargetElement();
76
- o && (o.style.cursor = s ? "pointer" : "");
77
- }), r.on("click", (t) => {
78
- const s = r.forEachFeatureAtPixel(t.pixel, (o) => o);
79
- if (s && this.markerClick) {
80
- const o = s.get("type") ?? "", a = s.get("id") ?? "", m = s.getProperties();
81
- this.markerClick(o, a, m, t);
126
+ return s.on("pointermove", (t) => {
127
+ t.dragging || this.pointerMoveRaf === null && (this.pointerMoveRaf = requestAnimationFrame(() => {
128
+ const r = s.hasFeatureAtPixel(t.pixel), o = s.getTargetElement();
129
+ o && (o.style.cursor = r ? "pointer" : ""), this.pointerMoveRaf = null;
130
+ }));
131
+ }), s.on("click", (t) => {
132
+ const r = s.forEachFeatureAtPixel(t.pixel, (o) => o);
133
+ if (r && this.markerClick) {
134
+ const o = r.get("type") ?? "", a = r.get("id") ?? "", n = r.getProperties();
135
+ this.markerClick(o, a, n, t);
82
136
  }
83
- }), r;
137
+ }), s;
84
138
  }
85
139
  /**
86
140
  * 设置地图中心点和缩放级别
@@ -120,10 +174,10 @@ class b {
120
174
  }) : { status: -1, message: `未找到名称为 ${e.name} 的相机视图` };
121
175
  }
122
176
  async setLayerVisibility(e) {
123
- const i = this.map.getLayers().getArray().find((r) => r.get("id") === e.id);
124
- return i ? (i.setVisible(e.visible), { status: 0, message: "成功" }) : { status: -1, message: `未找到ID为 ${e.id} 的图层` };
177
+ const i = this.map.getLayers().getArray().filter((s) => s.get("id") === e.id || s.get("group") === e.id);
178
+ return i.length > 0 ? (i.forEach((s) => s.setVisible(e.visible)), { status: 0, message: "成功" }) : { status: -1, message: `未找到ID为 ${e.id} 的图层` };
125
179
  }
126
180
  }
127
181
  export {
128
- b as default
182
+ I as default
129
183
  };
@@ -0,0 +1,23 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { IClusterPointParams } from '../../../types';
3
+ export default class ClusterPointController {
4
+ private map;
5
+ private clusterLayer;
6
+ private source;
7
+ private view;
8
+ private clusterCalculator;
9
+ private countBackgroundColor;
10
+ private countFontColor;
11
+ private locations;
12
+ private clusterMarkUrl;
13
+ private viewChangeKey;
14
+ private mapMoveKey;
15
+ private resolutionChangeTimeout;
16
+ constructor(map: OlMap);
17
+ addClusterPoints(params: IClusterPointParams): void;
18
+ removeAllClusterPoints(): void;
19
+ private configureVectorLayerStyle;
20
+ private getClusterStyle;
21
+ private showClusterResult;
22
+ private calculateCluster;
23
+ }
@@ -0,0 +1,102 @@
1
+ import r from "ol/Feature";
2
+ import i from "ol/geom/Point";
3
+ import a from "ol/layer/Vector";
4
+ import { unByKey as l } from "ol/Observable";
5
+ import m from "ol/source/Vector";
6
+ import n from "ol/style/Fill";
7
+ import y from "ol/style/Icon";
8
+ import g from "ol/style/Stroke";
9
+ import u from "ol/style/Style";
10
+ import C from "ol/style/Text";
11
+ import { PixelClusterCalculator as f } from "../cluster/pixel-cluster-calculator.mjs";
12
+ import { getPointStyle as c } from "../style/point-style.mjs";
13
+ class L {
14
+ constructor(e) {
15
+ this.countBackgroundColor = [2, 72, 200, 0.8], this.countFontColor = [255, 255, 255, 1], this.locations = [], this.clusterMarkUrl = "", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.map = e, this.view = e.getView(), this.clusterCalculator = new f(e), this.source = new m(), this.clusterLayer = new a({
16
+ source: this.source
17
+ }), this.clusterLayer.set("id", "cluster-points-layer"), this.map.addLayer(this.clusterLayer), this.configureVectorLayerStyle();
18
+ }
19
+ addClusterPoints(e) {
20
+ var t;
21
+ this.clusterMarkUrl = ((t = e.clusterSymbol) == null ? void 0 : t.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", this.countBackgroundColor = e.countBackgroundColor || this.countBackgroundColor, this.countFontColor = e.countFontColor || this.countFontColor, this.locations = e.points, this.locations.forEach((o) => {
22
+ o.symbol = o.symbol || e.pointSymbol;
23
+ }), this.viewChangeKey || (this.viewChangeKey = this.view.on("change:resolution", () => {
24
+ this.resolutionChangeTimeout && clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = setTimeout(() => {
25
+ this.calculateCluster();
26
+ }, 150);
27
+ })), this.mapMoveKey || (this.mapMoveKey = this.map.on("moveend", () => {
28
+ this.calculateCluster();
29
+ })), this.calculateCluster();
30
+ }
31
+ removeAllClusterPoints() {
32
+ this.source.clear(), this.viewChangeKey && (l(this.viewChangeKey), this.viewChangeKey = null), this.mapMoveKey && (l(this.mapMoveKey), this.mapMoveKey = null), this.resolutionChangeTimeout && (clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = null);
33
+ }
34
+ configureVectorLayerStyle() {
35
+ const e = this.view.getResolutionForZoom(18);
36
+ this.clusterLayer.setStyle((t, o) => {
37
+ const s = t.get("type");
38
+ if (o <= e)
39
+ return c(t.getProperties().symbol);
40
+ if (s === "cluster-point")
41
+ return c(t.getProperties().symbol);
42
+ if (s === "cluster-cluster")
43
+ return this.getClusterStyle(t.getProperties());
44
+ });
45
+ }
46
+ getClusterStyle(e) {
47
+ const t = e.clusterSymbolSize, o = new y({
48
+ src: this.clusterMarkUrl,
49
+ scale: t / 32
50
+ // 近似缩放
51
+ }), s = -(t + 10), h = new C({
52
+ text: String(e.count ?? 0),
53
+ font: "16px Arial Unicode MS",
54
+ fill: new n({ color: this.countFontColor }),
55
+ backgroundFill: new n({ color: this.countBackgroundColor }),
56
+ backgroundStroke: new g({
57
+ color: [
58
+ this.countBackgroundColor[0],
59
+ this.countBackgroundColor[1],
60
+ this.countBackgroundColor[2],
61
+ 0.5
62
+ ],
63
+ width: 4
64
+ }),
65
+ padding: [1, 2, 1, 2],
66
+ offsetY: s,
67
+ textAlign: "center",
68
+ justify: "center",
69
+ textBaseline: "middle"
70
+ });
71
+ return [new u({ image: o }), new u({ text: h })];
72
+ }
73
+ showClusterResult(e) {
74
+ this.source.clear(), e.forEach((t) => {
75
+ if (t.id !== -1 && t.center && t.symbolSize) {
76
+ const o = new r({
77
+ geometry: new i([t.center.x, t.center.y]),
78
+ type: "cluster-cluster",
79
+ count: t.count,
80
+ clusterSymbolSize: t.symbolSize
81
+ });
82
+ this.source.addFeature(o);
83
+ } else
84
+ t.items.forEach((o) => {
85
+ const s = new r({
86
+ ...o.properties,
87
+ geometry: new i([o.x, o.y]),
88
+ type: "cluster-point",
89
+ symbol: o.symbol
90
+ });
91
+ this.source.addFeature(s);
92
+ });
93
+ }), this.clusterLayer.changed();
94
+ }
95
+ calculateCluster() {
96
+ const e = this.clusterCalculator.calculate(this.locations), t = this.clusterCalculator.calculateSymbolSizes(e);
97
+ this.showClusterResult(t);
98
+ }
99
+ }
100
+ export {
101
+ L as default
102
+ };
@@ -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 {};