gisviewer-vue3-arcgis 1.0.85
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/README.md +103 -0
- package/es/index.d.ts +8 -0
- package/es/index.mjs +16 -0
- package/es/src/components.d.ts +9 -0
- package/es/src/gis-map/gis-map.vue.d.ts +91 -0
- package/es/src/gis-map/gis-map.vue.mjs +124 -0
- package/es/src/gis-map/gis-map.vue2.mjs +4 -0
- package/es/src/gis-map/index.d.ts +81 -0
- package/es/src/gis-map/index.mjs +7 -0
- package/es/src/gis-map/stores/appData.d.ts +3 -0
- package/es/src/gis-map/stores/appData.mjs +9 -0
- package/es/src/gis-map/stores/index.d.ts +7 -0
- package/es/src/gis-map/stores/index.mjs +10 -0
- package/es/src/gis-map/style/index.css +13 -0
- package/es/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/es/src/gis-map/utils/FlyToPoints.mjs +67 -0
- package/es/src/gis-map/utils/GreenWaveline.mjs +193 -0
- package/es/src/gis-map/utils/Layers.d.ts +31 -0
- package/es/src/gis-map/utils/Layers.mjs +99 -0
- package/es/src/gis-map/utils/common-utils.d.ts +65 -0
- package/es/src/gis-map/utils/common-utils.mjs +159 -0
- package/es/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +50 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +209 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +316 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +75 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +286 -0
- package/es/src/gis-map/utils/index.d.ts +21 -0
- package/es/src/gis-map/utils/index.mjs +23 -0
- package/es/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/es/src/gis-map/utils/map-initializer.mjs +248 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +271 -0
- package/es/src/gis-map/utils/overlay.d.ts +83 -0
- package/es/src/gis-map/utils/overlay.mjs +149 -0
- package/es/src/gis-map/utils/queue-length.d.ts +14 -0
- package/es/src/gis-map/utils/queue-length.mjs +83 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.mjs +169 -0
- package/es/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/sketchView.d.ts +209 -0
- package/es/src/gis-map/utils/sketchView.mjs +516 -0
- package/es/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/es/src/gis-map/utils/syncMapView.mjs +64 -0
- package/es/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/es/src/gis-map/utils/traffic-flow.mjs +308 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +4 -0
- package/es/src/types/index.d.ts +142 -0
- package/es/src/types/index.mjs +5 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +1 -0
- package/lib/src/components.d.ts +9 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +91 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -0
- package/lib/src/gis-map/gis-map.vue2.js +1 -0
- package/lib/src/gis-map/index.d.ts +81 -0
- package/lib/src/gis-map/index.js +1 -0
- package/lib/src/gis-map/stores/appData.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.js +1 -0
- package/lib/src/gis-map/stores/index.d.ts +7 -0
- package/lib/src/gis-map/stores/index.js +1 -0
- package/lib/src/gis-map/style/index.css +13 -0
- package/lib/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/lib/src/gis-map/utils/FlyToPoints.js +1 -0
- package/lib/src/gis-map/utils/GreenWaveline.js +1 -0
- package/lib/src/gis-map/utils/Layers.d.ts +31 -0
- package/lib/src/gis-map/utils/Layers.js +1 -0
- package/lib/src/gis-map/utils/common-utils.d.ts +65 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -0
- package/lib/src/gis-map/utils/index.d.ts +21 -0
- package/lib/src/gis-map/utils/index.js +1 -0
- package/lib/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/lib/src/gis-map/utils/map-initializer.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -0
- package/lib/src/gis-map/utils/overlay.d.ts +83 -0
- package/lib/src/gis-map/utils/overlay.js +1 -0
- package/lib/src/gis-map/utils/queue-length.d.ts +14 -0
- package/lib/src/gis-map/utils/queue-length.js +1 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.js +43 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/sketchView.d.ts +209 -0
- package/lib/src/gis-map/utils/sketchView.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/lib/src/gis-map/utils/syncMapView.js +1 -0
- package/lib/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/lib/src/gis-map/utils/traffic-flow.js +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/src/types/index.d.ts +142 -0
- package/lib/src/types/index.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import l from "@arcgis/core/Graphic";
|
|
2
|
+
import { Point as w } from "@arcgis/core/geometry";
|
|
3
|
+
import h from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
import { TextSymbol as y, SimpleMarkerSymbol as f } from "@arcgis/core/symbols";
|
|
5
|
+
import p from "../common-utils.mjs";
|
|
6
|
+
import L from "./cross.mjs";
|
|
7
|
+
import A from "./search-nearby-lanes.mjs";
|
|
8
|
+
import N from "./indicator-area.mjs";
|
|
9
|
+
class k {
|
|
10
|
+
/**
|
|
11
|
+
* 道路配置工具相关功能
|
|
12
|
+
* @param map map实例
|
|
13
|
+
* @param mapConfig 地图配置
|
|
14
|
+
*/
|
|
15
|
+
constructor(e) {
|
|
16
|
+
this.view = e, this.laneNumberLayer = new h({
|
|
17
|
+
minScale: 2257
|
|
18
|
+
}), this.view.map.add(this.laneNumberLayer), this.crossIndicatorAreaLayer = new h(), this.view.map.add(this.crossIndicatorAreaLayer);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 在进口道的顶端显示车道序号
|
|
22
|
+
* @param params
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
showLaneNumber(e) {
|
|
26
|
+
const { lanes: i } = e, s = [], o = [];
|
|
27
|
+
for (const m of i) {
|
|
28
|
+
const { crossId: n, laneNumber: a, stopLineCenter: r, laneDirection: c } = m;
|
|
29
|
+
if (!r[0] || !r[1])
|
|
30
|
+
continue;
|
|
31
|
+
let t = new w({
|
|
32
|
+
longitude: r[0],
|
|
33
|
+
latitude: r[1]
|
|
34
|
+
});
|
|
35
|
+
c && (t = p.destinationWithPoint(
|
|
36
|
+
t,
|
|
37
|
+
c,
|
|
38
|
+
-3
|
|
39
|
+
));
|
|
40
|
+
const d = {
|
|
41
|
+
type: "laneNumber",
|
|
42
|
+
id: `${n}_${a}`,
|
|
43
|
+
crossId: n,
|
|
44
|
+
laneNumber: a
|
|
45
|
+
}, u = new l({
|
|
46
|
+
geometry: t,
|
|
47
|
+
symbol: new y({
|
|
48
|
+
text: a,
|
|
49
|
+
color: "red",
|
|
50
|
+
verticalAlignment: "middle",
|
|
51
|
+
font: {
|
|
52
|
+
size: 10
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
o.push(u);
|
|
57
|
+
const b = new l({
|
|
58
|
+
geometry: t,
|
|
59
|
+
// 半透明白色圆点
|
|
60
|
+
symbol: new f({
|
|
61
|
+
style: "circle",
|
|
62
|
+
color: [255, 255, 255, 0.8],
|
|
63
|
+
size: 14,
|
|
64
|
+
outline: {
|
|
65
|
+
color: "white",
|
|
66
|
+
width: 1
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
attributes: d
|
|
70
|
+
});
|
|
71
|
+
s.push(b);
|
|
72
|
+
}
|
|
73
|
+
return this.laneNumberLayer.addMany(s), this.laneNumberLayer.addMany(o), { status: 0, message: "车道序号显示成功" };
|
|
74
|
+
}
|
|
75
|
+
/** 清除车道序号 */
|
|
76
|
+
clearLaneNumber() {
|
|
77
|
+
this.laneNumberLayer.removeAll();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 初始化算法区域生成工具
|
|
81
|
+
* @param params
|
|
82
|
+
* @returns Promise<IResult>
|
|
83
|
+
*/
|
|
84
|
+
async initializeSearch(e) {
|
|
85
|
+
var i;
|
|
86
|
+
return this.searchLaneTool || (this.searchLaneTool = new A(this.view)), this.cross = new L({ id: e.crossId, center: e.crossCenter }), (i = this.indicatorAreaTool) == null || i.clearIndicatorArea(), this.searchLaneTool.initializeSearch(e);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 生成路口指标计算区
|
|
90
|
+
*/
|
|
91
|
+
async calCrossIndicatorArea() {
|
|
92
|
+
this.cross.initialized || await this.initializeCross(), this.indicatorAreaTool || (this.indicatorAreaTool = new N(this.view)), await this.indicatorAreaTool.showCrossIndicatorArea(this.cross);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 路口初始化,计算周边进口道与车道
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
async initializeCross() {
|
|
99
|
+
if (!this.searchLaneTool)
|
|
100
|
+
return {
|
|
101
|
+
status: -1,
|
|
102
|
+
message: "算法区域生成工具未初始化, 请先执行initializeSearch"
|
|
103
|
+
};
|
|
104
|
+
const e = await this.searchLaneTool.getCurrentSearchResult();
|
|
105
|
+
this.searchLaneTool.clearResult(), await this.cross.initialize(e);
|
|
106
|
+
const i = this.cross.getLaneNumberInfo();
|
|
107
|
+
this.showLaneNumber({ lanes: i });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
k as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import MapView from '@arcgis/core/views/MapView';
|
|
2
|
+
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
+
import Cross from './cross';
|
|
4
|
+
export default class IndicatorArea {
|
|
5
|
+
private view;
|
|
6
|
+
/** 路口指标计算区图层 */
|
|
7
|
+
private indicatorAreaLayer;
|
|
8
|
+
/** 路口指标计算区Graphic */
|
|
9
|
+
private crossIndicatorAreaGraphic?;
|
|
10
|
+
/** 移动graphic的工具类 */
|
|
11
|
+
private sketchViewModel;
|
|
12
|
+
constructor(view: MapView | SceneView);
|
|
13
|
+
/**
|
|
14
|
+
* 显示路口指标计算区
|
|
15
|
+
* @param cross
|
|
16
|
+
*/
|
|
17
|
+
showCrossIndicatorArea(cross: Cross): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* 清除所有指标计算区
|
|
20
|
+
*/
|
|
21
|
+
clearIndicatorArea(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
2
|
+
import i from "@arcgis/core/Graphic";
|
|
3
|
+
import { SimpleFillSymbol as o } from "@arcgis/core/symbols";
|
|
4
|
+
import t from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
5
|
+
class h {
|
|
6
|
+
constructor(r) {
|
|
7
|
+
this.view = r, this.indicatorAreaLayer = new a(), this.view.map.add(this.indicatorAreaLayer), this.sketchViewModel = new t({
|
|
8
|
+
view: this.view,
|
|
9
|
+
layer: this.indicatorAreaLayer,
|
|
10
|
+
defaultUpdateOptions: {
|
|
11
|
+
tool: "reshape"
|
|
12
|
+
},
|
|
13
|
+
snappingOptions: {
|
|
14
|
+
enabled: !0
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 显示路口指标计算区
|
|
20
|
+
* @param cross
|
|
21
|
+
*/
|
|
22
|
+
async showCrossIndicatorArea(r) {
|
|
23
|
+
this.indicatorAreaLayer.removeAll();
|
|
24
|
+
const e = await r.calCrossIndicatorArea();
|
|
25
|
+
e ? (this.crossIndicatorAreaGraphic = new i({
|
|
26
|
+
geometry: e,
|
|
27
|
+
symbol: new o({
|
|
28
|
+
color: [255, 0, 0, 0.5],
|
|
29
|
+
outline: {
|
|
30
|
+
color: [255, 0, 0]
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}), this.indicatorAreaLayer.add(this.crossIndicatorAreaGraphic)) : this.sketchViewModel.create("polygon");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 清除所有指标计算区
|
|
37
|
+
*/
|
|
38
|
+
clearIndicatorArea() {
|
|
39
|
+
this.indicatorAreaLayer.removeAll();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
h as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Point, Polygon, Polyline } from '@arcgis/core/geometry';
|
|
2
|
+
export default class Lane {
|
|
3
|
+
/** 停止线 */
|
|
4
|
+
private _stopLine;
|
|
5
|
+
/** 停止线中点 */
|
|
6
|
+
stopLineCenter: Point;
|
|
7
|
+
set stopLine(line: Polyline);
|
|
8
|
+
get stopLine(): Polyline;
|
|
9
|
+
private _extendedStopLine;
|
|
10
|
+
/** 停止线延长线,用于计算和其他进口道停止线的交点 */
|
|
11
|
+
get extendedStopLine(): __esri.Polyline;
|
|
12
|
+
/** 行车方向 */
|
|
13
|
+
laneDirection: number;
|
|
14
|
+
/** 车道轮廓 */
|
|
15
|
+
lanePolygon: Polygon;
|
|
16
|
+
/** 车道id(路口号_进口道号_车道序号(>0为进口道, <0为出口道)) */
|
|
17
|
+
code: string;
|
|
18
|
+
/** 是否为进口道 */
|
|
19
|
+
isEntry: boolean;
|
|
20
|
+
getLaneDirection(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import L from "@turf/bearing";
|
|
2
|
+
import n from "../common-utils.mjs";
|
|
3
|
+
class a {
|
|
4
|
+
set stopLine(t) {
|
|
5
|
+
this._stopLine = t, this.stopLineCenter = t.extent.center;
|
|
6
|
+
}
|
|
7
|
+
get stopLine() {
|
|
8
|
+
return this._stopLine;
|
|
9
|
+
}
|
|
10
|
+
/** 停止线延长线,用于计算和其他进口道停止线的交点 */
|
|
11
|
+
get extendedStopLine() {
|
|
12
|
+
return this._extendedStopLine || (this._extendedStopLine = n.extendLineInTowDir(
|
|
13
|
+
this._stopLine,
|
|
14
|
+
100
|
|
15
|
+
)), this._extendedStopLine;
|
|
16
|
+
}
|
|
17
|
+
async getLaneDirection() {
|
|
18
|
+
const t = n.extendLineInTowDir(this._stopLine, 10), i = this._stopLine.paths[0];
|
|
19
|
+
let e = await n.getIntersectPointOfLineAndPolygon(
|
|
20
|
+
t,
|
|
21
|
+
this.lanePolygon,
|
|
22
|
+
5
|
|
23
|
+
);
|
|
24
|
+
e.length === 0 && (e = await n.getIntersectPointOfLineAndPolygon(
|
|
25
|
+
t,
|
|
26
|
+
this.lanePolygon,
|
|
27
|
+
-5
|
|
28
|
+
)), (!i.length || !e.length) && console.log("计算方位角失败", i, e);
|
|
29
|
+
const s = e[0], r = i[0], o = L(r, s);
|
|
30
|
+
this.laneDirection = o < 0 ? o + 360 : o;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
a as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Graphic from '@arcgis/core/Graphic';
|
|
2
|
+
import MapView from '@arcgis/core/views/MapView';
|
|
3
|
+
import SceneView from '@arcgis/core/views/SceneView';
|
|
4
|
+
import { IResult, IStartCrossBufferParam } from '../../../types';
|
|
5
|
+
export default class SearchNearbyLanes {
|
|
6
|
+
private view;
|
|
7
|
+
/** 显示圆心和边缘点的图层,可响应拖拽事件 */
|
|
8
|
+
private pointLayer;
|
|
9
|
+
/** 显示缓冲结果的图层 */
|
|
10
|
+
private bufferAreaLayer;
|
|
11
|
+
/** 车道图层 */
|
|
12
|
+
private laneLayer;
|
|
13
|
+
/** 停止线图层 */
|
|
14
|
+
private stopLineLayer;
|
|
15
|
+
/** 移动graphic的工具类 */
|
|
16
|
+
private sketchViewModel;
|
|
17
|
+
/** 显示圆心点的graphic */
|
|
18
|
+
private centerGraphic;
|
|
19
|
+
/** 显示边缘点的graphic */
|
|
20
|
+
private edgeGraphic;
|
|
21
|
+
/** 显示缓冲圆形的graphic */
|
|
22
|
+
private bufferGraphic;
|
|
23
|
+
/** 显示圆心与边缘点连线的graphic */
|
|
24
|
+
private radiusLineGraphic;
|
|
25
|
+
/** 鼠标开始拖动边缘点时,圆心点的位置 */
|
|
26
|
+
private centerGeometryAtStart;
|
|
27
|
+
/** 地理计算单位,统一为米 */
|
|
28
|
+
private readonly geometryUnit;
|
|
29
|
+
constructor(view: MapView | SceneView);
|
|
30
|
+
/**
|
|
31
|
+
* 搜索路口中心点周边车道
|
|
32
|
+
* @param params
|
|
33
|
+
* @returns Promise<IResult>
|
|
34
|
+
*/
|
|
35
|
+
initializeSearch(params: IStartCrossBufferParam): Promise<IResult>;
|
|
36
|
+
/**
|
|
37
|
+
* 获取当前缓冲区的搜索结果
|
|
38
|
+
*/
|
|
39
|
+
getCurrentSearchResult(): Promise<{
|
|
40
|
+
lanes: Graphic[];
|
|
41
|
+
stopLines: Graphic[];
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* 清除地图上显示的搜索结果
|
|
45
|
+
*/
|
|
46
|
+
clearResult(): void;
|
|
47
|
+
/**
|
|
48
|
+
* 计算缓冲区
|
|
49
|
+
* 移动边缘点或圆心点后调用
|
|
50
|
+
* @param vertices 圆心点与边缘点的坐标
|
|
51
|
+
*/
|
|
52
|
+
private calculateBuffer;
|
|
53
|
+
/**
|
|
54
|
+
* 载入车道和停止线图层
|
|
55
|
+
*/
|
|
56
|
+
private loadLaneAndStopLineLayer;
|
|
57
|
+
/**
|
|
58
|
+
* 更新车道与停止线图层的filter,高亮缓冲区内部的要素
|
|
59
|
+
* @param buffer
|
|
60
|
+
*/
|
|
61
|
+
private updateLayerFilter;
|
|
62
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import l from "@arcgis/core/Graphic";
|
|
2
|
+
import * as f from "@arcgis/core/core/promiseUtils";
|
|
3
|
+
import { Point as b, Polyline as p } from "@arcgis/core/geometry";
|
|
4
|
+
import S from "@arcgis/core/geometry/SpatialReference";
|
|
5
|
+
import * as h from "@arcgis/core/geometry/geometryEngineAsync";
|
|
6
|
+
import m from "@arcgis/core/layers/FeatureLayer";
|
|
7
|
+
import u from "@arcgis/core/layers/GraphicsLayer";
|
|
8
|
+
import G from "@arcgis/core/layers/support/FeatureEffect";
|
|
9
|
+
import R from "@arcgis/core/layers/support/FeatureFilter";
|
|
10
|
+
import d from "@arcgis/core/renderers/SimpleRenderer";
|
|
11
|
+
import v from "@arcgis/core/rest/support/Query";
|
|
12
|
+
import { SimpleMarkerSymbol as g, SimpleLineSymbol as L, SimpleFillSymbol as w } from "@arcgis/core/symbols";
|
|
13
|
+
import F from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
14
|
+
import A from "../../stores/index.mjs";
|
|
15
|
+
import I from "../common-utils.mjs";
|
|
16
|
+
class V {
|
|
17
|
+
constructor(e) {
|
|
18
|
+
this.geometryUnit = "meters", this.view = e, this.pointLayer = new u(), this.bufferAreaLayer = new u({
|
|
19
|
+
blendMode: "color-burn"
|
|
20
|
+
}), this.view.map.layers.addMany([this.bufferAreaLayer, this.pointLayer]);
|
|
21
|
+
const i = f.debounce(
|
|
22
|
+
async (t) => {
|
|
23
|
+
const r = await this.calculateBuffer(t);
|
|
24
|
+
this.updateLayerFilter(r);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
this.sketchViewModel = new F({
|
|
28
|
+
view: e,
|
|
29
|
+
layer: this.pointLayer
|
|
30
|
+
}), this.sketchViewModel.on("update", (t) => {
|
|
31
|
+
var c, s;
|
|
32
|
+
((s = (c = t.toolEventInfo) == null ? void 0 : c.mover) == null ? void 0 : s.attributes.type) === "edge" && (t.toolEventInfo.type === "move-start" ? this.centerGeometryAtStart = this.centerGraphic.geometry : this.centerGraphic.geometry = this.centerGeometryAtStart);
|
|
33
|
+
const r = this.centerGraphic.geometry, o = this.edgeGraphic.geometry, n = [
|
|
34
|
+
[r.x, r.y],
|
|
35
|
+
[o.x, o.y]
|
|
36
|
+
];
|
|
37
|
+
i(n).catch((y) => {
|
|
38
|
+
if (!f.isAbortError(y))
|
|
39
|
+
throw y;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 搜索路口中心点周边车道
|
|
45
|
+
* @param params
|
|
46
|
+
* @returns Promise<IResult>
|
|
47
|
+
*/
|
|
48
|
+
async initializeSearch(e) {
|
|
49
|
+
if (this.laneLayer)
|
|
50
|
+
this.laneLayer.visible = !0, this.stopLineLayer.visible = !0;
|
|
51
|
+
else {
|
|
52
|
+
const s = await this.loadLaneAndStopLineLayer();
|
|
53
|
+
if (s.status !== 0)
|
|
54
|
+
return s;
|
|
55
|
+
}
|
|
56
|
+
const { crossId: i, crossCenter: t } = e, r = new b({
|
|
57
|
+
longitude: t[0],
|
|
58
|
+
latitude: t[1]
|
|
59
|
+
});
|
|
60
|
+
this.view.goTo(
|
|
61
|
+
{
|
|
62
|
+
target: r,
|
|
63
|
+
zoom: 18
|
|
64
|
+
},
|
|
65
|
+
{ duration: 2e3 }
|
|
66
|
+
), this.centerGraphic = new l({
|
|
67
|
+
geometry: r,
|
|
68
|
+
symbol: new g({
|
|
69
|
+
style: "circle",
|
|
70
|
+
color: [0, 255, 255, 0.5],
|
|
71
|
+
size: 10
|
|
72
|
+
}),
|
|
73
|
+
attributes: {
|
|
74
|
+
crossId: i,
|
|
75
|
+
type: "center"
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const o = I.destinationWithPoint(
|
|
79
|
+
r,
|
|
80
|
+
90,
|
|
81
|
+
e.bufferRadius || 70
|
|
82
|
+
);
|
|
83
|
+
this.edgeGraphic = new l({
|
|
84
|
+
geometry: o,
|
|
85
|
+
symbol: new g({
|
|
86
|
+
style: "circle",
|
|
87
|
+
color: [0, 255, 255, 0.5],
|
|
88
|
+
size: 10
|
|
89
|
+
}),
|
|
90
|
+
attributes: {
|
|
91
|
+
crossId: i,
|
|
92
|
+
type: "edge"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const n = new p({
|
|
96
|
+
paths: [
|
|
97
|
+
[
|
|
98
|
+
[r.x, r.y],
|
|
99
|
+
[o.x, o.y]
|
|
100
|
+
]
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
this.radiusLineGraphic = new l({
|
|
104
|
+
geometry: n,
|
|
105
|
+
symbol: new L({
|
|
106
|
+
color: [0, 255, 255],
|
|
107
|
+
width: 2
|
|
108
|
+
})
|
|
109
|
+
}), this.pointLayer.addMany([
|
|
110
|
+
this.centerGraphic,
|
|
111
|
+
this.edgeGraphic,
|
|
112
|
+
this.radiusLineGraphic
|
|
113
|
+
]);
|
|
114
|
+
const c = await h.geodesicBuffer(
|
|
115
|
+
r,
|
|
116
|
+
e.bufferRadius || 70,
|
|
117
|
+
this.geometryUnit
|
|
118
|
+
);
|
|
119
|
+
return this.bufferGraphic = new l({
|
|
120
|
+
geometry: c,
|
|
121
|
+
symbol: new w({
|
|
122
|
+
color: [150, 150, 150],
|
|
123
|
+
outline: {
|
|
124
|
+
color: "#FFEB00",
|
|
125
|
+
width: "3px"
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
}), this.bufferAreaLayer.add(this.bufferGraphic), this.sketchViewModel.update([this.edgeGraphic, this.centerGraphic], {
|
|
129
|
+
tool: "move"
|
|
130
|
+
}), { status: 0, message: "初始化成功" };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 获取当前缓冲区的搜索结果
|
|
134
|
+
*/
|
|
135
|
+
async getCurrentSearchResult() {
|
|
136
|
+
const e = new v();
|
|
137
|
+
e.relationParameter = "intersects", e.geometry = this.bufferGraphic.geometry, e.returnGeometry = !0, e.outSpatialReference = new S({ wkid: 4326 }), e.outFields = ["*"];
|
|
138
|
+
const i = (await this.laneLayer.queryFeatures(e)).features, t = (await this.stopLineLayer.queryFeatures(e)).features;
|
|
139
|
+
return {
|
|
140
|
+
lanes: i,
|
|
141
|
+
stopLines: t
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 清除地图上显示的搜索结果
|
|
146
|
+
*/
|
|
147
|
+
clearResult() {
|
|
148
|
+
this.sketchViewModel.complete(), this.pointLayer.removeAll(), this.bufferAreaLayer.removeAll(), this.laneLayer.visible = !1, this.stopLineLayer.visible = !1;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 计算缓冲区
|
|
152
|
+
* 移动边缘点或圆心点后调用
|
|
153
|
+
* @param vertices 圆心点与边缘点的坐标
|
|
154
|
+
*/
|
|
155
|
+
async calculateBuffer(e) {
|
|
156
|
+
this.radiusLineGraphic.geometry = new p({
|
|
157
|
+
paths: [e],
|
|
158
|
+
spatialReference: this.view.spatialReference
|
|
159
|
+
});
|
|
160
|
+
const i = await h.geodesicLength(
|
|
161
|
+
this.radiusLineGraphic.geometry,
|
|
162
|
+
this.geometryUnit
|
|
163
|
+
), t = await h.geodesicBuffer(
|
|
164
|
+
this.centerGraphic.geometry,
|
|
165
|
+
i,
|
|
166
|
+
this.geometryUnit
|
|
167
|
+
);
|
|
168
|
+
return this.bufferGraphic.geometry = t, t;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 载入车道和停止线图层
|
|
172
|
+
*/
|
|
173
|
+
async loadLaneAndStopLineLayer() {
|
|
174
|
+
var s, y;
|
|
175
|
+
const e = A.useAppDataStore, i = JSON.parse(JSON.stringify(e.mapConfig));
|
|
176
|
+
if (!((s = i.roadConfigTool) != null && s.initLanePolygonLayer))
|
|
177
|
+
return {
|
|
178
|
+
status: -1,
|
|
179
|
+
message: "roadConfigTool.initLanePolygonLayer未配置"
|
|
180
|
+
};
|
|
181
|
+
if (!((y = i.roadConfigTool) != null && y.initStopLineLayer))
|
|
182
|
+
return {
|
|
183
|
+
status: -1,
|
|
184
|
+
message: "roadConfigTool.initStopLineLayer"
|
|
185
|
+
};
|
|
186
|
+
const t = `${i.assetsRoot}${i.roadConfigTool.initLanePolygonLayer}`;
|
|
187
|
+
let r;
|
|
188
|
+
try {
|
|
189
|
+
r = await (await fetch(t)).json();
|
|
190
|
+
} catch (a) {
|
|
191
|
+
return { status: -2, message: `${t}读取失败`, result: a.message };
|
|
192
|
+
}
|
|
193
|
+
const o = r.features.filter((a) => a.attributes.RoadSecID !== "").map((a) => l.fromJSON(a));
|
|
194
|
+
this.laneLayer = new m({
|
|
195
|
+
objectIdField: "FID",
|
|
196
|
+
spatialReference: r.spatialReference,
|
|
197
|
+
geometryType: "polygon",
|
|
198
|
+
source: o,
|
|
199
|
+
fields: [
|
|
200
|
+
{
|
|
201
|
+
name: "RoadSecID",
|
|
202
|
+
alias: "RoadSecID",
|
|
203
|
+
type: "string"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
renderer: new d({
|
|
207
|
+
symbol: new w({
|
|
208
|
+
color: [255, 0, 0, 0.3],
|
|
209
|
+
outline: {
|
|
210
|
+
color: "white"
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
}), this.view.map.layers.add(this.laneLayer);
|
|
215
|
+
const n = `${i.assetsRoot}${i.roadConfigTool.initStopLineLayer}`;
|
|
216
|
+
try {
|
|
217
|
+
r = await (await fetch(n)).json();
|
|
218
|
+
} catch (a) {
|
|
219
|
+
return {
|
|
220
|
+
status: -2,
|
|
221
|
+
message: `${n}读取失败`,
|
|
222
|
+
result: a.message
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const c = r.features.filter((a) => a.attributes.RoadSecID !== "").map((a) => l.fromJSON(a));
|
|
226
|
+
return this.stopLineLayer = new m({
|
|
227
|
+
objectIdField: "FID",
|
|
228
|
+
spatialReference: r.spatialReference,
|
|
229
|
+
geometryType: "polyline",
|
|
230
|
+
source: c,
|
|
231
|
+
fields: [
|
|
232
|
+
{
|
|
233
|
+
name: "RoadSecID",
|
|
234
|
+
alias: "RoadSecID",
|
|
235
|
+
type: "string"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
renderer: new d({
|
|
239
|
+
symbol: new L({
|
|
240
|
+
color: "red",
|
|
241
|
+
width: 4,
|
|
242
|
+
cap: "butt",
|
|
243
|
+
join: "miter"
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
}), this.view.map.layers.add(this.stopLineLayer), { status: 0, message: "ok" };
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 更新车道与停止线图层的filter,高亮缓冲区内部的要素
|
|
250
|
+
* @param buffer
|
|
251
|
+
*/
|
|
252
|
+
updateLayerFilter(e) {
|
|
253
|
+
const i = new R({
|
|
254
|
+
geometry: e,
|
|
255
|
+
spatialRelationship: "intersects"
|
|
256
|
+
}), t = new G({
|
|
257
|
+
filter: i,
|
|
258
|
+
excludedEffect: "opacity(0%)"
|
|
259
|
+
});
|
|
260
|
+
this.laneLayer.featureEffect = t, this.stopLineLayer.featureEffect = t;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export {
|
|
264
|
+
V as default
|
|
265
|
+
};
|