7 changed files with 104 additions and 8 deletions
@ -0,0 +1,4 @@ |
|||||||
|
<div class="content"> |
||||||
|
<div class="center" id="map"></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 { WaterRoadComponent } from './water-road.component'; |
||||||
|
|
||||||
|
describe('WaterRoadComponent', () => { |
||||||
|
let component: WaterRoadComponent; |
||||||
|
let fixture: ComponentFixture<WaterRoadComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ WaterRoadComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(WaterRoadComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,47 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
declare var AMap: any; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-water-road', |
||||||
|
templateUrl: './water-road.component.html', |
||||||
|
styleUrls: ['./water-road.component.scss'] |
||||||
|
}) |
||||||
|
export class WaterRoadComponent implements OnInit { |
||||||
|
|
||||||
|
constructor() { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
} |
||||||
|
ngAfterViewInit(): void { |
||||||
|
window.setTimeout(()=>{ |
||||||
|
this.mapInit() |
||||||
|
},0) |
||||||
|
} |
||||||
|
|
||||||
|
//地图初始化
|
||||||
|
mapInit () { |
||||||
|
//创建地图
|
||||||
|
let map = new AMap.Map('map', { |
||||||
|
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