|
@@ -1,20 +1,39 @@
|
|
<template>
|
|
<template>
|
|
- <div v-bind:id="mapDivId" ref="map" style="width: 100%; height: 100%;background: none;"></div>
|
|
|
|
|
|
+ <div v-bind:id="mapDivId" ref="map" style="width: 100%; height: 100%;background: none;">
|
|
|
|
+ <div id="toolbar" v-if="isdynamicPlotting" class="panel panel-primary"
|
|
|
|
+ style="position:absolute;z-index: 9999;top:4rem;left: 1rem; border-radius: 4px; width: fit-content;height:635px;overflow-y:scroll;background:#040b1f">
|
|
|
|
+ <div class="panel-heading" id="panelheading">
|
|
|
|
+ <h5 style=" color: #2bacf7;font-size: 1rem;padding:.5rem;">鼠标标绘</h5>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="panel-body content" id="panelbodycontent" style="margin-bottom: .5rem;padding-right: .5rem;">
|
|
|
|
+ <div align="right" class="button-group">
|
|
|
|
+ <el-button type="success" @click="PlottingDrawCancel">取消标绘</el-button>
|
|
|
|
+
|
|
|
|
+ <el-button type="success" @click="clearLayers">清空标绘</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div id="plottingPanel">
|
|
|
|
+ <div id="plotPanel" style="width: 15rem;height:50%;overflow-y:scroll;">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
<script>
|
|
<script>
|
|
- import 'leaflet-side-by-side'
|
|
|
|
- import '@supermap/iclient-leaflet'
|
|
|
|
- import 'leaflet/dist/leaflet.css'
|
|
|
|
- import 'leaflet.markercluster/dist/leaflet.markercluster-src.js'
|
|
|
|
- import 'leaflet.markercluster/dist/MarkerCluster.css'
|
|
|
|
- import 'leaflet.markercluster/dist/MarkerCluster.Default.css'
|
|
|
|
- import 'leaflet-draw'
|
|
|
|
- import 'leaflet-draw/dist/leaflet.draw.css'
|
|
|
|
-
|
|
|
|
- import L from 'leaflet'
|
|
|
|
|
|
+ // import 'leaflet-side-by-side'
|
|
|
|
+ // import '@supermap/iclient-leaflet'
|
|
|
|
+ // import 'leaflet/dist/leaflet.css'
|
|
|
|
+ // import 'leaflet.markercluster/dist/leaflet.markercluster-src.js'
|
|
|
|
+ // import 'leaflet.markercluster/dist/MarkerCluster.css'
|
|
|
|
+ // import 'leaflet.markercluster/dist/MarkerCluster.Default.css'
|
|
|
|
+ // import 'leaflet-draw'
|
|
|
|
+ // import 'leaflet-draw/dist/leaflet.draw.css'
|
|
|
|
+ // import L from 'leaflet'
|
|
|
|
|
|
- import { getSuperMap, iconList } from '@/api/components/supermap.js'
|
|
|
|
|
|
+ import {
|
|
|
|
+ getSuperMap,
|
|
|
|
+ iconList
|
|
|
|
+ } from '@/api/components/supermap.js'
|
|
// import {setToken} from '../plugins/auth'
|
|
// import {setToken} from '../plugins/auth'
|
|
import modal from '@/plugins/modal'
|
|
import modal from '@/plugins/modal'
|
|
|
|
|
|
@@ -22,12 +41,16 @@
|
|
name: 'sookaSuperMap',
|
|
name: 'sookaSuperMap',
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ plottingdrawControl: null,
|
|
|
|
+ plottingLayer: null,
|
|
mapDivId: '',
|
|
mapDivId: '',
|
|
map: null,
|
|
map: null,
|
|
layers: [],
|
|
layers: [],
|
|
|
|
+ layersBytype: [],
|
|
isAggregationLayers: [],
|
|
isAggregationLayers: [],
|
|
radiusLayers: [],
|
|
radiusLayers: [],
|
|
myGroup: [],
|
|
myGroup: [],
|
|
|
|
+ myGroupBytype: [],
|
|
isAggregationMyGroup: [],
|
|
isAggregationMyGroup: [],
|
|
polygon: null,
|
|
polygon: null,
|
|
connectLayer: [],
|
|
connectLayer: [],
|
|
@@ -35,9 +58,10 @@
|
|
graphicsLayer: [],
|
|
graphicsLayer: [],
|
|
latLngLayers: [],
|
|
latLngLayers: [],
|
|
latLngGroup: [],
|
|
latLngGroup: [],
|
|
- isEditableLayers: false,//绘图控件
|
|
|
|
- drawControl: null,//绘图控件
|
|
|
|
- deckglLayer: null//图层Layer
|
|
|
|
|
|
+ isEditableLayers: false, //绘图控件
|
|
|
|
+ drawControl: null, //绘图控件
|
|
|
|
+ deckglLayer: null, //图层Layer
|
|
|
|
+ deckglLayerList: [] //图层Layer(数组)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -80,7 +104,9 @@
|
|
for (let i = 0; i < latlng.length - 1; i++) {
|
|
for (let i = 0; i < latlng.length - 1; i++) {
|
|
let start = latlng[i]
|
|
let start = latlng[i]
|
|
let end = latlng[i + 1]
|
|
let end = latlng[i + 1]
|
|
- dis += window.L.latLng([start.lat, start.lng]).distanceTo([end.lat, end.lng])//计算两个点之间的距离,并累加
|
|
|
|
|
|
+ dis += window.L.latLng([start.lat, start.lng]).distanceTo([end.lat,
|
|
|
|
+ end.lng
|
|
|
|
+ ]) //计算两个点之间的距离,并累加
|
|
}
|
|
}
|
|
//结果得到的也是number类型,单位是KM
|
|
//结果得到的也是number类型,单位是KM
|
|
modal.msg((dis / 10e2).toFixed(2) + 'km')
|
|
modal.msg((dis / 10e2).toFixed(2) + 'km')
|
|
@@ -214,58 +240,91 @@
|
|
mapDiv: null,
|
|
mapDiv: null,
|
|
codes: null,
|
|
codes: null,
|
|
mapSite: {},
|
|
mapSite: {},
|
|
- isSideBySide: null,
|
|
|
|
|
|
+ isdynamicPlotting: false,//动态标绘表格
|
|
|
|
+ isSideBySide: false,
|
|
showLatLng: null,
|
|
showLatLng: null,
|
|
showAreaLatLng: null,
|
|
showAreaLatLng: null,
|
|
showLineLatLng: null
|
|
showLineLatLng: null
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- clearM: async function(isAggregation) {//清理地图标点
|
|
|
|
|
|
+ loadHeatMap: async function() {
|
|
|
|
+ var heatNumbers = 150, heatRadius = 30;
|
|
|
|
+ var num = parseInt(heatNumbers);
|
|
|
|
+ num = (num > 0) ? num : 0;
|
|
|
|
+ var radius = parseInt(heatRadius);
|
|
|
|
+ radius = (radius > 0) ? radius : 0;
|
|
|
|
+ var heatPoints = [];
|
|
|
|
+ for (var i = 0; i < num; i++) {
|
|
|
|
+ heatPoints[i] = [Math.random() * 0.28 + 42, Math.random() * 0.5 + 125, Math.random() * 80];
|
|
|
|
+ }
|
|
|
|
+ var resultLayer = window.L.heatLayer(heatPoints, {
|
|
|
|
+ radius: radius,
|
|
|
|
+ minOpacity: 0.5
|
|
|
|
+ }).addTo(this.map);
|
|
|
|
+ },
|
|
|
|
+ clearM: async function(isAggregation) { //清理地图标点
|
|
if (isAggregation) {
|
|
if (isAggregation) {
|
|
if (this.isAggregationMyGroup != undefined && this.isAggregationMyGroup != false) {
|
|
if (this.isAggregationMyGroup != undefined && this.isAggregationMyGroup != false) {
|
|
this.isAggregationMyGroup.clearLayers()
|
|
this.isAggregationMyGroup.clearLayers()
|
|
}
|
|
}
|
|
- this.map.removeLayer(this.isAggregationLayers)
|
|
|
|
- this.isAggregationLayers = []
|
|
|
|
- this.radiusLayers = []
|
|
|
|
- this.isAggregationLayers = window.L.markerClusterGroup({
|
|
|
|
- //设置为true时显示聚类所占据的范围
|
|
|
|
- showCoverageOnHover: true,
|
|
|
|
- //设置为true时会向低一级聚类缩放
|
|
|
|
- zoomToBoundsOnClick: true,
|
|
|
|
- //增加点位时增加聚合动画(否则会出问题)
|
|
|
|
- animateAddingMarkers: true,
|
|
|
|
- //最大缩放级别点击聚合图标展开图标
|
|
|
|
- spiderfyOnMaxZoom: true
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ if (this.isAggregationLayers != null && this.isAggregationLayers.length > 0) {
|
|
|
|
+ this.map.removeLayer(this.isAggregationLayers)
|
|
|
|
+ this.isAggregationLayers = []
|
|
|
|
+ this.radiusLayers = []
|
|
|
|
+ this.isAggregationLayers = window.L.markerClusterGroup({
|
|
|
|
+ //设置为true时显示聚类所占据的范围
|
|
|
|
+ showCoverageOnHover: true,
|
|
|
|
+ //设置为true时会向低一级聚类缩放
|
|
|
|
+ zoomToBoundsOnClick: true,
|
|
|
|
+ //增加点位时增加聚合动画(否则会出问题)
|
|
|
|
+ animateAddingMarkers: true,
|
|
|
|
+ //最大缩放级别点击聚合图标展开图标
|
|
|
|
+ spiderfyOnMaxZoom: true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
if (this.myGroup != undefined && this.myGroup != false) {
|
|
if (this.myGroup != undefined && this.myGroup != false) {
|
|
this.myGroup.clearLayers()
|
|
this.myGroup.clearLayers()
|
|
}
|
|
}
|
|
this.layers = []
|
|
this.layers = []
|
|
}
|
|
}
|
|
-
|
|
|
|
},
|
|
},
|
|
- clearC: async function() {//清理地图画线
|
|
|
|
|
|
+ clearMByType: async function(type) { //清理地图标点(根据类型,可取消落点)
|
|
|
|
+ if (this.myGroupBytype != undefined && this.myGroupBytype != false) {
|
|
|
|
+ for (var i = this.myGroupBytype.length - 1; i >= 0; i--) {
|
|
|
|
+ if (this.myGroupBytype[i].type == type) {
|
|
|
|
+ this.myGroupBytype[i].myGroup.clearLayers()
|
|
|
|
+ this.myGroupBytype.splice(i, 1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (this.layersBytype != null && this.layersBytype.length > 0) {
|
|
|
|
+ for (var i = this.layersBytype.length - 1; i >= 0; i--) {
|
|
|
|
+ if (this.layersBytype[i].type == type) {
|
|
|
|
+ this.layersBytype.splice(i, 1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ clearC: async function() { //清理地图画线
|
|
if (this.connectLayer != undefined && this.connectLayer != false) {
|
|
if (this.connectLayer != undefined && this.connectLayer != false) {
|
|
this.connectLayer.clearLayers()
|
|
this.connectLayer.clearLayers()
|
|
}
|
|
}
|
|
this.connectLayer = []
|
|
this.connectLayer = []
|
|
},
|
|
},
|
|
- clearCTwo: async function() {//清理地图画线two
|
|
|
|
|
|
+ clearCTwo: async function() { //清理地图画线two
|
|
if (this.connectLayerTwo != undefined && this.connectLayerTwo != false) {
|
|
if (this.connectLayerTwo != undefined && this.connectLayerTwo != false) {
|
|
this.connectLayerTwo.clearLayers()
|
|
this.connectLayerTwo.clearLayers()
|
|
}
|
|
}
|
|
this.connectLayerTwo = []
|
|
this.connectLayerTwo = []
|
|
},
|
|
},
|
|
- clearG: async function() {//清理地图图形
|
|
|
|
|
|
+ clearG: async function() { //清理地图图形
|
|
if (this.graphicsLayer != undefined && this.graphicsLayer != false) {
|
|
if (this.graphicsLayer != undefined && this.graphicsLayer != false) {
|
|
this.graphicsLayer.clearLayers()
|
|
this.graphicsLayer.clearLayers()
|
|
}
|
|
}
|
|
this.graphicsLayer = []
|
|
this.graphicsLayer = []
|
|
},
|
|
},
|
|
- clearP: async function() {//清理点击事件落点
|
|
|
|
|
|
+ clearP: async function() { //清理点击事件落点
|
|
if (this.latLngGroup != undefined && this.latLngGroup != false) {
|
|
if (this.latLngGroup != undefined && this.latLngGroup != false) {
|
|
this.latLngGroup.clearLayers()
|
|
this.latLngGroup.clearLayers()
|
|
}
|
|
}
|
|
@@ -276,6 +335,7 @@
|
|
this.mapDivId = this.mapDiv
|
|
this.mapDivId = this.mapDiv
|
|
let mapSite = this.mapSite
|
|
let mapSite = this.mapSite
|
|
let isSideBySide = this.isSideBySide
|
|
let isSideBySide = this.isSideBySide
|
|
|
|
+ let isdynamicPlotting = this.isdynamicPlotting
|
|
// setToken("eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImY5Zjg3ZjVmLWQ4NTctNDQxZC04NmQ5LTg4OWExZWRlODE4ZSIsInVzZXJuYW1lIjoiYWRtaW4ifQ.26mAzmaM9pUza9585aLnRMyRd4GxvrWbCxN0erYsuiBDYQiYnyc-TwXVNDI7Xrpt3Bqmbnul-XMszOxYQi12LA");
|
|
// setToken("eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImY5Zjg3ZjVmLWQ4NTctNDQxZC04NmQ5LTg4OWExZWRlODE4ZSIsInVzZXJuYW1lIjoiYWRtaW4ifQ.26mAzmaM9pUza9585aLnRMyRd4GxvrWbCxN0erYsuiBDYQiYnyc-TwXVNDI7Xrpt3Bqmbnul-XMszOxYQi12LA");
|
|
_that.isAggregationLayers = window.L.markerClusterGroup({
|
|
_that.isAggregationLayers = window.L.markerClusterGroup({
|
|
//设置为true时显示聚类所占据的范围
|
|
//设置为true时显示聚类所占据的范围
|
|
@@ -287,7 +347,7 @@
|
|
//最大缩放级别点击聚合图标展开图标
|
|
//最大缩放级别点击聚合图标展开图标
|
|
spiderfyOnMaxZoom: true
|
|
spiderfyOnMaxZoom: true
|
|
})
|
|
})
|
|
- if (!isSideBySide) { //只有一个地图
|
|
|
|
|
|
+ if (!isSideBySide) { //只有一个地图
|
|
if (this.codes.length != 1) {
|
|
if (this.codes.length != 1) {
|
|
modal.msgError('请输入一个地图code!')
|
|
modal.msgError('请输入一个地图code!')
|
|
return
|
|
return
|
|
@@ -298,13 +358,17 @@
|
|
let url = mapList[0].url
|
|
let url = mapList[0].url
|
|
let centerLat = mapList[0].centerLat
|
|
let centerLat = mapList[0].centerLat
|
|
let centerLng = mapList[0].centerLng
|
|
let centerLng = mapList[0].centerLng
|
|
- let zoom = mapList[0].zoom //默认比例
|
|
|
|
- let maxZoom = mapList[0].maxZoom //最大比例
|
|
|
|
|
|
+ let zoom = mapList[0].zoom //默认比例
|
|
|
|
+ let maxZoom = mapList[0].maxZoom //最大比例
|
|
let minZoom = mapList[0].minZoom //最小比例
|
|
let minZoom = mapList[0].minZoom //最小比例
|
|
- let zoomControl = mapList[0].zoomControl == null ? true : mapList[0].zoomControl //地图缩放+-号是否显示
|
|
|
|
- let attributionControl = mapList[0].attributionControl == null ? true : mapList[0].attributionControl //logo是否显示
|
|
|
|
- let logoControl = mapList[0].logoControl == null ? false : mapList[0].logoControl //logo是否显示
|
|
|
|
- let dragging = mapList[0].dragging == null ? true : mapList[0].dragging //地图是否允许鼠标拖拽
|
|
|
|
|
|
+ let zoomControl = mapList[0].zoomControl == null ? true : mapList[0]
|
|
|
|
+ .zoomControl //地图缩放+-号是否显示
|
|
|
|
+ let attributionControl = mapList[0].attributionControl == null ? true : mapList[0]
|
|
|
|
+ .attributionControl //logo是否显示
|
|
|
|
+ let logoControl = mapList[0].logoControl == null ? false : mapList[0]
|
|
|
|
+ .logoControl //logo是否显示
|
|
|
|
+ let dragging = mapList[0].dragging == null ? true : mapList[0]
|
|
|
|
+ .dragging //地图是否允许鼠标拖拽
|
|
|
|
|
|
let defaultConfigure = {
|
|
let defaultConfigure = {
|
|
crs: window.L.CRS.EPSG4326,
|
|
crs: window.L.CRS.EPSG4326,
|
|
@@ -320,6 +384,7 @@
|
|
}
|
|
}
|
|
let loadConfiguration = Object.assign(defaultConfigure, mapSite)
|
|
let loadConfiguration = Object.assign(defaultConfigure, mapSite)
|
|
this.map = window.L.map(this.mapDiv, loadConfiguration)
|
|
this.map = window.L.map(this.mapDiv, loadConfiguration)
|
|
|
|
+
|
|
//鼠标双击落点
|
|
//鼠标双击落点
|
|
if (this.showLatLng != undefined) {
|
|
if (this.showLatLng != undefined) {
|
|
let icon = new window.L.Icon({
|
|
let icon = new window.L.Icon({
|
|
@@ -367,7 +432,8 @@
|
|
let editableLayer = e.layer
|
|
let editableLayer = e.layer
|
|
let layerType = e.layerType
|
|
let layerType = e.layerType
|
|
editableLayer.on('dblclick', function(e) {
|
|
editableLayer.on('dblclick', function(e) {
|
|
- if (layerType === 'polygon' || layerType === 'rectangle') {
|
|
|
|
|
|
+ if (layerType === 'polygon' || layerType ===
|
|
|
|
+ 'rectangle') {
|
|
let latlng = editableLayer.getLatLngs()[0]
|
|
let latlng = editableLayer.getLatLngs()[0]
|
|
_that.showAreaLatLng(latlng)
|
|
_that.showAreaLatLng(latlng)
|
|
}
|
|
}
|
|
@@ -409,10 +475,12 @@
|
|
editableLayers.addLayer(editableLayer)
|
|
editableLayers.addLayer(editableLayer)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ // url = 'https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China_4326'
|
|
|
|
+
|
|
window.L.supermap.tiledMapLayer(url).addTo(this.map)
|
|
window.L.supermap.tiledMapLayer(url).addTo(this.map)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- } else { //卷帘地图
|
|
|
|
|
|
+ } else { //卷帘地图
|
|
if (this.codes.length != 2) {
|
|
if (this.codes.length != 2) {
|
|
modal.msgError('请输入两个地图code!')
|
|
modal.msgError('请输入两个地图code!')
|
|
return
|
|
return
|
|
@@ -424,13 +492,17 @@
|
|
let osmurl = mapList[1].url
|
|
let osmurl = mapList[1].url
|
|
let centerLat = mapList[0].centerLat
|
|
let centerLat = mapList[0].centerLat
|
|
let centerLng = mapList[0].centerLng
|
|
let centerLng = mapList[0].centerLng
|
|
- let zoom = mapList[0].zoom //默认比例
|
|
|
|
- let maxZoom = mapList[0].maxZoom //最大比例
|
|
|
|
|
|
+ let zoom = mapList[0].zoom //默认比例
|
|
|
|
+ let maxZoom = mapList[0].maxZoom //最大比例
|
|
let minZoom = mapList[0].minZoom //最小比例
|
|
let minZoom = mapList[0].minZoom //最小比例
|
|
- let zoomControl = mapList[0].zoomControl == null ? true : mapList[0].zoomControl //地图缩放+-号是否显示
|
|
|
|
- let attributionControl = mapList[0].attributionControl == null ? true : mapList[0].attributionControl //logo是否显示
|
|
|
|
- let logoControl = mapList[0].logoControl == null ? false : mapList[0].logoControl //logo是否显示
|
|
|
|
- let dragging = mapList[0].dragging == null ? true : mapList[0].dragging //地图是否允许鼠标拖拽
|
|
|
|
|
|
+ let zoomControl = mapList[0].zoomControl == null ? true : mapList[0]
|
|
|
|
+ .zoomControl //地图缩放+-号是否显示
|
|
|
|
+ let attributionControl = mapList[0].attributionControl == null ? true : mapList[0]
|
|
|
|
+ .attributionControl //logo是否显示
|
|
|
|
+ let logoControl = mapList[0].logoControl == null ? false : mapList[0]
|
|
|
|
+ .logoControl //logo是否显示
|
|
|
|
+ let dragging = mapList[0].dragging == null ? true : mapList[0]
|
|
|
|
+ .dragging //地图是否允许鼠标拖拽
|
|
|
|
|
|
let defaultConfigure = {
|
|
let defaultConfigure = {
|
|
crs: window.L.CRS.EPSG4326,
|
|
crs: window.L.CRS.EPSG4326,
|
|
@@ -494,7 +566,8 @@
|
|
let editableLayer = e.layer
|
|
let editableLayer = e.layer
|
|
let layerType = e.layerType
|
|
let layerType = e.layerType
|
|
editableLayer.on('dblclick', function(e) {
|
|
editableLayer.on('dblclick', function(e) {
|
|
- if (layerType === 'polygon' || layerType === 'rectangle') {
|
|
|
|
|
|
+ if (layerType === 'polygon' || layerType ===
|
|
|
|
+ 'rectangle') {
|
|
let latlng = editableLayer.getLatLngs()[0]
|
|
let latlng = editableLayer.getLatLngs()[0]
|
|
_that.showAreaLatLng(latlng)
|
|
_that.showAreaLatLng(latlng)
|
|
}
|
|
}
|
|
@@ -563,16 +636,17 @@
|
|
for (let i = 0; i < line.length - 1; i++) {
|
|
for (let i = 0; i < line.length - 1; i++) {
|
|
let start = line[i]
|
|
let start = line[i]
|
|
let end = line[i + 1]
|
|
let end = line[i + 1]
|
|
- dis += window.L.latLng([start.lat, start.lng]).distanceTo([end.lat, end.lng])//计算两个点之间的距离,并累加
|
|
|
|
|
|
+ dis += window.L.latLng([start.lat, start.lng]).distanceTo([end.lat, end.lng]) //计算两个点之间的距离,并累加
|
|
}
|
|
}
|
|
//结果得到的也是number类型,单位是 米
|
|
//结果得到的也是number类型,单位是 米
|
|
return (dis / 10e2).toFixed(2) + 'km'
|
|
return (dis / 10e2).toFixed(2) + 'km'
|
|
},
|
|
},
|
|
- setMarkers: function(markersList) {//地图标点
|
|
|
|
|
|
+ setMarkers: function(markersList) { //地图标点
|
|
const _that = this
|
|
const _that = this
|
|
for (let i = 0; i < markersList.length; i++) {
|
|
for (let i = 0; i < markersList.length; i++) {
|
|
- let isAggregation = markersList[i].isAggregation == null ? false : markersList[i].isAggregation //是否聚合点位
|
|
|
|
- let keepBindPopup = isAggregation == true ? false : markersList[i].keepBindPopup //提示气泡是否一直显示
|
|
|
|
|
|
+ let isAggregation = markersList[i].isAggregation == null ? false : markersList[i]
|
|
|
|
+ .isAggregation //是否聚合点位
|
|
|
|
+ let keepBindPopup = isAggregation == true ? false : markersList[i].keepBindPopup //提示气泡是否一直显示
|
|
|
|
|
|
let icon = new window.L.Icon({
|
|
let icon = new window.L.Icon({
|
|
iconUrl: iconList[markersList[i].icon],
|
|
iconUrl: iconList[markersList[i].icon],
|
|
@@ -626,14 +700,71 @@
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- setMarkersRadius: function(markersList) {//地图标点带范围
|
|
|
|
|
|
+ setMarkersByType: function(markersList, type) { //地图标点(根据类型,可取消落点 clearMByType方法)
|
|
|
|
+ const _that = this
|
|
|
|
+ let lay = []
|
|
|
|
+ let myGroup = []
|
|
|
|
+ for (let i = 0; i < markersList.length; i++) {
|
|
|
|
+ let keepBindPopup = markersList[i].keepBindPopup //提示气泡是否一直显示
|
|
|
|
+
|
|
|
|
+ let icon = new window.L.Icon({
|
|
|
|
+ iconUrl: iconList[markersList[i].icon],
|
|
|
|
+ iconSize: [48, 48],
|
|
|
|
+ iconAnchor: [24, 40],
|
|
|
|
+ popupAnchor: [-3, -40],
|
|
|
|
+ shadowSize: [41, 41]
|
|
|
|
+ })
|
|
|
|
+ let markerClick = window.L.marker([markersList[i].lat, markersList[i].lng], {
|
|
|
|
+ icon: icon
|
|
|
|
+ }).addTo(this.map)
|
|
|
|
+ if (markersList[i].bindPopupHtml != null && markersList[i].bindPopupHtml !== '') {
|
|
|
|
+ let html = markersList[i].bindPopupHtml
|
|
|
|
+ if (keepBindPopup) {
|
|
|
|
+ markerClick.bindPopup(html, {
|
|
|
|
+ autoClose: false,
|
|
|
|
+ closeOnClick: null,
|
|
|
|
+ closeButton: false
|
|
|
|
+ }).openPopup(markerClick.getLatLng())
|
|
|
|
+ } else {
|
|
|
|
+ markerClick.on('mouseover', function() {
|
|
|
|
+ let html = markersList[i].bindPopupHtml
|
|
|
|
+ this.bindPopup(html).openPopup(this.getLatLng())
|
|
|
|
+ }).on('mouseout', function() {
|
|
|
|
+ this.closePopup()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (markersList[i].click != null && markersList[i].click !== '') {
|
|
|
|
+ if (markersList[i].parameter != null && markersList[i].parameter !== '') {
|
|
|
|
+ markerClick.on('click', function() {
|
|
|
|
+ let clickName = markersList[i].click
|
|
|
|
+ _that.$emit(clickName, markersList[i].parameter)
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ markerClick.on('click', function() {
|
|
|
|
+ let clickName = markersList[i].click
|
|
|
|
+ _that.$emit(clickName)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ lay.push(markerClick)
|
|
|
|
+ _that.layersBytype.push({ type: type, marker: markerClick })
|
|
|
|
+ myGroup = window.L.layerGroup(lay)
|
|
|
|
+ _that.myGroupBytype.push({ type: type, myGroup: myGroup })
|
|
|
|
+ this.map.addLayer(myGroup)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ setMarkersRadius: function(markersList) { //地图标点带范围
|
|
const _that = this
|
|
const _that = this
|
|
for (let i = 0; i < markersList.length; i++) {
|
|
for (let i = 0; i < markersList.length; i++) {
|
|
- let isAggregation = markersList[i].isAggregation == null ? false : markersList[i].isAggregation //是否聚合点位
|
|
|
|
- let keepBindPopup = isAggregation == true ? false : markersList[i].keepBindPopup //提示气泡是否一直显示
|
|
|
|
|
|
+ let isAggregation = markersList[i].isAggregation == null ? false : markersList[i]
|
|
|
|
+ .isAggregation //是否聚合点位
|
|
|
|
+ let keepBindPopup = isAggregation == true ? false : markersList[i].keepBindPopup //提示气泡是否一直显示
|
|
|
|
|
|
- _that.polygon = window.L.circle([markersList[i].lat, markersList[i].lng], { radius: markersList[i].radius * 1000 })
|
|
|
|
- let icon = new window.L.Icon({//传感器
|
|
|
|
|
|
+ _that.polygon = window.L.circle([markersList[i].lat, markersList[i].lng], {
|
|
|
|
+ radius: markersList[i].radius
|
|
|
|
+ })
|
|
|
|
+ let icon = new window.L.Icon({ //传感器
|
|
iconUrl: iconList[markersList[i].icon],
|
|
iconUrl: iconList[markersList[i].icon],
|
|
iconSize: [48, 48],
|
|
iconSize: [48, 48],
|
|
iconAnchor: [24, 40],
|
|
iconAnchor: [24, 40],
|
|
@@ -689,13 +820,15 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- setConnectList: function(connectList, color) {//地图画线
|
|
|
|
|
|
+ setConnectList: function(connectList, color) { //地图画线
|
|
const _that = this
|
|
const _that = this
|
|
let points = []
|
|
let points = []
|
|
for (let i = 0; i < connectList.length; i++) {
|
|
for (let i = 0; i < connectList.length; i++) {
|
|
- points.push([connectList[i].lat, connectList[i].lng])//创建点
|
|
|
|
|
|
+ points.push([connectList[i].lat, connectList[i].lng]) //创建点
|
|
}
|
|
}
|
|
- let polyline = window.L.polyline(points, { color: color })
|
|
|
|
|
|
+ let polyline = window.L.polyline(points, {
|
|
|
|
+ color: color
|
|
|
|
+ })
|
|
if (this.connectLayer != undefined && this.connectLayer != false) {
|
|
if (this.connectLayer != undefined && this.connectLayer != false) {
|
|
_that.connectLayer.addLayer(polyline)
|
|
_that.connectLayer.addLayer(polyline)
|
|
} else {
|
|
} else {
|
|
@@ -703,13 +836,15 @@
|
|
_that.connectLayer.addLayer(polyline)
|
|
_that.connectLayer.addLayer(polyline)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- setConnectTwoList: function(connectList, color) {//地图画线图层2
|
|
|
|
|
|
+ setConnectTwoList: function(connectList, color) { //地图画线图层2
|
|
const _that = this
|
|
const _that = this
|
|
let points = []
|
|
let points = []
|
|
for (let i = 0; i < connectList.length; i++) {
|
|
for (let i = 0; i < connectList.length; i++) {
|
|
- points.push([connectList[i].lat, connectList[i].lng])//创建点
|
|
|
|
|
|
+ points.push([connectList[i].lat, connectList[i].lng]) //创建点
|
|
}
|
|
}
|
|
- let polyline = window.L.polyline(points, { color: color })
|
|
|
|
|
|
+ let polyline = window.L.polyline(points, {
|
|
|
|
+ color: color
|
|
|
|
+ })
|
|
if (this.connectLayerTwo != undefined && this.connectLayerTwo != false) {
|
|
if (this.connectLayerTwo != undefined && this.connectLayerTwo != false) {
|
|
_that.connectLayerTwo.addLayer(polyline)
|
|
_that.connectLayerTwo.addLayer(polyline)
|
|
} else {
|
|
} else {
|
|
@@ -717,13 +852,15 @@
|
|
_that.connectLayerTwo.addLayer(polyline)
|
|
_that.connectLayerTwo.addLayer(polyline)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- setGraphicsList: function(graphicsList, color) {//地图图形
|
|
|
|
|
|
+ setGraphicsList: function(graphicsList, color) { //地图图形
|
|
const _that = this
|
|
const _that = this
|
|
let points = []
|
|
let points = []
|
|
for (let i = 0; i < graphicsList.length; i++) {
|
|
for (let i = 0; i < graphicsList.length; i++) {
|
|
- points.push([graphicsList[i].lat, graphicsList[i].lng])//创建点
|
|
|
|
|
|
+ points.push([graphicsList[i].lat, graphicsList[i].lng]) //创建点
|
|
}
|
|
}
|
|
- let polygon = window.L.polygon(points, { color: color })
|
|
|
|
|
|
+ let polygon = window.L.polygon(points, {
|
|
|
|
+ color: color
|
|
|
|
+ })
|
|
polygon.addTo(this.map)
|
|
polygon.addTo(this.map)
|
|
if (this.graphicsLayer != undefined && this.graphicsLayer != false) {
|
|
if (this.graphicsLayer != undefined && this.graphicsLayer != false) {
|
|
_that.graphicsLayer.addLayer(polygon)
|
|
_that.graphicsLayer.addLayer(polygon)
|
|
@@ -732,16 +869,19 @@
|
|
_that.graphicsLayer.addLayer(polygon)
|
|
_that.graphicsLayer.addLayer(polygon)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- dropLocation: function(lat, lng) {//落点定位
|
|
|
|
- this.controlLevel(10)
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.map.panTo([lat, lng])
|
|
|
|
- }, 500)
|
|
|
|
|
|
+ dropLocation: function(lat, lng) { //落点定位
|
|
|
|
+
|
|
|
|
+ this.map.flyTo([lat, lng], 14, { duration: 2 })
|
|
|
|
+
|
|
|
|
+ // this.controlLevel(12)
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // this.map.panTo([lat, lng])
|
|
|
|
+ // }, 1000)
|
|
},
|
|
},
|
|
- controlLevel: function(level) {//控制地图缩放级别
|
|
|
|
|
|
+ controlLevel: function(level) { //控制地图缩放级别
|
|
this.map.setZoom(level)
|
|
this.map.setZoom(level)
|
|
},
|
|
},
|
|
- layerSwitching: function(url, isClear) {//图层切换 url 图层地址 isClear 是否清除图层
|
|
|
|
|
|
+ layerSwitching: function(url, isClear) { //图层切换 url 图层地址 isClear 是否清除图层
|
|
if (isClear) {
|
|
if (isClear) {
|
|
if (this.deckglLayer != null) {
|
|
if (this.deckglLayer != null) {
|
|
this.deckglLayer.remove()
|
|
this.deckglLayer.remove()
|
|
@@ -749,11 +889,71 @@
|
|
}
|
|
}
|
|
this.deckglLayer = window.L.supermap.tiledMapLayer(url, {})
|
|
this.deckglLayer = window.L.supermap.tiledMapLayer(url, {})
|
|
this.map.addLayer(this.deckglLayer)
|
|
this.map.addLayer(this.deckglLayer)
|
|
|
|
+ },
|
|
|
|
+ layerSwitchingList: function(urlList) { //图层切换数组 urlList 图层地址(数组)
|
|
|
|
+ if (this.deckglLayerList != null && this.deckglLayerList.length > 0) {
|
|
|
|
+ for (let i = 0; i < this.deckglLayerList.length; i++) {
|
|
|
|
+ this.deckglLayerList[i].remove()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (urlList != null && urlList.length > 0) {
|
|
|
|
+ for (let i = 0; i < urlList.length; i++) {
|
|
|
|
+ this.deckglLayer = window.L.supermap.tiledMapLayer(urlList[i], {})
|
|
|
|
+ this.deckglLayerList.push(this.deckglLayer)
|
|
|
|
+ this.map.addLayer(this.deckglLayer)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /** ----------------------------------动态绘制开始------------------------------------- */
|
|
|
|
+ clearLayers: function() {
|
|
|
|
+ this.plottingLayer.removeAllFeatures()
|
|
|
|
+ },
|
|
|
|
+ PlottingDrawCancel: function() {
|
|
|
|
+ this.plottingdrawControl.handler.disable()
|
|
|
|
+ },
|
|
|
|
+ dynamicPlotting: function() {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ var host = 'https://iserver.supermap.io'
|
|
|
|
+ var serverUrl = host + '/iserver/services/plot-jingyong/rest/plot/'
|
|
|
|
+
|
|
|
|
+ var me = this
|
|
|
|
+ this.plottingLayer = window.L.supermap.plotting.plottingLayer('plot',
|
|
|
|
+ serverUrl)
|
|
|
|
+ this.plottingLayer.spatialAnalystUrl =
|
|
|
|
+ host + '/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst'
|
|
|
|
+ this.plottingLayer.addTo(this.map)
|
|
|
|
+ this.plottingdrawControl = window.L.supermap.plotting.drawControl(this
|
|
|
|
+ .plottingLayer)
|
|
|
|
+ this.plottingdrawControl.addTo(this.map)
|
|
|
|
+ var editControl = window.L.supermap.plotting.editControl()
|
|
|
|
+ editControl.addTo(this.map)
|
|
|
|
+ window.L.supermap.plotting.initPlotPanel('plotPanel', serverUrl, this
|
|
|
|
+ .plottingdrawControl)
|
|
|
|
+ }, 2000)
|
|
}
|
|
}
|
|
|
|
+ /** ----------------------------------动态绘制结束------------------------------------- */
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+ @import '@/assets/styles/base.scss';
|
|
|
|
+
|
|
|
|
+ .button-group {
|
|
|
|
+ button {
|
|
|
|
+ padding: 0 0.3rem;
|
|
|
|
+ height: 1.5rem;
|
|
|
|
+ background-color: #112543;
|
|
|
|
+ color: #2bacf7;
|
|
|
|
+ border: 1px solid #33467f;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ button:hover {
|
|
|
|
+ border: 1px solid #33467f;
|
|
|
|
+ background-color: #112543;
|
|
|
|
+ text-shadow: 0 0 15px rgba($color: $inBlueHover, $alpha: 1.0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
</style>
|
|
</style>
|