gisviewer-vue3-arcgis
Version:
在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:
36 lines (35 loc) • 1 kB
JavaScript
import L from "@turf/bearing";
import n from "../common-utils.mjs";
class a {
set stopLine(t) {
this._stopLine = t, this.stopLineCenter = t.extent.center;
}
get stopLine() {
return this._stopLine;
}
/** 停止线延长线,用于计算和其他进口道停止线的交点 */
get extendedStopLine() {
return this._extendedStopLine || (this._extendedStopLine = n.extendLineInTowDir(
this._stopLine,
100
)), this._extendedStopLine;
}
async getLaneDirection() {
const t = n.extendLineInTowDir(this._stopLine, 10), i = this._stopLine.paths[0];
let e = await n.getIntersectPointOfLineAndPolygon(
t,
this.lanePolygon,
5
);
e.length === 0 && (e = await n.getIntersectPointOfLineAndPolygon(
t,
this.lanePolygon,
-5
)), (!i.length || !e.length) && console.log("计算方位角失败", i, e);
const s = e[0], r = i[0], o = L(r, s);
this.laneDirection = o < 0 ? o + 360 : o;
}
}
export {
a as default
};