|
|
|
@ -3,6 +3,7 @@ import { Component, OnInit, Renderer2, ElementRef, Inject, NgZone, ViewChild } f
|
|
|
|
|
import { FormBuilder, FormGroup, FormControl } from '@angular/forms'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
import { IMap } from '@src/modules/map/declare/map'; |
|
|
|
|
declare var AMap: any; |
|
|
|
|
declare var QRCode: any; |
|
|
|
|
|
|
|
|
@ -212,7 +213,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//地图范围圆圈---重点单位
|
|
|
|
|
circle = new AMap.Circle({ |
|
|
|
|
circle = MapFactory.CircleInstance({ |
|
|
|
|
center: null, |
|
|
|
|
radius: 0, //半径
|
|
|
|
|
strokeOpacity: 1, |
|
|
|
@ -224,7 +225,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
zIndex: 50, |
|
|
|
|
}) |
|
|
|
|
//地图范围圆圈---水源
|
|
|
|
|
circleofwater = new AMap.Circle({ |
|
|
|
|
circleofwater = MapFactory.CircleInstance({ |
|
|
|
|
center: null, |
|
|
|
|
radius: 0, //半径
|
|
|
|
|
strokeOpacity: 1, |
|
|
|
@ -236,7 +237,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
zIndex: 50, |
|
|
|
|
}) |
|
|
|
|
//地图范围圆圈---消防力量
|
|
|
|
|
circleoffireForce = new AMap.Circle({ |
|
|
|
|
circleoffireForce = MapFactory.CircleInstance({ |
|
|
|
|
center: null, |
|
|
|
|
radius: 0, //半径
|
|
|
|
|
strokeOpacity: 1, |
|
|
|
@ -248,7 +249,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
zIndex: 50, |
|
|
|
|
}) |
|
|
|
|
//地图范围圆圈---联动力量
|
|
|
|
|
circleoflinkageForces = new AMap.Circle({ |
|
|
|
|
circleoflinkageForces = MapFactory.CircleInstance({ |
|
|
|
|
center: null, |
|
|
|
|
radius: 0, //半径
|
|
|
|
|
strokeOpacity: 1, |
|
|
|
@ -276,7 +277,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.circle.setCenter(this.markers[0]._position) |
|
|
|
|
this.circle.setMap(this.map) |
|
|
|
|
let Distance |
|
|
|
|
let lnglat = new AMap.LngLat(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
let lnglat = MapFactory.LngLatInstance(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
if (this.unitAreaDefault == '0') { |
|
|
|
|
this.circle.setRadius(this.Calculationofdistance(this.map.getBounds()) / 2) |
|
|
|
|
Distance = Math.abs(lnglat.offset(0, this.Calculationofdistance(this.map.getBounds()) / 2).lat - this.selectedUnit.location.y) |
|
|
|
@ -386,12 +387,12 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setContent(div) |
|
|
|
|
}; |
|
|
|
|
var _renderMarker = (context) => { |
|
|
|
|
var content = `<img class='clusterImg' src="${context.data[0].image}" alt="">`; |
|
|
|
|
var offset = new AMap.Pixel(-15, -15); |
|
|
|
|
var offset = MapFactory.PixelInstance(-15, -15); |
|
|
|
|
context.marker.setContent(content) |
|
|
|
|
context.marker.setOffset(offset) |
|
|
|
|
} |
|
|
|
@ -441,7 +442,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
// 创建一个自定义内容的 infowindow 实例
|
|
|
|
|
this.infoWindow = new AMap.InfoWindow({ |
|
|
|
|
position: [item.location.x, item.location.y], |
|
|
|
|
offset: new AMap.Pixel(0, -30), |
|
|
|
|
offset: MapFactory.PixelInstance(0, -30), |
|
|
|
|
content: markerContent, |
|
|
|
|
}); |
|
|
|
|
this.infoWindow.open(this.map); |
|
|
|
@ -480,7 +481,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.circleoffireForce.setCenter(this.markers[0]._position) |
|
|
|
|
this.circleoffireForce.setMap(this.map) |
|
|
|
|
let Distance |
|
|
|
|
let lnglat = new AMap.LngLat(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
let lnglat = MapFactory.LngLatInstance(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
if (this.fireForceAreaDefault == '0') { |
|
|
|
|
this.circleoffireForce.setRadius(this.Calculationofdistance(this.map.getBounds()) / 2) |
|
|
|
|
Distance = Math.abs(lnglat.offset(0, this.Calculationofdistance(this.map.getBounds()) / 2).lat - this.selectedUnit.location.y) |
|
|
|
@ -557,12 +558,12 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setContent(div) |
|
|
|
|
}; |
|
|
|
|
var _renderMarker = (context) => { |
|
|
|
|
var content = `<img class='clusterImg' src="${context.data[0].image}" alt="">`; |
|
|
|
|
var offset = new AMap.Pixel(-15, -15); |
|
|
|
|
var offset = MapFactory.PixelInstance(-15, -15); |
|
|
|
|
context.marker.setContent(content) |
|
|
|
|
context.marker.setOffset(offset) |
|
|
|
|
} |
|
|
|
@ -601,7 +602,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.circleoflinkageForces.setCenter(this.markers[0]._position) |
|
|
|
|
this.circleoflinkageForces.setMap(this.map) |
|
|
|
|
let Distance |
|
|
|
|
let lnglat = new AMap.LngLat(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
let lnglat = MapFactory.LngLatInstance(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
if (this.linkageForcesAreaDefault == '0') { |
|
|
|
|
this.circleoflinkageForces.setRadius(this.Calculationofdistance(this.map.getBounds()) / 2) |
|
|
|
|
Distance = Math.abs(lnglat.offset(0, this.Calculationofdistance(this.map.getBounds()) / 2).lat - this.selectedUnit.location.y) |
|
|
|
@ -700,12 +701,12 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setContent(div) |
|
|
|
|
}; |
|
|
|
|
var _renderMarker = (context) => { |
|
|
|
|
var content = `<img class='clusterImg' src="${context.data[0].image}" alt="">`; |
|
|
|
|
var offset = new AMap.Pixel(-15, -15); |
|
|
|
|
var offset = MapFactory.PixelInstance(-15, -15); |
|
|
|
|
context.marker.setContent(content) |
|
|
|
|
context.marker.setOffset(offset) |
|
|
|
|
} |
|
|
|
@ -750,7 +751,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.circleofwater.setCenter(this.markers[0]._position) |
|
|
|
|
this.circleofwater.setMap(this.map) |
|
|
|
|
let Distance |
|
|
|
|
let lnglat = new AMap.LngLat(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
let lnglat = MapFactory.LngLatInstance(this.selectedUnit.location.x, this.selectedUnit.location.y) // lng, lat 替换成传入的坐标
|
|
|
|
|
|
|
|
|
|
//如果选择当前的视野范围算出查询半径
|
|
|
|
|
if (this.waterAreaDefault == '0') { |
|
|
|
@ -840,12 +841,12 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2)); |
|
|
|
|
context.marker.setContent(div) |
|
|
|
|
}; |
|
|
|
|
var _renderMarker = (context) => { |
|
|
|
|
var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`; |
|
|
|
|
var offset = new AMap.Pixel(-15, -15); |
|
|
|
|
var offset = MapFactory.PixelInstance(-15, -15); |
|
|
|
|
context.marker.setContent(content) |
|
|
|
|
context.marker.setOffset(offset) |
|
|
|
|
} |
|
|
|
@ -957,7 +958,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.showLeftDiv = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map: any //地图
|
|
|
|
|
map: IMap //地图
|
|
|
|
|
markers: any = []; //markers标注
|
|
|
|
|
|
|
|
|
|
//地图2D 3D切换
|
|
|
|
@ -991,18 +992,14 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
//地图初始化
|
|
|
|
|
mapInit() { |
|
|
|
|
let that = this |
|
|
|
|
var layer = new AMap.createDefaultLayer({ |
|
|
|
|
var layer = MapFactory.LayerInstance({ |
|
|
|
|
zooms: [3, 20], //可见级别
|
|
|
|
|
visible: true, //是否可见
|
|
|
|
|
opacity: 1, //透明度
|
|
|
|
|
zIndex: 0, //叠加层级
|
|
|
|
|
resizeEnable: true //是否监控地图容器尺寸变化,
|
|
|
|
|
}) |
|
|
|
|
// that.map = new AMap.Map('map', {
|
|
|
|
|
// layers: [layer], //当只想显示标准图层时layers属性可缺省,
|
|
|
|
|
// });
|
|
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }).self; |
|
|
|
|
debugger; |
|
|
|
|
}).self; |
|
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }); |
|
|
|
|
that.map.setCity('上海市'); |
|
|
|
|
AMap.plugin(["AMap.RangingTool", "AMap.MouseTool"], function () { |
|
|
|
|
that.mouseTool = new AMap.MouseTool(that.map); |
|
|
|
@ -1073,7 +1070,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
imageSize: new AMap.Size(19, 31), |
|
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/end.png" |
|
|
|
|
}), |
|
|
|
|
offset: new AMap.Pixel(-9, -31) |
|
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
|
|
}, |
|
|
|
|
midMarkerOptions: {//可缺省
|
|
|
|
|
icon: new AMap.Icon({ |
|
|
|
@ -1081,7 +1078,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
imageSize: new AMap.Size(19, 31), |
|
|
|
|
image: "https://webapi.amap.com/theme/v1.3/markers/b/mid.png" |
|
|
|
|
}), |
|
|
|
|
offset: new AMap.Pixel(-9, -31) |
|
|
|
|
offset: MapFactory.PixelInstance(-9, -31) |
|
|
|
|
}, |
|
|
|
|
lineOptions: {//可缺省
|
|
|
|
|
strokeStyle: "solid", |
|
|
|
@ -1185,7 +1182,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
// 创建一个自定义内容的 infowindow 实例
|
|
|
|
|
this.infoWindow = new AMap.InfoWindow({ |
|
|
|
|
position: [e.location.x, e.location.y], |
|
|
|
|
offset: new AMap.Pixel(0, -30), |
|
|
|
|
offset: MapFactory.PixelInstance(0, -30), |
|
|
|
|
content: markerContent, |
|
|
|
|
}); |
|
|
|
|
this.infoWindow.open(this.map); |
|
|
|
@ -1198,7 +1195,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
marker.on('click', (ev) => { //marker点击事件
|
|
|
|
|
this.infoWindow = new AMap.InfoWindow({ |
|
|
|
|
position: [e.location.x, e.location.y], |
|
|
|
|
offset: new AMap.Pixel(0, -30), |
|
|
|
|
offset: MapFactory.PixelInstance(0, -30), |
|
|
|
|
content: markerContent, |
|
|
|
|
}); |
|
|
|
|
this.infoWindow.open(this.map); |
|
|
|
@ -1232,7 +1229,7 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
this.showLeftDiv = false |
|
|
|
|
this.isShowRouteGIS = true |
|
|
|
|
this.routeEnd = e.name |
|
|
|
|
this.endCoordinate = new AMap.LngLat(e.location.x, e.location.y) |
|
|
|
|
this.endCoordinate = MapFactory.LngLatInstance(e.location.x, e.location.y).self |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//全景漫游
|
|
|
|
@ -1313,14 +1310,14 @@ export class GisLabelingComponent implements OnInit {
|
|
|
|
|
for (let index = 0; index < result.tips.length; index++) { |
|
|
|
|
const element = result.tips[index]; |
|
|
|
|
if (element.location) { |
|
|
|
|
that.startCoordinate = new AMap.LngLat(element.location.lng, element.location.lat) |
|
|
|
|
that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat).self |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else {//终点
|
|
|
|
|
that.routeEndList = result.tips |
|
|
|
|
that.endCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat) |
|
|
|
|
that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat).self |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|