陈鹏飞
4 years ago
8 changed files with 171 additions and 6 deletions
@ -0,0 +1,3 @@
|
||||
<div class="content"> |
||||
<div class="center" id="center"></div> |
||||
</div> |
@ -0,0 +1,11 @@
|
||||
.content { |
||||
width: 100%; |
||||
height: 100%; |
||||
box-sizing: border-box; |
||||
padding: 0.244141rem; |
||||
overflow: hidden; |
||||
.center { |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { RouterGISComponent } from './router-gis.component'; |
||||
|
||||
describe('RouterGISComponent', () => { |
||||
let component: RouterGISComponent; |
||||
let fixture: ComponentFixture<RouterGISComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ RouterGISComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(RouterGISComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,48 @@
|
||||
import { Component, OnInit } from '@angular/core'; |
||||
declare var AMap: any; |
||||
|
||||
@Component({ |
||||
selector: 'app-router-gis', |
||||
templateUrl: './router-gis.component.html', |
||||
styleUrls: ['./router-gis.component.scss'] |
||||
}) |
||||
export class RouterGISComponent implements OnInit { |
||||
|
||||
constructor() { } |
||||
|
||||
ngOnInit(): void { |
||||
|
||||
} |
||||
|
||||
ngAfterViewInit(): void { |
||||
window.setTimeout(()=>{ |
||||
this.mapInit() |
||||
},0) |
||||
} |
||||
|
||||
//地图初始化
|
||||
mapInit () { |
||||
//创建地图
|
||||
let map = new AMap.Map('center', { |
||||
resizeEnable: true, |
||||
cursor: 'default', |
||||
zooms:[6,18], |
||||
}); |
||||
//构造路线导航类 实际路线
|
||||
let driving = new AMap.Driving({ |
||||
map: map, |
||||
showTraffic: true, |
||||
isOutline: true, |
||||
}); |
||||
driving.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '万科公园里',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); |
||||
//构造路线导航类 导航路线
|
||||
let drivingTwo = new AMap.Driving({ |
||||
map: map, |
||||
showTraffic: false, |
||||
}); |
||||
drivingTwo.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); |
||||
//function (status,result) { console.log(status,result) } //地图路线 匹配起始点回调函数
|
||||
//new AMap.LngLat(116.379028, 39.865042), new AMap.LngLat(116.427281, 39.903719) / [{keyword: '淄博站',city:'山东'},{keyword: '淄博北站',city:'山东'}], //路线可搜索, 可用坐标
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue