Browse Source

[完善] 引入路线规划,周边水源模块

dev
陈鹏飞 4 years ago
parent
commit
4f37b272ce
  1. 2
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  2. 16
      src/app/key-unit/edit-plan-info/edit-plan-info.component.html
  3. 18
      src/app/key-unit/edit-unit-info/edit-unit-info.component.html
  4. 64
      src/app/key-unit/router-gis/router-gis.component.html
  5. 123
      src/app/key-unit/router-gis/router-gis.component.scss
  6. 176
      src/app/key-unit/router-gis/router-gis.component.ts
  7. 18
      src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html
  8. 16
      src/app/key-unit/view-unit-details/view-unit-details.component.html
  9. 17
      src/app/key-unit/water-road/water-road.component.html
  10. 2
      src/app/key-unit/water-road/water-road.component.ts

2
src/app/gis-management/gis-labeling/gis-labeling.component.ts

@ -387,7 +387,7 @@ export class GisLabelingComponent implements OnInit {
// 创建一个 Icon
let startIcon = new AMap.Icon({
image: '../../../assets/images/fireHydrant.png',
imageSize: new AMap.Size(32, 32),
imageSize: new AMap.Size(20, 20),
});
positonList.forEach((item,index)=>{
let marker = new AMap.Marker({

16
src/app/key-unit/edit-plan-info/edit-plan-info.component.html

@ -32,17 +32,27 @@
<app-function-division></app-function-division>
</ng-template>
</mat-tab>
<mat-tab label="7.实景图">
<mat-tab label="7.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="8.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="9.实景图">
<ng-template matTabContent>
<app-realistic-picture></app-realistic-picture>
</ng-template>
</mat-tab>
<mat-tab label="8.上传CAD">
<mat-tab label="10.上传CAD">
<ng-template matTabContent>
<app-uploading-cad></app-uploading-cad>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity平面图">
<!-- <mat-tab label="11.unity平面图">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2Basic/index.html" name="unityApp" frameborder="0" width="96%" height="100%" style="margin-left: 2%;"></iframe>
</ng-template>

18
src/app/key-unit/edit-unit-info/edit-unit-info.component.html

@ -31,22 +31,32 @@
<app-function-division></app-function-division>
</ng-template>
</mat-tab>
<mat-tab label="6.实景图">
<mat-tab label="6.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="7.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="8.实景图">
<ng-template matTabContent>
<app-realistic-picture></app-realistic-picture>
</ng-template>
</mat-tab>
<mat-tab label="7.上传CAD">
<mat-tab label="9.上传CAD">
<ng-template matTabContent>
<app-uploading-cad></app-uploading-cad>
</ng-template>
</mat-tab>
<mat-tab label="8.作战部署">
<mat-tab label="10.作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity作战部署">
<!-- <mat-tab label="11.unity作战部署">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2/index.html" name="unityApp" frameborder="0" width="100%" height="98%"></iframe>
</ng-template>

64
src/app/key-unit/router-gis/router-gis.component.html

@ -1,7 +1,63 @@
<div class="content">
<div class="center" id="center"></div>
<div class="btnbox">
<div class="btn" (click)="next()">已到达熟悉单位</div>
<div (click)="back()">取消本次任务</div>
<div class="map" id="map"></div>
<!-- 导航路线 -->
<div class="routeGIS">
<div class="routeHeader">
<label style="bottom: 8px; left: 38px;" class="routeGISPublicIcon" (click)='clearGISRoute()'>清除路线</label>
<label style="bottom: 8px; left: 275px;" class="routeGISPublicIcon" (click)='queryGISRoute()'>查询</label>
<div class="routeLeft" (click)='exchangeGISRoute()'><mat-icon>import_export</mat-icon></div>
<div class="routeContent">
<div class="routeEveryRow">
<label class="routeText"></label>
<input type="text" list="start" [(ngModel)]="routeStart" (ngModelChange)="routeChange(0)">
<datalist id="start">
<option *ngFor="let item of routeStartList" value="{{item.district}} {{item.name}}">
</datalist>
<label class="routeClear" *ngIf="routeStart" (click)='deleteSearchGIS(0)'>×</label>
</div>
<div class="routeEveryRow">
<label class="routeText"></label>
<input type="text" list="end" [(ngModel)]="routeEnd" (ngModelChange)="routeChange(1)">
<datalist id="end">
<option *ngFor="let item of routeEndList" value="{{item.district}} {{item.name}}">
</datalist>
<label class="routeClear" *ngIf="routeEnd" (click)='deleteSearchGIS(1)'>×</label>
</div>
</div>
</div>
<div class="routeCenter" *ngIf="routes.steps.length">
<div style="text-align: center;">
<button class="routeType" [ngClass]="{'selectRouteType': selectType}" (click)='toggleRoute(true)'>推荐方案</button>
<button class="routeType" [ngClass]="{'selectRouteType': !selectType}" (click)='toggleRoute(false)'>躲避拥堵</button>
</div>
<div class="routeTypeExplain" style="text-align: center; font-weight: 550;">
<label>约{{ routes.time / 60 | number:'0.0-0' }}分钟</label>
<label>{{ routes.distance / 1000 | number:'0.1-1' }}公里</label>
</div>
<div class="routeTypeExplain" style="color: rgb(176, 180, 184); margin-top: -10px;">
<label>途径</label>
<span *ngFor="let item of routes.steps">{{item.road? item.road + '>' : null}}</span>
</div>
<div class="routeCenterTB" title="{{routeStart}}">
<p style="background-color: #0080FF;"></p><label style="font-weight: 550;">{{routeStart}}</label>
</div>
<div class="routeCenterTB" *ngFor="let item of routes.steps" style="border-bottom: 1px solid rgb(223, 212, 212);" title="{{item.instruction}}">
<p class="orientation" *ngIf="item.orientation == '西'"></p>
<p class="orientation" *ngIf="item.orientation == '北'"></p>
<p class="orientation" *ngIf="item.orientation == '东'"></p>
<p class="orientation" *ngIf="item.orientation == '南'"></p>
<p class="orientation" *ngIf="item.orientation == '西北'"></p>
<p class="orientation" *ngIf="item.orientation == '西南'"></p>
<p class="orientation" *ngIf="item.orientation == '东北'"></p>
<p class="orientation" *ngIf="item.orientation == '东南'"></p>
<label>{{item.instruction}}</label>
</div>
<div class="routeCenterTB" title="{{routeEnd}}">
<p style="background-color: rgb(250, 21, 21);"></p><label style="font-weight: 550;">{{routeEnd}}</label>
</div>
</div>
</div>
<!-- 导航路线 -->
</div>

123
src/app/key-unit/router-gis/router-gis.component.scss

@ -2,34 +2,111 @@
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 3px;
padding: 1px;
overflow: hidden;
position: relative;
.center {
.map { width: 100%; height: 100%; }
}
//文本溢出
.overflowText {
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.mat-icon, label, button, p, span {cursor:pointer;}
//左侧导航路线
.routeGIS {
width: 340px;
max-height: 700px;
overflow: hidden;
position: absolute;
border-radius: 10px;
background-color: #0080FF;
left: 30px;
top: 15px;
z-index: 6;
display: flex;
flex-direction: column;
.routeHeader {
width: 100%;
height: 740px;
}
.btnbox{
position: absolute;
left: 50%;
bottom: 7%;;
transform: translateX(-50%);
height: 130px;
min-height: 130px;
position: relative;
display: flex;
div{
align-items: center;
justify-content: center;
.routeLeft {
width: 26px;
text-align: center;
width:130px;
height: 48px;
line-height: 48px;
opacity: 1;
border-radius: 30px;
font-size: 16px;
margin: 0 12px;
background: #E9EAF3;
cursor: pointer;
margin: 0 5px;
box-sizing: border-box;
.mat-icon { font-size: 24px; color: #fff; }
}
.routeContent {
flex: 1;
//起点终点 input
.routeEveryRow {
position: relative;
height: 30px;
margin: 3px 0;
label { position: absolute; color: #fff; }
.routeText {
font-size: 14px;
top: 5.5px;
left: 5px;
}
.routeClear {
top: 0px;
right: 18px;
font-size: 20px;
}
input {
width: 80%;
padding-left: 25px;
height: 30px;
border-radius: 5px;
border: none;
outline: none;
color: #fff;
background-color: #0874DE;
}
}
}
.btn{
background: linear-gradient(337deg, #FC7045 0%, #FF4923 100%);
color: #fff;
}
//导航内容区
.routeCenter::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.routeCenter {
width: 100%;
overflow-y: auto;
scrollbar-width: none; /* Firefox */
box-sizing: border-box;
background-color: #fff;
border-radius: 0 0 10px 10px;
border: 1px solid rgb(201, 197, 197);
>div {
width: 100%;
height: 30px;
line-height: 30px;
box-sizing: border-box;
margin: 5px 0;
font-size: 12px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
} //div
>div:not(:first-child){ padding: 0 10px; box-sizing: border-box; }
.routeTypeExplain label { margin: 0 10px; }
.routeCenterTB {
p { display: inline-block; margin-right: 10px; width: 30px; height: 30px; border-radius: 50%; color: #fff; text-align: center; font-size: 14px; }
.orientation { color: #0080FF; }
}
}
}
}
.routeGISPublicIcon { position: absolute; color: #fff; font-size: 14px; } //导航 定位部分公共样式
//选择路线 方案 button
.routeType { margin: 0 10px; outline: none; border: none; background-color: transparent; font-size: 14px; font-weight: 550; color: rgb(122, 116, 116); }
.selectRouteType { color: #0080FF; }

176
src/app/key-unit/router-gis/router-gis.component.ts

@ -1,4 +1,5 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, NgZone, OnInit, Output } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
declare var AMap: any;
@Component({
@ -8,53 +9,158 @@ declare var AMap: any;
})
export class RouterGISComponent implements OnInit {
@Output() onCustomEvent: EventEmitter<any> = new EventEmitter();//创建实力
constructor() { }
constructor(public _ngZone:NgZone,public snackBar: MatSnackBar,) { }
ngOnInit(): void {
window.setTimeout(()=>{
this.mapInit()
},0)
}
ngAfterViewInit(): void {
}
//地图初始化
mapInit () {
console.log("ditu")
//创建地图
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,
let that = this
var layer = new AMap.createDefaultLayer({
zooms:[3,20], //可见级别
visible:true, //是否可见
opacity:1, //透明度
zIndex:0, //叠加层级
resizeEnable: true //是否监控地图容器尺寸变化,
})
that.map = new AMap.Map('map',{
layers:[layer], //当只想显示标准图层时layers属性可缺省,
});
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:'山东'}], //路线可搜索, 可用坐标
that.map.setCity('上海市');
}
//下一步
next(){
this.emitEvent()
map:any; //地图实例
routeStart:any; //起点
routeStartList:any = [] //起点 搜索结果
routeEnd:any; //终点
routeEndList:any = [] //终点 搜索结果
timeout:any; //延时器
routeGIS:any; //查询结果 规划路线
selectType:boolean = true; //路线选择 推荐方案/躲避用拥堵
//输入框 输入事件
routeChange (e) {
let that = this
window.clearTimeout(this.timeout)
this.timeout = window.setTimeout(()=>{
that.map.getCity( function(info){ //获取当前 city
AMap.plugin(['AMap.AutoComplete'], () =>{
var autoOptions = {city: info.city}
let keywords
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd
var autoComplete = new AMap.Autocomplete(autoOptions);
autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{
if(e == 0){
that.routeStartList = result.tips
that.startCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
}else{
that.routeEndList = result.tips
that.endCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
}
});
} //if
})
})
}); //获取当前 city
},500)
}
private emitEvent(){
this.onCustomEvent.emit('data from child');//通过emit可将需要传递的数据发送给父组件
//清空导航输入框
deleteSearchGIS (e) {
if (e==0) {
this.routeStart = null
this.routeStartList = []
this.startCoordinate = null
} else {
this.routeEnd = null
this.routeEndList = []
this.endCoordinate = null
}
}
//取消
back(){
window.history.back();
//清除路线
clearGISRoute () {
this.routeStart = null
this.routeStartList = []
this.routeEnd = null
this.routeEndList = []
this.startCoordinate = null
this.endCoordinate = null
this.routeGIS? this.routeGIS.clear() : null
this.routes = { distance: 0, time: 0, steps: [], }
this.map.setCity('上海市'); //设置地图中心点
}
//交换起始点
exchangeGISRoute () {
let data = this.routeStart
this.routeStart = this.routeEnd
this.routeEnd = data
this.routeStartList = []
this.routeEndList = []
let data2 = this.startCoordinate
this.startCoordinate = this.endCoordinate
this.endCoordinate = data2
}
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标
endCoordinate:any//结束坐标
//导航查询
queryGISRoute () {
if (this.startCoordinate && this.endCoordinate) {
//构造路线导航类
let that = this
this.selectType = true
this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({
map: this.map,
});
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
} else { alert('获取驾驶规划路线失败') }
}
);
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择起始点','确定',config);
}
}
//切换 导航模式 推荐方案/躲避拥堵
toggleRoute (e) {
let that = this
if (this.selectType != e) {
this.selectType = e
this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({
map: this.map,
policy: e==true? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC
});
// 根据起终点名称规划驾车导航路线
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
} else { alert('获取驾驶规划路线失败') }
}
);
}
}
}

18
src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html

@ -24,22 +24,32 @@
<app-function-division-look></app-function-division-look>
</ng-template>
</mat-tab>
<mat-tab label="6.实景图">
<mat-tab label="6.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="7.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="8.实景图">
<ng-template matTabContent>
<app-realistic-picture-look></app-realistic-picture-look>
</ng-template>
</mat-tab>
<mat-tab label="7.上传CAD">
<mat-tab label="9.上传CAD">
<ng-template matTabContent>
<app-uploading-cad-look></app-uploading-cad-look>
</ng-template>
</mat-tab>
<mat-tab label="8.作战部署">
<mat-tab label="10.作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity作战部署">
<!-- <mat-tab label="11.unity作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
<iframe id="main" src="/unityApp2/index.html" name="unityApp" frameborder="0" width="100%" height="98%"></iframe>

16
src/app/key-unit/view-unit-details/view-unit-details.component.html

@ -29,17 +29,27 @@
<app-function-division-look></app-function-division-look>
</ng-template>
</mat-tab>
<mat-tab label="7.实景图">
<mat-tab label="7.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="8.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="9.实景图">
<ng-template matTabContent>
<app-realistic-picture-look></app-realistic-picture-look>
</ng-template>
</mat-tab>
<mat-tab label="8.上传CAD">
<mat-tab label="10.上传CAD">
<ng-template matTabContent>
<app-uploading-cad-look></app-uploading-cad-look>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity平面图">
<!-- <mat-tab label="11.unity平面图">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2Basic/index.html" name="unityApp" frameborder="0" width="96%" height="100%" style="margin-left:2%;"></iframe>
</ng-template>

17
src/app/key-unit/water-road/water-road.component.html

@ -1,19 +1,4 @@
<div class="content">
<div class="center" id="map"></div>
<!-- <div class="textbox">
<div class="btn">
<span>
<mat-icon (click)="save()">description</mat-icon>
<mat-icon (click)="clickicon()">create</mat-icon>
</span>
</div>
<div class="text" [hidden]="!isshow">
<textarea [(ngModel)]="textcontant" name="" id="" cols="28" rows="18" placeholder="水源情况主要包括消火栓位置、管径、外观完好情况、停车取水位置试水情况,消防水池位置、容量、停车取水位置、取水测试情况,取消码头位置、水位、停车取水位置等;道路情况主要包括道路长度、宽度、起始点、沿线重点单位、立交、桥梁、涵洞及其通车能力。【该项主要在道路水源熟悉时填写】"></textarea>
</div>
</div> -->
<div class="editbtn" (click)="opendialog()">
<p style="margin-top: 20px;"><mat-icon>create</mat-icon></p>
<p style="font-size: 16px;color: #fff;">编辑</p>
</div>
<div class="center" id="center"></div>
</div>

2
src/app/key-unit/water-road/water-road.component.ts

@ -86,7 +86,7 @@ export class WaterRoadComponent implements OnInit {
offset: new AMap.Pixel(-4, -50)
});
this.map = new AMap.Map('map',{
this.map = new AMap.Map('center',{
center: [108.377865, 22.763499], //初始地图中心点
zoom: 16
});

Loading…
Cancel
Save