gisviewer-vue3-arcgis 1.0.158 → 1.0.159
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/utils/common-utils.d.ts +2 -2
- package/es/src/gis-map/utils/common-utils.mjs +24 -24
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +23 -23
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +4 -8
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +136 -238
- package/lib/src/gis-map/utils/common-utils.d.ts +2 -2
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.d.ts +4 -8
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +2 -1
|
@@ -80,7 +80,7 @@ export default class CommonUtils {
|
|
|
80
80
|
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
81
81
|
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
82
82
|
static isCoordinateValid(coordinate: {
|
|
83
|
-
latitude: number;
|
|
84
|
-
longitude: number;
|
|
83
|
+
latitude: number | string;
|
|
84
|
+
longitude: number | string;
|
|
85
85
|
}): boolean;
|
|
86
86
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Point as
|
|
1
|
+
import { Point as O, Polyline as f } from "@arcgis/core/geometry";
|
|
2
2
|
import * as g from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
|
-
import * as
|
|
3
|
+
import * as l from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
4
|
import p from "@turf/bearing";
|
|
5
5
|
import u from "@turf/destination";
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import * as o from "@turf/helpers";
|
|
7
|
+
import L from "pako";
|
|
8
|
+
import y from "proj4";
|
|
9
9
|
class i {
|
|
10
10
|
/**
|
|
11
11
|
* 得到某个点在一定方向、距离之外的另一个点
|
|
@@ -15,10 +15,10 @@ class i {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
static destinationWithPoint(t, e, n) {
|
|
18
|
-
const r =
|
|
18
|
+
const r = o.point([t.x, t.y]), s = u(r, n, e, {
|
|
19
19
|
units: "meters"
|
|
20
20
|
});
|
|
21
|
-
return new
|
|
21
|
+
return new O({
|
|
22
22
|
x: s.geometry.coordinates[0],
|
|
23
23
|
y: s.geometry.coordinates[1]
|
|
24
24
|
});
|
|
@@ -29,7 +29,7 @@ class i {
|
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
31
|
static angleOfLine(t) {
|
|
32
|
-
const e = t.paths[0], n =
|
|
32
|
+
const e = t.paths[0], n = o.point(e[0]), r = o.point(e[e.length - 1]);
|
|
33
33
|
return p(n, r);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -38,9 +38,9 @@ class i {
|
|
|
38
38
|
* @param distance
|
|
39
39
|
*/
|
|
40
40
|
static extendLineInTowDir(t, e) {
|
|
41
|
-
const n = t.paths[0], r =
|
|
41
|
+
const n = t.paths[0], r = o.point(n[0]), s = o.point(n[1]), a = p(s, r), c = u(r, e, a, {
|
|
42
42
|
units: "meters"
|
|
43
|
-
}),
|
|
43
|
+
}), h = a > 0 ? a - 180 : a + 180, P = u(s, e, h, {
|
|
44
44
|
units: "meters"
|
|
45
45
|
});
|
|
46
46
|
return new f({
|
|
@@ -82,9 +82,9 @@ class i {
|
|
|
82
82
|
e,
|
|
83
83
|
s
|
|
84
84
|
), await i.pointDistance(r) > 2.5) {
|
|
85
|
-
const
|
|
85
|
+
const a = new f({ paths: [r] });
|
|
86
86
|
return (await i.getOffsetLine(
|
|
87
|
-
|
|
87
|
+
a,
|
|
88
88
|
-s
|
|
89
89
|
)).paths[0];
|
|
90
90
|
}
|
|
@@ -114,8 +114,8 @@ class i {
|
|
|
114
114
|
n !== 0 && (t = await i.getOffsetLine(t, n));
|
|
115
115
|
const r = await g.intersect(t, e);
|
|
116
116
|
if (r instanceof f) {
|
|
117
|
-
const s = r.paths[0],
|
|
118
|
-
return [
|
|
117
|
+
const s = r.paths[0], a = s[0], c = s[s.length - 1];
|
|
118
|
+
return [a, c];
|
|
119
119
|
}
|
|
120
120
|
return [];
|
|
121
121
|
}
|
|
@@ -126,12 +126,12 @@ class i {
|
|
|
126
126
|
* @returns 平移后的polyline
|
|
127
127
|
*/
|
|
128
128
|
static async getOffsetLine(t, e) {
|
|
129
|
-
const n =
|
|
129
|
+
const n = l.geographicToWebMercator(t), r = await g.offset(
|
|
130
130
|
n,
|
|
131
131
|
e,
|
|
132
132
|
"meters"
|
|
133
133
|
);
|
|
134
|
-
return
|
|
134
|
+
return l.webMercatorToGeographic(
|
|
135
135
|
r,
|
|
136
136
|
!1
|
|
137
137
|
);
|
|
@@ -145,11 +145,11 @@ class i {
|
|
|
145
145
|
try {
|
|
146
146
|
const e = [], n = t.split("");
|
|
147
147
|
for (let s = 0; s < n.length; s++) {
|
|
148
|
-
const
|
|
149
|
-
e.push(
|
|
148
|
+
const a = n[s];
|
|
149
|
+
e.push(a.charCodeAt(0));
|
|
150
150
|
}
|
|
151
151
|
const r = new Uint8Array(e);
|
|
152
|
-
return
|
|
152
|
+
return L.inflate(r, { to: "string" });
|
|
153
153
|
} catch {
|
|
154
154
|
console.log(`非压缩内容: ${t}`);
|
|
155
155
|
}
|
|
@@ -183,7 +183,7 @@ class i {
|
|
|
183
183
|
static transformLineProjection(t) {
|
|
184
184
|
try {
|
|
185
185
|
return t.map(
|
|
186
|
-
(e) =>
|
|
186
|
+
(e) => y(i.geoReference).inverse([
|
|
187
187
|
e[0] - i.xOffset,
|
|
188
188
|
e[1] - i.yOffset
|
|
189
189
|
])
|
|
@@ -197,7 +197,7 @@ class i {
|
|
|
197
197
|
}
|
|
198
198
|
static transformPointProjection(t) {
|
|
199
199
|
try {
|
|
200
|
-
return
|
|
200
|
+
return y(i.geoReference).inverse([
|
|
201
201
|
t[0] - i.xOffset,
|
|
202
202
|
t[1] - i.yOffset
|
|
203
203
|
]);
|
|
@@ -212,11 +212,11 @@ class i {
|
|
|
212
212
|
return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
|
|
213
213
|
}
|
|
214
214
|
static getExtensionLine(t, e, n) {
|
|
215
|
-
const r =
|
|
216
|
-
return u(s, n,
|
|
215
|
+
const r = o.point(t), s = o.point(e), a = p(r, s);
|
|
216
|
+
return u(s, n, a, { units: "meters" }).geometry.coordinates;
|
|
217
217
|
}
|
|
218
218
|
static isCoordinateValid(t) {
|
|
219
|
-
return t.latitude
|
|
219
|
+
return typeof t.latitude == "string" && (t.latitude = Number(t.latitude)), typeof t.longitude == "string" && (t.longitude = Number(t.longitude)), t.latitude !== null && t.longitude !== null && !isNaN(t.latitude) && !isNaN(t.longitude) && t.latitude !== 0 && t.longitude !== 0;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
export {
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import h from "../common-utils.mjs";
|
|
2
2
|
class r {
|
|
3
|
-
constructor(
|
|
3
|
+
constructor(s) {
|
|
4
4
|
this.parentName = "", this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
5
5
|
Math.floor(Math.random() * 255),
|
|
6
6
|
Math.floor(Math.random() * 255),
|
|
7
7
|
Math.floor(Math.random() * 255)
|
|
8
|
-
], this.crossCount = 0, this.subDistrictCount = 0, this.id =
|
|
9
|
-
for (const
|
|
10
|
-
if (
|
|
11
|
-
const o = new r(
|
|
8
|
+
], this.crossCount = 0, this.subDistrictCount = 0, this.id = s.id, this.name = s.name, this.parentId = s.parentId;
|
|
9
|
+
for (const t of s.children)
|
|
10
|
+
if (t.children) {
|
|
11
|
+
const o = new r(t);
|
|
12
12
|
o.parentName = this.name;
|
|
13
|
-
const
|
|
13
|
+
const a = this.areaColor[0], n = this.areaColor[1], e = this.areaColor[2], i = Math.random() * 200 - 100;
|
|
14
14
|
o.areaColor = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
Math.max(a + i, 100),
|
|
16
|
+
Math.max(n + i, 100),
|
|
17
|
+
Math.max(e + i, 100)
|
|
18
18
|
], this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
19
|
-
} else {
|
|
19
|
+
} else if (h.isCoordinateValid(t)) {
|
|
20
20
|
const o = {
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
parentId:
|
|
24
|
-
latitude: Number(
|
|
25
|
-
longitude: Number(
|
|
26
|
-
signalId:
|
|
27
|
-
isKey:
|
|
21
|
+
id: t.id,
|
|
22
|
+
name: t.name,
|
|
23
|
+
parentId: t.parentId,
|
|
24
|
+
latitude: Number(t.latitude),
|
|
25
|
+
longitude: Number(t.longitude),
|
|
26
|
+
signalId: t.signalId,
|
|
27
|
+
isKey: t.isKey === 1
|
|
28
28
|
};
|
|
29
29
|
this.crosses.push(o), this.crossCount++;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
getAllCrossCoordinates() {
|
|
33
|
-
const
|
|
34
|
-
for (const
|
|
35
|
-
|
|
36
|
-
for (const
|
|
37
|
-
|
|
38
|
-
return
|
|
33
|
+
const s = [];
|
|
34
|
+
for (const t of this.crosses)
|
|
35
|
+
s.push([t.longitude, t.latitude]);
|
|
36
|
+
for (const t of this.subDistricts)
|
|
37
|
+
s.push(...t.getAllCrossCoordinates());
|
|
38
|
+
return s;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
@@ -5,12 +5,10 @@ export default class SignalControlAreaController {
|
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
7
|
private highlightLayer;
|
|
8
|
-
private districtControllers;
|
|
9
8
|
private watchHandle?;
|
|
10
|
-
private openDriveServerUrl;
|
|
11
9
|
private readonly crossScale;
|
|
12
10
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
13
|
-
showSignalControlArea(params: any):
|
|
11
|
+
showSignalControlArea(params: any): IResult;
|
|
14
12
|
clearSignalControlArea(): IResult;
|
|
15
13
|
locateSignalControlArea(params: {
|
|
16
14
|
id: string;
|
|
@@ -27,14 +25,12 @@ export default class SignalControlAreaController {
|
|
|
27
25
|
*/
|
|
28
26
|
private findAreaGraphic;
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
28
|
+
* 绘制区控与子区
|
|
31
29
|
* @param districtController
|
|
30
|
+
* @param isDistrict 是否是区控
|
|
32
31
|
* @returns
|
|
33
32
|
*/
|
|
34
|
-
private
|
|
35
|
-
private showSubDistrictCross;
|
|
36
|
-
private loadedSubDistricts;
|
|
37
|
-
private showSubDistrictRoad;
|
|
33
|
+
private drawArea;
|
|
38
34
|
/**
|
|
39
35
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
40
36
|
* @param attributes
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import * as u from "@arcgis/core/core/reactiveUtils.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import S from "../../stores/index.mjs";
|
|
11
|
-
import m from "../common-utils.mjs";
|
|
12
|
-
import v from "./district-controller.mjs";
|
|
13
|
-
class k {
|
|
2
|
+
import y from "@arcgis/core/Graphic";
|
|
3
|
+
import h from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import p from "@turf/buffer";
|
|
5
|
+
import f from "@turf/convex";
|
|
6
|
+
import * as o from "@turf/helpers";
|
|
7
|
+
import d from "concaveman";
|
|
8
|
+
import b from "./district-controller.mjs";
|
|
9
|
+
class x {
|
|
14
10
|
constructor(e) {
|
|
15
|
-
this.
|
|
16
|
-
const i = S.useAppDataStore.mapConfig;
|
|
17
|
-
this.openDriveServerUrl = i.openDriveServer.url, this.districtControllerLayer = new l({
|
|
11
|
+
this.crossScale = 5e3, this.view = e, this.districtControllerLayer = new h({
|
|
18
12
|
id: "districtControllerLayer",
|
|
19
13
|
maxScale: 144447,
|
|
20
14
|
minScale: 1155582
|
|
21
|
-
}), this.subDistrictControllerLayer = new
|
|
15
|
+
}), this.subDistrictControllerLayer = new h({
|
|
22
16
|
id: "subDistrictControllerLayer",
|
|
23
17
|
maxScale: 0,
|
|
24
18
|
minScale: 144447
|
|
25
|
-
}), this.crossLayer = new
|
|
19
|
+
}), this.crossLayer = new h({
|
|
26
20
|
id: "crossLayer",
|
|
27
21
|
maxScale: 0,
|
|
28
22
|
minScale: 36112
|
|
29
|
-
}), this.highlightLayer = new
|
|
23
|
+
}), this.highlightLayer = new h({
|
|
30
24
|
id: "highlightLayer"
|
|
31
25
|
}), this.view.map.addMany([
|
|
32
26
|
this.districtControllerLayer,
|
|
@@ -35,80 +29,82 @@ class k {
|
|
|
35
29
|
this.highlightLayer
|
|
36
30
|
]);
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (const
|
|
41
|
-
const
|
|
42
|
-
this.
|
|
32
|
+
showSignalControlArea(e) {
|
|
33
|
+
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
34
|
+
for (const t of e) {
|
|
35
|
+
const r = new b(t);
|
|
36
|
+
this.drawArea(r, !0);
|
|
43
37
|
}
|
|
44
|
-
this.watchHandle = u.watch(
|
|
38
|
+
return this.watchHandle = u.watch(
|
|
45
39
|
() => this.view.scale,
|
|
46
|
-
(
|
|
47
|
-
r > this.crossScale &&
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
(t, r) => {
|
|
41
|
+
console.log(t, r), t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((s) => {
|
|
42
|
+
s.symbol = this.getCrossGraphicSymbol(
|
|
43
|
+
s.attributes,
|
|
50
44
|
"marker"
|
|
51
45
|
);
|
|
52
|
-
}), this.highlightLayer.graphics.forEach((
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
}), this.highlightLayer.graphics.forEach((s) => {
|
|
47
|
+
s.getAttribute("type") === "cross" && (s.symbol = this.getCrossGraphicSymbol(
|
|
48
|
+
s.attributes,
|
|
55
49
|
"marker"
|
|
56
50
|
));
|
|
57
|
-
})) :
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
})) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((s) => {
|
|
52
|
+
s.symbol = this.getCrossGraphicSymbol(
|
|
53
|
+
s.attributes,
|
|
60
54
|
"picture"
|
|
61
55
|
);
|
|
62
|
-
}), this.highlightLayer.graphics.forEach((
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
}), this.highlightLayer.graphics.forEach((s) => {
|
|
57
|
+
s.getAttribute("type") === "cross" && (s.symbol = this.getCrossGraphicSymbol(
|
|
58
|
+
s.attributes,
|
|
65
59
|
"picture"
|
|
66
60
|
));
|
|
67
61
|
}));
|
|
68
62
|
}
|
|
69
|
-
);
|
|
70
|
-
for (const r of this.districtControllers)
|
|
71
|
-
for (const i of r.subDistricts)
|
|
72
|
-
await this.showSubDistrictRoad(i);
|
|
73
|
-
return console.timeEnd("showSignalControlArea"), { status: 0, message: "ok" };
|
|
63
|
+
), { status: 0, message: "ok" };
|
|
74
64
|
}
|
|
75
65
|
clearSignalControlArea() {
|
|
76
66
|
var e;
|
|
77
67
|
return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.watchHandle) == null || e.remove(), this.view.closePopup(), { status: 0, message: "ok" };
|
|
78
68
|
}
|
|
79
69
|
async locateSignalControlArea(e) {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
target:
|
|
70
|
+
const t = this.findAreaGraphic(e.id);
|
|
71
|
+
return t ? (t.attributes.type === "cross" ? await this.view.goTo({
|
|
72
|
+
target: t.geometry,
|
|
83
73
|
scale: 1500
|
|
84
|
-
}) : await this.view.goTo(
|
|
74
|
+
}) : await this.view.goTo(t.geometry), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
|
|
85
75
|
}
|
|
86
76
|
showPopup(e) {
|
|
87
|
-
const
|
|
77
|
+
const t = e.geometry.type === "point" ? e.geometry : e.geometry.centroid;
|
|
88
78
|
this.view.openPopup({
|
|
89
79
|
features: [e],
|
|
90
|
-
location:
|
|
80
|
+
location: t
|
|
91
81
|
});
|
|
92
82
|
}
|
|
93
83
|
async highlightSignalControlArea(e) {
|
|
94
84
|
if (!e.id || e.id === "")
|
|
95
85
|
return { status: 1, message: "请输入id" };
|
|
96
86
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray().map((i) => i.clone()), r = this.subDistrictControllerLayer.graphics.filter(
|
|
88
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
|
|
89
|
+
).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
|
|
90
|
+
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
91
|
+
).toArray().map((i) => i.clone());
|
|
92
|
+
if (t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0)
|
|
93
|
+
return { status: 1, message: "未找到" };
|
|
94
|
+
if (t.length > 0)
|
|
95
|
+
await this.view.goTo(t);
|
|
96
|
+
else if (r.length > 0) {
|
|
97
|
+
const i = r[0].geometry.centroid;
|
|
98
|
+
await this.view.goTo({
|
|
99
|
+
target: i,
|
|
100
|
+
scale: this.crossScale - 500
|
|
101
|
+
});
|
|
102
|
+
} else
|
|
103
|
+
s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
|
|
104
|
+
target: s[0].geometry,
|
|
105
|
+
scale: 1500
|
|
106
|
+
});
|
|
107
|
+
return { status: 0, message: "ok" };
|
|
112
108
|
}
|
|
113
109
|
resetHighlight() {
|
|
114
110
|
return this.highlightLayer.removeAll(), this.view.closePopup(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
@@ -119,35 +115,47 @@ class k {
|
|
|
119
115
|
* @returns
|
|
120
116
|
*/
|
|
121
117
|
findAreaGraphic(e) {
|
|
122
|
-
let
|
|
123
|
-
(
|
|
118
|
+
let t = this.districtControllerLayer.graphics.find(
|
|
119
|
+
(r) => r.attributes.id === e
|
|
124
120
|
);
|
|
125
|
-
|
|
126
|
-
(
|
|
127
|
-
)),
|
|
128
|
-
return r.toArray();
|
|
121
|
+
return t || (t = this.subDistrictControllerLayer.graphics.find(
|
|
122
|
+
(r) => r.attributes.id === e
|
|
123
|
+
)), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
|
|
129
124
|
}
|
|
130
125
|
/**
|
|
131
|
-
*
|
|
126
|
+
* 绘制区控与子区
|
|
132
127
|
* @param districtController
|
|
128
|
+
* @param isDistrict 是否是区控
|
|
133
129
|
* @returns
|
|
134
130
|
*/
|
|
135
|
-
|
|
131
|
+
drawArea(e, t) {
|
|
136
132
|
const r = e.getAllCrossCoordinates();
|
|
137
133
|
if (r.length >= 2) {
|
|
138
|
-
let
|
|
134
|
+
let i = null;
|
|
139
135
|
if (r.length === 2)
|
|
140
|
-
|
|
141
|
-
else
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
i = o.lineString(r);
|
|
137
|
+
else {
|
|
138
|
+
if (t) {
|
|
139
|
+
const n = o.featureCollection(
|
|
140
|
+
r.map((g) => o.point(g))
|
|
141
|
+
);
|
|
142
|
+
i = f(n);
|
|
143
|
+
} else {
|
|
144
|
+
const n = d(r, 0.5);
|
|
145
|
+
n.length >= 4 && (i = o.polygon([n]));
|
|
146
|
+
}
|
|
147
|
+
i || (i = o.lineString(r));
|
|
146
148
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
const l = p(
|
|
150
|
+
i.geometry,
|
|
151
|
+
// 区控面积更大,需要更大的缓冲半径
|
|
152
|
+
t ? 200 : 30,
|
|
153
|
+
{
|
|
154
|
+
units: "meters"
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
let a;
|
|
158
|
+
t ? a = [
|
|
151
159
|
{
|
|
152
160
|
fieldName: "id",
|
|
153
161
|
label: "区控编号"
|
|
@@ -160,7 +168,17 @@ class k {
|
|
|
160
168
|
fieldName: "subDistrictCount",
|
|
161
169
|
label: "子区数量"
|
|
162
170
|
}
|
|
163
|
-
]
|
|
171
|
+
] : a = [
|
|
172
|
+
{
|
|
173
|
+
fieldName: "parentName",
|
|
174
|
+
label: "所属区控"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
fieldName: "crossCount",
|
|
178
|
+
label: "路口数量"
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
const m = {
|
|
164
182
|
type: "signalControlArea",
|
|
165
183
|
id: e.id,
|
|
166
184
|
name: e.name,
|
|
@@ -168,112 +186,58 @@ class k {
|
|
|
168
186
|
parentName: e.parentName,
|
|
169
187
|
crossCount: e.crossCount,
|
|
170
188
|
subDistrictCount: e.subDistrictCount
|
|
171
|
-
},
|
|
189
|
+
}, c = new y({
|
|
172
190
|
geometry: {
|
|
173
191
|
type: "polygon",
|
|
174
|
-
rings:
|
|
192
|
+
rings: l.geometry.coordinates
|
|
175
193
|
},
|
|
176
194
|
symbol: {
|
|
177
195
|
type: "simple-fill",
|
|
178
|
-
color: [...e.areaColor, 0.
|
|
196
|
+
color: [...e.areaColor, 0.2],
|
|
179
197
|
outline: {
|
|
180
198
|
color: e.areaColor,
|
|
181
|
-
width:
|
|
199
|
+
width: 3,
|
|
200
|
+
style: t ? "solid" : "long-dash"
|
|
182
201
|
}
|
|
183
202
|
},
|
|
184
|
-
attributes:
|
|
203
|
+
attributes: m,
|
|
185
204
|
popupTemplate: {
|
|
186
|
-
title:
|
|
205
|
+
title: `${t ? "区控" : "子区"} ${e.name}`,
|
|
187
206
|
content: [
|
|
188
207
|
{
|
|
189
208
|
type: "fields",
|
|
190
|
-
fieldInfos:
|
|
209
|
+
fieldInfos: a
|
|
191
210
|
}
|
|
192
211
|
]
|
|
193
212
|
}
|
|
194
213
|
});
|
|
195
|
-
this.districtControllerLayer.add(
|
|
214
|
+
t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
|
|
196
215
|
}
|
|
197
|
-
for (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
e.crosses = e.crosses.filter(
|
|
203
|
-
(t) => m.isCoordinateValid(t)
|
|
204
|
-
), e.crosses.forEach((t) => {
|
|
205
|
-
if (m.isCoordinateValid(t)) {
|
|
206
|
-
const s = {
|
|
207
|
-
type: "cross",
|
|
208
|
-
id: t.id,
|
|
209
|
-
name: t.name,
|
|
210
|
-
color: e.areaColor,
|
|
211
|
-
signalId: t.signalId,
|
|
212
|
-
districtId: e.id,
|
|
213
|
-
districtName: e.name,
|
|
214
|
-
isKey: t.isKey
|
|
215
|
-
}, o = new a({
|
|
216
|
-
geometry: {
|
|
217
|
-
type: "point",
|
|
218
|
-
x: t.longitude,
|
|
219
|
-
y: t.latitude
|
|
220
|
-
},
|
|
221
|
-
symbol: this.getCrossGraphicSymbol(s, "marker"),
|
|
222
|
-
attributes: s,
|
|
223
|
-
popupTemplate: {
|
|
224
|
-
title: t.name,
|
|
225
|
-
content: [
|
|
226
|
-
{
|
|
227
|
-
type: "fields",
|
|
228
|
-
fieldInfos: [
|
|
229
|
-
{
|
|
230
|
-
fieldName: "districtName",
|
|
231
|
-
label: "区控名称"
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
fieldName: "id",
|
|
235
|
-
label: "路口编号"
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
fieldName: "signalId",
|
|
239
|
-
label: "信号机编号"
|
|
240
|
-
}
|
|
241
|
-
]
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
i.push(o);
|
|
247
|
-
} else
|
|
248
|
-
console.log("路口坐标无效", t);
|
|
249
|
-
}), this.crossLayer.addMany(i);
|
|
250
|
-
}
|
|
251
|
-
showSubDistrictCross(e) {
|
|
252
|
-
const r = [];
|
|
253
|
-
e.crosses = e.crosses.filter(
|
|
254
|
-
(i) => m.isCoordinateValid(i)
|
|
255
|
-
), e.crosses.forEach((i) => {
|
|
256
|
-
const t = {
|
|
216
|
+
for (const i of e.subDistricts)
|
|
217
|
+
this.drawArea(i, !1);
|
|
218
|
+
const s = [];
|
|
219
|
+
e.crosses.forEach((i) => {
|
|
220
|
+
const l = {
|
|
257
221
|
type: "cross",
|
|
258
222
|
id: i.id,
|
|
259
223
|
name: i.name,
|
|
260
224
|
color: e.areaColor,
|
|
261
225
|
signalId: i.signalId,
|
|
262
|
-
districtId: e.parentId,
|
|
263
|
-
districtName: e.parentName,
|
|
264
|
-
subDistrictId: e.id,
|
|
265
|
-
subDistrictName: e.name,
|
|
226
|
+
districtId: t ? e.id : e.parentId,
|
|
227
|
+
districtName: t ? e.name : e.parentName,
|
|
228
|
+
subDistrictId: t ? "" : e.id,
|
|
229
|
+
subDistrictName: t ? "" : e.name,
|
|
266
230
|
isKey: i.isKey
|
|
267
|
-
},
|
|
231
|
+
}, a = new y({
|
|
268
232
|
geometry: {
|
|
269
233
|
type: "point",
|
|
270
234
|
x: i.longitude,
|
|
271
235
|
y: i.latitude
|
|
272
236
|
},
|
|
273
|
-
symbol: this.getCrossGraphicSymbol(
|
|
274
|
-
attributes:
|
|
237
|
+
symbol: this.getCrossGraphicSymbol(l, "marker"),
|
|
238
|
+
attributes: l,
|
|
275
239
|
popupTemplate: {
|
|
276
|
-
title:
|
|
240
|
+
title: i.name,
|
|
277
241
|
content: [
|
|
278
242
|
{
|
|
279
243
|
type: "fields",
|
|
@@ -299,74 +263,8 @@ class k {
|
|
|
299
263
|
]
|
|
300
264
|
}
|
|
301
265
|
});
|
|
302
|
-
|
|
303
|
-
}), this.crossLayer.addMany(
|
|
304
|
-
}
|
|
305
|
-
async showSubDistrictRoad(e) {
|
|
306
|
-
if (e.crosses.length > 1 && !this.loadedSubDistricts.includes(e.id) && this.openDriveServerUrl && this.openDriveServerUrl !== "") {
|
|
307
|
-
this.loadedSubDistricts.push(e.id);
|
|
308
|
-
const r = await C.get(
|
|
309
|
-
`http://${this.openDriveServerUrl}/api/computable/getRoadsectWithinJunctions`,
|
|
310
|
-
{
|
|
311
|
-
params: {
|
|
312
|
-
junctionIds: e.crosses.map((i) => i.id).join(",")
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
);
|
|
316
|
-
if (r.status === 200) {
|
|
317
|
-
const i = r.data.result;
|
|
318
|
-
if (i.length > 0) {
|
|
319
|
-
const t = i.map((h) => new g({ paths: [h] })), s = y.geodesicBuffer(
|
|
320
|
-
t,
|
|
321
|
-
5,
|
|
322
|
-
"meters"
|
|
323
|
-
), o = y.union(
|
|
324
|
-
s
|
|
325
|
-
), c = new a({
|
|
326
|
-
geometry: o,
|
|
327
|
-
symbol: {
|
|
328
|
-
type: "simple-fill",
|
|
329
|
-
color: [...e.areaColor, 0.8],
|
|
330
|
-
outline: {
|
|
331
|
-
color: e.areaColor,
|
|
332
|
-
width: 1
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
attributes: {
|
|
336
|
-
type: "subDistrict",
|
|
337
|
-
districtId: e.parentId,
|
|
338
|
-
districtName: e.parentName,
|
|
339
|
-
subDistrictId: e.id,
|
|
340
|
-
subDistrictName: e.name,
|
|
341
|
-
crossCount: e.crosses.length
|
|
342
|
-
},
|
|
343
|
-
popupTemplate: {
|
|
344
|
-
title: `子区 ${e.name}`,
|
|
345
|
-
content: [
|
|
346
|
-
{
|
|
347
|
-
type: "fields",
|
|
348
|
-
fieldInfos: [
|
|
349
|
-
{
|
|
350
|
-
fieldName: "districtName",
|
|
351
|
-
label: "区控名称"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
fieldName: "subDistrictName",
|
|
355
|
-
label: "子区名称"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
fieldName: "crossCount",
|
|
359
|
-
label: "路口数量"
|
|
360
|
-
}
|
|
361
|
-
]
|
|
362
|
-
}
|
|
363
|
-
]
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
this.subDistrictControllerLayer.add(c);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
266
|
+
s.push(a);
|
|
267
|
+
}), this.crossLayer.addMany(s);
|
|
370
268
|
}
|
|
371
269
|
/**
|
|
372
270
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
@@ -374,10 +272,10 @@ class k {
|
|
|
374
272
|
* @param symbolType
|
|
375
273
|
* @returns
|
|
376
274
|
*/
|
|
377
|
-
getCrossGraphicSymbol(e,
|
|
378
|
-
const { isKey:
|
|
379
|
-
if (
|
|
380
|
-
return
|
|
275
|
+
getCrossGraphicSymbol(e, t) {
|
|
276
|
+
const { isKey: r, color: s } = e;
|
|
277
|
+
if (t === "marker")
|
|
278
|
+
return r ? {
|
|
381
279
|
type: "picture-marker",
|
|
382
280
|
url: "/GisViewerAssets/Images/icon_star.png",
|
|
383
281
|
width: "30px",
|
|
@@ -385,14 +283,14 @@ class k {
|
|
|
385
283
|
} : {
|
|
386
284
|
type: "simple-marker",
|
|
387
285
|
style: "circle",
|
|
388
|
-
color:
|
|
286
|
+
color: s,
|
|
389
287
|
size: 8,
|
|
390
288
|
outline: {
|
|
391
289
|
color: "white",
|
|
392
290
|
width: 1
|
|
393
291
|
}
|
|
394
292
|
};
|
|
395
|
-
if (
|
|
293
|
+
if (t === "picture")
|
|
396
294
|
return {
|
|
397
295
|
type: "cim",
|
|
398
296
|
data: {
|
|
@@ -431,7 +329,7 @@ class k {
|
|
|
431
329
|
height: 12,
|
|
432
330
|
horizontalAlignment: "Center",
|
|
433
331
|
offsetX: 0,
|
|
434
|
-
offsetY:
|
|
332
|
+
offsetY: r ? 50 : 40,
|
|
435
333
|
haloSize: 1,
|
|
436
334
|
haloSymbol: {
|
|
437
335
|
type: "CIMPolygonSymbol",
|
|
@@ -470,11 +368,11 @@ class k {
|
|
|
470
368
|
y: 0
|
|
471
369
|
},
|
|
472
370
|
anchorPointUnits: "Relative",
|
|
473
|
-
size:
|
|
371
|
+
size: r ? 45 : 30,
|
|
474
372
|
rotateClockwise: !0,
|
|
475
373
|
textureFilter: "Picture",
|
|
476
|
-
url: `/GisViewerAssets/Images/xhj_${
|
|
477
|
-
offsetY:
|
|
374
|
+
url: `/GisViewerAssets/Images/xhj_${r ? 4 : 1}.png`,
|
|
375
|
+
offsetY: r ? 22 : 15
|
|
478
376
|
}
|
|
479
377
|
]
|
|
480
378
|
}
|
|
@@ -483,5 +381,5 @@ class k {
|
|
|
483
381
|
}
|
|
484
382
|
}
|
|
485
383
|
export {
|
|
486
|
-
|
|
384
|
+
x as default
|
|
487
385
|
};
|
|
@@ -80,7 +80,7 @@ export default class CommonUtils {
|
|
|
80
80
|
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
81
81
|
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
82
82
|
static isCoordinateValid(coordinate: {
|
|
83
|
-
latitude: number;
|
|
84
|
-
longitude: number;
|
|
83
|
+
latitude: number | string;
|
|
84
|
+
longitude: number | string;
|
|
85
85
|
}): boolean;
|
|
86
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),p=require("@turf/bearing"),g=require("@turf/destination"),b=require("@turf/helpers"),S=require("pako"),P=require("proj4");function y(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),p=require("@turf/bearing"),g=require("@turf/destination"),b=require("@turf/helpers"),S=require("pako"),P=require("proj4");function y(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>c[t]})}}return e.default=c,Object.freeze(e)}const l=y(L),h=y(w),o=y(b);class i{static destinationWithPoint(e,t,n){const r=o.point([e.x,e.y]),s=g(r,n,t,{units:"meters"});return new u.Point({x:s.geometry.coordinates[0],y:s.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=o.point(t[0]),r=o.point(t[t.length-1]);return p(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=o.point(n[0]),s=o.point(n[1]),a=p(s,r),f=g(r,t,a,{units:"meters"}),d=a>0?a-180:a+180,O=g(s,t,d,{units:"meters"});return new u.Polyline({paths:[[f.geometry.coordinates,O.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await l.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await i.getIntersectPointOfLineAndPolygon(e,t);if(await i.pointDistance(r)<3&&n){for(const s of n)if(r=await i.getIntersectPointOfLineAndPolygon(e,t,s),await i.pointDistance(r)>2.5){const a=new u.Polyline({paths:[r]});return(await i.getOffsetLine(a,-s)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new u.Polyline({paths:[e]});return await l.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await i.getOffsetLine(e,n));const r=await l.intersect(e,t);if(r instanceof u.Polyline){const s=r.paths[0],a=s[0],f=s[s.length-1];return[a,f]}return[]}static async getOffsetLine(e,t){const n=h.geographicToWebMercator(e),r=await l.offset(n,t,"meters");return h.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let s=0;s<n.length;s++){const a=n[s];t.push(a.charCodeAt(0))}const r=new Uint8Array(t);return S.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of i.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let s=0;s<r.size();s++)n.push(r.get(s));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){i.geoReference=e,i.xOffset=t,i.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(i.geoReference).inverse([t[0]-i.xOffset,t[1]-i.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static transformPointProjection(e){try{return P(i.geoReference).inverse([e[0]-i.xOffset,e[1]-i.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",i.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=o.point(e),s=o.point(t),a=p(r,s);return g(s,n,a,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return typeof e.latitude=="string"&&(e.latitude=Number(e.latitude)),typeof e.longitude=="string"&&(e.longitude=Number(e.longitude)),e.latitude!==null&&e.longitude!==null&&!isNaN(e.latitude)&&!isNaN(e.longitude)&&e.latitude!==0&&e.longitude!==0}}exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("../common-utils.js");class r{constructor(s){this.parentName="",this.crosses=[],this.subDistricts=[],this.areaColor=[Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)],this.crossCount=0,this.subDistrictCount=0,this.id=s.id,this.name=s.name,this.parentId=s.parentId;for(const t of s.children)if(t.children){const o=new r(t);o.parentName=this.name;const e=this.areaColor[0],a=this.areaColor[1],n=this.areaColor[2],i=Math.random()*200-100;o.areaColor=[Math.max(e+i,100),Math.max(a+i,100),Math.max(n+i,100)],this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else if(h.default.isCoordinateValid(t)){const o={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,isKey:t.isKey===1};this.crosses.push(o),this.crossCount++}}getAllCrossCoordinates(){const s=[];for(const t of this.crosses)s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=r;
|
|
@@ -5,12 +5,10 @@ export default class SignalControlAreaController {
|
|
|
5
5
|
private subDistrictControllerLayer;
|
|
6
6
|
private crossLayer;
|
|
7
7
|
private highlightLayer;
|
|
8
|
-
private districtControllers;
|
|
9
8
|
private watchHandle?;
|
|
10
|
-
private openDriveServerUrl;
|
|
11
9
|
private readonly crossScale;
|
|
12
10
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
13
|
-
showSignalControlArea(params: any):
|
|
11
|
+
showSignalControlArea(params: any): IResult;
|
|
14
12
|
clearSignalControlArea(): IResult;
|
|
15
13
|
locateSignalControlArea(params: {
|
|
16
14
|
id: string;
|
|
@@ -27,14 +25,12 @@ export default class SignalControlAreaController {
|
|
|
27
25
|
*/
|
|
28
26
|
private findAreaGraphic;
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
28
|
+
* 绘制区控与子区
|
|
31
29
|
* @param districtController
|
|
30
|
+
* @param isDistrict 是否是区控
|
|
32
31
|
* @returns
|
|
33
32
|
*/
|
|
34
|
-
private
|
|
35
|
-
private showSubDistrictCross;
|
|
36
|
-
private loadedSubDistricts;
|
|
37
|
-
private showSubDistrictRoad;
|
|
33
|
+
private drawArea;
|
|
38
34
|
/**
|
|
39
35
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
40
36
|
* @param attributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),b=require("@turf/convex"),L=require("@turf/helpers"),C=require("concaveman"),v=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(d),l=g(L);class A{constructor(e){this.crossScale=5e3,this.view=e,this.districtControllerLayer=new h({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new h({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new h({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new h({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new v.default(t);this.drawArea(r,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,r)=>{console.log(t,r),t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>i.clone()),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());if(t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0)return{status:1,message:"未找到"};if(t.length>0)await this.view.goTo(t);else if(r.length>0){const i=r[0].geometry.centroid;await this.view.goTo({target:i,scale:this.crossScale-500})}else s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500});return{status:0,message:"ok"}}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=l.lineString(r);else{if(t){const c=l.featureCollection(r.map(p=>l.point(p)));i=b(c)}else{const c=C(r,.5);c.length>=4&&(i=l.polygon([c]))}i||(i=l.lineString(r))}const n=f(i.geometry,t?200:30,{units:"meters"});let o;t?o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:o=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const m={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},y=new u({geometry:{type:"polygon",rings:n.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.2],outline:{color:e.areaColor,width:3,style:t?"solid":"long-dash"}},attributes:m,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:o}]}});t?this.districtControllerLayer.add(y):this.subDistrictControllerLayer.add(y)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=[];e.crosses.forEach(i=>{const n={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey},o=new u({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(n,"marker"),attributes:n,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(o)}),this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:r,color:s}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?50:40,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=A;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gisviewer-vue3-arcgis",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.159",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@types/pako": "^2.0.0",
|
|
36
36
|
"@vitest/coverage-c8": "^0.29.2",
|
|
37
37
|
"axios": "^1.4.0",
|
|
38
|
+
"concaveman": "^1.2.1",
|
|
38
39
|
"fast-xml-parser": "^4.4.0",
|
|
39
40
|
"md5": "^2.3.0",
|
|
40
41
|
"pako": "^2.1.0",
|