gisviewer-vue3-arcgis 1.0.127 → 1.0.128
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 +4 -1
- package/es/src/gis-map/gis-map.vue.mjs +71 -59
- package/es/src/gis-map/index.d.ts +3 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +45 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +392 -241
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +5 -5
- package/es/src/gis-map/utils/signal-control-area-controller/index.d.ts +6 -0
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +42 -27
- package/es/src/types/index.d.ts +4 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +45 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +4 -4
- 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 +6 -0
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/lib/src/types/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class r {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.crosses = [], this.subDistricts = [], this.areaColor = [
|
|
4
4
|
Math.floor(Math.random() * 255),
|
|
@@ -7,15 +7,15 @@ class i {
|
|
|
7
7
|
], this.crossCount = 0, this.subDistrictCount = 0, this.id = t.id, this.name = t.name, this.parentId = t.parentId;
|
|
8
8
|
for (const s of t.children)
|
|
9
9
|
if (s.children) {
|
|
10
|
-
const o = new
|
|
10
|
+
const o = new r(s);
|
|
11
11
|
o.areaColor = this.areaColor, this.subDistricts.push(o), this.subDistrictCount++, this.crossCount += o.crossCount;
|
|
12
12
|
} else {
|
|
13
13
|
const o = {
|
|
14
14
|
id: s.id,
|
|
15
15
|
name: s.name,
|
|
16
16
|
parentId: s.parentId,
|
|
17
|
-
latitude: s.latitude,
|
|
18
|
-
longitude: s.longitude
|
|
17
|
+
latitude: Number(s.latitude),
|
|
18
|
+
longitude: Number(s.longitude)
|
|
19
19
|
};
|
|
20
20
|
this.crosses.push(o), this.crossCount++;
|
|
21
21
|
}
|
|
@@ -30,5 +30,5 @@ class i {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
r as default
|
|
34
34
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import n from "@arcgis/core/Graphic";
|
|
2
2
|
import s from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import p from "@turf/
|
|
3
|
+
import p from "@turf/buffer";
|
|
4
|
+
import f from "@turf/convex";
|
|
4
5
|
import * as c from "@turf/helpers";
|
|
5
|
-
import
|
|
6
|
-
class
|
|
6
|
+
import y from "./district-controller.mjs";
|
|
7
|
+
class v {
|
|
7
8
|
constructor(e) {
|
|
8
9
|
this.view = e, this.view.popup.visibleElements = {
|
|
9
10
|
closeButton: !0,
|
|
@@ -29,7 +30,7 @@ class C {
|
|
|
29
30
|
}
|
|
30
31
|
showSignalControlArea(e) {
|
|
31
32
|
for (const t of e) {
|
|
32
|
-
const r = new
|
|
33
|
+
const r = new y(t);
|
|
33
34
|
this.drawArea(r, !0);
|
|
34
35
|
}
|
|
35
36
|
return { status: 0, message: "ok" };
|
|
@@ -56,16 +57,30 @@ class C {
|
|
|
56
57
|
}
|
|
57
58
|
return { status: 1, message: "未找到" };
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* 绘制区控与子区
|
|
62
|
+
* @param districtController
|
|
63
|
+
* @param isDistrict 是否是区控
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
59
66
|
drawArea(e, t) {
|
|
60
67
|
const r = e.getAllCrossCoordinates();
|
|
61
68
|
if (r.length > 2) {
|
|
62
|
-
const
|
|
63
|
-
r.map((
|
|
64
|
-
),
|
|
65
|
-
if (!
|
|
69
|
+
const o = c.featureCollection(
|
|
70
|
+
r.map((u) => c.point(u))
|
|
71
|
+
), i = f(o);
|
|
72
|
+
if (!i)
|
|
66
73
|
return;
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
const d = p(
|
|
75
|
+
i.geometry,
|
|
76
|
+
// 区控面积更大,需要更大的缓冲半径
|
|
77
|
+
t ? 200 : 20,
|
|
78
|
+
{
|
|
79
|
+
units: "meters"
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
let a;
|
|
83
|
+
t ? a = [
|
|
69
84
|
{
|
|
70
85
|
fieldName: "id",
|
|
71
86
|
label: "区控编号"
|
|
@@ -78,7 +93,7 @@ class C {
|
|
|
78
93
|
fieldName: "subDistrictCount",
|
|
79
94
|
label: "子区数量"
|
|
80
95
|
}
|
|
81
|
-
] :
|
|
96
|
+
] : a = [
|
|
82
97
|
{
|
|
83
98
|
fieldName: "parentId",
|
|
84
99
|
label: "区控编号"
|
|
@@ -95,7 +110,7 @@ class C {
|
|
|
95
110
|
const l = new n({
|
|
96
111
|
geometry: {
|
|
97
112
|
type: "polygon",
|
|
98
|
-
rings:
|
|
113
|
+
rings: d.geometry.coordinates
|
|
99
114
|
},
|
|
100
115
|
symbol: {
|
|
101
116
|
type: "simple-fill",
|
|
@@ -118,20 +133,20 @@ class C {
|
|
|
118
133
|
content: [
|
|
119
134
|
{
|
|
120
135
|
type: "fields",
|
|
121
|
-
fieldInfos:
|
|
136
|
+
fieldInfos: a
|
|
122
137
|
}
|
|
123
138
|
]
|
|
124
139
|
}
|
|
125
140
|
});
|
|
126
141
|
t ? this.districtControllerLayer.add(l) : this.subDistrictControllerLayer.add(l);
|
|
127
142
|
}
|
|
128
|
-
for (const
|
|
129
|
-
this.drawArea(
|
|
130
|
-
const
|
|
143
|
+
for (const o of e.subDistricts)
|
|
144
|
+
this.drawArea(o, !1);
|
|
145
|
+
const m = e.crosses.map((o) => new n({
|
|
131
146
|
geometry: {
|
|
132
147
|
type: "point",
|
|
133
|
-
x:
|
|
134
|
-
y:
|
|
148
|
+
x: o.longitude,
|
|
149
|
+
y: o.latitude
|
|
135
150
|
},
|
|
136
151
|
symbol: {
|
|
137
152
|
type: "simple-marker",
|
|
@@ -140,21 +155,17 @@ class C {
|
|
|
140
155
|
},
|
|
141
156
|
attributes: {
|
|
142
157
|
type: "cross",
|
|
143
|
-
id:
|
|
144
|
-
name:
|
|
158
|
+
id: o.id,
|
|
159
|
+
name: o.name,
|
|
145
160
|
districtId: t ? e.id : e.parentId,
|
|
146
161
|
subDistrictId: t ? "" : e.id
|
|
147
162
|
},
|
|
148
163
|
popupTemplate: {
|
|
149
|
-
title:
|
|
164
|
+
title: o.name,
|
|
150
165
|
content: [
|
|
151
166
|
{
|
|
152
167
|
type: "fields",
|
|
153
168
|
fieldInfos: [
|
|
154
|
-
{
|
|
155
|
-
fieldName: "id",
|
|
156
|
-
label: "路口编号"
|
|
157
|
-
},
|
|
158
169
|
{
|
|
159
170
|
fieldName: "districtId",
|
|
160
171
|
label: "区控编号"
|
|
@@ -162,15 +173,19 @@ class C {
|
|
|
162
173
|
{
|
|
163
174
|
fieldName: "subDistrictId",
|
|
164
175
|
label: "子区编号"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
fieldName: "id",
|
|
179
|
+
label: "路口编号"
|
|
165
180
|
}
|
|
166
181
|
]
|
|
167
182
|
}
|
|
168
183
|
]
|
|
169
184
|
}
|
|
170
185
|
}));
|
|
171
|
-
this.crossLayer.addMany(
|
|
186
|
+
this.crossLayer.addMany(m);
|
|
172
187
|
}
|
|
173
188
|
}
|
|
174
189
|
export {
|
|
175
|
-
|
|
190
|
+
v as default
|
|
176
191
|
};
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams } from '../types';
|
|
3
|
+
import { IFindSumoParams, ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IStartCrossBufferParam, IToggleTrafficInfoParams, IUnselectSumoParams } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -73,6 +73,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
73
73
|
showOpenDriveFromFile: (params: IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
74
74
|
clearOpenDrive: () => Promise<void>;
|
|
75
75
|
findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
76
|
+
selectSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
77
|
+
unselectSumoInOpenDrive: (params: IUnselectSumoParams) => Promise<import("../types").IResult>;
|
|
78
|
+
getSumoInfo: (params: IFindSumoParams) => Promise<import("../types").IResult>;
|
|
76
79
|
splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
77
80
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
78
81
|
clearSignalControlArea: () => void;
|
|
@@ -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 a=require("vue"),y=require("./stores/index.js");require("./style/index.css");const ye=require("./utils/holo-flow/index.js"),he=require("./utils/map-initializer.js"),O=require("./utils/open-drive-renderer/index.js"),Ce=require("./utils/overlay.js"),Oe=require("./utils/queue-length.js"),S=require("./utils/road-config-tool/index.js"),Se=require("./utils/signal-control-area-controller/index.js"),ke=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Te={style:{position:"absolute",bottom:"10px",left:"10px"}},Le=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:D,emit:T}){const d=a.ref(null);let c,i,r,o,s,n,m,t,l;const f=a.ref(!1);a.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",p=>{p.ctrlKey&&p.key==="i"&&(f.value=!f.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,C=await(await fetch(h.config)).json();C.assetsRoot=h.assetsRoot||u;const we=y.default.useAppDataStore;we.mapConfig=C,i=new he.default,c=await i.initialize({container:d.value,markerClickCallback:(p,w,v,ve)=>{g("markerClick",p,w,v,ve)},mapClickCallback:(p,w,v)=>{g("mapClick",p,w,v)}}),s=new ye.default(c),await s.init(),g("mapLoaded")});const L=a.computed(()=>c),I=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},b=()=>{s.downloadTrackLog()},A=async e=>await i.setMapCenter(e),q=async e=>await i.setMapCamera(e),_=async e=>await i.lookAt(e),x=e=>i.setLayerVisibility(e),V=(e,u)=>i.requestCoordinateTransform(e,u),M=e=>{i.cancelCoordinateTransform(e)},N=e=>{i.setMapZoomRange(e)},F=e=>(r||(r=new S.default(c)),r.showLaneNumber(e)),B=()=>{r==null||r.clearLaneNumber()},E=async e=>(r||(r=new S.default(c)),await r.initializeSearch(e)),H=async()=>r==null?void 0:r.calCrossIndicatorArea(),j=async()=>{},z=async(e,u)=>{o||(o=new ke.default(c)),o.connectTrafficFlow(e,u)},P=()=>{o==null||o.disconnectTrafficFlow()},Q=e=>{s.handleVehicleTraceData(e)},R=()=>{s.clearHoloTrace()},Z=e=>{s.setInterpolate(e)},K=async e=>{await s.handleSignalData(e)},G=()=>{s.clearHoloSignal()},J=e=>{o==null||o.toggleTrafficInfo(e),s.toggleTrafficInfo(e)},U=e=>{s.togglePause(e)},W=e=>{o==null||o.toggleTrafficObject(e),s.toggleTrafficObject(e)},X=e=>{s.updatePanelContent(e)},Y=async e=>(n||(n=new Ce.default(c)),n.addOverlays(e)),$=e=>n==null?void 0:n.removeOverlaysByType(e),ee=e=>n==null?void 0:n.removeOverlaysById(e),te=()=>n==null?void 0:n.removeAllOverlays(),ne=()=>{n==null||n.showAllOverlays()},ae=e=>{m||(m=new Oe.default(c)),m.updateQueueLength(e)},re=()=>{m==null||m.removeQueueLength()},oe=async(e,u)=>(t||(t=new O.default(c)),await t.showOpenDriveFromServer(e,u)),se=async e=>(t||(t=new O.default(c)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},pe=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(l||(l=new Se.default(c)),l.showSignalControlArea(e)),fe=()=>{l==null||l.clearSignalControlArea()},ge=e=>l?l.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},h=k,g=T;return D({mapViewer:L,setLayerVisibility:x,setMapCenter:A,lookAt:_,setMapCamera:q,setMapZoomRange:N,requestCoordinateTransform:V,cancelCoordinateTransform:M,addOverlays:Y,showAllOverlays:ne,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:F,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:H,calRoadIndicatorArea:j,connectCarFlow:z,disconnectCarFlow:P,handleHoloVehicleTraceData:Q,clearHoloTrace:R,handleHoloSignalData:K,clearHoloSignal:G,setInterpolate:Z,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:U,updateQueueLength:ae,removeQueueLength:re,showOpenDriveFromServer:oe,showOpenDriveFromFile:se,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:me,splitOpenDriveLane:pe,showSignalControlArea:de,clearSignalControlArea:fe,locateSignalControlArea:ge}),(e,u)=>(a.openBlock(),a.createElementBlock("div",De,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[a.withDirectives(a.createElementVNode("div",Te,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:I}," 开始记录 "),a.createElementVNode("button",{onClick:b},"下载日志")],512),[[a.vShow,f.value]])],512)]))}});exports.default=Le;
|
|
@@ -62,6 +62,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
62
62
|
showOpenDriveFromFile: (params: import("../types").IShowOpenDriveFromFileParams) => Promise<import("../types").IResult>;
|
|
63
63
|
clearOpenDrive: () => Promise<void>;
|
|
64
64
|
findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
65
|
+
selectSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
66
|
+
unselectSumoInOpenDrive: (params: import("../types").IUnselectSumoParams) => Promise<import("../types").IResult>;
|
|
67
|
+
getSumoInfo: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
|
|
65
68
|
splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
|
|
66
69
|
showSignalControlArea: (params: any) => import("../types").IResult;
|
|
67
70
|
clearSignalControlArea: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams } from '../../../types';
|
|
1
|
+
import { IFindSumoParams, IResult, IShowOpenDriveFromFileParams, ISplitOpenDriveLaneParams, IUnselectSumoParams } from '../../../types';
|
|
2
2
|
export default class OpenDriveRenderer {
|
|
3
3
|
private static instance;
|
|
4
4
|
static getInstance(view: __esri.MapView | __esri.SceneView): OpenDriveRenderer;
|
|
@@ -19,6 +19,11 @@ export default class OpenDriveRenderer {
|
|
|
19
19
|
private openDriveServer;
|
|
20
20
|
private openDriveClickCallback;
|
|
21
21
|
private makeMd5FromFile;
|
|
22
|
+
/**
|
|
23
|
+
* 从本地文件/网络文件显示OpenDrive内容
|
|
24
|
+
* @param params
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
22
27
|
showOpenDriveFromFile(params: IShowOpenDriveFromFileParams): Promise<IResult>;
|
|
23
28
|
/**
|
|
24
29
|
* 从服务器载入OpenDrive文件解析结果并显示
|
|
@@ -26,7 +31,19 @@ export default class OpenDriveRenderer {
|
|
|
26
31
|
* @param projectName
|
|
27
32
|
*/
|
|
28
33
|
showOpenDriveFromServer(server: string, projectName: string): Promise<IResult>;
|
|
34
|
+
/**
|
|
35
|
+
* 显示所有车道
|
|
36
|
+
* @param roads 道路列表
|
|
37
|
+
* @param showJunctionLane 是否显示路口内车道
|
|
38
|
+
* @param showRoadName 是否显示道路名称
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
29
41
|
private showAllLanes;
|
|
42
|
+
/**
|
|
43
|
+
* 显示路口
|
|
44
|
+
* @param params
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
30
47
|
private showJunction;
|
|
31
48
|
private currentSectionCode;
|
|
32
49
|
private currentJunctionId;
|
|
@@ -40,8 +57,19 @@ export default class OpenDriveRenderer {
|
|
|
40
57
|
* 监听鼠标点击事件,获取高亮要素的拓扑信息
|
|
41
58
|
*/
|
|
42
59
|
private monitorMouseClick;
|
|
60
|
+
/**
|
|
61
|
+
* 图标增大动画
|
|
62
|
+
* @param graphic
|
|
63
|
+
* @param targetSize
|
|
64
|
+
*/
|
|
43
65
|
private increasePictureMarkerSize;
|
|
66
|
+
/**
|
|
67
|
+
* 图标缩小动画
|
|
68
|
+
* @param graphic
|
|
69
|
+
* @param targetSize
|
|
70
|
+
*/
|
|
44
71
|
private decreasePictureMarkerSize;
|
|
72
|
+
getSumoInfo(params: IFindSumoParams): Promise<IResult>;
|
|
45
73
|
/**
|
|
46
74
|
* 清除OpenDrive内容
|
|
47
75
|
*/
|
|
@@ -59,6 +87,22 @@ export default class OpenDriveRenderer {
|
|
|
59
87
|
* @returns
|
|
60
88
|
*/
|
|
61
89
|
private findLane;
|
|
90
|
+
/**
|
|
91
|
+
* graphic渐隐渐显闪烁
|
|
92
|
+
* @param flashGraphic
|
|
93
|
+
*/
|
|
62
94
|
private flashGraphic;
|
|
95
|
+
/**
|
|
96
|
+
* 通过接口取消选中
|
|
97
|
+
* @param params
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
unselectSumo(params?: IUnselectSumoParams): IResult;
|
|
101
|
+
/**
|
|
102
|
+
* 通过接口选中
|
|
103
|
+
* @param params
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
selectSumo(params: IFindSumoParams): IResult;
|
|
63
107
|
splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
|
|
64
108
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
<tr><td>路口编号</td><td>${
|
|
3
|
-
<tr><td>信号机编号</td><td>${
|
|
4
|
-
</table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),$=require("@arcgis/core/core/promiseUtils"),M=require("@arcgis/core/geometry"),J=require("@arcgis/core/geometry/geometryEngine"),G=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),y=require("axios"),P=require("md5"),A=require("pako"),C=require("../common-utils.js"),x=require("./wasm-loader.js");function O(f){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const t in f)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(f,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>f[t]})}}return e.default=f,Object.freeze(e)}const N=O($),L=O(J);class D{constructor(e){this.wasmLoader=x.default.getInstance(),this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={closeButton:!1,collapseButton:!1,actionBar:!1},this.laneLayer=new G({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new G({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:P(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,g;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await y.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;C.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=A.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((g=e.options)==null?void 0:g.showRoadName)||!0);const u=o.data.result.junctions;if(this.showJunction(u),e.options&&e.options.centerMap!==!1){const d=C.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await y.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=A.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:u}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const g=new p({geometry:{type:"polyline",paths:[u]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(g),r.laneSections.sort((d,b)=>Number(d.id)-Number(b.id));for(let d=0;d<r.laneSections.length;d++){const b=r.laneSections[d],k=Number(b.id);for(const m of b.lanePaths){const w=Number(m.id);if(w===0)continue;const F=m.type,I=m.innerPath.concat(m.outerPath.reverse());if(I.length<=3){console.warn(`lane ${w} has less than 3 points`);continue}I.push(m.innerPath[0]);const j=new M.Polygon({rings:[I]});if(j){const S=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${k}+${w}`,roadId:c,roadName:r.name,sectionId:k,sectionIndex:d,laneId:w,type:F,sumoId:""}});this.allLaneGraphics.push(S),n.push(S)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=N.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.attributes.roadId}+${this.hitGraphic.attributes.sectionId}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=L.union(r.map(u=>u.geometry));this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic)}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n;const a=this.hitGraphic.getAttribute("name"),r=this.hitGraphic.getAttribute("crossId");this.view.popup.open({title:a,content:`<table>
|
|
2
|
+
<tr><td>路口编号</td><td>${n}</td></tr>
|
|
3
|
+
<tr><td>信号机编号</td><td>${r||"无信控"}</td></tr>
|
|
4
|
+
</table>`,location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=N.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await y.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await y.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await y.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const l=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=L.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.graphics.forEach(t=>{t.visible=!1,t.setAttribute("selected",!1)});else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&(t.visible=!1,t.setAttribute("selected",!1))}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=L.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
|
|
@@ -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"}});class r{constructor(s){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.areaColor=this.areaColor,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)};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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),i=require("@arcgis/core/layers/GraphicsLayer"),m=require("@turf/buffer"),y=require("@turf/convex"),b=require("@turf/helpers"),g=require("./district-controller.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(b);class C{constructor(e){this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1},this.districtControllerLayer=new i({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new i({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new i({id:"crossLayer",maxScale:0,minScale:18056}),this.view.map.addMany([this.crossLayer,this.districtControllerLayer,this.subDistrictControllerLayer])}showSignalControlArea(e){for(const t of e){const r=new g.default(t);this.drawArea(r,!0)}return{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),(e=this.eventHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}locateSignalControlArea(e){let t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e.id);if(t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e.id)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e.id)),t){this.view.goTo(t.geometry);const r=t.geometry.type==="point"?t.geometry:t.geometry.centroid;return this.view.popup.open({features:[t],location:r}),{status:0,message:"ok"}}return{status:1,message:"未找到"}}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>2){const o=u.featureCollection(r.map(f=>u.point(f))),l=y(o);if(!l)return;const p=m(l.geometry,t?200:20,{units:"meters"});let a;t?a=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:a=[{fieldName:"parentId",label:"区控编号"},{fieldName:"id",label:"子区编号"},{fieldName:"crossCount",label:"路口数量"}];const n=new c({geometry:{type:"polygon",rings:p.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.5],outline:{color:e.areaColor,width:1}},attributes:{type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},popupTemplate:{title:e.name,content:[{type:"fields",fieldInfos:a}]}});t?this.districtControllerLayer.add(n):this.subDistrictControllerLayer.add(n)}for(const o of e.subDistricts)this.drawArea(o,!1);const d=e.crosses.map(o=>new c({geometry:{type:"point",x:o.longitude,y:o.latitude},symbol:{type:"simple-marker",color:e.areaColor,size:8},attributes:{type:"cross",id:o.id,name:o.name,districtId:t?e.id:e.parentId,subDistrictId:t?"":e.id},popupTemplate:{title:o.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtId",label:"区控编号"},{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"id",label:"路口编号"}]}]}}));this.crossLayer.addMany(d)}}exports.default=C;
|
package/lib/src/types/index.d.ts
CHANGED