gisviewer-vue3-arcgis 1.0.151 → 1.0.153
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 +4 -0
- package/es/src/gis-map/utils/common-utils.mjs +16 -13
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +9 -8
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +77 -74
- package/lib/src/gis-map/utils/common-utils.d.ts +4 -0
- 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.js +1 -1
- package/package.json +1 -1
|
@@ -79,4 +79,8 @@ export default class CommonUtils {
|
|
|
79
79
|
static transformPointProjection(point: number[]): number[];
|
|
80
80
|
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
81
81
|
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
82
|
+
static isCoordinateValid(coordinate: {
|
|
83
|
+
latitude: number;
|
|
84
|
+
longitude: number;
|
|
85
|
+
}): boolean;
|
|
82
86
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Point as
|
|
1
|
+
import { Point as d, Polyline as f } from "@arcgis/core/geometry";
|
|
2
2
|
import * as g from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
3
|
import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import p from "@turf/bearing";
|
|
5
|
+
import u from "@turf/destination";
|
|
6
6
|
import * as a from "@turf/helpers";
|
|
7
|
-
import
|
|
7
|
+
import O from "pako";
|
|
8
8
|
import h from "proj4";
|
|
9
9
|
class i {
|
|
10
10
|
/**
|
|
@@ -15,10 +15,10 @@ class i {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
static destinationWithPoint(t, e, n) {
|
|
18
|
-
const r = a.point([t.x, t.y]), s =
|
|
18
|
+
const r = a.point([t.x, t.y]), s = u(r, n, e, {
|
|
19
19
|
units: "meters"
|
|
20
20
|
});
|
|
21
|
-
return new
|
|
21
|
+
return new d({
|
|
22
22
|
x: s.geometry.coordinates[0],
|
|
23
23
|
y: s.geometry.coordinates[1]
|
|
24
24
|
});
|
|
@@ -30,7 +30,7 @@ class i {
|
|
|
30
30
|
*/
|
|
31
31
|
static angleOfLine(t) {
|
|
32
32
|
const e = t.paths[0], n = a.point(e[0]), r = a.point(e[e.length - 1]);
|
|
33
|
-
return
|
|
33
|
+
return p(n, r);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 在头尾两个方向上延长折线
|
|
@@ -38,14 +38,14 @@ class i {
|
|
|
38
38
|
* @param distance
|
|
39
39
|
*/
|
|
40
40
|
static extendLineInTowDir(t, e) {
|
|
41
|
-
const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o =
|
|
41
|
+
const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o = p(s, r), c = u(r, e, o, {
|
|
42
42
|
units: "meters"
|
|
43
|
-
}),
|
|
43
|
+
}), l = o > 0 ? o - 180 : o + 180, P = u(s, e, l, {
|
|
44
44
|
units: "meters"
|
|
45
45
|
});
|
|
46
46
|
return new f({
|
|
47
47
|
paths: [
|
|
48
|
-
[c.geometry.coordinates,
|
|
48
|
+
[c.geometry.coordinates, P.geometry.coordinates]
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -149,7 +149,7 @@ class i {
|
|
|
149
149
|
e.push(o.charCodeAt(0));
|
|
150
150
|
}
|
|
151
151
|
const r = new Uint8Array(e);
|
|
152
|
-
return
|
|
152
|
+
return O.inflate(r, { to: "string" });
|
|
153
153
|
} catch {
|
|
154
154
|
console.log(`非压缩内容: ${t}`);
|
|
155
155
|
}
|
|
@@ -212,8 +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 = a.point(t), s = a.point(e), o =
|
|
216
|
-
return
|
|
215
|
+
const r = a.point(t), s = a.point(e), o = p(r, s);
|
|
216
|
+
return u(s, n, o, { units: "meters" }).geometry.coordinates;
|
|
217
|
+
}
|
|
218
|
+
static isCoordinateValid(t) {
|
|
219
|
+
return t.latitude !== void 0 && t.longitude !== void 0 && !isNaN(t.latitude) && !isNaN(t.longitude) && t.latitude !== 0 && t.longitude !== 0;
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import h from "../common-utils.mjs";
|
|
2
|
+
class r {
|
|
2
3
|
constructor(t) {
|
|
3
4
|
this.parentName = "", this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
4
5
|
Math.floor(Math.random() * 255),
|
|
@@ -7,13 +8,13 @@ class i {
|
|
|
7
8
|
], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.id, this.name = t.name, this.parentId = t.parentId;
|
|
8
9
|
for (const s of t.children)
|
|
9
10
|
if (s.children) {
|
|
10
|
-
const o = new
|
|
11
|
+
const o = new r(s);
|
|
11
12
|
o.parentName = this.name;
|
|
12
|
-
const
|
|
13
|
+
const n = this.areaColor[0], e = this.areaColor[1], a = this.areaColor[2], i = Math.random() * 200 - 100;
|
|
13
14
|
o.areaColor = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
a +
|
|
15
|
+
n + i,
|
|
16
|
+
e + i,
|
|
17
|
+
a + i
|
|
17
18
|
], this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
18
19
|
} else {
|
|
19
20
|
const o = {
|
|
@@ -31,12 +32,12 @@ class i {
|
|
|
31
32
|
getAllCrossCoordinates() {
|
|
32
33
|
const t = [];
|
|
33
34
|
for (const s of this.crosses)
|
|
34
|
-
t.push([s.longitude, s.latitude]);
|
|
35
|
+
h.isCoordinateValid(s) && t.push([s.longitude, s.latitude]);
|
|
35
36
|
for (const s of this.subDistricts)
|
|
36
37
|
t.push(...s.getAllCrossCoordinates());
|
|
37
38
|
return t;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
r as default
|
|
42
43
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import * as p from "@arcgis/core/core/reactiveUtils.js";
|
|
2
2
|
import y from "@arcgis/core/Graphic";
|
|
3
|
-
import
|
|
3
|
+
import l from "@arcgis/core/layers/GraphicsLayer";
|
|
4
4
|
import f from "@turf/buffer";
|
|
5
5
|
import d from "@turf/concave";
|
|
6
6
|
import m from "@turf/convex";
|
|
7
|
-
import * as
|
|
8
|
-
import b from "
|
|
9
|
-
|
|
7
|
+
import * as n from "@turf/helpers";
|
|
8
|
+
import b from "../common-utils.mjs";
|
|
9
|
+
import L from "./district-controller.mjs";
|
|
10
|
+
class M {
|
|
10
11
|
constructor(e) {
|
|
11
|
-
this.crossScale = 5e3, this.view = e, this.districtControllerLayer = new
|
|
12
|
+
this.crossScale = 5e3, this.view = e, this.districtControllerLayer = new l({
|
|
12
13
|
id: "districtControllerLayer",
|
|
13
14
|
maxScale: 144447,
|
|
14
15
|
minScale: 1155582
|
|
15
|
-
}), this.subDistrictControllerLayer = new
|
|
16
|
+
}), this.subDistrictControllerLayer = new l({
|
|
16
17
|
id: "subDistrictControllerLayer",
|
|
17
18
|
maxScale: 0,
|
|
18
19
|
minScale: 144447
|
|
19
|
-
}), this.crossLayer = new
|
|
20
|
+
}), this.crossLayer = new l({
|
|
20
21
|
id: "crossLayer",
|
|
21
22
|
maxScale: 0,
|
|
22
23
|
minScale: 36112
|
|
23
|
-
}), this.highlightLayer = new
|
|
24
|
+
}), this.highlightLayer = new l({
|
|
24
25
|
id: "highlightLayer"
|
|
25
26
|
}), this.view.map.addMany([
|
|
26
27
|
this.districtControllerLayer,
|
|
@@ -32,7 +33,7 @@ class x {
|
|
|
32
33
|
showSignalControlArea(e) {
|
|
33
34
|
this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
|
|
34
35
|
for (const t of e) {
|
|
35
|
-
const r = new
|
|
36
|
+
const r = new L(t);
|
|
36
37
|
this.drawArea(r, !0);
|
|
37
38
|
}
|
|
38
39
|
return this.watchHandle = p.watch(
|
|
@@ -81,6 +82,8 @@ class x {
|
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
async highlightSignalControlArea(e) {
|
|
85
|
+
if (!e.id || e.id === "")
|
|
86
|
+
return { status: 1, message: "请输入id" };
|
|
84
87
|
this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
|
|
85
88
|
const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray().map((i) => i.clone()), r = this.subDistrictControllerLayer.graphics.filter(
|
|
86
89
|
(i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
|
|
@@ -119,18 +122,15 @@ class x {
|
|
|
119
122
|
if (r.length >= 2) {
|
|
120
123
|
let i = null;
|
|
121
124
|
if (r.length === 2)
|
|
122
|
-
i =
|
|
125
|
+
i = n.lineString(r);
|
|
123
126
|
else if (r.length > 2) {
|
|
124
|
-
const
|
|
125
|
-
r.map((u) =>
|
|
127
|
+
const h = n.featureCollection(
|
|
128
|
+
r.map((u) => n.point(u))
|
|
126
129
|
);
|
|
127
|
-
t ? i = m(
|
|
130
|
+
t ? i = m(h) : (i = d(h), i || (i = m(h)));
|
|
128
131
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const a = f(
|
|
132
|
+
i || (i = n.lineString(r));
|
|
133
|
+
const o = f(
|
|
134
134
|
i.geometry,
|
|
135
135
|
// 区控面积更大,需要更大的缓冲半径
|
|
136
136
|
t ? 200 : 30,
|
|
@@ -138,8 +138,8 @@ class x {
|
|
|
138
138
|
units: "meters"
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
|
-
let
|
|
142
|
-
t ?
|
|
141
|
+
let a;
|
|
142
|
+
t ? a = [
|
|
143
143
|
{
|
|
144
144
|
fieldName: "id",
|
|
145
145
|
label: "区控编号"
|
|
@@ -152,7 +152,7 @@ class x {
|
|
|
152
152
|
fieldName: "subDistrictCount",
|
|
153
153
|
label: "子区数量"
|
|
154
154
|
}
|
|
155
|
-
] :
|
|
155
|
+
] : a = [
|
|
156
156
|
{
|
|
157
157
|
fieldName: "parentName",
|
|
158
158
|
label: "所属区控"
|
|
@@ -173,7 +173,7 @@ class x {
|
|
|
173
173
|
}, c = new y({
|
|
174
174
|
geometry: {
|
|
175
175
|
type: "polygon",
|
|
176
|
-
rings:
|
|
176
|
+
rings: o.geometry.coordinates
|
|
177
177
|
},
|
|
178
178
|
symbol: {
|
|
179
179
|
type: "simple-fill",
|
|
@@ -190,7 +190,7 @@ class x {
|
|
|
190
190
|
content: [
|
|
191
191
|
{
|
|
192
192
|
type: "fields",
|
|
193
|
-
fieldInfos:
|
|
193
|
+
fieldInfos: a
|
|
194
194
|
}
|
|
195
195
|
]
|
|
196
196
|
}
|
|
@@ -199,56 +199,59 @@ class x {
|
|
|
199
199
|
}
|
|
200
200
|
for (const i of e.subDistricts)
|
|
201
201
|
this.drawArea(i, !1);
|
|
202
|
-
const s =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
202
|
+
const s = [];
|
|
203
|
+
e.crosses.forEach((i) => {
|
|
204
|
+
if (b.isCoordinateValid(i)) {
|
|
205
|
+
const o = {
|
|
206
|
+
type: "cross",
|
|
207
|
+
id: i.id,
|
|
208
|
+
name: i.name,
|
|
209
|
+
color: e.areaColor,
|
|
210
|
+
signalId: i.signalId,
|
|
211
|
+
districtId: t ? e.id : e.parentId,
|
|
212
|
+
districtName: t ? e.name : e.parentName,
|
|
213
|
+
subDistrictId: t ? "" : e.id,
|
|
214
|
+
subDistrictName: t ? "" : e.name,
|
|
215
|
+
isKey: i.isKey
|
|
216
|
+
}, a = new y({
|
|
217
|
+
geometry: {
|
|
218
|
+
type: "point",
|
|
219
|
+
x: i.longitude,
|
|
220
|
+
y: i.latitude
|
|
221
|
+
},
|
|
222
|
+
symbol: this.getCrossGraphicSymbol(o, "marker"),
|
|
223
|
+
attributes: o,
|
|
224
|
+
popupTemplate: {
|
|
225
|
+
title: i.name,
|
|
226
|
+
content: [
|
|
227
|
+
{
|
|
228
|
+
type: "fields",
|
|
229
|
+
fieldInfos: [
|
|
230
|
+
{
|
|
231
|
+
fieldName: "districtName",
|
|
232
|
+
label: "区控名称"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
fieldName: "subDistrictName",
|
|
236
|
+
label: "子区名称"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
fieldName: "id",
|
|
240
|
+
label: "路口编号"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
fieldName: "signalId",
|
|
244
|
+
label: "信号机编号"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
s.push(a);
|
|
252
|
+
} else
|
|
253
|
+
console.log("路口坐标无效", i);
|
|
254
|
+
}), this.crossLayer.addMany(s);
|
|
252
255
|
}
|
|
253
256
|
/**
|
|
254
257
|
* 生成路口点符号。在不同比例尺下,使用不同的符号
|
|
@@ -365,5 +368,5 @@ class x {
|
|
|
365
368
|
}
|
|
366
369
|
}
|
|
367
370
|
export {
|
|
368
|
-
|
|
371
|
+
M as default
|
|
369
372
|
};
|
|
@@ -79,4 +79,8 @@ export default class CommonUtils {
|
|
|
79
79
|
static transformPointProjection(point: number[]): number[];
|
|
80
80
|
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
81
81
|
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
82
|
+
static isCoordinateValid(coordinate: {
|
|
83
|
+
latitude: number;
|
|
84
|
+
longitude: number;
|
|
85
|
+
}): boolean;
|
|
82
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"),
|
|
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(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const l=y(L),d=y(w),c=y(b);class i{static destinationWithPoint(e,t,n){const r=c.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=c.point(t[0]),r=c.point(t[t.length-1]);return p(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=c.point(n[0]),s=c.point(n[1]),o=p(s,r),f=g(r,t,o,{units:"meters"}),h=o>0?o-180:o+180,O=g(s,t,h,{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 o=new u.Polyline({paths:[r]});return(await i.getOffsetLine(o,-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],o=s[0],f=s[s.length-1];return[o,f]}return[]}static async getOffsetLine(e,t){const n=d.geographicToWebMercator(e),r=await l.offset(n,t,"meters");return d.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let s=0;s<n.length;s++){const o=n[s];t.push(o.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=c.point(e),s=c.point(t),o=p(r,s);return g(s,n,o,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return e.latitude!==void 0&&e.longitude!==void 0&&!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"}});class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=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],n=this.areaColor[1],a=this.areaColor[2],i=Math.random()*200-100;o.areaColor=[e+i,n+i,a+i],this.subDistricts.push(o),this.subDistrictCount++,this.crossCount+=o.crossCount}else{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)u.default.isCoordinateValid(t)&&s.push([t.longitude,t.latitude]);for(const t of this.subDistricts)s.push(...t.getAllCrossCoordinates());return s}}exports.default=r;
|
|
@@ -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 f=require("@arcgis/core/core/reactiveUtils.js"),u=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),L=require("@turf/concave"),m=require("@turf/convex"),C=require("@turf/helpers"),v=require("../common-utils.js"),w=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 S=g(f),h=g(C);class A{constructor(e){this.crossScale=5e3,this.view=e,this.districtControllerLayer=new n({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new n({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new n({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new n({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 w.default(t);this.drawArea(r,!0)}return this.watchHandle=S.watch(()=>this.view.scale,(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());return 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?{status:1,message:"未找到"}:(t.length>0?await this.view.goTo(t):r.length>0?await this.view.goTo(r):s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),{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=h.lineString(r);else if(r.length>2){const c=h.featureCollection(r.map(d=>h.point(d)));t?i=m(c):(i=L(c),i||(i=m(c)))}i||(i=h.lineString(r));const l=b(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 p={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:l.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:p,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=>{if(v.default.isCoordinateValid(i)){const l={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(l,"marker"),attributes:l,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});s.push(o)}else console.log("路口坐标无效",i)}),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?30:22,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;
|