|
@@ -13,8 +13,8 @@ import CzwStyle from "@/views/gis/map-info/style/czw";
|
|
import HczStyle from "@/views/gis/map-info/style/hcz";
|
|
import HczStyle from "@/views/gis/map-info/style/hcz";
|
|
import store from "@/store";
|
|
import store from "@/store";
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
-import {geometry} from "@turf/turf";
|
|
|
|
import {formatPosition} from "@/utils/easyMap";
|
|
import {formatPosition} from "@/utils/easyMap";
|
|
|
|
+import * as turf from "@turf/turf";
|
|
|
|
|
|
const formatWkt = (wkt) => {
|
|
const formatWkt = (wkt) => {
|
|
return wkt.split(',').join('\\\,')
|
|
return wkt.split(',').join('\\\,')
|
|
@@ -101,6 +101,8 @@ const state = {
|
|
],
|
|
],
|
|
layer: null,
|
|
layer: null,
|
|
},
|
|
},
|
|
|
|
+ l: null,
|
|
|
|
+ s: null
|
|
}
|
|
}
|
|
|
|
|
|
const getters = {
|
|
const getters = {
|
|
@@ -119,6 +121,30 @@ const mutations = {
|
|
},
|
|
},
|
|
SET_GIS_MAP(state, {map, defaultDom, qyDom}) {
|
|
SET_GIS_MAP(state, {map, defaultDom, qyDom}) {
|
|
state.map = map
|
|
state.map = map
|
|
|
|
+ state.s = new source.Vector()
|
|
|
|
+ state.l = new layer.Vector({
|
|
|
|
+ source: state.s,
|
|
|
|
+ zIndex: 99999,
|
|
|
|
+ style: new style.Style({ //图层样式
|
|
|
|
+ fill: new style.Fill({
|
|
|
|
+ color: 'rgba(46,129,255,0.15)' //填充颜色
|
|
|
|
+ }),
|
|
|
|
+ stroke: new style.Stroke({
|
|
|
|
+ color: '#2E81FF', //边框颜色
|
|
|
|
+ width: 2, // 边框宽度
|
|
|
|
+ lineDash: [10, 10]
|
|
|
|
+ }),
|
|
|
|
+ image: new style.Circle({
|
|
|
|
+ radius: 5,
|
|
|
|
+ fill: new style.Fill({
|
|
|
|
+ color: '#ffcc33'
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ state.map.addLayer(state.l)
|
|
|
|
+
|
|
|
|
+
|
|
state.element.layer = new layer.Tile({
|
|
state.element.layer = new layer.Tile({
|
|
zIndex: 10,
|
|
zIndex: 10,
|
|
})
|
|
})
|
|
@@ -365,6 +391,41 @@ const mutations = {
|
|
state.gisParams.qy.analysisWKT = formatPosition.cpnTwpn(state.gisParams.qy.analysisCircle.getGeometry().getCoordinates())
|
|
state.gisParams.qy.analysisWKT = formatPosition.cpnTwpn(state.gisParams.qy.analysisCircle.getGeometry().getCoordinates())
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ANALYSIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ANALYSIS_ELEMENT')
|
|
|
|
+ state.gisParams.qy.info['5'].tableData = []
|
|
|
|
+ state.gisParams.qy.info['5'].loading = true
|
|
|
|
+ axios({
|
|
|
|
+ url: state.gisParams.qy.analysisDeviceLayer.getSource().getUrls()[0],
|
|
|
|
+ method: 'get',
|
|
|
|
+ params: {
|
|
|
|
+ service: 'WFS',
|
|
|
|
+ version: '1.0.0',
|
|
|
|
+ request: 'GetFeature',
|
|
|
|
+ typename: 'mysqlGeo:stg_view_deviceinfo_df_value1,mysqlGeo:stg_view_deviceinfo_df_value2,mysqlGeo:stg_view_deviceinfo_df_value3',
|
|
|
|
+ srsName: 'EPSG:4326',
|
|
|
|
+ outputFormat: 'application/json',
|
|
|
|
+ CQL_FILTER: `INTERSECTS(location, ${state.gisParams.qy.analysisWKT})`
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ state.gisParams.qy.info['5'].tableData = res.data.features.map(v => {
|
|
|
|
+ let type = ''
|
|
|
|
+ switch (v.properties.typeValue) {
|
|
|
|
+ case 'gal': type = '公安类'
|
|
|
|
+ break
|
|
|
|
+ case 'myl': type = '民用类'
|
|
|
|
+ break
|
|
|
|
+ case 'shl': type = '社会类'
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ name: v.properties.name,
|
|
|
|
+ status: v.properties.online == '1' ? true : false,
|
|
|
|
+ type: type,
|
|
|
|
+ distanceValue: turf.distance(state.gisParams.qy.info['5'].center, [Number(v.geometry.coordinates[0]), Number(v.geometry.coordinates[1])], {units: 'kilometers'}).toFixed(3),
|
|
|
|
+ distance: turf.distance(state.gisParams.qy.info['5'].center, [Number(v.geometry.coordinates[0]), Number(v.geometry.coordinates[1])], {units: 'kilometers'}).toFixed(2) + 'km'
|
|
|
|
+ }
|
|
|
|
+ }).sort((a, b) => a.distanceValue - b.distanceValue)
|
|
|
|
+ state.gisParams.qy.info['5'].loading = false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
SET_GIS_PARAMS_DEFAULT_SB(state, {wkt, id, info, config = {}}: any) {
|
|
SET_GIS_PARAMS_DEFAULT_SB(state, {wkt, id, info, config = {}}: any) {
|