|
|
@ -3,7 +3,7 @@ import { Component, OnInit, Renderer2, ElementRef, Inject, NgZone, ViewChild } f |
|
|
|
import { FormBuilder, FormGroup, FormControl } from '@angular/forms'; |
|
|
|
import { FormBuilder, FormGroup, FormControl } from '@angular/forms'; |
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
import { IMap } from '@src/modules/map/declare/map'; |
|
|
|
import { IDriving, IMap, IMouseTool } from '@src/modules/map/declare/map'; |
|
|
|
declare var AMap: any; |
|
|
|
declare var AMap: any; |
|
|
|
declare var QRCode: any; |
|
|
|
declare var QRCode: any; |
|
|
|
|
|
|
|
|
|
|
@ -467,7 +467,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.keyUnitForm.reset() |
|
|
|
this.keyUnitForm.reset() |
|
|
|
this.keyUnitForm.controls.areaUnit.setValue('-1') |
|
|
|
this.keyUnitForm.controls.areaUnit.setValue('-1') |
|
|
|
this.map.remove(this.circle) |
|
|
|
this.map.remove(this.circle) |
|
|
|
this.unitCluster.setData([]) |
|
|
|
this.unitCluster ? this.unitCluster.setData([]) : null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -589,7 +589,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.fireForceForm.reset() |
|
|
|
this.fireForceForm.reset() |
|
|
|
this.fireForceForm.controls.areaFireForce.setValue('-1') |
|
|
|
this.fireForceForm.controls.areaFireForce.setValue('-1') |
|
|
|
this.map.remove(this.circleoffireForce) |
|
|
|
this.map.remove(this.circleoffireForce) |
|
|
|
this.fireForceCluster.setData([]) |
|
|
|
this.fireForceCluster ? this.fireForceCluster.setData([]) : null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -738,7 +738,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.linkageForcesForm.reset() |
|
|
|
this.linkageForcesForm.reset() |
|
|
|
this.linkageForcesForm.controls.areaLinkageForces.setValue('-1') |
|
|
|
this.linkageForcesForm.controls.areaLinkageForces.setValue('-1') |
|
|
|
this.map.remove(this.circleoflinkageForces) |
|
|
|
this.map.remove(this.circleoflinkageForces) |
|
|
|
this.linkageForcesCluster.setData([]) |
|
|
|
this.linkageForcesCluster ? this.linkageForcesCluster.setData([]) : null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -924,7 +924,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.watertForm.reset() |
|
|
|
this.watertForm.reset() |
|
|
|
this.watertForm.controls.areaWater.setValue('-1') |
|
|
|
this.watertForm.controls.areaWater.setValue('-1') |
|
|
|
this.map.remove(this.circleofwater) |
|
|
|
this.map.remove(this.circleofwater) |
|
|
|
this.waterCluster.setData([]) |
|
|
|
this.waterCluster ? this.waterCluster.setData([]) : null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -933,8 +933,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
let p1 = [bounds.northEast.lng, bounds.northEast.lat]; |
|
|
|
let p1 = [bounds.northEast.lng, bounds.northEast.lat]; |
|
|
|
let p2 = [bounds.northEast.lng, bounds.southWest.lat]; |
|
|
|
let p2 = [bounds.northEast.lng, bounds.southWest.lat]; |
|
|
|
// 返回 p1 到 p2 间的地面距离,单位:米
|
|
|
|
// 返回 p1 到 p2 间的地面距离,单位:米
|
|
|
|
let dis = AMap.GeometryUtil.distance(p1, p2); |
|
|
|
return this.map.distance(p1, p2); |
|
|
|
return dis |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//全选重点单位
|
|
|
|
//全选重点单位
|
|
|
@ -986,14 +985,14 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//卫星图层
|
|
|
|
//卫星图层
|
|
|
|
satelliteLayer = new AMap.TileLayer.Satellite(); |
|
|
|
satelliteLayer = MapFactory.TileLayerInstance().Satellite(); |
|
|
|
satelliteModel: boolean = false |
|
|
|
satelliteModel: boolean = false |
|
|
|
satelliteChange(e) { |
|
|
|
satelliteChange(e) { |
|
|
|
e.checked ? this.map.add(this.satelliteLayer) : this.map.remove(this.satelliteLayer); |
|
|
|
e.checked ? this.map.add(this.satelliteLayer) : this.map.remove(this.satelliteLayer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//路网图层
|
|
|
|
//路网图层
|
|
|
|
roadNetLayer = new AMap.TileLayer.RoadNet(); |
|
|
|
roadNetLayer = MapFactory.TileLayerInstance().RoadNet(); |
|
|
|
loadModel: boolean = false |
|
|
|
loadModel: boolean = false |
|
|
|
loadChange(e) { |
|
|
|
loadChange(e) { |
|
|
|
e.checked ? this.map.add(this.roadNetLayer) : this.map.remove(this.roadNetLayer); |
|
|
|
e.checked ? this.map.add(this.roadNetLayer) : this.map.remove(this.roadNetLayer); |
|
|
@ -1051,11 +1050,11 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
opacity: 1, //透明度
|
|
|
|
opacity: 1, //透明度
|
|
|
|
zIndex: 0, //叠加层级
|
|
|
|
zIndex: 0, //叠加层级
|
|
|
|
resizeEnable: true //是否监控地图容器尺寸变化,
|
|
|
|
resizeEnable: true //是否监控地图容器尺寸变化,
|
|
|
|
}).self; |
|
|
|
}) |
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }); |
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }); |
|
|
|
that.map.setCity('上海市'); |
|
|
|
that.map.setCity('上海市'); |
|
|
|
AMap.plugin(["AMap.RangingTool", "AMap.MouseTool"], function () { |
|
|
|
that.map.plugin(["AMap.RangingTool", "AMap.MouseTool"], function () { |
|
|
|
that.mouseTool = new AMap.MouseTool(that.map.self); |
|
|
|
that.mouseTool = MapFactory.MouseToolInstance(that.map); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -1066,7 +1065,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
measureDistance; //测距离
|
|
|
|
measureDistance; //测距离
|
|
|
|
distanceList = []; //测距离 点和线
|
|
|
|
distanceList = []; //测距离 点和线
|
|
|
|
measureArea; //测面积
|
|
|
|
measureArea; //测面积
|
|
|
|
mouseTool;//二合一测距和侧面积
|
|
|
|
mouseTool:IMouseTool;//二合一测距和侧面积
|
|
|
|
checkRadio = false //判断测距和侧面积是否选中
|
|
|
|
checkRadio = false //判断测距和侧面积是否选中
|
|
|
|
|
|
|
|
|
|
|
|
//测距离 开始
|
|
|
|
//测距离 开始
|
|
|
@ -1111,24 +1110,24 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
case 'rule': { |
|
|
|
case 'rule': { |
|
|
|
this.mouseTool.rule({ |
|
|
|
this.mouseTool.rule({ |
|
|
|
startMarkerOptions: {//可缺省
|
|
|
|
startMarkerOptions: {//可缺省
|
|
|
|
icon: new AMap.Icon({ |
|
|
|
icon: MapFactory.IconInstance({ |
|
|
|
size: new AMap.Size(19, 31),//图标大小
|
|
|
|
size: MapFactory.SizeInstance(19, 31),//图标大小
|
|
|
|
imageSize: new AMap.Size(19, 31), |
|
|
|
imageSize: MapFactory.SizeInstance(19, 31), |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/start.png" |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/start.png" |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
endMarkerOptions: {//可缺省
|
|
|
|
endMarkerOptions: {//可缺省
|
|
|
|
icon: new AMap.Icon({ |
|
|
|
icon: MapFactory.IconInstance({ |
|
|
|
size: new AMap.Size(19, 31),//图标大小
|
|
|
|
size: MapFactory.SizeInstance(19, 31),//图标大小
|
|
|
|
imageSize: new AMap.Size(19, 31), |
|
|
|
imageSize: MapFactory.SizeInstance(19, 31), |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/end.png" |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/end.png" |
|
|
|
}), |
|
|
|
}), |
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
|
}, |
|
|
|
}, |
|
|
|
midMarkerOptions: {//可缺省
|
|
|
|
midMarkerOptions: {//可缺省
|
|
|
|
icon: new AMap.Icon({ |
|
|
|
icon: MapFactory.IconInstance({ |
|
|
|
size: new AMap.Size(19, 31),//图标大小
|
|
|
|
size: MapFactory.SizeInstance(19, 31),//图标大小
|
|
|
|
imageSize: new AMap.Size(19, 31), |
|
|
|
imageSize: MapFactory.SizeInstance(19, 31), |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/mid.png" |
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/mid.png" |
|
|
|
}), |
|
|
|
}), |
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
@ -1282,7 +1281,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.showLeftDiv = false |
|
|
|
this.showLeftDiv = false |
|
|
|
this.isShowRouteGIS = true |
|
|
|
this.isShowRouteGIS = true |
|
|
|
this.routeEnd = e.name |
|
|
|
this.routeEnd = e.name |
|
|
|
this.endCoordinate = MapFactory.LngLatInstance(e.location.x, e.location.y).self |
|
|
|
this.endCoordinate = MapFactory.LngLatInstance(e.location.x, e.location.y) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//全景漫游
|
|
|
|
//全景漫游
|
|
|
@ -1334,7 +1333,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
routeEnd: any; //终点
|
|
|
|
routeEnd: any; //终点
|
|
|
|
routeEndList: any = [] //终点 搜索结果
|
|
|
|
routeEndList: any = [] //终点 搜索结果
|
|
|
|
timeout: any; //延时器
|
|
|
|
timeout: any; //延时器
|
|
|
|
routeGIS: any; //查询结果 规划路线
|
|
|
|
routeGIS: IDriving; //查询结果 规划路线
|
|
|
|
selectType: boolean = true; //路线选择 推荐方案/躲避用拥堵
|
|
|
|
selectType: boolean = true; //路线选择 推荐方案/躲避用拥堵
|
|
|
|
|
|
|
|
|
|
|
|
//关闭导航路线
|
|
|
|
//关闭导航路线
|
|
|
@ -1349,11 +1348,11 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.timeout = window.setTimeout(() => { |
|
|
|
this.timeout = window.setTimeout(() => { |
|
|
|
|
|
|
|
|
|
|
|
that.map.getCity(function (info) { //获取当前 city
|
|
|
|
that.map.getCity(function (info) { //获取当前 city
|
|
|
|
AMap.plugin(['AMap.AutoComplete'], () => { |
|
|
|
that.map.plugin(['AMap.AutoComplete'], () => { |
|
|
|
var autoOptions = { city: info.city } |
|
|
|
var autoOptions = { city: info.city } |
|
|
|
let keywords |
|
|
|
let keywords |
|
|
|
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd |
|
|
|
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd |
|
|
|
var autoComplete = new AMap.Autocomplete(autoOptions); |
|
|
|
var autoComplete = MapFactory.AutocompleteInstance(autoOptions); |
|
|
|
autoComplete.search(keywords, function (status, result) { |
|
|
|
autoComplete.search(keywords, function (status, result) { |
|
|
|
if (result && result.tips && result.tips.length) { //搜索到数据时
|
|
|
|
if (result && result.tips && result.tips.length) { //搜索到数据时
|
|
|
|
that._ngZone.run(() => { |
|
|
|
that._ngZone.run(() => { |
|
|
@ -1363,14 +1362,14 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
for (let index = 0; index < result.tips.length; index++) { |
|
|
|
for (let index = 0; index < result.tips.length; index++) { |
|
|
|
const element = result.tips[index]; |
|
|
|
const element = result.tips[index]; |
|
|
|
if (element.location) { |
|
|
|
if (element.location) { |
|
|
|
that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat).self |
|
|
|
that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else {//终点
|
|
|
|
} else {//终点
|
|
|
|
that.routeEndList = result.tips |
|
|
|
that.routeEndList = result.tips |
|
|
|
that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat).self |
|
|
|
that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -1431,7 +1430,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
let that = this |
|
|
|
let that = this |
|
|
|
this.selectType = true |
|
|
|
this.selectType = true |
|
|
|
this.routeGIS ? this.routeGIS.clear() : null |
|
|
|
this.routeGIS ? this.routeGIS.clear() : null |
|
|
|
this.routeGIS = new AMap.Driving({ |
|
|
|
this.routeGIS = MapFactory.DrivingInstance({ |
|
|
|
map: this.map, |
|
|
|
map: this.map, |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (!this.startCoordinate) { |
|
|
|
if (!this.startCoordinate) { |
|
|
@ -1440,7 +1439,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
config.duration = 3000 |
|
|
|
config.duration = 3000 |
|
|
|
this.snackBar.open('未查询到起点坐标信息,请输入有效地址', '确定', config); |
|
|
|
this.snackBar.open('未查询到起点坐标信息,请输入有效地址', '确定', config); |
|
|
|
return |
|
|
|
return |
|
|
|
} else if (!this.startCoordinate) { |
|
|
|
} else if (!this.endCoordinate) { |
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.duration = 3000 |
|
|
|
config.duration = 3000 |
|
|
@ -1464,7 +1463,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
if (this.selectType != e) { |
|
|
|
if (this.selectType != e) { |
|
|
|
this.selectType = e |
|
|
|
this.selectType = e |
|
|
|
this.routeGIS ? this.routeGIS.clear() : null |
|
|
|
this.routeGIS ? this.routeGIS.clear() : null |
|
|
|
this.routeGIS = new AMap.Driving({ |
|
|
|
this.routeGIS = MapFactory.DrivingInstance({ |
|
|
|
map: this.map, |
|
|
|
map: this.map, |
|
|
|
policy: e == true ? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC |
|
|
|
policy: e == true ? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC |
|
|
|
}); |
|
|
|
}); |
|
|
|