|
|
@ -246,6 +246,7 @@ const vueGis = { |
|
|
|
zoom: null, |
|
|
|
parentPolygon: [], |
|
|
|
|
|
|
|
centerFlag: 'point',//定义中心点的flag point点 fit 自适应 |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
@ -266,7 +267,7 @@ const vueGis = { |
|
|
|
|
|
|
|
//加载当前园区的标注 |
|
|
|
this.loadPolygon(this.subAgencyArray) |
|
|
|
|
|
|
|
this.setMapLocation() |
|
|
|
await this.loadList() |
|
|
|
|
|
|
|
}, |
|
|
@ -366,6 +367,7 @@ const vueGis = { |
|
|
|
this.orgData.zoom = map.getView().getZoom() |
|
|
|
console.log('center', map.getView().getCenter()) |
|
|
|
console.log('zoom', map.getView().getZoom()) |
|
|
|
|
|
|
|
this.runAgencyArray.push(this.orgData) |
|
|
|
|
|
|
|
this.subAgencyArray.forEach(item => { |
|
|
@ -396,20 +398,74 @@ const vueGis = { |
|
|
|
|
|
|
|
//加载组织数据 |
|
|
|
await this.loadOrgData() |
|
|
|
|
|
|
|
//绘制父级组织数据 |
|
|
|
this.loadParentPolygon() |
|
|
|
//绘制本级组织数据 |
|
|
|
this.loadPolygon(this.subAgencyArray) |
|
|
|
|
|
|
|
//加载当前园区的标注 |
|
|
|
await this.loadPolygon(this.subAgencyArray) |
|
|
|
//重置地图中心点 |
|
|
|
|
|
|
|
// //重置地图中心点 |
|
|
|
// if (isRefreshView) { |
|
|
|
// this.setMapLocation() |
|
|
|
// mapView.setCenter(this.centerPoint); |
|
|
|
// mapView.setZoom(this.zoom); |
|
|
|
this.setMapLocation() |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
await this.loadList() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//设置地图定位的中心点和缩放级别 |
|
|
|
setMapLocation () { |
|
|
|
if (!this.zoom) { |
|
|
|
this.setZoom(this.orgData.agencyLevel) |
|
|
|
} |
|
|
|
this.centerPoint = [] |
|
|
|
|
|
|
|
|
|
|
|
//如果存在中心点(返回时赋值) |
|
|
|
if (this.center && this.center.length > 0) { |
|
|
|
this.centerPoint = this.center |
|
|
|
this.centerFlag = 'point' |
|
|
|
this.center = [] |
|
|
|
|
|
|
|
} else if (parentLayer.getSource().getFeatures()[0]) {//如果是初次进入,不存在下级组织,用父级组织 |
|
|
|
this.centerFlag = 'flag_parent' |
|
|
|
|
|
|
|
|
|
|
|
} else if (polygonLayer.getSource().getFeatures()[0]) {//如果是初次进入,存在下级组织 |
|
|
|
this.centerFlag = 'flag_polygon' |
|
|
|
|
|
|
|
} else if (this.orgData.longitude && this.orgData.latitude) { |
|
|
|
this.centerPoint.push(this.orgData.longitude) |
|
|
|
this.centerPoint.push(this.orgData.latitude) |
|
|
|
this.centerFlag = 'point' |
|
|
|
|
|
|
|
} else { |
|
|
|
this.centerPoint = centerPointGlobal |
|
|
|
this.centerFlag = 'point' |
|
|
|
} |
|
|
|
// debugger |
|
|
|
if (this.centerFlag === 'flag_parent') { |
|
|
|
let parentFeatures = parentLayer.getSource().getFeatures()[0] |
|
|
|
let polygon = parentFeatures.getGeometry(); |
|
|
|
map.getView().fit(polygon, map.getSize()); |
|
|
|
this.zoom = map.getView().getZoom() - 1 |
|
|
|
|
|
|
|
} else if (this.centerFlag === 'flag_polygon') { |
|
|
|
let polygonFeatures = polygonLayer.getSource().getFeatures()[0] |
|
|
|
let polygon = polygonFeatures.getGeometry(); |
|
|
|
map.getView().fit(polygon, map.getSize()); |
|
|
|
this.zoom = map.getView().getZoom() - 1 |
|
|
|
|
|
|
|
} else { |
|
|
|
mapView.setCenter(this.centerPoint); |
|
|
|
|
|
|
|
} |
|
|
|
mapView.setZoom(this.zoom); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//返回所选组织 |
|
|
@ -608,7 +664,7 @@ const vueGis = { |
|
|
|
let oneArray = [x, y] |
|
|
|
this.iconCoordinators.push(oneArray) |
|
|
|
// debugger |
|
|
|
//视频监控样式 |
|
|
|
//地图icon样式 |
|
|
|
let oneCctv = new Feature({ |
|
|
|
geometry: new Point([x, y]), |
|
|
|
id: oneIcon.id_, |
|
|
@ -637,26 +693,8 @@ const vueGis = { |
|
|
|
iconSource.addFeatures(iconFeatures); |
|
|
|
} |
|
|
|
|
|
|
|
// this.addGif() |
|
|
|
|
|
|
|
}, |
|
|
|
//设置地图定位的中心点和缩放级别 |
|
|
|
setMapLocation () { |
|
|
|
this.centerPoint = [] |
|
|
|
|
|
|
|
if (this.center && this.center.length > 0) { |
|
|
|
this.centerPoint = this.center |
|
|
|
} else if (this.orgData.longitude && this.orgData.latitude) { |
|
|
|
|
|
|
|
this.centerPoint.push(this.orgData.longitude) |
|
|
|
this.centerPoint.push(this.orgData.latitude) |
|
|
|
} else { |
|
|
|
this.centerPoint = centerPointGlobal |
|
|
|
} |
|
|
|
if (!this.zoom) { |
|
|
|
this.setZoom(this.orgData.agencyLevel) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//根据组织层级设置缩放级别 |
|
|
|
setZoom (agencyLevel) { |
|
|
@ -670,8 +708,23 @@ const vueGis = { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
firstCenterMap () { |
|
|
|
this.centerPoint = [] |
|
|
|
if (this.orgData.longitude && this.orgData.latitude) { |
|
|
|
this.centerPoint.push(this.orgData.longitude) |
|
|
|
this.centerPoint.push(this.orgData.latitude) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.centerPoint = centerPointGlobal |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.zoom) { |
|
|
|
this.setZoom(this.orgData.agencyLevel) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
initMap () { |
|
|
|
this.setMapLocation() |
|
|
|
this.firstCenterMap() |
|
|
|
|
|
|
|
gaodeMapLayer = new TileLayer({ |
|
|
|
title: "地图", |
|
|
|