gisviewer-vue3-arcgis 1.0.284 → 1.0.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +6 -5
- package/es/src/gis-map/gis-map.vue.d.ts +124 -1
- package/es/src/gis-map/gis-map.vue.mjs +63 -63
- package/es/src/gis-map/index.d.ts +124 -1
- package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +236 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +576 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
- package/es/src/gis-map/utils/index.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
- package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
- package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +67 -0
- package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
- package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
- package/es/src/gis-map-ol/index.d.ts +44 -1
- package/es/src/gis-map-ol/index.mjs +8 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +129 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +263 -0
- package/es/src/index.mjs +4 -4
- package/es/src/types/index.mjs +5 -0
- package/lib/index.js +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +124 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +124 -1
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
- package/lib/src/gis-map/utils/index.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
- package/lib/src/gis-map-ol/index.d.ts +44 -1
- package/lib/src/gis-map-ol/index.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { ILayerVisibleParams, IMapInitializerParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
3
|
+
export default class OlMapInitializer {
|
|
4
|
+
private mapConfig;
|
|
5
|
+
private map;
|
|
6
|
+
private mapView;
|
|
7
|
+
private markerClick;
|
|
8
|
+
initialize(params: IMapInitializerParams): OlMap;
|
|
9
|
+
private processUrl;
|
|
10
|
+
private loadLayers;
|
|
11
|
+
private createMap;
|
|
12
|
+
/**
|
|
13
|
+
* 设置地图中心点和缩放级别
|
|
14
|
+
* @param params
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
18
|
+
setMapZoom(params: {
|
|
19
|
+
zoom: number;
|
|
20
|
+
}): IResult;
|
|
21
|
+
/**
|
|
22
|
+
* 设置地图预存的相机视图
|
|
23
|
+
* @param params
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
setMapCamera(params: ISetMapCameraParams): Promise<IResult>;
|
|
27
|
+
setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import n from "ol/layer/Tile";
|
|
2
|
+
import c from "ol/Map";
|
|
3
|
+
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 {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.mapConfig = {};
|
|
12
|
+
}
|
|
13
|
+
initialize(e) {
|
|
14
|
+
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
|
+
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
|
+
}
|
|
19
|
+
loadLayers(e) {
|
|
20
|
+
if (!this.map)
|
|
21
|
+
return;
|
|
22
|
+
const i = 1 / 0, r = 16384;
|
|
23
|
+
e.forEach((t) => {
|
|
24
|
+
var o, a;
|
|
25
|
+
(o = t.source) != null && o.url && (t.source.url = this.processUrl(t.source.url));
|
|
26
|
+
let s;
|
|
27
|
+
switch (t.type) {
|
|
28
|
+
case "gwc-wms": {
|
|
29
|
+
s = new n({
|
|
30
|
+
preload: i,
|
|
31
|
+
cacheSize: r,
|
|
32
|
+
source: new u({
|
|
33
|
+
...t.source,
|
|
34
|
+
tileGrid: new l({
|
|
35
|
+
...t.source.tileGrid
|
|
36
|
+
})
|
|
37
|
+
}),
|
|
38
|
+
...t.options
|
|
39
|
+
});
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "wmts": {
|
|
43
|
+
s = new n({
|
|
44
|
+
preload: i,
|
|
45
|
+
cacheSize: r,
|
|
46
|
+
source: new p({
|
|
47
|
+
...t.source,
|
|
48
|
+
tileGrid: new f({
|
|
49
|
+
...t.source.tileGrid
|
|
50
|
+
}),
|
|
51
|
+
projection: new h({
|
|
52
|
+
code: t.source.projection || "EPSG:4326"
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
...t.options
|
|
56
|
+
});
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
s && (s.set("id", t.id), (a = this.map) == null || a.addLayer(s));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
createMap(e) {
|
|
64
|
+
const i = this.mapConfig.view;
|
|
65
|
+
this.mapView = new d({ ...i }), this.mapConfig.camera ? this.mapConfig.camera.home = i : this.mapConfig.camera = {
|
|
66
|
+
home: i
|
|
67
|
+
};
|
|
68
|
+
const r = new c({
|
|
69
|
+
target: e,
|
|
70
|
+
view: this.mapView
|
|
71
|
+
});
|
|
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);
|
|
82
|
+
}
|
|
83
|
+
}), r;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 设置地图中心点和缩放级别
|
|
87
|
+
* @param params
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
async setMapCenter(e) {
|
|
91
|
+
return this.map ? new Promise((i) => {
|
|
92
|
+
e.duration && e.duration > 0 ? this.mapView.animate(
|
|
93
|
+
{
|
|
94
|
+
center: e.center || this.mapView.getCenter(),
|
|
95
|
+
zoom: e.zoom || this.mapView.getZoom(),
|
|
96
|
+
duration: e.duration * 1e3
|
|
97
|
+
},
|
|
98
|
+
() => {
|
|
99
|
+
i({ status: 0, message: "成功" });
|
|
100
|
+
}
|
|
101
|
+
) : (e.zoom && this.mapView.setZoom(e.zoom), e.center && this.mapView.setCenter(e.center), i({ status: 0, message: "成功" }));
|
|
102
|
+
}) : { status: -1, message: "地图未初始化" };
|
|
103
|
+
}
|
|
104
|
+
setMapZoom(e) {
|
|
105
|
+
return this.map ? (this.mapView.setZoom(e.zoom), { status: 0, message: "成功" }) : { status: -1, message: "地图未初始化" };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 设置地图预存的相机视图
|
|
109
|
+
* @param params
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
async setMapCamera(e) {
|
|
113
|
+
if (!this.map)
|
|
114
|
+
return { status: -1, message: "地图未初始化" };
|
|
115
|
+
const i = this.mapConfig.camera[e.name];
|
|
116
|
+
return i ? await this.setMapCenter({
|
|
117
|
+
center: i.center,
|
|
118
|
+
zoom: e.zoom || i.zoom,
|
|
119
|
+
duration: e.duration || 0
|
|
120
|
+
}) : { status: -1, message: `未找到名称为 ${e.name} 的相机视图` };
|
|
121
|
+
}
|
|
122
|
+
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} 的图层` };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
b as default
|
|
129
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 showName;
|
|
9
|
+
private showStyle;
|
|
10
|
+
private viewChangeKey;
|
|
11
|
+
private mapMoveKey;
|
|
12
|
+
private resolutionChangeTimeout;
|
|
13
|
+
private readonly clusterRadius;
|
|
14
|
+
private readonly minClusterPoints;
|
|
15
|
+
private readonly maxClusterSymbolSize;
|
|
16
|
+
private readonly minClusterSymbolSize;
|
|
17
|
+
private clusteredLocations;
|
|
18
|
+
private locations;
|
|
19
|
+
constructor(map: OlMap);
|
|
20
|
+
showSignalCross(params: IShowSignalCrossParams): IResult;
|
|
21
|
+
private calculateCluster;
|
|
22
|
+
clearSignalCross(): void;
|
|
23
|
+
changeShowName(showName: string): void;
|
|
24
|
+
private updateScatterSymbol;
|
|
25
|
+
/**
|
|
26
|
+
* 配置矢量图层样式:复用 Icon,并为不同 feature 渲染不同 Text。
|
|
27
|
+
* - 使用 resolution 判断是否显示文字(在指定缩放级别后才显示)
|
|
28
|
+
* - 使用缓存避免每次渲染都创建新的 Style/Icon/数组对象
|
|
29
|
+
*/
|
|
30
|
+
private configureVectorLayerStyle;
|
|
31
|
+
private createCrossFeature;
|
|
32
|
+
private getClusterStyle;
|
|
33
|
+
private getBrandLabel;
|
|
34
|
+
private getOnlineLabel;
|
|
35
|
+
private getMalfunctionLabel;
|
|
36
|
+
private locationToScreen;
|
|
37
|
+
private doPixelCluster;
|
|
38
|
+
private getNeighbors;
|
|
39
|
+
private getDistance;
|
|
40
|
+
private createClusters;
|
|
41
|
+
private showClusterResult;
|
|
42
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import _ from "ol/Feature";
|
|
2
|
+
import v from "ol/geom/Point";
|
|
3
|
+
import B from "ol/layer/Vector";
|
|
4
|
+
import { unByKey as E } from "ol/Observable";
|
|
5
|
+
import V from "ol/source/Vector";
|
|
6
|
+
import k from "ol/style/Circle";
|
|
7
|
+
import y from "ol/style/Fill";
|
|
8
|
+
import F from "ol/style/Icon";
|
|
9
|
+
import I from "ol/style/Stroke";
|
|
10
|
+
import d from "ol/style/Style";
|
|
11
|
+
import K from "ol/style/Text";
|
|
12
|
+
class se {
|
|
13
|
+
constructor(e) {
|
|
14
|
+
this.showName = "detail", this.showStyle = "scatter", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.map = e, this.view = e.getView(), this.source = new V(), this.crossLayer = new B({
|
|
15
|
+
source: this.source
|
|
16
|
+
}), this.crossLayer.set("id", "signal-control-cross-layer"), this.map.addLayer(this.crossLayer), this.configureVectorLayerStyle();
|
|
17
|
+
}
|
|
18
|
+
showSignalCross(e) {
|
|
19
|
+
if (this.source.clear(), this.showName = e.showName || "detail", this.showStyle = e.style || "scatter", this.viewChangeKey || (this.viewChangeKey = this.view.on("change:resolution", () => {
|
|
20
|
+
this.showStyle === "cluster" && (this.resolutionChangeTimeout && clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = setTimeout(() => {
|
|
21
|
+
this.calculateCluster(), this.resolutionChangeTimeout = null;
|
|
22
|
+
}, 150));
|
|
23
|
+
})), this.mapMoveKey || (this.mapMoveKey = this.map.on("moveend", () => {
|
|
24
|
+
this.showStyle === "cluster" && this.calculateCluster();
|
|
25
|
+
})), this.showStyle === "scatter") {
|
|
26
|
+
const s = [], o = [];
|
|
27
|
+
e.points.forEach((t) => {
|
|
28
|
+
const n = this.createCrossFeature(t);
|
|
29
|
+
t.isMalfunction === !0 || t.isOnline === !1 ? o.push(n) : s.push(n);
|
|
30
|
+
}), this.source.addFeatures(s), this.source.addFeatures(o), this.crossLayer.changed();
|
|
31
|
+
} else
|
|
32
|
+
this.locations = e.points.map((s) => ({
|
|
33
|
+
id: s.crossId,
|
|
34
|
+
x: s.x,
|
|
35
|
+
y: s.y,
|
|
36
|
+
visited: !1,
|
|
37
|
+
clusterId: void 0,
|
|
38
|
+
properties: s
|
|
39
|
+
})), this.calculateCluster();
|
|
40
|
+
return {
|
|
41
|
+
status: 0,
|
|
42
|
+
message: "success"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
calculateCluster() {
|
|
46
|
+
console.time("cluster"), this.locationToScreen();
|
|
47
|
+
const e = this.doPixelCluster(this.clusterRadius);
|
|
48
|
+
this.showClusterResult(e), console.timeEnd("cluster");
|
|
49
|
+
}
|
|
50
|
+
clearSignalCross() {
|
|
51
|
+
this.source.clear(), this.viewChangeKey && (E(this.viewChangeKey), this.viewChangeKey = null), this.mapMoveKey && (E(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 r = this.map.getView(), p = r.getResolutionForZoom(13), w = r.getResolutionForZoom(15), S = r.getResolutionForZoom(17), C = (i, c, l) => `/GisViewerAssets/Images/cross/ic_${(i ?? "gc").toLowerCase() === "scats" ? "scats" : "gc"}_${c === !1 ? "offline" : "online"}_${l ? "malfunction" : "normal"}.png`, u = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new Map(), x = {
|
|
66
|
+
gc: "#86efac",
|
|
67
|
+
// 浅绿色
|
|
68
|
+
scats: "#16a34a"
|
|
69
|
+
// 深绿色
|
|
70
|
+
}, z = new I({ color: "#ffffff", width: 1.5 }), R = (i, c) => {
|
|
71
|
+
const l = x[i] ? i : "gc", a = b.get(l);
|
|
72
|
+
if (a)
|
|
73
|
+
return a;
|
|
74
|
+
const m = [
|
|
75
|
+
new d({
|
|
76
|
+
image: new k({
|
|
77
|
+
radius: c > p ? 3 : 8,
|
|
78
|
+
fill: new y({ color: x[l] }),
|
|
79
|
+
stroke: z
|
|
80
|
+
}),
|
|
81
|
+
zIndex: 1
|
|
82
|
+
})
|
|
83
|
+
];
|
|
84
|
+
return b.set(l, m), m;
|
|
85
|
+
}, Z = new y({ color: "#1f2937" }), A = new I({ color: "#ffffff", width: 3 }), L = (i) => {
|
|
86
|
+
const c = u.get(i);
|
|
87
|
+
if (c)
|
|
88
|
+
return c;
|
|
89
|
+
const l = new d({
|
|
90
|
+
image: new F({
|
|
91
|
+
src: i,
|
|
92
|
+
scale: 0.5,
|
|
93
|
+
anchor: [0.5, 1],
|
|
94
|
+
anchorXUnits: "fraction",
|
|
95
|
+
anchorYUnits: "fraction"
|
|
96
|
+
}),
|
|
97
|
+
zIndex: 1
|
|
98
|
+
});
|
|
99
|
+
return u.set(i, l), l;
|
|
100
|
+
}, P = (i) => {
|
|
101
|
+
const c = h.get(i);
|
|
102
|
+
if (c)
|
|
103
|
+
return c;
|
|
104
|
+
const l = [L(i)];
|
|
105
|
+
return h.set(i, l), l;
|
|
106
|
+
};
|
|
107
|
+
this.crossLayer.setStyle((i, c) => {
|
|
108
|
+
if ((i.get("type") ?? "") === "signal-cluster")
|
|
109
|
+
return this.getClusterStyle(i.getProperties());
|
|
110
|
+
const a = this.showName === "crossName" ? i.get("name") : this.showName === "signalId" ? i.get("signalId") : `${i.get("name")}(${i.get("signalId")})`, m = i.get("brand") ?? "gc", M = i.get("isOnline"), N = i.get("isMalfunction"), g = C(m, M, N);
|
|
111
|
+
if (c > w)
|
|
112
|
+
return R(m, c);
|
|
113
|
+
if (c > S)
|
|
114
|
+
return P(g);
|
|
115
|
+
const f = O.get(i);
|
|
116
|
+
if (f && f.label === a && f.iconKey === g)
|
|
117
|
+
return f.styles;
|
|
118
|
+
const X = L(g), Y = new d({
|
|
119
|
+
text: new K({
|
|
120
|
+
text: a,
|
|
121
|
+
font: '12px "Microsoft YaHei"',
|
|
122
|
+
textAlign: "center",
|
|
123
|
+
textBaseline: "bottom",
|
|
124
|
+
offsetY: -28,
|
|
125
|
+
fill: Z,
|
|
126
|
+
stroke: A
|
|
127
|
+
}),
|
|
128
|
+
zIndex: 2
|
|
129
|
+
}), T = [X, Y];
|
|
130
|
+
return O.set(i, {
|
|
131
|
+
label: a,
|
|
132
|
+
iconKey: g,
|
|
133
|
+
styles: T
|
|
134
|
+
}), T;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
createCrossFeature(e) {
|
|
138
|
+
return e.brand = e.brand.toLowerCase(), new _({
|
|
139
|
+
geometry: new v([e.x, e.y]),
|
|
140
|
+
type: "signal-cross",
|
|
141
|
+
id: e.crossId,
|
|
142
|
+
brandLabel: this.getBrandLabel(e.brand),
|
|
143
|
+
isOnlineLabel: this.getOnlineLabel(e.isOnline),
|
|
144
|
+
isMalfunctionLabel: this.getMalfunctionLabel(e.isMalfunction),
|
|
145
|
+
...e
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
getClusterStyle(e) {
|
|
149
|
+
const s = e.clusterSymbolSize, o = new F({
|
|
150
|
+
src: "/GisViewerAssets/Images/cross/gis_xhj_blue.png",
|
|
151
|
+
scale: s / 32
|
|
152
|
+
// 近似缩放
|
|
153
|
+
}), t = -(s + 10), n = new K({
|
|
154
|
+
text: String(e.count ?? 0),
|
|
155
|
+
font: "16px sans-serif",
|
|
156
|
+
fill: new y({ color: [255, 255, 255, 255] }),
|
|
157
|
+
backgroundFill: new y({ color: [2, 72, 200, 255] }),
|
|
158
|
+
backgroundStroke: new I({ color: [2, 72, 200, 128], width: 2 }),
|
|
159
|
+
padding: [3, 6, 3, 6],
|
|
160
|
+
offsetY: t,
|
|
161
|
+
textAlign: "center"
|
|
162
|
+
});
|
|
163
|
+
return [new d({ image: o }), new d({ text: n })];
|
|
164
|
+
}
|
|
165
|
+
// private formatCrossName(name?: string) {
|
|
166
|
+
// return (name || '').replace(/与/g, '/');
|
|
167
|
+
// }
|
|
168
|
+
getBrandLabel(e) {
|
|
169
|
+
const s = (e ?? "").toLowerCase();
|
|
170
|
+
return s === "scats" ? "SCATS" : s === "gc" ? "国产" : e ?? "";
|
|
171
|
+
}
|
|
172
|
+
getOnlineLabel(e) {
|
|
173
|
+
return e ? "在线" : "离线";
|
|
174
|
+
}
|
|
175
|
+
getMalfunctionLabel(e) {
|
|
176
|
+
return e ? "故障" : "正常";
|
|
177
|
+
}
|
|
178
|
+
locationToScreen() {
|
|
179
|
+
this.clusteredLocations = [], this.locations.forEach((e) => {
|
|
180
|
+
const s = this.map.getPixelFromCoordinate([e.x, e.y]), [o, t] = s || [NaN, NaN];
|
|
181
|
+
Number.isFinite(o) && Number.isFinite(t) && o > 0 && t > 0 && (e.properties = e.properties || {}, e.properties.screenX = o, e.properties.screenY = t, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
doPixelCluster(e) {
|
|
185
|
+
let s = 0;
|
|
186
|
+
for (let o = 0; o < this.clusteredLocations.length; o++) {
|
|
187
|
+
const t = this.clusteredLocations[o];
|
|
188
|
+
if (t.visited)
|
|
189
|
+
continue;
|
|
190
|
+
t.visited = !0;
|
|
191
|
+
const n = this.getNeighbors(t, e);
|
|
192
|
+
n.length < this.minClusterPoints ? t.clusterId = -1 : (n.forEach((r) => {
|
|
193
|
+
r.visited = !0, r.clusterId = s;
|
|
194
|
+
}), t.clusterId = s, s++);
|
|
195
|
+
}
|
|
196
|
+
return this.createClusters();
|
|
197
|
+
}
|
|
198
|
+
getNeighbors(e, s) {
|
|
199
|
+
return this.clusteredLocations.filter((o) => o.id === e.id || o.visited ? !1 : this.getDistance(e, o) <= s);
|
|
200
|
+
}
|
|
201
|
+
getDistance(e, s) {
|
|
202
|
+
var o, t, n, r;
|
|
203
|
+
return Math.sqrt(
|
|
204
|
+
Math.pow(
|
|
205
|
+
(((o = e.properties) == null ? void 0 : o.screenX) ?? 0) - (((t = s.properties) == null ? void 0 : t.screenX) ?? 0),
|
|
206
|
+
2
|
|
207
|
+
) + Math.pow(
|
|
208
|
+
(((n = e.properties) == null ? void 0 : n.screenY) ?? 0) - (((r = s.properties) == null ? void 0 : r.screenY) ?? 0),
|
|
209
|
+
2
|
|
210
|
+
)
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
createClusters() {
|
|
214
|
+
const e = {}, s = [];
|
|
215
|
+
for (const t of this.clusteredLocations)
|
|
216
|
+
t.clusterId === void 0 || t.clusterId === -1 ? s.push(t) : (e[t.clusterId] || (e[t.clusterId] = []), e[t.clusterId].push(t));
|
|
217
|
+
const o = Object.keys(e).map((t) => {
|
|
218
|
+
const n = e[Number(t)], r = n.length, p = n.reduce((u, h) => u + h.x, 0), w = n.reduce((u, h) => u + h.y, 0), S = p / r, C = w / r;
|
|
219
|
+
return {
|
|
220
|
+
id: Number(t),
|
|
221
|
+
items: n,
|
|
222
|
+
count: r,
|
|
223
|
+
center: { x: S, y: C }
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
return s.length > 0 && o.push({
|
|
227
|
+
id: -1,
|
|
228
|
+
items: s,
|
|
229
|
+
count: s.length,
|
|
230
|
+
center: null
|
|
231
|
+
}), o;
|
|
232
|
+
}
|
|
233
|
+
showClusterResult(e) {
|
|
234
|
+
this.source.clear();
|
|
235
|
+
let s = Number.MIN_VALUE, o = Number.MAX_VALUE;
|
|
236
|
+
e.forEach((t) => {
|
|
237
|
+
t.count > 1 && (o = Math.min(o, t.count), s = Math.max(s, t.count));
|
|
238
|
+
}), e.forEach((t) => {
|
|
239
|
+
if (t.id !== -1 && t.center) {
|
|
240
|
+
let n = o === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (t.count - o) / (s - o) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
241
|
+
n *= 0.75;
|
|
242
|
+
const r = new _({
|
|
243
|
+
geometry: new v([t.center.x, t.center.y]),
|
|
244
|
+
type: "signal-cluster",
|
|
245
|
+
count: t.count,
|
|
246
|
+
clusterSymbolSize: n
|
|
247
|
+
});
|
|
248
|
+
this.source.addFeature(r);
|
|
249
|
+
} else
|
|
250
|
+
t.items.forEach((n) => {
|
|
251
|
+
const r = this.createCrossFeature({
|
|
252
|
+
...n.properties,
|
|
253
|
+
x: n.x,
|
|
254
|
+
y: n.y
|
|
255
|
+
});
|
|
256
|
+
this.source.addFeature(r);
|
|
257
|
+
});
|
|
258
|
+
}), this.crossLayer.changed();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
se as default
|
|
263
|
+
};
|
package/es/src/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GisMap as
|
|
2
|
-
import "./gis-map-ol";
|
|
3
|
-
export * from "./gis-map-ol";
|
|
1
|
+
import { GisMap as r } from "./gis-map/index.mjs";
|
|
2
|
+
import { GisMapOl as e } from "./gis-map-ol/index.mjs";
|
|
4
3
|
export {
|
|
5
|
-
|
|
4
|
+
r as GisMap,
|
|
5
|
+
e as GisMapOl
|
|
6
6
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var N = /* @__PURE__ */ ((r) => (r.West = "1", r.North = "2", r.East = "3", r.South = "4", r))(N || {}), x = /* @__PURE__ */ ((r) => (r[r.None = 0] = "None", r[r.PlateNumber = 1] = "PlateNumber", r[r.Id = 2] = "Id", r[r.Mix = 3] = "Mix", r))(x || {});
|
|
2
|
+
export {
|
|
3
|
+
x as EVehiclePlateState,
|
|
4
|
+
N as QuadrantCode
|
|
5
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("core-js/stable/array/at");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("core-js/stable/array/at");const r=require("./src/gis-map/utils/index.js"),i=require("./src/index.js"),n=require("./src/gis-map/index.js"),l=require("./src/gis-map-ol/index.js"),u={install:(e,s)=>{for(const o in i)e.use(i[o]);const{gisviewerAssetsRoot:t}=s;e.config.globalProperties.$gisviewerAssetsRoot=t||""}};exports.MapUtils=r.default;exports.GisMap=n.GisMap;exports.GisMapOl=l.GisMapOl;exports.default=u;
|
|
@@ -217,7 +217,130 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
217
217
|
setEdpassLayerVisibility: (params: IShowEdpassDeviceParams) => Promise<import("../types").IResult>;
|
|
218
218
|
props: any;
|
|
219
219
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
|
|
220
|
-
SignalCountdownPanel:
|
|
220
|
+
SignalCountdownPanel: import("vue").DefineComponent<{
|
|
221
|
+
displayMode: {
|
|
222
|
+
type: StringConstructor;
|
|
223
|
+
required: true;
|
|
224
|
+
};
|
|
225
|
+
flash: {
|
|
226
|
+
type: BooleanConstructor;
|
|
227
|
+
required: true;
|
|
228
|
+
};
|
|
229
|
+
crossId: {
|
|
230
|
+
type: StringConstructor;
|
|
231
|
+
required: true;
|
|
232
|
+
};
|
|
233
|
+
roadId: {
|
|
234
|
+
type: StringConstructor;
|
|
235
|
+
required: true;
|
|
236
|
+
};
|
|
237
|
+
mapPoint: {
|
|
238
|
+
type: ArrayConstructor;
|
|
239
|
+
required: true;
|
|
240
|
+
};
|
|
241
|
+
stopLine: {
|
|
242
|
+
type: ArrayConstructor;
|
|
243
|
+
required: true;
|
|
244
|
+
};
|
|
245
|
+
scale: {
|
|
246
|
+
type: NumberConstructor;
|
|
247
|
+
required: true;
|
|
248
|
+
};
|
|
249
|
+
position: {
|
|
250
|
+
type: ObjectConstructor;
|
|
251
|
+
required: true;
|
|
252
|
+
};
|
|
253
|
+
rotation: {
|
|
254
|
+
type: NumberConstructor;
|
|
255
|
+
required: true;
|
|
256
|
+
};
|
|
257
|
+
lampStatus: {
|
|
258
|
+
type: ObjectConstructor;
|
|
259
|
+
required: true;
|
|
260
|
+
};
|
|
261
|
+
}, {
|
|
262
|
+
colors: string[];
|
|
263
|
+
props: any;
|
|
264
|
+
panelStyle: import("vue").ComputedRef<{
|
|
265
|
+
top: string;
|
|
266
|
+
left: string;
|
|
267
|
+
'transform-origin': string;
|
|
268
|
+
transform: string;
|
|
269
|
+
}>;
|
|
270
|
+
blImage: import("vue").ComputedRef<string>;
|
|
271
|
+
blNumberStyle: import("vue").ComputedRef<any>;
|
|
272
|
+
blLampStyle: import("vue").ComputedRef<{
|
|
273
|
+
display: string;
|
|
274
|
+
animation: string;
|
|
275
|
+
}>;
|
|
276
|
+
uImage: import("vue").ComputedRef<string>;
|
|
277
|
+
uNumberStyle: import("vue").ComputedRef<any>;
|
|
278
|
+
uLampStyle: import("vue").ComputedRef<{
|
|
279
|
+
display: string;
|
|
280
|
+
animation: string;
|
|
281
|
+
}>;
|
|
282
|
+
lImage: import("vue").ComputedRef<string>;
|
|
283
|
+
lNumberStyle: import("vue").ComputedRef<any>;
|
|
284
|
+
lLampStyle: import("vue").ComputedRef<{
|
|
285
|
+
display: string;
|
|
286
|
+
animation: string;
|
|
287
|
+
}>;
|
|
288
|
+
sImage: import("vue").ComputedRef<string>;
|
|
289
|
+
sNumberStyle: import("vue").ComputedRef<any>;
|
|
290
|
+
sLampStyle: import("vue").ComputedRef<{
|
|
291
|
+
display: string;
|
|
292
|
+
animation: string;
|
|
293
|
+
}>;
|
|
294
|
+
rImage: import("vue").ComputedRef<string>;
|
|
295
|
+
rNumberStyle: import("vue").ComputedRef<any>;
|
|
296
|
+
rLampStyle: import("vue").ComputedRef<{
|
|
297
|
+
display: string;
|
|
298
|
+
animation: string;
|
|
299
|
+
}>;
|
|
300
|
+
getColorString: (color: string | undefined) => "red" | "rgb(255, 192, 2)" | "lime" | "white";
|
|
301
|
+
getNumberStyle: (color: string | undefined) => any;
|
|
302
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
303
|
+
displayMode: {
|
|
304
|
+
type: StringConstructor;
|
|
305
|
+
required: true;
|
|
306
|
+
};
|
|
307
|
+
flash: {
|
|
308
|
+
type: BooleanConstructor;
|
|
309
|
+
required: true;
|
|
310
|
+
};
|
|
311
|
+
crossId: {
|
|
312
|
+
type: StringConstructor;
|
|
313
|
+
required: true;
|
|
314
|
+
};
|
|
315
|
+
roadId: {
|
|
316
|
+
type: StringConstructor;
|
|
317
|
+
required: true;
|
|
318
|
+
};
|
|
319
|
+
mapPoint: {
|
|
320
|
+
type: ArrayConstructor;
|
|
321
|
+
required: true;
|
|
322
|
+
};
|
|
323
|
+
stopLine: {
|
|
324
|
+
type: ArrayConstructor;
|
|
325
|
+
required: true;
|
|
326
|
+
};
|
|
327
|
+
scale: {
|
|
328
|
+
type: NumberConstructor;
|
|
329
|
+
required: true;
|
|
330
|
+
};
|
|
331
|
+
position: {
|
|
332
|
+
type: ObjectConstructor;
|
|
333
|
+
required: true;
|
|
334
|
+
};
|
|
335
|
+
rotation: {
|
|
336
|
+
type: NumberConstructor;
|
|
337
|
+
required: true;
|
|
338
|
+
};
|
|
339
|
+
lampStatus: {
|
|
340
|
+
type: ObjectConstructor;
|
|
341
|
+
required: true;
|
|
342
|
+
};
|
|
343
|
+
}>>, {}, {}>;
|
|
221
344
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
222
345
|
config: {
|
|
223
346
|
type: StringConstructor;
|