Browse Source

[新增]引入水源道路地图

master
邵佳豪 4 years ago
parent
commit
c475de9d0f
  1. 8
      src/app/ui/router-gis/router-gis.component.ts
  2. 14
      src/app/ui/training-recordinfo/training-recordinfo.component.html
  3. 3
      src/app/ui/ui.module.ts
  4. 4
      src/app/ui/water-road/water-road.component.html
  5. 11
      src/app/ui/water-road/water-road.component.scss
  6. 25
      src/app/ui/water-road/water-road.component.spec.ts
  7. 47
      src/app/ui/water-road/water-road.component.ts

8
src/app/ui/router-gis/router-gis.component.ts

@ -11,15 +11,15 @@ export class RouterGISComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
ngAfterViewInit(): void {
window.setTimeout(()=>{
this.mapInit()
},0)
}
ngAfterViewInit(): void {
}
//地图初始化
mapInit () {
//创建地图

14
src/app/ui/training-recordinfo/training-recordinfo.component.html

@ -27,12 +27,20 @@
</mat-tab>
<mat-tab label="安全疏散设施情况">
<app-fire-fighting-device></app-fire-fighting-device>
<ng-template matTabContent>
<app-fire-fighting-device></app-fire-fighting-device>
</ng-template>
</mat-tab>
<mat-tab label="消防设施情况">
<app-fire-fighting-device></app-fire-fighting-device>
<ng-template matTabContent>
<app-fire-fighting-device></app-fire-fighting-device>
</ng-template>
</mat-tab>
<mat-tab label="水源道路情况">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="水源道路情况"> 水源道路情况 </mat-tab>
<mat-tab label="重点部位情况">
<ng-template matTabContent>
<app-key-site></app-key-site>

3
src/app/ui/ui.module.ts

@ -66,8 +66,9 @@ import { TrainingRecordinfoComponent } from './training-recordinfo/training-reco
import { RouterGISComponent } from './router-gis/router-gis.component';
import { KeyUnitModule } from '../key-unit/key-unit.module';
import { PhotoofthesceneComponent } from './photoofthescene/photoofthescene.component';
import { WaterRoadComponent } from './water-road/water-road.component';
@NgModule({
declarations: [UiComponent, FooterComponent, UserdataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe,EditUser,CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent,HomeComponent, AddSixFamiliarComponent, TitleComponent, SelectUnit, TrainingRecordinfoComponent,RouterGISComponent, PhotoofthesceneComponent],
declarations: [UiComponent, FooterComponent, UserdataComponent, ChangepasswordComponent,IsnoPipe,ConfirmpswDirective,TimePipe,EditUser,CollectionToolsComponent,WorkingAreaComponent,CreateBuilding,EditBuilding,leftFunctionalDomainComponent,editPlaneFigureComponent,ViewDetails,saveOneDialog,saveTwoDialog,addDisposalNodeComponent,editDisposalNodeComponent,HomeComponent, AddSixFamiliarComponent, TitleComponent, SelectUnit, TrainingRecordinfoComponent,RouterGISComponent, PhotoofthesceneComponent, WaterRoadComponent],
imports: [
CommonModule,

4
src/app/ui/water-road/water-road.component.html

@ -0,0 +1,4 @@
<div class="content">
<div class="center" id="map"></div>
</div>

11
src/app/ui/water-road/water-road.component.scss

@ -0,0 +1,11 @@
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0.244141rem;
overflow: hidden;
.center {
width: 100%;
height: 100%;
}
}

25
src/app/ui/water-road/water-road.component.spec.ts

@ -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();
});
});

47
src/app/ui/water-road/water-road.component.ts

@ -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…
Cancel
Save