Browse Source

地图

shibei_master
jiangyy 4 years ago
parent
commit
3bef9ab3ef
  1. 106
      src/views/modules/visual/basicinfo/basicInfoMain.vue

106
src/views/modules/visual/basicinfo/basicInfoMain.vue

@ -246,6 +246,7 @@ const vueGis = {
zoom: null, zoom: null,
parentPolygon: [], parentPolygon: [],
centerFlag: 'point',//flag point fit
} }
}, },
@ -266,7 +267,7 @@ const vueGis = {
// //
this.loadPolygon(this.subAgencyArray) this.loadPolygon(this.subAgencyArray)
this.setMapLocation()
await this.loadList() await this.loadList()
}, },
@ -366,6 +367,7 @@ const vueGis = {
this.orgData.zoom = map.getView().getZoom() this.orgData.zoom = map.getView().getZoom()
console.log('center', map.getView().getCenter()) console.log('center', map.getView().getCenter())
console.log('zoom', map.getView().getZoom()) console.log('zoom', map.getView().getZoom())
this.runAgencyArray.push(this.orgData) this.runAgencyArray.push(this.orgData)
this.subAgencyArray.forEach(item => { this.subAgencyArray.forEach(item => {
@ -396,20 +398,73 @@ const vueGis = {
// //
await this.loadOrgData() await this.loadOrgData()
//
this.loadParentPolygon() this.loadParentPolygon()
//
this.loadPolygon(this.subAgencyArray)
// //
await this.loadPolygon(this.subAgencyArray)
// //
// if (isRefreshView) { // if (isRefreshView) {
// this.setMapLocation() this.setMapLocation()
// mapView.setCenter(this.centerPoint);
// mapView.setZoom(this.zoom);
// } // }
await this.loadList() 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 (polygonLayer.getSource().getFeatures()[0]) {//,
this.centerFlag = 'flag_polygon'
} else if (parentLayer.getSource().getFeatures()[0]) {//
this.centerFlag = 'flag_parent'
} 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());
}
else if (this.centerFlag === 'flag_polygon') {
let polygonFeatures = polygonLayer.getSource().getFeatures()[0]
let polygon = polygonFeatures.getGeometry();
map.getView().fit(polygon, map.getSize());
}
else {
mapView.setCenter(this.centerPoint);
mapView.setZoom(this.zoom);
}
}, },
// //
@ -608,7 +663,7 @@ const vueGis = {
let oneArray = [x, y] let oneArray = [x, y]
this.iconCoordinators.push(oneArray) this.iconCoordinators.push(oneArray)
// debugger // debugger
// //icon
let oneCctv = new Feature({ let oneCctv = new Feature({
geometry: new Point([x, y]), geometry: new Point([x, y]),
id: oneIcon.id_, id: oneIcon.id_,
@ -637,26 +692,8 @@ const vueGis = {
iconSource.addFeatures(iconFeatures); 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) { setZoom (agencyLevel) {
@ -670,8 +707,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 () { initMap () {
this.setMapLocation() this.firstCenterMap()
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
title: "地图", title: "地图",

Loading…
Cancel
Save