|
@@ -49,7 +49,9 @@ export default {
|
|
|
mTime: null,
|
|
|
code: 230000,
|
|
|
mapData: {},// 传过来的值
|
|
|
- href: window.location.href
|
|
|
+ href: window.location.href,
|
|
|
+ level:6,
|
|
|
+ center:[],
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -60,12 +62,12 @@ export default {
|
|
|
let _self = this
|
|
|
bigemap.then(() => {
|
|
|
// window.BM.Config.HTTP_URL = 'http://www.bigemap.com:9000';
|
|
|
- window.BM.Config.HTTP_URL = 'http://localhost:9000';
|
|
|
+ window.BM.Config.HTTP_URL = 'http://192.168.1.181:9000';
|
|
|
// arcgis-satellite
|
|
|
// amap-satellite
|
|
|
// zhongkexingtu
|
|
|
// let map = window.BM.map('map', 'bigemap.arcgis-satellite', {
|
|
|
- let map = window.BM.map('map', 'bigemap.6914xxtx', {
|
|
|
+ let map = window.BM.map('map', null, {
|
|
|
center: [30, 104],
|
|
|
minZoom: 6,
|
|
|
zoom: 11,
|
|
@@ -74,16 +76,23 @@ export default {
|
|
|
preferCanvas: true, //适用于数据量大时 地图反应速度加快
|
|
|
});
|
|
|
window.Bmap = map;
|
|
|
-
|
|
|
-
|
|
|
- // 没透明
|
|
|
- // var offline=window.BM.tileLayer('bigemap.a58a3rnz');
|
|
|
- // 透明
|
|
|
- var layer=window.BM.tileLayer('bigemap.ct4z5ch5',{opacity:0.7}).addTo(map).on('load',function (){
|
|
|
- layer.options.maxNativeZoom=8;
|
|
|
- layer.options.maxZoom=12;
|
|
|
- map.setMaxZoom(12);
|
|
|
- });
|
|
|
+ var layer1=window.BM.tileLayer('bigemap.6914xxtx')
|
|
|
+ var layer2=window.BM.tileLayer('bigemap.ct4z5ch5',{opacity:0.7});
|
|
|
+ map.setMaxZoom(12);
|
|
|
+ layer1.addTo(map);
|
|
|
+ setTimeout(()=>{
|
|
|
+ Object.assign(layer2.options,{
|
|
|
+ opacity:0.7,
|
|
|
+ maxNativeZoom:8,
|
|
|
+ maxZoom:12
|
|
|
+ })
|
|
|
+ if (this.mapData.center.length !== 0) {
|
|
|
+ _self.level = this.mapData.level
|
|
|
+ _self.center = this.mapData.center
|
|
|
+ this.bMap.setView(this.mapData.center, this.mapData.level)
|
|
|
+ }
|
|
|
+ },500)
|
|
|
+ layer2.addTo(map);
|
|
|
this.bMap = map;
|
|
|
//首尾需要一致
|
|
|
let mask = window.BMturf.polygon([[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]);
|
|
@@ -141,10 +150,6 @@ export default {
|
|
|
// this.setHeatMap(this.bMap);
|
|
|
//绑定事件
|
|
|
this.bindEvents(this.bMap);
|
|
|
- if(this.mapData.level !== null){
|
|
|
- this.bMap.setZoom(this.mapData.level)
|
|
|
- this.bMap.panTo(this.mapData.center)
|
|
|
- }
|
|
|
})
|
|
|
let sIconurl = 'http://'+_self.href.split("//")[1].split("/")[0]+'/largeScreenImg/station.png'
|
|
|
let hfSIconurl = 'http://'+_self.href.split("//")[1].split("/")[0]+'/largeScreenImg/huafuStation.png'
|
|
@@ -377,12 +382,15 @@ export default {
|
|
|
},
|
|
|
//绑定事件-监听地图级别和拖动
|
|
|
bindEvents(map) {
|
|
|
+ let _self = this
|
|
|
map.on('moveend', function (e) {
|
|
|
const c = this.getCenter();
|
|
|
+ _self.center = this.getCenter()
|
|
|
document.getElementById('move').innerHTML = '当前中心点: 纬度:' + c.lat.toFixed(5) + ',经度:' + c.lng.toFixed(5);
|
|
|
});
|
|
|
//添加一个缩放事件
|
|
|
map.on('zoomend', function (e) {
|
|
|
+ _self.level = this.getZoom()
|
|
|
document.getElementById('zoom').innerHTML = '当前级别 : ' + this.getZoom();
|
|
|
});
|
|
|
},
|