gisviewer-vue3-arcgis 1.0.133 → 1.0.134
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/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/src/gis-map/gis-map.vue.d.ts +17 -0
- package/es/src/gis-map/gis-map.vue.mjs +118 -113
- package/es/src/gis-map/index.d.ts +17 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +7 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +48 -0
- package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +4 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +18 -16
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +3 -7
- package/es/style.css +1 -1
- package/lib/_virtual/_plugin-vue_export-helper.js +1 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +17 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +17 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +18 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue.js +1 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +1 -0
- package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +2 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
- package/es/src/gis-map/utils/open-drive-renderer/draw-bezier.mjs +0 -49
- package/es/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
- package/es/src/gis-map/utils/open-drive-renderer/junction.mjs +0 -151
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
- package/es/src/gis-map/utils/open-drive-renderer/lane-section.mjs +0 -82
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
- package/es/src/gis-map/utils/open-drive-renderer/lane-utils.mjs +0 -265
- package/es/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
- package/es/src/gis-map/utils/open-drive-renderer/lane.mjs +0 -110
- package/es/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
- package/es/src/gis-map/utils/open-drive-renderer/road.mjs +0 -121
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
- package/es/src/gis-map/utils/open-drive-renderer/wasm-loader.mjs +0 -425
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.d.ts +0 -17
- package/lib/src/gis-map/utils/open-drive-renderer/draw-bezier.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/junction.d.ts +0 -51
- package/lib/src/gis-map/utils/open-drive-renderer/junction.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.d.ts +0 -48
- package/lib/src/gis-map/utils/open-drive-renderer/lane-section.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.d.ts +0 -29
- package/lib/src/gis-map/utils/open-drive-renderer/lane-utils.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/lane.d.ts +0 -77
- package/lib/src/gis-map/utils/open-drive-renderer/lane.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/road.d.ts +0 -62
- package/lib/src/gis-map/utils/open-drive-renderer/road.js +0 -1
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.d.ts +0 -108
- package/lib/src/gis-map/utils/open-drive-renderer/wasm-loader.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@turf/bearing"),j=require("@turf/helpers"),a=require("./wasm-loader.js");function h(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const I=h(j),L=class{static isLaneDirEqualDriveDir(e){var t,n;let o=0;if(((t=e.road.predecessor)==null?void 0:t.elementType)==="junction"){const c=e.road.predecessor.elementId,i=a.default.getInstance().junctionList.get(c);if(i){for(const d of i.laneLinks)if(d.outgoing.roadId===e.road.id){o=d.outgoing.laneId;break}}}else if(((n=e.road.successor)==null?void 0:n.elementType)==="junction"){const c=e.road.successor.elementId,i=a.default.getInstance().junctionList.get(c);if(i){for(const d of i.laneLinks)if(d.incoming.roadId===e.road.id){o=d.incoming.laneId;break}}}return o===0?!0:o*e.id>0}static getDriveAngle(e){const o=L.getLaneEndPoints(e),t=I.point(o[0]),n=I.point(o[1]);return m(t,n)}static getLaneEndPoints(e,o="middle"){let t,n,c,i;switch(e.isDirEqual?(t=e.innerBorder[0],n=e.innerBorder[e.innerBorder.length-1],c=e.outerBorder[0],i=e.outerBorder[e.outerBorder.length-1]):(t=e.innerBorder[e.innerBorder.length-1],n=e.innerBorder[0],c=e.outerBorder[e.outerBorder.length-1],i=e.outerBorder[0]),o){case"inner":return[t,n];case"outer":return[c,i];default:{const d=[(t[0]+c[0])/2,(t[1]+c[1])/2],g=[(n[0]+i[0])/2,(n[1]+i[1])/2];return[d,g]}}}static getPrevAndNext(e){var i,d,g,l;const o=[],t=[],n=e.laneSection.s0===0,c=e.road.isLastLaneSection(e.laneSection.s0);if(n){if(((i=e.road.predecessor)==null?void 0:i.elementType)==="junction"){const s=a.default.getInstance().junctionList.get(e.road.predecessor.elementId);if(s){const r=s.getSuccessorForIncoming(e.road.id,e.id);if(r.length>0)t.push(...r);else{const u=s.getPredecessorForOutgoing(e.road.id,e.id);o.push(...u)}}}else if(((d=e.road.predecessor)==null?void 0:d.elementType)==="road"&&e.predecessor!==0){const s=e.road.predecessor.elementId;let r=0;if(e.road.predecessor.contactPoint==="end"){const f=a.default.getInstance().roadList.get(s);f&&(r=f.getLastLaneSection().s0)}const u={roadId:s,sectionId:r,laneId:e.predecessor};e.isDirEqual?o.push(u):t.push(u)}}else if(e.predecessor!==0){const s=e.road.getPrevLaneSection(e.laneSection.s0);if(s){const r={roadId:e.road.id,sectionId:s.s0,laneId:e.predecessor};e.isDirEqual?o.push(r):t.push(r)}}if(c){if(((g=e.road.successor)==null?void 0:g.elementType)==="junction"){const s=a.default.getInstance().junctionList.get(e.road.successor.elementId);if(s){const r=s.getSuccessorForIncoming(e.road.id,e.id);if(r.length>0)t.push(...r);else{const u=s.getPredecessorForOutgoing(e.road.id,e.id);o.push(...u)}}}else if(((l=e.road.successor)==null?void 0:l.elementType)==="road"&&e.successor!==0){const s=e.road.successor.elementId;let r=0;if(e.road.successor.contactPoint==="end"){const f=a.default.getInstance().roadList.get(s);f&&(r=f.getLastLaneSection().s0)}const u={roadId:s,sectionId:r,laneId:e.successor};e.isDirEqual?t.push(u):o.push(u)}}else if(e.successor!==0){const s=e.road.getNextLaneSection(e.laneSection.s0);if(s){const r={roadId:e.road.id,sectionId:s.s0,laneId:e.successor};e.isDirEqual?t.push(r):o.push(r)}}return{predecessorLanes:o,successorLanes:t}}};let p=L;p.shpLanePolygonMap=new Map;p.shpArrowPositionMap=new Map;exports.default=p;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ISampledLane } from '../../../types';
|
|
2
|
-
import LaneSection from './lane-section';
|
|
3
|
-
import Road from './road';
|
|
4
|
-
export default class Lane {
|
|
5
|
-
/** 车道id:
|
|
6
|
-
* 车道在路段中的序号,-2,-1,0,1,2,...
|
|
7
|
-
*/
|
|
8
|
-
id: number;
|
|
9
|
-
/** 车道类型, driving/walk/bike... */
|
|
10
|
-
type: string;
|
|
11
|
-
/** 内侧边线采样点坐标 */
|
|
12
|
-
innerBorder: number[][];
|
|
13
|
-
/** 外侧边线采样点坐标 */
|
|
14
|
-
outerBorder: number[][];
|
|
15
|
-
centerLine: number[][];
|
|
16
|
-
road: Road;
|
|
17
|
-
laneSection: LaneSection;
|
|
18
|
-
predecessor: number;
|
|
19
|
-
successor: number;
|
|
20
|
-
/** 车道行车方向与正北夹角 */
|
|
21
|
-
private angle;
|
|
22
|
-
/** 车道行车方向是否与参考线方向一致 */
|
|
23
|
-
private _isDirEqual;
|
|
24
|
-
/**
|
|
25
|
-
* 行车方向是否已计算
|
|
26
|
-
* 存在无法计算行车方向, isDirEqual = undefined的情况,额外加一个标志
|
|
27
|
-
* */
|
|
28
|
-
private isDirEqualReady;
|
|
29
|
-
/**
|
|
30
|
-
* 车道面
|
|
31
|
-
*/
|
|
32
|
-
ring: number[][];
|
|
33
|
-
constructor(odrLane: any, road: Road, lanesection: LaneSection);
|
|
34
|
-
get isDirEqual(): boolean | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* 车道代码:道路id_路段id_车道id
|
|
37
|
-
*/
|
|
38
|
-
get laneCode(): string;
|
|
39
|
-
/**
|
|
40
|
-
* 车道边线采样后的数据
|
|
41
|
-
*/
|
|
42
|
-
get sampledLane(): ISampledLane;
|
|
43
|
-
/**
|
|
44
|
-
* 获取路段内同方向最外侧车道
|
|
45
|
-
*/
|
|
46
|
-
get outerMostLaneInTheSameDir(): Lane;
|
|
47
|
-
/**
|
|
48
|
-
* 车道航向角
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
get drivingAngle(): number;
|
|
52
|
-
/**
|
|
53
|
-
* 根据左右边线生成车道中心线
|
|
54
|
-
* @param left
|
|
55
|
-
* @param right
|
|
56
|
-
*/
|
|
57
|
-
private getCenterLineFromBorder;
|
|
58
|
-
/**
|
|
59
|
-
* 获取车道按行车方向的起点、终点,可选择内侧、中间、外侧
|
|
60
|
-
* @param type
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
getLaneEndPoints(type?: string): number[][];
|
|
64
|
-
/**
|
|
65
|
-
* 获取车道的前驱车道和后继车道
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
getLink(): {
|
|
69
|
-
predecessorLanes: import("../../../types").ILaneInfo[];
|
|
70
|
-
successorLanes: import("../../../types").ILaneInfo[];
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* 获取车道停止线
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
getStopLine(): number[][];
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../common-utils.js"),s=require("./lane-utils.js");class a{constructor(e,t,i){this.isDirEqualReady=!1,this.road=t,this.laneSection=i,this.id=e.id,this.type=e.type,this.predecessor=e.predecessor,this.successor=e.successor;const o=n.default.getStdVecEntries(e.inner_border,!0);this.innerBorder=n.default.transformLineProjection(o);const r=n.default.getStdVecEntries(e.outer_border,!0);this.outerBorder=n.default.transformLineProjection(r),this.centerLine=this.getCenterLineFromBorder(this.innerBorder,this.outerBorder);const d=this.innerBorder.concat([...this.outerBorder].reverse());d.push(d[0]),this.ring=d}get isDirEqual(){return this.isDirEqualReady||(this._isDirEqual=s.default.isLaneDirEqualDriveDir(this),this.isDirEqualReady=!0),this._isDirEqual}get laneCode(){return`${this.road.id}_${this.laneSection.s0}_${this.id}`}get sampledLane(){return{id:this.id,type:this.type,innerPath:this.innerBorder,outerPath:this.outerBorder}}get outerMostLaneInTheSameDir(){const e=this.laneSection.allLaneIds,t=this.id>0?e[e.length-1]:e[0];return this.laneSection.getLane(t)}get drivingAngle(){if(!this.angle){const e=s.default.getDriveAngle(this);this.angle=e}return this.angle}getCenterLineFromBorder(e,t){const i=[],o=Math.min(e.length,t.length);for(let r=0;r<o;r++)i.push([(e[r][0]+t[r][0])/2,(e[r][1]+t[r][1])/2]);return i}getLaneEndPoints(e="middle"){return s.default.getLaneEndPoints(this,e)}getLink(){return s.default.getPrevAndNext(this)}getStopLine(){const e=this.getLaneEndPoints("inner"),t=this.getLaneEndPoints("outer");return[e[1],t[1]]}}exports.default=a;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { IRoadLink, ISampledRoad } from '../../../types';
|
|
2
|
-
import LaneSection from './lane-section';
|
|
3
|
-
export default class Road {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
length: number;
|
|
7
|
-
junction: string;
|
|
8
|
-
successor: IRoadLink;
|
|
9
|
-
predecessor: IRoadLink;
|
|
10
|
-
/** 道路上下左右的边框 */
|
|
11
|
-
borders: {
|
|
12
|
-
left: number[][];
|
|
13
|
-
right: number[][];
|
|
14
|
-
top: number[][];
|
|
15
|
-
bottom: number[][];
|
|
16
|
-
};
|
|
17
|
-
/** 上下左右边框围成的多边形 */
|
|
18
|
-
polygon: number[][];
|
|
19
|
-
refLine: number[][];
|
|
20
|
-
private sToLaneSection;
|
|
21
|
-
constructor(odrRoad: any);
|
|
22
|
-
/**
|
|
23
|
-
* 获取一个路段
|
|
24
|
-
* @param s0
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
getLaneSection(s0: number): LaneSection | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* 获取第一个路段
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
getFirstLaneSection(): LaneSection;
|
|
33
|
-
/**
|
|
34
|
-
* 获取最后一个路段
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
getLastLaneSection(): LaneSection;
|
|
38
|
-
getLaneSectionIndex(s: number): number;
|
|
39
|
-
getLaneSectionLength(s: number): number;
|
|
40
|
-
/**
|
|
41
|
-
* 是否是最后一个路段的里程值
|
|
42
|
-
* @param s
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
isLastLaneSection(s: number): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* 获取下一个路段
|
|
48
|
-
* @param s
|
|
49
|
-
*/
|
|
50
|
-
getNextLaneSection(s: number): LaneSection | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* 获取上一个路段
|
|
53
|
-
* @param s
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
getPrevLaneSection(s: number): LaneSection | undefined;
|
|
57
|
-
/** 获取所有路段 */
|
|
58
|
-
get allLaneSections(): LaneSection[];
|
|
59
|
-
get laneSectionNumber(): number;
|
|
60
|
-
get sampledRoad(): ISampledRoad;
|
|
61
|
-
private getBorderLine;
|
|
62
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../common-utils.js"),h=require("./lane-section.js");class l{constructor(e){this.id=e.id,this.name=e.name,this.length=e.length,this.junction=e.junction,this.sToLaneSection=new Map;const t=a.default.getStdVecEntries(e.ref_line,!0);this.refLine=a.default.transformLineProjection(t);for(const i of[!0,!1]){const o=i?e.predecessor:e.successor,r={elementId:o.id,elementType:o.type,contactPoint:o.contact_point};i?this.predecessor=r:this.successor=r}a.default.getStdVecEntries(e.odr_lanesections,!0).forEach(i=>{const o=new h.default(i,this);this.sToLaneSection.set(o.s0,o)}),this.borders=this.getBorderLine();const n=[];n.push(...this.borders.right),n.push(...this.borders.top),n.push(...[...this.borders.left].reverse()),n.push(...[...this.borders.bottom].reverse()),n.push(n[0]),this.polygon=n}getLaneSection(e){return this.sToLaneSection.get(e)}getFirstLaneSection(){const e=[...this.sToLaneSection.keys()];return e.sort((t,s)=>t-s),this.sToLaneSection.get(e[0])}getLastLaneSection(){const e=[...this.sToLaneSection.keys()];return e.sort((t,s)=>t-s),this.sToLaneSection.get(e[e.length-1])}getLaneSectionIndex(e){return[...this.sToLaneSection.keys()].indexOf(e)}getLaneSectionLength(e){const t=[...this.sToLaneSection.keys()],s=t.indexOf(e);let n=0;return s===0?t.length===1?n=this.length:n=t[1]:s===t.length-1?n=this.length-t[t.length-1]:n=t[s+1]-e,n}isLastLaneSection(e){const t=[...this.sToLaneSection.keys()];return t.sort((s,n)=>s-n),e===t[t.length-1]}getNextLaneSection(e){const t=[...this.sToLaneSection.keys()],s=t.indexOf(e);if(s>=0&&s<t.length-1)return this.sToLaneSection.get(t[s+1])}getPrevLaneSection(e){const t=[...this.sToLaneSection.keys()],s=t.indexOf(e);if(s>0)return this.sToLaneSection.get(t[s-1])}get allLaneSections(){return[...this.sToLaneSection.values()]}get laneSectionNumber(){return this.sToLaneSection.size}get sampledRoad(){return{id:this.id,name:this.name,junction:this.junction,refLine:this.refLine,laneSections:this.allLaneSections.map(e=>e.sampledLaneSection)}}getBorderLine(){const e=[],t=[];let s=[],n=[];const i=[...this.sToLaneSection.keys()];return i.forEach((o,r)=>{const c=this.getLaneSection(o);r===0?n=c.borders.bottom:r===i.length-1&&(s=c.borders.top),e.push(...c.borders.left),t.push(...c.borders.right)}),{left:e,right:t,top:s,bottom:n}}}exports.default=l;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { ILaneInfo, IResult, ISampledRoad } from '../../../types';
|
|
2
|
-
import Junction from './junction';
|
|
3
|
-
import Lane from './lane';
|
|
4
|
-
import Road from './road';
|
|
5
|
-
export default class WasmLoader {
|
|
6
|
-
private static instance;
|
|
7
|
-
static getInstance(): WasmLoader;
|
|
8
|
-
roadList: Map<string, Road>;
|
|
9
|
-
junctionList: Map<string, Junction>;
|
|
10
|
-
private junctionTableData;
|
|
11
|
-
private isWasmLoaded;
|
|
12
|
-
private ModuleOpenDrive;
|
|
13
|
-
private ModuleOpenDriveMap;
|
|
14
|
-
private appDataStore;
|
|
15
|
-
private FsFile;
|
|
16
|
-
/**
|
|
17
|
-
* 载入指定xodr文件并解析
|
|
18
|
-
* @param filePath
|
|
19
|
-
*/
|
|
20
|
-
load(file: string): Promise<IResult>;
|
|
21
|
-
clear(): void;
|
|
22
|
-
/**
|
|
23
|
-
* 读取xodr中wasm接口不提供的数据
|
|
24
|
-
* @param fileText
|
|
25
|
-
*/
|
|
26
|
-
private readXodrString;
|
|
27
|
-
/**
|
|
28
|
-
* 解析路网
|
|
29
|
-
*/
|
|
30
|
-
private getRoadNetwork;
|
|
31
|
-
/**
|
|
32
|
-
* 获取所有道路的采样结果
|
|
33
|
-
*/
|
|
34
|
-
get allSampledRoads(): ISampledRoad[];
|
|
35
|
-
/**
|
|
36
|
-
* 获取路网结构
|
|
37
|
-
*/
|
|
38
|
-
get roadNetwork(): {
|
|
39
|
-
roadName: string;
|
|
40
|
-
roadId: string;
|
|
41
|
-
roadLength: number;
|
|
42
|
-
sections: {
|
|
43
|
-
sectionId: number;
|
|
44
|
-
laneIds: number[];
|
|
45
|
-
}[];
|
|
46
|
-
}[];
|
|
47
|
-
/**
|
|
48
|
-
* 从车道信息获取车道对象
|
|
49
|
-
* @param laneInfo
|
|
50
|
-
*/
|
|
51
|
-
getLane(laneInfo: ILaneInfo): Lane | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* 获取两个车道之间的车道功能
|
|
54
|
-
* 左转、直行、右转、调头
|
|
55
|
-
* @param incoming
|
|
56
|
-
* @param outgoing
|
|
57
|
-
*/
|
|
58
|
-
getFunctionFromIncomingToOutgoing(incoming: ILaneInfo, outgoing: ILaneInfo): IResult;
|
|
59
|
-
/**
|
|
60
|
-
* 获取所有路口的轮廓
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
getJunctionOutline(junctionId: string): IResult;
|
|
64
|
-
/**
|
|
65
|
-
* 获取车道的前驱车道和后继车道
|
|
66
|
-
* @param laneInfo
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
getLaneLink(laneInfo: ILaneInfo): IResult;
|
|
70
|
-
getRoadLink(roadId: string): IResult;
|
|
71
|
-
getConnectionLink(junctionId: string): IResult;
|
|
72
|
-
getLaneAngle(laneInfo: ILaneInfo): IResult;
|
|
73
|
-
getTurnArrow(params: {
|
|
74
|
-
incoming: ILaneInfo;
|
|
75
|
-
outgoing: ILaneInfo;
|
|
76
|
-
}): IResult;
|
|
77
|
-
/**
|
|
78
|
-
* 道路路段车道的轮廓
|
|
79
|
-
* @param roadId
|
|
80
|
-
* @param sectionId
|
|
81
|
-
* @param laneId
|
|
82
|
-
* @returns
|
|
83
|
-
*/
|
|
84
|
-
getPolygon(roadId: string, sectionId?: number, laneId?: number): IResult;
|
|
85
|
-
/**
|
|
86
|
-
* 车道长度
|
|
87
|
-
* @param laneInfo
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
90
|
-
getLaneLength(laneInfo: ILaneInfo): IResult;
|
|
91
|
-
getRoadStopLine(junctionId: string): IResult;
|
|
92
|
-
getLaneStopLine(laneInfo: ILaneInfo): IResult;
|
|
93
|
-
getLaneCenterLine(laneInfo: ILaneInfo): IResult;
|
|
94
|
-
getSumoEdgeInfo(sectionCode: string): {
|
|
95
|
-
obj_id: string;
|
|
96
|
-
obj_type: number;
|
|
97
|
-
obj_desc: string;
|
|
98
|
-
obj_info: {
|
|
99
|
-
obj_id: string;
|
|
100
|
-
length: number;
|
|
101
|
-
from: string;
|
|
102
|
-
to: string;
|
|
103
|
-
numLanes: number;
|
|
104
|
-
type: string;
|
|
105
|
-
laneList: any[];
|
|
106
|
-
};
|
|
107
|
-
} | undefined;
|
|
108
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("fast-xml-parser"),L=require("../../stores/index.js"),g=require("../common-utils.js"),p=require("./junction.js"),S=require("./road.js");class c{constructor(){this.roadList=new Map,this.junctionList=new Map,this.junctionTableData=new Map,this.isWasmLoaded=!1,this.appDataStore=L.default.useAppDataStore,this.FsFile="data.xodr"}static getInstance(){return c.instance||(c.instance=new c),c.instance}async load(o){if(!this.isWasmLoaded){const r=window.libOpenDrive;this.ModuleOpenDrive=await r(),this.isWasmLoaded=!0}console.time("加载用时");const t=await(await fetch(o)).text();this.readXodrString(t);const n=new TextEncoder().encode(t);try{this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`)}catch{}this.ModuleOpenDrive.FS_createDataFile(".",this.FsFile,n,!0,!0);const i={with_lateralProfile:!0,with_laneHeight:!0,with_road_objects:!1,center_map:!1,abs_z_for_for_local_road_obj_outline:!0};return this.ModuleOpenDriveMap=new this.ModuleOpenDrive.OpenDriveMap(`./${this.FsFile}`,i),console.timeEnd("加载用时"),this.getRoadNetwork()}clear(){this.roadList.clear(),this.junctionList.clear();try{this.ModuleOpenDrive.FS_unlink(`./${this.FsFile}`)}catch{}}readXodrString(o){const t=new m.XMLParser({ignoreAttributes:!1,allowBooleanAttributes:!0}).parse(o),s=t.OpenDRIVE.header.geoReference,n=t.OpenDRIVE.header.offset;if(n){const r=Number(n["@_x"])||0,a=Number(n["@_y"])||0;g.default.setGeoData(s,r,a)}const i=t.OpenDRIVE.junction;for(const r of i){const a=JSON.parse(r.userData.tableData);this.junctionTableData.set(a.id,a)}}getRoadNetwork(){this.roadList.clear(),this.junctionList.clear();let o;try{console.time("采样用时"),o=this.ModuleOpenDrive.get_odr_road_network(this.ModuleOpenDriveMap,.5)}catch(s){return{status:-1,message:`解析路网失败, ${s}`}}finally{console.timeEnd("采样用时")}console.time("投影转换用时");try{g.default.getStdVecEntries(o.roads,!0).forEach(n=>{const i=new S.default(n);this.roadList.set(i.id,i)})}catch(s){return{status:-1,message:`解析道路失败, ${s}`}}try{g.default.getStdVecEntries(o.junctions,!0).forEach(n=>{const i=new p.default(n);i.tableData=this.junctionTableData.get(i.id),this.junctionList.set(n.id,i)})}catch(s){return{status:-1,message:`解析路口失败, ${s}`}}console.timeEnd("投影转换用时");const e=[];this.roadList.forEach(s=>{const n=s.allLaneSections.map(i=>{const r=i.allLanes.map(a=>({id:a.id,type:a.type,innerPath:a.innerBorder,outerPath:a.outerBorder,centerLine:a.centerLine}));return{id:i.s0,lanePaths:r}});e.push({id:s.id,name:s.name,laneSections:n,junction:s.junction,refLine:s.refLine})});const t=[];return this.junctionList.forEach(s=>{s.tableData&&t.push(s.tableData)}),{status:0,message:"ok",result:{roads:e,junctions:t}}}get allSampledRoads(){return[...this.roadList.values()].map(o=>o.sampledRoad)}get roadNetwork(){return[...this.roadList.values()].map(e=>{const t=e.allLaneSections.map(s=>{const n=s.allLaneIds.filter(i=>i!==0);return{sectionId:s.s0,laneIds:n}});return{roadName:e.name,roadId:e.id,roadLength:e.length,sections:t}})}getLane(o){const e=this.roadList.get(o.roadId),t=e==null?void 0:e.getLaneSection(o.sectionId);return t==null?void 0:t.getLane(o.laneId)}getFunctionFromIncomingToOutgoing(o,e){const t=this.getLane(o),s=this.getLane(e);if(!t||!s||!t.drivingAngle||!s.drivingAngle)return{status:-1,message:"车道信息错误"};let n=s.drivingAngle-t.drivingAngle;n>180?n-=360:n<-180&&(n+=360);let i="";return-45<n&&n<45?i="s":45<=n&&n<=135?i="r":-135<=n&&n<=-45?i="l":i="t",{status:0,result:i,message:"ok"}}getJunctionOutline(o){const e=[];if(o!==""){const t=this.junctionList.get(o);if(t){const s=t.getJunctionOutline();e.push({junctionId:o,name:t.name,outline:s})}}else for(const t of this.junctionList){const s=t[0],n=t[1],i=n.getJunctionOutline();i.length<=4?console.log(i,s):e.push({junctionId:s,name:n.name,outline:i})}return{status:0,result:e,message:"ok"}}getLaneLink(o){const e=this.getLane(o);return e?{status:0,result:e.getLink(),message:"ok"}:{status:-1,message:"车道信息错误"}}getRoadLink(o){const e=[];if(o!==""){const t=this.roadList.get(o);t&&e.push({roadId:o,successor:t.successor,predecessor:t.predecessor})}else[...this.roadList.values()].forEach(s=>{e.push({roadId:o,successor:s.successor,predecessor:s.predecessor})});return{status:0,result:e,message:"ok"}}getConnectionLink(o){const e=[];for(const t of this.junctionList){const s=t[0],n=t[1];if((o===""||s===o)&&(e.push({id:s,name:n.name,links:n.laneLinks}),o!==""))break}return{status:0,result:e,message:"ok"}}getLaneAngle(o){const e=this.getLane(o);if(e){const t=e.drivingAngle;if(t)return{status:0,result:t,message:"ok"}}return{status:-1,message:"车道信息错误"}}getTurnArrow(o){const e=this.getLane(o.incoming);if(!e)return{status:-1,message:"进口道信息错误"};const t=e.drivingAngle;if(!t)return{status:-1,message:"进口道信息错误"};const s=this.getLane(o.outgoing);if(!s)return{status:-1,message:"出口道信息错误"};const n=s.drivingAngle;if(!n)return{status:-1,message:"出口道信息错误"};let i=n-t;i>180?i-=360:i<-180&&(i+=360);let r="";return-45<i&&i<45?r="s":45<=i&&i<=135?r="r":-135<=i&&i<=-45?r="l":r="t",{status:0,message:"ok",result:{incomingAngle:t,outgoingAngle:n,direction:r}}}getPolygon(o,e,t){const s=this.roadList.get(o);if(!s)return{status:-1,message:"道路id错误"};if(e!==void 0&&t!==void 0&&!isNaN(e)&&!isNaN(t)){const n=this.getLane({roadId:o,sectionId:e,laneId:t});return n?{status:0,message:"ok",result:n.ring}:{status:-1,message:"车道信息错误"}}else if(e!==void 0&&!isNaN(e)){const n=s.getLaneSection(e);return n?{status:0,message:"ok",result:n.polygon}:{status:-1,message:"路段信息错误"}}else return{status:0,message:"ok",result:s.polygon}}getLaneLength(o){const e=this.getLane(o);if(e){let t=0;return e.road.isLastLaneSection(e.laneSection.s0)?t=e.road.length-e.laneSection.s0:t=e.road.getNextLaneSection(e.laneSection.s0).s0-e.laneSection.s0,{status:0,message:"ok",result:Number(t.toFixed(2))}}else return{status:-1,message:"车道信息错误"}}getRoadStopLine(o){const e=[];for(const t of this.junctionList){const s=t[0],n=t[1];if(s===o){const i=n.getRoadStopLine();e.push({junctionId:s,stopLines:i});break}else if(o===""){const i=n.getRoadStopLine();e.push({junctionId:s,stopLines:i})}}return{status:0,message:"ok",result:e}}getLaneStopLine(o){const e=this.getLane(o);return e?{status:0,message:"ok",result:e.getStopLine()}:{status:-1,message:"车道信息错误"}}getLaneCenterLine(o){const e=this.getLane(o);return e?{status:0,message:"ok",result:e.getLaneEndPoints("middle")}:{status:-1,message:"车道信息错误"}}getSumoEdgeInfo(o){const e=o.split("+"),t=e[0],s=Number(e[1]),n=this.roadList.get(t);if(!n)return;let i="";if(n.laneSectionNumber===1)i=`-${t}`;else{const u=n.getLaneSectionIndex(s);if(u===-1)return;i=`-${t}#${u}`}const r=n.predecessor.elementId,a=n.successor.elementId,l=n.getLaneSection(s);if(!l)return;const d=[],f=l.laneNumber-1;for(const u of l.allLanes){if(u.id===0)continue;const h=f-Math.abs(u.id);d.push({obj_id:`${i}_${h}`})}return{obj_id:i,obj_type:1,obj_desc:"edge",obj_info:{obj_id:i,length:n.getLaneSectionLength(s),from:r,to:a,numLanes:f,type:"driving",laneList:d}}}}exports.default=c;
|