/** * @copyright © 未来飞马 © 未来全栈 www.fmode.cn * 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd. * 保留所有权利 All Rights Reserved. * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/map/page-map.start/page-map.start.component.mjs */ import{Component}from"@angular/core";import*as AMapLoader from"@amap/amap-jsapi-loader";import*as i0 from"@angular/core";import*as i1 from"@angular/common";window._AMapSecurityConfig={securityJsCode:"32aa3f4ab0fa0061de03edd4eafdd50a"};export class PageMapStartComponent{constructor(){this.placeList=[{name:"江财蛟桥校区",location:[115.855125,28.744335]},{name:"江财枫林校区",location:[115.835639,28.734119]},{name:"江财麦庐校区",location:[115.816717,28.728899]}]}ngAfterViewInit(){this.initMap()}async initMap(){await this.createMap(),this.goAndMarkPlace(this.placeList[1])}async createMap(){this.AMap=await AMapLoader.load({key:"473b52010df7d3a32db0a2f5db245c8e",version:"2.0"}),this.map=new this.AMap.Map("container")}async addMarks(){let e=new this.AMap.Marker({position:[115.835639,28.734119]});this.map.add(e)}goAndMarkPlace(e){this.map.setCenter(e.location),this.map.setZoom(18),console.log(this.placeList),e.marker||(e.marker=new this.AMap.Marker({position:e.location}),this.map.add(e.marker))}clearMark(e){e?.marker?.remove()}planRoute(e,a){let t;this.map.plugin(["AMap.Transfer"],(()=>{let n={map:this.map,city:"南昌市",panel:"panel",policy:this.AMap.TransferPolicy.LEAST_TIME};console.log(this.AMap),console.log(this.AMap.TransferPolicy),t=new this.AMap.Transfer(n),t.search(new this.AMap.LngLat(e.location[0],e.location[1]),new this.AMap.LngLat(a.location[0],a.location[1]),((e,a)=>{"complete"===e?(console.log("绘制公交路线完成:"),console.log(a)):console.error("公交路线数据查询失败"+a)}))}))}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:PageMapStartComponent,deps:[],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"14.0.0",version:"17.3.12",type:PageMapStartComponent,selector:"app-page-map.start",ngImport:i0,template:'\x3c!-- 全屏地图 --\x3e\n
\n\n\x3c!-- 右侧地点 --\x3e\n