UNPKG

gisviewer-vue3-arcgis

Version:

在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:

2 lines (1 loc) 2.23 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../common-utils.js"),h=require("./lane.js"),p=require("@arcgis/core/geometry"),g=require("@arcgis/core/geometry/geometryEngineAsync"),s=require("../../../types/index.js");function L(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const x=L(g);class C{constructor(t){this.lanes=[],this.id=t}async findCorrespondingEntrance(t){var c;const e=this.lanes[0],n=e.lanePolygon.centroid;let o,i=1/0,r;for(const l of t){o=l.lanes[0].lanePolygon.centroid;const y=new p.Polyline({paths:[[[o.x,o.y],[n.x,n.y]]]}),d=await x.geodesicLength(y,"meters");d<i&&(i=d,r=l)}const f=r.furthestLane.extendedStopLine;(await u.default.getIntersectPointsOfStopLineAndLane(f,e.lanePolygon,[5])).length&&(this.entrance=r,await this.splitStopLine(),console.log(`${this.id}的对应进口道是${(c=this.entrance)==null?void 0:c.id}`))}addLanes(t){for(const e of t.lanes){const n=new h.default;n.lanePolygon=e,n.isEntry=!1,this.lanes.push(n)}}async splitStopLine(){if(this.entrance){for(const t of this.lanes){const e=await u.default.getIntersectPointsOfStopLineAndLane(this.entrance.furthestLane.extendedStopLine,t.lanePolygon,[.5,1,2,3,4,5,6,7,8]);if(e.length!==0){switch(this.entrance.quadrantCode){case s.QuadrantCode.West:e.sort((n,o)=>n[1]-o[1]);break;case s.QuadrantCode.North:e.sort((n,o)=>n[0]-o[0]);break;case s.QuadrantCode.East:e.sort((n,o)=>o[1]-n[1]);break;case s.QuadrantCode.South:e.sort((n,o)=>o[0]-n[0]);break}t.stopLine=new p.Polyline({paths:[e]}),await t.getLaneDirection()}}this.lanes.sort((t,e)=>{switch(this.entrance.quadrantCode){case s.QuadrantCode.West:return t.stopLine.extent.center.y-e.stopLine.extent.center.y;case s.QuadrantCode.North:return t.stopLine.extent.center.x-e.stopLine.extent.center.x;case s.QuadrantCode.East:return e.stopLine.extent.center.y-t.stopLine.extent.center.y;case s.QuadrantCode.South:return e.stopLine.extent.center.x-t.stopLine.extent.center.x}})}}}exports.default=C;