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.
- package/es/src/gis-map/gis-map.vue.d.ts +2 -2
- package/es/src/gis-map/index.d.ts +2 -2
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +6 -2
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +5 -3
- package/es/src/gis-map/utils/overlay.d.ts +2 -2
- package/es/src/gis-map/utils/overlay.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +1 -1
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +2 -2
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +69 -43
- package/es/src/gis-map-ol/index.d.ts +25 -0
- package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +95 -41
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
- package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +124 -166
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
- package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
- package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
- package/es/src/types/index.d.ts +2 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +2 -2
- package/lib/src/gis-map/index.d.ts +2 -2
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +2 -2
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -1
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -1
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +30 -1
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -1
- package/lib/src/gis-map-ol/index.d.ts +25 -0
- package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -1
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +1 -10
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -1
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
- package/lib/src/types/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import S from "ol/style/Fill";
|
|
2
|
+
import f from "ol/style/Stroke";
|
|
3
|
+
import a from "ol/style/Style";
|
|
4
|
+
import g from "ol/style/Text";
|
|
5
|
+
const c = /* @__PURE__ */ new Map();
|
|
6
|
+
let d = null;
|
|
7
|
+
function x(e, n) {
|
|
8
|
+
return e ? Array.isArray(e) ? e.map((i) => {
|
|
9
|
+
if (i.type === "text" && i.field) {
|
|
10
|
+
const r = (n == null ? void 0 : n[i.field]) ?? "";
|
|
11
|
+
return JSON.stringify({ ...i, __textContent__: r });
|
|
12
|
+
}
|
|
13
|
+
return JSON.stringify(i);
|
|
14
|
+
}).join("|") : JSON.stringify(e) : "__default__";
|
|
15
|
+
}
|
|
16
|
+
function u() {
|
|
17
|
+
return d || (d = new a({
|
|
18
|
+
stroke: new f({
|
|
19
|
+
color: "#2563eb",
|
|
20
|
+
width: 2
|
|
21
|
+
})
|
|
22
|
+
})), d;
|
|
23
|
+
}
|
|
24
|
+
function p(e) {
|
|
25
|
+
return new a({
|
|
26
|
+
stroke: new f({
|
|
27
|
+
color: e.color ?? "#2563eb",
|
|
28
|
+
width: e.width ?? 2,
|
|
29
|
+
lineCap: e.lineCap ?? "round",
|
|
30
|
+
lineJoin: e.lineJoin ?? "round",
|
|
31
|
+
lineDash: e.lineDash,
|
|
32
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function s(e) {
|
|
37
|
+
const n = new a({
|
|
38
|
+
stroke: new f({
|
|
39
|
+
color: e.borderColor ?? "#000000",
|
|
40
|
+
width: (e.width ?? 2) + (e.borderWidth ?? 2) * 2,
|
|
41
|
+
lineCap: e.lineCap ?? "round",
|
|
42
|
+
lineJoin: e.lineJoin ?? "round",
|
|
43
|
+
lineDash: e.lineDash,
|
|
44
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
45
|
+
})
|
|
46
|
+
}), t = new a({
|
|
47
|
+
stroke: new f({
|
|
48
|
+
color: e.color ?? "#2563eb",
|
|
49
|
+
width: e.width ?? 2,
|
|
50
|
+
lineCap: e.lineCap ?? "round",
|
|
51
|
+
lineJoin: e.lineJoin ?? "round",
|
|
52
|
+
lineDash: e.lineDash,
|
|
53
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
return [n, t];
|
|
57
|
+
}
|
|
58
|
+
function D(e, n) {
|
|
59
|
+
const t = n || 2;
|
|
60
|
+
switch (e) {
|
|
61
|
+
case "solid":
|
|
62
|
+
return;
|
|
63
|
+
case "dash":
|
|
64
|
+
return [t * 4, t * 2];
|
|
65
|
+
case "dot":
|
|
66
|
+
return [t, t * 2];
|
|
67
|
+
case "dash-dot":
|
|
68
|
+
return [t * 4, t * 2, t, t * 2];
|
|
69
|
+
case "long-dash":
|
|
70
|
+
return [t * 6, t * 3];
|
|
71
|
+
case "long-dash-dot":
|
|
72
|
+
return [t * 6, t * 2, t, t * 2];
|
|
73
|
+
case "long-dash-dot-dot":
|
|
74
|
+
return [t * 6, t * 2, t, t * 2, t, t * 2];
|
|
75
|
+
case "short-dash":
|
|
76
|
+
return [t * 2, t];
|
|
77
|
+
case "short-dot":
|
|
78
|
+
return [t, t];
|
|
79
|
+
case "short-dash-dot":
|
|
80
|
+
return [t * 2, t, t, t];
|
|
81
|
+
case "short-dash-dot-dot":
|
|
82
|
+
return [t * 2, t, t, t, t, t];
|
|
83
|
+
case "none":
|
|
84
|
+
return [0, 1];
|
|
85
|
+
default:
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function w(e) {
|
|
90
|
+
const n = e.width ?? 2, t = D(e.style ?? "solid", n);
|
|
91
|
+
return new a({
|
|
92
|
+
stroke: new f({
|
|
93
|
+
color: e.color ?? [0, 0, 0, 1],
|
|
94
|
+
width: n,
|
|
95
|
+
lineCap: e.cap ?? "round",
|
|
96
|
+
lineJoin: e.join ?? "round",
|
|
97
|
+
lineDash: t,
|
|
98
|
+
lineDashOffset: 0
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function C(e, n) {
|
|
103
|
+
const t = new g({
|
|
104
|
+
text: String(n),
|
|
105
|
+
font: e.font ?? "14px Arial Unicode MS",
|
|
106
|
+
fill: new S({
|
|
107
|
+
color: e.fillColor ?? [0, 0, 0]
|
|
108
|
+
}),
|
|
109
|
+
stroke: new f({
|
|
110
|
+
color: e.strokeColor ?? [255, 255, 255],
|
|
111
|
+
width: e.strokeWidth ?? 3
|
|
112
|
+
}),
|
|
113
|
+
offsetX: e.offsetX ?? 0,
|
|
114
|
+
offsetY: e.offsetY ?? 0,
|
|
115
|
+
textAlign: e.textAlign ?? "center",
|
|
116
|
+
textBaseline: e.textBaseline ?? "middle",
|
|
117
|
+
placement: e.placement ?? "point",
|
|
118
|
+
overflow: e.overflow ?? !1,
|
|
119
|
+
maxAngle: e.maxAngle ?? Math.PI / 4
|
|
120
|
+
});
|
|
121
|
+
return new a({ text: t });
|
|
122
|
+
}
|
|
123
|
+
function _(e, n) {
|
|
124
|
+
if (!e)
|
|
125
|
+
return u();
|
|
126
|
+
const t = x(e, n), i = c.get(t);
|
|
127
|
+
if (i)
|
|
128
|
+
return i;
|
|
129
|
+
let r;
|
|
130
|
+
if (Array.isArray(e) && e.length > 0) {
|
|
131
|
+
const l = [];
|
|
132
|
+
if (e.forEach((o) => {
|
|
133
|
+
if (o.type === "line")
|
|
134
|
+
l.push(p(o));
|
|
135
|
+
else if (o.type === "simple-line")
|
|
136
|
+
l.push(w(o));
|
|
137
|
+
else if (o.type === "bordered")
|
|
138
|
+
l.push(...s(o));
|
|
139
|
+
else if (o.type === "text" && o.field) {
|
|
140
|
+
const h = (n == null ? void 0 : n[o.field]) ?? "";
|
|
141
|
+
h && l.push(C(o, h));
|
|
142
|
+
}
|
|
143
|
+
}), l.length > 0)
|
|
144
|
+
return r = l, c.set(t, r), r;
|
|
145
|
+
}
|
|
146
|
+
return e && e.type === "bordered" ? (r = s(e), c.set(t, r), r) : e && e.type === "simple-line" ? (r = w(e), c.set(t, r), r) : e ? (r = p(e), c.set(t, r), r) : u();
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
D as getLineDashByStyle,
|
|
150
|
+
_ as getLineStyle
|
|
151
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Style from 'ol/style/Style';
|
|
2
|
+
/**
|
|
3
|
+
* 清除样式缓存
|
|
4
|
+
*/
|
|
5
|
+
export declare function clearStyleCache(): void;
|
|
6
|
+
/**
|
|
7
|
+
* 获取当前缓存大小
|
|
8
|
+
*/
|
|
9
|
+
export declare function getStyleCacheSize(): number;
|
|
10
|
+
/**
|
|
11
|
+
* 获取单点样式
|
|
12
|
+
* 支持 symbol 数组配置(icon + text + circle + shape),或单个 symbol 配置
|
|
13
|
+
* 若 symbol 为空则显示蓝色圆点
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // 单个图标配置
|
|
17
|
+
* { symbol: { url: '/path/to/icon.png', scale: 1 } }
|
|
18
|
+
*
|
|
19
|
+
* // 圆点样式配置
|
|
20
|
+
* { symbol: { type: 'circle', radius: 8, fillColor: '#ff0000', strokeColor: '#ffffff', strokeWidth: 2 } }
|
|
21
|
+
*
|
|
22
|
+
* // 规则图形样式配置(三角形)
|
|
23
|
+
* { symbol: { type: 'shape', points: 3, radius: 10, fillColor: 'red', strokeColor: 'black', strokeWidth: 1 } }
|
|
24
|
+
*
|
|
25
|
+
* // 规则图形样式配置(正方形,旋转45度)
|
|
26
|
+
* { symbol: { type: 'shape', points: 4, radius: 10, angle: Math.PI / 4, fillColor: 'blue' } }
|
|
27
|
+
*
|
|
28
|
+
* // 规则图形样式配置(五角星)
|
|
29
|
+
* { symbol: { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' } }
|
|
30
|
+
*
|
|
31
|
+
* // 规则图形样式配置(十字形)
|
|
32
|
+
* { symbol: { type: 'shape', points: 4, radius: 10, radius2: 0, strokeColor: 'red', strokeWidth: 2 } }
|
|
33
|
+
*
|
|
34
|
+
* // ArcGIS picture-marker 配置 (转换为 OpenLayers Icon)
|
|
35
|
+
* { symbol: { type: 'picture-marker', url: '/path/to/icon.png', width: 24, height: 24, angle: 0, xoffset: 0, yoffset: 0 } }
|
|
36
|
+
*
|
|
37
|
+
* // ArcGIS simple-marker 配置 (根据 style 返回对应的 OpenLayers 样式)
|
|
38
|
+
* // style 可选值: 'circle', 'square', 'diamond', 'triangle', 'cross', 'x', 'path'
|
|
39
|
+
* { symbol: { type: 'simple-marker', style: 'circle', size: 12, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 1 } } }
|
|
40
|
+
* { symbol: { type: 'simple-marker', style: 'square', size: 12, color: [0, 128, 255, 1], outline: { color: [0, 0, 0, 1], width: 2 } } }
|
|
41
|
+
* { symbol: { type: 'simple-marker', style: 'diamond', size: 14, color: [255, 215, 0, 1], outline: { color: [139, 69, 19, 1], width: 1 } } }
|
|
42
|
+
* { symbol: { type: 'simple-marker', style: 'triangle', size: 12, color: [0, 255, 0, 1], outline: { color: [0, 100, 0, 1], width: 1 } } }
|
|
43
|
+
* { symbol: { type: 'simple-marker', style: 'cross', size: 12, outline: { color: [255, 0, 0, 1], width: 2 } } }
|
|
44
|
+
* { symbol: { type: 'simple-marker', style: 'x', size: 12, outline: { color: [0, 0, 255, 1], width: 2 } } }
|
|
45
|
+
*
|
|
46
|
+
* // 数组配置(图标 + 文字)
|
|
47
|
+
* {
|
|
48
|
+
* symbol: [
|
|
49
|
+
* { type: 'icon', url: '/path/to/icon.png', scale: 1 },
|
|
50
|
+
* { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], offsetY: 20 }
|
|
51
|
+
* ]
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* // 数组配置(圆点 + 文字)
|
|
55
|
+
* {
|
|
56
|
+
* symbol: [
|
|
57
|
+
* { type: 'circle', radius: 10, fillColor: 'rgba(255,0,0,0.8)', strokeColor: '#fff', strokeWidth: 2 },
|
|
58
|
+
* { type: 'text', field: 'label', font: '12px Arial', fillColor: [255,255,255], offsetY: 0 }
|
|
59
|
+
* ]
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* // 数组配置(五角星 + 文字)
|
|
63
|
+
* {
|
|
64
|
+
* symbol: [
|
|
65
|
+
* { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' },
|
|
66
|
+
* { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 18 }
|
|
67
|
+
* ]
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // 数组配置(ArcGIS simple-marker + 文字)
|
|
71
|
+
* {
|
|
72
|
+
* symbol: [
|
|
73
|
+
* { type: 'simple-marker', style: 'diamond', size: 16, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 2 } },
|
|
74
|
+
* { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 20 }
|
|
75
|
+
* ]
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
export declare function getPointStyle(symbol: any, attributes?: any): Style | Style[];
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import h from "ol/style/Circle";
|
|
2
|
+
import p from "ol/style/Fill";
|
|
3
|
+
import M from "ol/style/Icon";
|
|
4
|
+
import u from "ol/style/RegularShape";
|
|
5
|
+
import d from "ol/style/Stroke";
|
|
6
|
+
import f from "ol/style/Style";
|
|
7
|
+
import P from "ol/style/Text";
|
|
8
|
+
const c = /* @__PURE__ */ new Map();
|
|
9
|
+
let w = null;
|
|
10
|
+
function U(e, t) {
|
|
11
|
+
return e ? Array.isArray(e) ? e.map((a) => {
|
|
12
|
+
if (a.type === "text" && a.field) {
|
|
13
|
+
const n = (t == null ? void 0 : t[a.field]) ?? "";
|
|
14
|
+
return JSON.stringify({ ...a, __textContent__: n });
|
|
15
|
+
}
|
|
16
|
+
return JSON.stringify(a);
|
|
17
|
+
}).join("|") : JSON.stringify(e) : "__default__";
|
|
18
|
+
}
|
|
19
|
+
function k() {
|
|
20
|
+
return w || (w = new f({
|
|
21
|
+
image: new h({
|
|
22
|
+
radius: 6,
|
|
23
|
+
fill: new p({ color: "#2563eb" }),
|
|
24
|
+
stroke: new d({ color: "#ffffff", width: 1.5 })
|
|
25
|
+
})
|
|
26
|
+
})), w;
|
|
27
|
+
}
|
|
28
|
+
function S(e) {
|
|
29
|
+
const t = new M({
|
|
30
|
+
src: e.url,
|
|
31
|
+
scale: e.scale ?? 1,
|
|
32
|
+
anchor: e.anchor ?? [0.5, 0.5],
|
|
33
|
+
anchorXUnits: e.anchorXUnits ?? "fraction",
|
|
34
|
+
anchorYUnits: e.anchorYUnits ?? "fraction",
|
|
35
|
+
rotation: e.rotation ?? 0
|
|
36
|
+
});
|
|
37
|
+
return new f({ image: t });
|
|
38
|
+
}
|
|
39
|
+
function x(e) {
|
|
40
|
+
const t = new h({
|
|
41
|
+
radius: e.radius ?? 6,
|
|
42
|
+
fill: new p({ color: e.fillColor ?? "#2563eb" }),
|
|
43
|
+
stroke: new d({
|
|
44
|
+
color: e.strokeColor ?? "#ffffff",
|
|
45
|
+
width: e.strokeWidth ?? 1.5
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
return new f({ image: t });
|
|
49
|
+
}
|
|
50
|
+
function C(e) {
|
|
51
|
+
const t = new u({
|
|
52
|
+
points: e.points ?? 4,
|
|
53
|
+
radius: e.radius ?? 10,
|
|
54
|
+
radius2: e.radius2,
|
|
55
|
+
angle: e.angle ?? 0,
|
|
56
|
+
rotation: e.rotation ?? 0,
|
|
57
|
+
fill: e.fillColor ? new p({ color: e.fillColor }) : void 0,
|
|
58
|
+
stroke: new d({
|
|
59
|
+
color: e.strokeColor ?? "#000000",
|
|
60
|
+
width: e.strokeWidth ?? 1
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
return new f({ image: t });
|
|
64
|
+
}
|
|
65
|
+
function _(e) {
|
|
66
|
+
const t = e.width != null || e.height != null, i = {
|
|
67
|
+
src: e.url,
|
|
68
|
+
anchor: e.anchor ?? [0.5, 0.5],
|
|
69
|
+
anchorXUnits: "fraction",
|
|
70
|
+
anchorYUnits: "fraction",
|
|
71
|
+
rotation: (e.angle ?? 0) * Math.PI / 180,
|
|
72
|
+
// ArcGIS angle 是角度,转换为弧度
|
|
73
|
+
displacement: [e.xoffset ?? 0, -(e.yoffset ?? 0)]
|
|
74
|
+
// yoffset 取反以匹配 ArcGIS 方向
|
|
75
|
+
};
|
|
76
|
+
t ? (e.width != null && (i.width = e.width), e.height != null && (i.height = e.height)) : e.scale != null && (i.scale = e.scale);
|
|
77
|
+
const a = new M(i);
|
|
78
|
+
return new f({ image: a });
|
|
79
|
+
}
|
|
80
|
+
function A(e) {
|
|
81
|
+
var s, g;
|
|
82
|
+
const t = e.size ?? 12, i = e.color ?? [0, 0, 0, 1], a = ((s = e.outline) == null ? void 0 : s.color) ?? [255, 255, 255, 1], n = ((g = e.outline) == null ? void 0 : g.width) ?? 1, o = new p({ color: i }), r = new d({ color: a, width: n });
|
|
83
|
+
let l;
|
|
84
|
+
switch (e.style) {
|
|
85
|
+
case "circle":
|
|
86
|
+
l = new h({
|
|
87
|
+
radius: t / 2,
|
|
88
|
+
fill: o,
|
|
89
|
+
stroke: r
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
case "square":
|
|
93
|
+
l = new u({
|
|
94
|
+
points: 4,
|
|
95
|
+
radius: t / 2,
|
|
96
|
+
angle: Math.PI / 4,
|
|
97
|
+
// 旋转45度使其成为正方形
|
|
98
|
+
fill: o,
|
|
99
|
+
stroke: r
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
case "diamond":
|
|
103
|
+
l = new u({
|
|
104
|
+
points: 4,
|
|
105
|
+
radius: t / 2,
|
|
106
|
+
angle: 0,
|
|
107
|
+
// 不旋转,呈菱形
|
|
108
|
+
fill: o,
|
|
109
|
+
stroke: r
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
case "triangle":
|
|
113
|
+
l = new u({
|
|
114
|
+
points: 3,
|
|
115
|
+
radius: t / 2,
|
|
116
|
+
angle: 0,
|
|
117
|
+
fill: o,
|
|
118
|
+
stroke: r
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
case "cross":
|
|
122
|
+
l = new u({
|
|
123
|
+
points: 4,
|
|
124
|
+
radius: t / 2,
|
|
125
|
+
radius2: 0,
|
|
126
|
+
angle: 0,
|
|
127
|
+
stroke: r
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
case "x":
|
|
131
|
+
l = new u({
|
|
132
|
+
points: 4,
|
|
133
|
+
radius: t / 2,
|
|
134
|
+
radius2: 0,
|
|
135
|
+
angle: Math.PI / 4,
|
|
136
|
+
// 旋转45度成为 X
|
|
137
|
+
stroke: r
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
case "path":
|
|
141
|
+
l = new h({
|
|
142
|
+
radius: t / 2,
|
|
143
|
+
fill: o,
|
|
144
|
+
stroke: r
|
|
145
|
+
});
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
l = new h({
|
|
149
|
+
radius: t / 2,
|
|
150
|
+
fill: o,
|
|
151
|
+
stroke: r
|
|
152
|
+
});
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
return new f({ image: l });
|
|
156
|
+
}
|
|
157
|
+
function I(e, t) {
|
|
158
|
+
const i = new P({
|
|
159
|
+
text: String(t),
|
|
160
|
+
font: e.font ?? "14px Arial Unicode MS",
|
|
161
|
+
fill: new p({
|
|
162
|
+
color: e.fillColor ?? [0, 0, 0]
|
|
163
|
+
}),
|
|
164
|
+
stroke: new d({
|
|
165
|
+
color: e.strokeColor ?? [255, 255, 255],
|
|
166
|
+
width: e.strokeWidth ?? 3
|
|
167
|
+
}),
|
|
168
|
+
offsetX: e.offsetX ?? 0,
|
|
169
|
+
offsetY: e.offsetY ?? 0,
|
|
170
|
+
textAlign: e.textAlign ?? "center",
|
|
171
|
+
textBaseline: e.textBaseline ?? "middle"
|
|
172
|
+
});
|
|
173
|
+
return new f({ text: i });
|
|
174
|
+
}
|
|
175
|
+
function B(e, t) {
|
|
176
|
+
if (!e)
|
|
177
|
+
return k();
|
|
178
|
+
const i = U(e, t), a = c.get(i);
|
|
179
|
+
if (a)
|
|
180
|
+
return a;
|
|
181
|
+
let n;
|
|
182
|
+
if (Array.isArray(e) && e.length > 0) {
|
|
183
|
+
const o = [];
|
|
184
|
+
if (e.forEach((r) => {
|
|
185
|
+
if (r.type === "icon" && r.url)
|
|
186
|
+
o.push(S(r));
|
|
187
|
+
else if (r.type === "picture-marker" && r.url)
|
|
188
|
+
o.push(_(r));
|
|
189
|
+
else if (r.type === "simple-marker")
|
|
190
|
+
o.push(A(r));
|
|
191
|
+
else if (r.type === "circle")
|
|
192
|
+
o.push(x(r));
|
|
193
|
+
else if (r.type === "shape")
|
|
194
|
+
o.push(C(r));
|
|
195
|
+
else if (r.type === "text" && r.field) {
|
|
196
|
+
const l = (t == null ? void 0 : t[r.field]) ?? "";
|
|
197
|
+
l && o.push(I(r, l));
|
|
198
|
+
}
|
|
199
|
+
}), o.length > 0)
|
|
200
|
+
return n = o, c.set(i, n), n;
|
|
201
|
+
}
|
|
202
|
+
return e && e.url ? (n = S(e), c.set(i, n), n) : e && e.type === "picture-marker" && e.url ? (n = _(e), c.set(i, n), n) : e && e.type === "simple-marker" ? (n = A(e), c.set(i, n), n) : e && e.type === "circle" ? (n = x(e), c.set(i, n), n) : e && e.type === "shape" ? (n = C(e), c.set(i, n), n) : k();
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
B as getPointStyle
|
|
206
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Style from 'ol/style/Style';
|
|
2
|
+
/**
|
|
3
|
+
* 清除样式缓存
|
|
4
|
+
*/
|
|
5
|
+
export declare function clearStyleCache(): void;
|
|
6
|
+
/**
|
|
7
|
+
* 获取当前缓存大小
|
|
8
|
+
*/
|
|
9
|
+
export declare function getStyleCacheSize(): number;
|
|
10
|
+
/**
|
|
11
|
+
* 获取多边形样式
|
|
12
|
+
* 支持 symbol 数组配置(polygon + text),或单个 symbol 配置
|
|
13
|
+
* 若 symbol 为空则显示默认半透明蓝色填充
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // 简单多边形样式配置
|
|
17
|
+
* { symbol: { fillColor: 'rgba(255,0,0,0.5)', strokeColor: '#ff0000', strokeWidth: 2 } }
|
|
18
|
+
*
|
|
19
|
+
* // 仅边框样式配置(无填充)
|
|
20
|
+
* { symbol: { strokeColor: '#2563eb', strokeWidth: 3 } }
|
|
21
|
+
*
|
|
22
|
+
* // 虚线边框样式配置
|
|
23
|
+
* { symbol: { fillColor: 'rgba(0,128,255,0.3)', strokeColor: '#0080ff', strokeWidth: 2, lineDash: [10, 5] } }
|
|
24
|
+
*
|
|
25
|
+
* // 带边框的多边形样式配置(双边框效果)
|
|
26
|
+
* { symbol: { type: 'bordered', fillColor: 'rgba(255,255,255,0.8)', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#333333', borderWidth: 1 } }
|
|
27
|
+
*
|
|
28
|
+
* // 数组配置(多边形 + 文字)
|
|
29
|
+
* {
|
|
30
|
+
* symbol: [
|
|
31
|
+
* { type: 'polygon', fillColor: 'rgba(255,0,0,0.5)', strokeColor: '#ff0000', strokeWidth: 2 },
|
|
32
|
+
* { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0] }
|
|
33
|
+
* ]
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* // 数组配置(带边框多边形 + 文字)
|
|
37
|
+
* {
|
|
38
|
+
* symbol: [
|
|
39
|
+
* { type: 'bordered', fillColor: 'rgba(255,255,255,0.8)', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#333333', borderWidth: 1 },
|
|
40
|
+
* { type: 'text', field: 'areaName', font: '12px Arial', fillColor: [0,0,0] }
|
|
41
|
+
* ]
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* // ArcGIS simple-fill 配置
|
|
45
|
+
* // style 可选值: 'solid', 'none', 'horizontal', 'vertical', 'cross', 'forward-diagonal', 'backward-diagonal', 'diagonal-cross'
|
|
46
|
+
* { symbol: { type: 'simple-fill', style: 'solid', color: [255, 0, 0, 0.5], outline: { color: [0, 0, 0, 1], width: 2, style: 'solid' } } }
|
|
47
|
+
* { symbol: { type: 'simple-fill', style: 'none', outline: { color: [255, 0, 0, 1], width: 3, style: 'dash' } } }
|
|
48
|
+
*
|
|
49
|
+
* // ArcGIS picture-fill 配置(降级为纯色填充)
|
|
50
|
+
* { symbol: { type: 'picture-fill', url: '/path/to/pattern.png', width: 32, height: 32, outline: { color: [0, 0, 0, 1], width: 1 } } }
|
|
51
|
+
*
|
|
52
|
+
* // 数组配置(ArcGIS simple-fill + 文字)
|
|
53
|
+
* {
|
|
54
|
+
* symbol: [
|
|
55
|
+
* { type: 'simple-fill', style: 'solid', color: [0, 128, 255, 0.4], outline: { color: [0, 0, 128, 1], width: 2, style: 'solid' } },
|
|
56
|
+
* { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0] }
|
|
57
|
+
* ]
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
export declare function getPolygonStyle(symbol: any, attributes?: any): Style | Style[];
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import f from "ol/style/Fill";
|
|
2
|
+
import c from "ol/style/Stroke";
|
|
3
|
+
import a from "ol/style/Style";
|
|
4
|
+
import k from "ol/style/Text";
|
|
5
|
+
import { getLineDashByStyle as C } from "./line-style.mjs";
|
|
6
|
+
const u = /* @__PURE__ */ new Map();
|
|
7
|
+
let d = null;
|
|
8
|
+
function D(e, n) {
|
|
9
|
+
return e ? Array.isArray(e) ? e.map((l) => {
|
|
10
|
+
if (l.type === "text" && l.field) {
|
|
11
|
+
const t = (n == null ? void 0 : n[l.field]) ?? "";
|
|
12
|
+
return JSON.stringify({ ...l, __textContent__: t });
|
|
13
|
+
}
|
|
14
|
+
return JSON.stringify(l);
|
|
15
|
+
}).join("|") : JSON.stringify(e) : "__default__";
|
|
16
|
+
}
|
|
17
|
+
function p() {
|
|
18
|
+
return d || (d = new a({
|
|
19
|
+
fill: new f({
|
|
20
|
+
color: "rgba(37, 99, 235, 0.3)"
|
|
21
|
+
}),
|
|
22
|
+
stroke: new c({
|
|
23
|
+
color: "#2563eb",
|
|
24
|
+
width: 2
|
|
25
|
+
})
|
|
26
|
+
})), d;
|
|
27
|
+
}
|
|
28
|
+
function w(e) {
|
|
29
|
+
return new a({
|
|
30
|
+
fill: e.fillColor ? new f({ color: e.fillColor }) : void 0,
|
|
31
|
+
stroke: new c({
|
|
32
|
+
color: e.strokeColor ?? "#2563eb",
|
|
33
|
+
width: e.strokeWidth ?? 2,
|
|
34
|
+
lineCap: e.lineCap ?? "round",
|
|
35
|
+
lineJoin: e.lineJoin ?? "round",
|
|
36
|
+
lineDash: e.lineDash,
|
|
37
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function x(e, n) {
|
|
42
|
+
switch (e) {
|
|
43
|
+
case "solid":
|
|
44
|
+
return new f({ color: n ?? [0, 0, 0, 0.5] });
|
|
45
|
+
case "none":
|
|
46
|
+
case "null":
|
|
47
|
+
return;
|
|
48
|
+
case "horizontal":
|
|
49
|
+
case "vertical":
|
|
50
|
+
case "cross":
|
|
51
|
+
case "forward-diagonal":
|
|
52
|
+
case "backward-diagonal":
|
|
53
|
+
case "diagonal-cross":
|
|
54
|
+
return new f({ color: n ?? [0, 0, 0, 0.3] });
|
|
55
|
+
default:
|
|
56
|
+
return new f({ color: n ?? [0, 0, 0, 0.5] });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function S(e) {
|
|
60
|
+
const n = e.style ?? "solid", o = x(n, e.color);
|
|
61
|
+
let l;
|
|
62
|
+
if (e.outline) {
|
|
63
|
+
const t = e.outline.width ?? 1, r = e.outline.style ?? "solid", i = C(r, t);
|
|
64
|
+
l = new c({
|
|
65
|
+
color: e.outline.color ?? [0, 0, 0, 1],
|
|
66
|
+
width: t,
|
|
67
|
+
lineCap: e.outline.cap ?? "round",
|
|
68
|
+
lineJoin: e.outline.join ?? "round",
|
|
69
|
+
lineDash: i
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return new a({
|
|
73
|
+
fill: o,
|
|
74
|
+
stroke: l
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function s(e) {
|
|
78
|
+
const n = new f({
|
|
79
|
+
color: e.color ?? "rgba(128, 128, 128, 0.3)"
|
|
80
|
+
});
|
|
81
|
+
let o;
|
|
82
|
+
if (e.outline) {
|
|
83
|
+
const l = e.outline.width ?? 1, t = e.outline.style ?? "solid", r = C(t, l);
|
|
84
|
+
o = new c({
|
|
85
|
+
color: e.outline.color ?? [0, 0, 0, 1],
|
|
86
|
+
width: l,
|
|
87
|
+
lineDash: r
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return new a({
|
|
91
|
+
fill: n,
|
|
92
|
+
stroke: o
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function g(e) {
|
|
96
|
+
const n = new a({
|
|
97
|
+
stroke: new c({
|
|
98
|
+
color: e.borderColor ?? "#000000",
|
|
99
|
+
width: (e.strokeWidth ?? 2) + (e.borderWidth ?? 2) * 2,
|
|
100
|
+
lineCap: e.lineCap ?? "round",
|
|
101
|
+
lineJoin: e.lineJoin ?? "round",
|
|
102
|
+
lineDash: e.lineDash,
|
|
103
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
104
|
+
})
|
|
105
|
+
}), o = new a({
|
|
106
|
+
fill: e.fillColor ? new f({ color: e.fillColor }) : void 0,
|
|
107
|
+
stroke: new c({
|
|
108
|
+
color: e.strokeColor ?? "#2563eb",
|
|
109
|
+
width: e.strokeWidth ?? 2,
|
|
110
|
+
lineCap: e.lineCap ?? "round",
|
|
111
|
+
lineJoin: e.lineJoin ?? "round",
|
|
112
|
+
lineDash: e.lineDash,
|
|
113
|
+
lineDashOffset: e.lineDashOffset ?? 0
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
return [n, o];
|
|
117
|
+
}
|
|
118
|
+
function J(e, n) {
|
|
119
|
+
const o = new k({
|
|
120
|
+
text: String(n),
|
|
121
|
+
font: e.font ?? "14px Arial Unicode MS",
|
|
122
|
+
fill: new f({
|
|
123
|
+
color: e.fillColor ?? [0, 0, 0]
|
|
124
|
+
}),
|
|
125
|
+
stroke: new c({
|
|
126
|
+
color: e.strokeColor ?? [255, 255, 255],
|
|
127
|
+
width: e.strokeWidth ?? 3
|
|
128
|
+
}),
|
|
129
|
+
offsetX: e.offsetX ?? 0,
|
|
130
|
+
offsetY: e.offsetY ?? 0,
|
|
131
|
+
textAlign: e.textAlign ?? "center",
|
|
132
|
+
textBaseline: e.textBaseline ?? "middle",
|
|
133
|
+
overflow: e.overflow ?? !1
|
|
134
|
+
});
|
|
135
|
+
return new a({ text: o });
|
|
136
|
+
}
|
|
137
|
+
function P(e, n) {
|
|
138
|
+
if (!e)
|
|
139
|
+
return p();
|
|
140
|
+
const o = D(e, n), l = u.get(o);
|
|
141
|
+
if (l)
|
|
142
|
+
return l;
|
|
143
|
+
let t;
|
|
144
|
+
if (Array.isArray(e) && e.length > 0) {
|
|
145
|
+
const r = [];
|
|
146
|
+
if (e.forEach((i) => {
|
|
147
|
+
if (i.type === "polygon")
|
|
148
|
+
r.push(w(i));
|
|
149
|
+
else if (i.type === "simple-fill")
|
|
150
|
+
r.push(S(i));
|
|
151
|
+
else if (i.type === "picture-fill")
|
|
152
|
+
r.push(s(i));
|
|
153
|
+
else if (i.type === "bordered")
|
|
154
|
+
r.push(...g(i));
|
|
155
|
+
else if (i.type === "text" && i.field) {
|
|
156
|
+
const h = (n == null ? void 0 : n[i.field]) ?? "";
|
|
157
|
+
h && r.push(J(i, h));
|
|
158
|
+
}
|
|
159
|
+
}), r.length > 0)
|
|
160
|
+
return t = r, u.set(o, t), t;
|
|
161
|
+
}
|
|
162
|
+
return e && e.type === "bordered" ? (t = g(e), u.set(o, t), t) : e && e.type === "simple-fill" ? (t = S(e), u.set(o, t), t) : e && e.type === "picture-fill" ? (t = s(e), u.set(o, t), t) : e ? (t = w(e), u.set(o, t), t) : p();
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
P as getPolygonStyle
|
|
166
|
+
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export interface IOverlayParam {
|
|
|
149
149
|
defaultSymbol?: IPointSymbol | ILineSymbol | IPolygonSymbol;
|
|
150
150
|
defaultVisible?: boolean;
|
|
151
151
|
overlays: Array<IOverlay>;
|
|
152
|
+
needZoom?: boolean;
|
|
152
153
|
}
|
|
153
154
|
export interface IClusterPointParams {
|
|
154
155
|
type?: string;
|
|
@@ -323,7 +324,7 @@ export interface ISignalSubSystem {
|
|
|
323
324
|
subShape?: number[][][] | string;
|
|
324
325
|
nodeSymbol?: any;
|
|
325
326
|
roadSymbol?: any;
|
|
326
|
-
children
|
|
327
|
+
children?: {
|
|
327
328
|
x: number;
|
|
328
329
|
y: number;
|
|
329
330
|
nodeId: string;
|
|
@@ -123,8 +123,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
123
123
|
removeAllClusterPoints: () => void;
|
|
124
124
|
addMask: (params: IMaskParam) => void;
|
|
125
125
|
removeMask: () => void;
|
|
126
|
-
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
127
|
-
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
126
|
+
removeOverlaysByType: (types: string[] | string) => import("../types").IResult;
|
|
127
|
+
removeOverlaysById: (ids: string[] | string) => import("../types").IResult;
|
|
128
128
|
removeAllOverlays: () => import("../types").IResult;
|
|
129
129
|
showAllOverlays: () => void;
|
|
130
130
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|