gisviewer-vue3-arcgis
Version:
在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:
2 lines (1 loc) • 2.13 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../../types/index.js"),a=require("../common-utils.js"),h=require("./lane.js"),d=require("@arcgis/core/geometry");class u{constructor(e){this.lanes=[],this.id=e}async addLanes(e){for(const i of e.lanes)for(const s of e.stopLines){const t=await a.default.getIntersectPointsOfStopLineAndLane(s,i,[.5,-.5]);if(t.length===0)continue;const n=new d.Polyline({paths:[t]}),o=new h.default;o.lanePolygon=i,o.stopLine=n,o.isEntry=!0,await o.getLaneDirection(),this.addLane(o);break}}addLane(e){this.furthestLane||(this.furthestLane=e),this.dir||(this.dir=e.laneDirection,this.dir<45||this.dir>315?this.quadrantCode=r.QuadrantCode.North:this.dir<135?this.quadrantCode=r.QuadrantCode.East:this.dir<225?this.quadrantCode=r.QuadrantCode.South:this.quadrantCode=r.QuadrantCode.West);const i=e.stopLine,s=i.paths[0];switch(this.quadrantCode){case r.QuadrantCode.West:e.stopLineCenter.x<this.furthestLane.stopLineCenter.x&&(this.furthestLane=e),s[0][1]<s[1][1]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.y>n.stopLineCenter.y){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.North:e.stopLineCenter.y>this.furthestLane.stopLineCenter.y&&(this.furthestLane=e),s[0][0]<s[1][0]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.x>n.stopLineCenter.x){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.East:e.stopLineCenter.x>this.furthestLane.stopLineCenter.x&&(this.furthestLane=e),s[0][1]>s[1][1]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.y<n.stopLineCenter.y){this.lanes.splice(t,0,e);return}}break;case r.QuadrantCode.South:e.stopLineCenter.y<this.furthestLane.stopLineCenter.y&&(this.furthestLane=e),s[0][0]>s[1][0]&&(i.paths=[s.reverse()]);for(let t=0;t<this.lanes.length;t++){const n=this.lanes[t];if(e.stopLineCenter.x<n.stopLineCenter.x){this.lanes.splice(t,0,e);return}}break}this.lanes.push(e)}}exports.default=u;