|
@@ -3,12 +3,21 @@ import * as layer from "ol/layer";
|
|
|
import * as style from "ol/style";
|
|
|
import * as ol from "ol";
|
|
|
import * as format from "ol/format";
|
|
|
-import SbStyle from "@/views/gis/map-info/style/sb";
|
|
|
import CommonStyle from "@/views/gis/map-info/style/common";
|
|
|
+import SbStyle from "@/views/gis/map-info/style/sb";
|
|
|
+import JqStyle from "@/views/gis/map-info/style/jq";
|
|
|
+import LgStyle from "@/views/gis/map-info/style/lg";
|
|
|
+import CzwStyle from "@/views/gis/map-info/style/czw";
|
|
|
+import HczStyle from "@/views/gis/map-info/style/hcz";
|
|
|
|
|
|
const state = {
|
|
|
menuRootName: '9cd5fbf9-35fd-4fb2-8c24-1f871afd67be',
|
|
|
isTooling: false,
|
|
|
+ videoParams: {
|
|
|
+ show: false,
|
|
|
+ name: null,
|
|
|
+ code: null
|
|
|
+ },
|
|
|
map: null,
|
|
|
activeQyId: null,
|
|
|
gisParams: {
|
|
@@ -33,6 +42,10 @@ const mutations = {
|
|
|
SET_IS_TOOLING(state, flag) {
|
|
|
state.isTooling = flag
|
|
|
},
|
|
|
+ SET_VIDEO_PARAMS(state, data) {
|
|
|
+ const { show, name = null, code = null } = data
|
|
|
+ state.videoParams = { show, name, code }
|
|
|
+ },
|
|
|
SET_GIS_MAP(state, {map, defaultDom}) {
|
|
|
state.map = map
|
|
|
state.gisParams.default.source = new source.Vector()
|
|
@@ -55,7 +68,7 @@ const mutations = {
|
|
|
})
|
|
|
state.map.addOverlay(state.gisParams.default.overlay)
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_SB(state, {wkt, info, config}) {
|
|
|
+ SET_GIS_PARAMS_DEFAULT_SB(state, {wkt, id, info, config}) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -65,12 +78,12 @@ const mutations = {
|
|
|
state.gisParams.default.type = 'sb'
|
|
|
state.gisParams.default.info = JSON.parse(JSON.stringify(info))
|
|
|
const newFeat: any = new format.WKT().readFeature(wkt)
|
|
|
- let type = ''
|
|
|
- if (info.type = '公安类') {
|
|
|
+ let type
|
|
|
+ if (info.type === '公安类') {
|
|
|
type = 'galsb'
|
|
|
- } else if (info.type = '社会类') {
|
|
|
+ } else if (info.type === '社会类') {
|
|
|
type = 'shlsb'
|
|
|
- } else if (info.type = '民用类') {
|
|
|
+ } else if (info.type === '民用类') {
|
|
|
type = 'mylsb'
|
|
|
}
|
|
|
newFeat.set('defaultStyle', SbStyle.sbStyle(type))
|
|
@@ -85,10 +98,143 @@ const mutations = {
|
|
|
newFeat.setStyle(newFeat.get('defaultStyle'))
|
|
|
}
|
|
|
})
|
|
|
- newFeat.setStyle(newFeat.get('analysisStyle'))
|
|
|
- newFeat.set('featureType', 'sb')
|
|
|
- newFeat.set('info', state.gisParams.default.info)
|
|
|
- newFeat.setId(info.deviceid)
|
|
|
+ newFeat.get('resetStyle')()
|
|
|
+ newFeat.set('featureType', JSON.parse(JSON.stringify(state.gisParams.default.type)))
|
|
|
+ newFeat.set('info', JSON.parse(JSON.stringify(state.gisParams.default.info)))
|
|
|
+ newFeat.setId(id)
|
|
|
+ state.gisParams.default.source.addFeature(newFeat)
|
|
|
+ state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log('异常数据:', wkt, info, e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ SET_GIS_PARAMS_DEFAULT_JQ(state, {wkt, id, info, config}) {
|
|
|
+ const {
|
|
|
+ isAnalysis = false
|
|
|
+ } = config
|
|
|
+ if (state.gisParams.default.layer) {
|
|
|
+ state.gisParams.default.source?.clear()
|
|
|
+ try {
|
|
|
+ state.gisParams.default.type = 'jq'
|
|
|
+ state.gisParams.default.info = JSON.parse(JSON.stringify(info))
|
|
|
+ const newFeat: any = new format.WKT().readFeature(wkt)
|
|
|
+ newFeat.set('defaultStyle', JqStyle.jqStyle())
|
|
|
+ newFeat.set('activeStyle', [...CommonStyle.activeStyle(), ...JqStyle.jqStyle()])
|
|
|
+ newFeat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...JqStyle.jqStyle()])
|
|
|
+ newFeat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...JqStyle.jqStyle()])
|
|
|
+ newFeat.set('isAnalysis', isAnalysis)
|
|
|
+ newFeat.set('resetStyle', () => {
|
|
|
+ if (newFeat.get('isAnalysis')) {
|
|
|
+ newFeat.setStyle(newFeat.get('analysisStyle'))
|
|
|
+ } else {
|
|
|
+ newFeat.setStyle(newFeat.get('defaultStyle'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ newFeat.get('resetStyle')()
|
|
|
+ newFeat.set('featureType', JSON.parse(JSON.stringify(state.gisParams.default.type)))
|
|
|
+ newFeat.set('info', JSON.parse(JSON.stringify(state.gisParams.default.info)))
|
|
|
+ newFeat.setId(id)
|
|
|
+ state.gisParams.default.source.addFeature(newFeat)
|
|
|
+ state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log('异常数据:', wkt, info, e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ SET_GIS_PARAMS_DEFAULT_LG(state, {wkt, id, info, config}) {
|
|
|
+ const {
|
|
|
+ isAnalysis = false
|
|
|
+ } = config
|
|
|
+ if (state.gisParams.default.layer) {
|
|
|
+ state.gisParams.default.source?.clear()
|
|
|
+ try {
|
|
|
+ state.gisParams.default.type = 'lg'
|
|
|
+ state.gisParams.default.info = JSON.parse(JSON.stringify(info))
|
|
|
+ const newFeat: any = new format.WKT().readFeature(wkt)
|
|
|
+ newFeat.set('defaultStyle', LgStyle.lgStyle())
|
|
|
+ newFeat.set('activeStyle', [...CommonStyle.activeStyle(), ...LgStyle.lgStyle()])
|
|
|
+ newFeat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...LgStyle.lgStyle()])
|
|
|
+ newFeat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...LgStyle.lgStyle()])
|
|
|
+ newFeat.set('isAnalysis', isAnalysis)
|
|
|
+ newFeat.set('resetStyle', () => {
|
|
|
+ if (newFeat.get('isAnalysis')) {
|
|
|
+ newFeat.setStyle(newFeat.get('analysisStyle'))
|
|
|
+ } else {
|
|
|
+ newFeat.setStyle(newFeat.get('defaultStyle'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ newFeat.get('resetStyle')()
|
|
|
+ newFeat.set('featureType', JSON.parse(JSON.stringify(state.gisParams.default.type)))
|
|
|
+ newFeat.set('info', JSON.parse(JSON.stringify(state.gisParams.default.info)))
|
|
|
+ newFeat.setId(id)
|
|
|
+ state.gisParams.default.source.addFeature(newFeat)
|
|
|
+ state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log('异常数据:', wkt, info, e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ SET_GIS_PARAMS_DEFAULT_CZW(state, {wkt, id, info, config}) {
|
|
|
+ const {
|
|
|
+ isAnalysis = false
|
|
|
+ } = config
|
|
|
+ if (state.gisParams.default.layer) {
|
|
|
+ state.gisParams.default.source?.clear()
|
|
|
+ try {
|
|
|
+ state.gisParams.default.type = 'czw'
|
|
|
+ state.gisParams.default.info = JSON.parse(JSON.stringify(info))
|
|
|
+ const newFeat: any = new format.WKT().readFeature(wkt)
|
|
|
+ newFeat.set('defaultStyle', LgStyle.lgStyle())
|
|
|
+ newFeat.set('activeStyle', [...CommonStyle.activeStyle(), ...CzwStyle.czwStyle()])
|
|
|
+ newFeat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...CzwStyle.czwStyle()])
|
|
|
+ newFeat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...CzwStyle.czwStyle()])
|
|
|
+ newFeat.set('isAnalysis', isAnalysis)
|
|
|
+ newFeat.set('resetStyle', () => {
|
|
|
+ if (newFeat.get('isAnalysis')) {
|
|
|
+ newFeat.setStyle(newFeat.get('analysisStyle'))
|
|
|
+ } else {
|
|
|
+ newFeat.setStyle(newFeat.get('defaultStyle'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ newFeat.get('resetStyle')()
|
|
|
+ newFeat.set('featureType', JSON.parse(JSON.stringify(state.gisParams.default.type)))
|
|
|
+ newFeat.set('info', JSON.parse(JSON.stringify(state.gisParams.default.info)))
|
|
|
+ newFeat.setId(id)
|
|
|
+ state.gisParams.default.source.addFeature(newFeat)
|
|
|
+ state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log('异常数据:', wkt, info, e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ SET_GIS_PARAMS_DEFAULT_HCZ(state, {wkt, id, info, config}) {
|
|
|
+ const {
|
|
|
+ isAnalysis = false
|
|
|
+ } = config
|
|
|
+ if (state.gisParams.default.layer) {
|
|
|
+ state.gisParams.default.source?.clear()
|
|
|
+ try {
|
|
|
+ state.gisParams.default.type = 'hcz'
|
|
|
+ state.gisParams.default.info = JSON.parse(JSON.stringify(info))
|
|
|
+ const newFeat: any = new format.WKT().readFeature(wkt)
|
|
|
+ newFeat.set('defaultStyle', HczStyle.hczStyle())
|
|
|
+ newFeat.set('activeStyle', [...CommonStyle.activeStyle(), ...HczStyle.hczStyle()])
|
|
|
+ newFeat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...HczStyle.hczStyle()])
|
|
|
+ newFeat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...HczStyle.hczStyle()])
|
|
|
+ newFeat.set('isAnalysis', isAnalysis)
|
|
|
+ newFeat.set('resetStyle', () => {
|
|
|
+ if (newFeat.get('isAnalysis')) {
|
|
|
+ newFeat.setStyle(newFeat.get('analysisStyle'))
|
|
|
+ } else {
|
|
|
+ newFeat.setStyle(newFeat.get('defaultStyle'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ newFeat.get('resetStyle')()
|
|
|
+ newFeat.set('featureType', JSON.parse(JSON.stringify(state.gisParams.default.type)))
|
|
|
+ newFeat.set('info', JSON.parse(JSON.stringify(state.gisParams.default.info)))
|
|
|
+ newFeat.setId(id)
|
|
|
+ state.gisParams.default.source.addFeature(newFeat)
|
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -114,9 +260,17 @@ const actions = {
|
|
|
commit('SET_GIS_MAP', {map, defaultDom})
|
|
|
}
|
|
|
},
|
|
|
- LOAD_GIS_PARAMS_DEFAULT({ commit }: any, {type, wkt, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT({ commit }: any, {type, wkt, id, info, config = {}}: any) {
|
|
|
if (type === 'sb') {
|
|
|
- commit('SET_GIS_PARAMS_DEFAULT_SB', {wkt, info, config})
|
|
|
+ commit('SET_GIS_PARAMS_DEFAULT_SB', {wkt, id, info, config})
|
|
|
+ } else if (type === 'jq') {
|
|
|
+ commit('SET_GIS_PARAMS_DEFAULT_JQ', {wkt, id, info, config})
|
|
|
+ } else if (type === 'lg') {
|
|
|
+ commit('SET_GIS_PARAMS_DEFAULT_LG', {wkt, id, info, config})
|
|
|
+ } else if (type === 'czw') {
|
|
|
+ commit('SET_GIS_PARAMS_DEFAULT_CZW', {wkt, id, info, config})
|
|
|
+ } else if (type === 'hcz') {
|
|
|
+ commit('SET_GIS_PARAMS_DEFAULT_HCZ', {wkt, id, info, config})
|
|
|
}
|
|
|
},
|
|
|
LOAD_GIS_PARAMS_DEFAULT_RESET({ commit }: any) {
|