|
@@ -14,6 +14,7 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
const state: any = reactive({
|
|
|
warningOpen: true,
|
|
|
warningInfo: {},
|
|
|
+ warningParams: {},
|
|
|
map: null,
|
|
|
mapFunc: null,
|
|
|
zoom: 0,
|
|
@@ -24,56 +25,57 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
overlayTrack: null,
|
|
|
},
|
|
|
trackHoverData: null,
|
|
|
- trackMap: new Map([['123', {
|
|
|
- data: {
|
|
|
- targetSourceJson: '[]'
|
|
|
- },
|
|
|
- color: randomColor(1),
|
|
|
- history: [],
|
|
|
- real: [{}],
|
|
|
- trackId: '123',
|
|
|
- moveToTrack: () => {},
|
|
|
- // 直接用图层的话declutter: true会报错,Uncaught TypeError: Failed to execute 'clip' on 'CanvasRenderingContext2D': parameter 1 is not of type 'Path2D'.
|
|
|
- lineLayer: 'lineLayer_' + 123,
|
|
|
- pointsLayer: 'pointsLayer_' + 123,
|
|
|
- del: () => {},
|
|
|
- visibleTrack: (visible) => {},
|
|
|
- refreshTrackStyle: () => {},
|
|
|
- showTrack: true,
|
|
|
- showArchive: true,
|
|
|
- archiveLayout: {
|
|
|
- width: 480,
|
|
|
- top: 10,
|
|
|
- left: 200
|
|
|
- },
|
|
|
- archiveParams: {
|
|
|
- tab: 1,
|
|
|
- }
|
|
|
- }]])
|
|
|
+ trackMap: new Map()
|
|
|
+ // [['123', {
|
|
|
+ // data: {
|
|
|
+ // targetSourceJson: '[]'
|
|
|
+ // },
|
|
|
+ // color: randomColor(1),
|
|
|
+ // history: [],
|
|
|
+ // real: [{}],
|
|
|
+ // trackId: '123',
|
|
|
+ // moveToTrack: () => {},
|
|
|
+ // // 直接用图层的话declutter: true会报错,Uncaught TypeError: Failed to execute 'clip' on 'CanvasRenderingContext2D': parameter 1 is not of type 'Path2D'.
|
|
|
+ // lineLayer: 'lineLayer_' + 123,
|
|
|
+ // pointsLayer: 'pointsLayer_' + 123,
|
|
|
+ // del: () => {},
|
|
|
+ // visibleTrack: (visible) => {},
|
|
|
+ // refreshTrackStyle: () => {},
|
|
|
+ // showTrack: true,
|
|
|
+ // showArchive: true,
|
|
|
+ // archiveLayout: {
|
|
|
+ // width: 480,
|
|
|
+ // top: 10,
|
|
|
+ // left: 200
|
|
|
+ // },
|
|
|
+ // archiveParams: {
|
|
|
+ // tab: 1,
|
|
|
+ // }
|
|
|
+ // }]]
|
|
|
})
|
|
|
const initMap = (map, mapFunc, {trackPointDom}) => {
|
|
|
state.map = map
|
|
|
state.mapFunc = mapFunc
|
|
|
state.zoom = state.map.getView().getZoom()
|
|
|
- state.map.on('movestart', e => {
|
|
|
- map.un('pointermove', mapPointerMove)
|
|
|
- map.un('singleclick', mapSingleClick)
|
|
|
- })
|
|
|
- state.map.on('moveend', e => {
|
|
|
- state.trackHover = new Date().getTime()
|
|
|
- state.zoom = e.map.getView().getZoom()
|
|
|
- switchZoom()
|
|
|
- map.on('singleclick', mapSingleClick)
|
|
|
- map.on('pointermove', mapPointerMove)
|
|
|
- })
|
|
|
- state.ws.overlayTrack = new ol.Overlay({
|
|
|
- element: trackPointDom,
|
|
|
- autoPan: false,
|
|
|
- offset: [0, -22],
|
|
|
- positioning: 'bottom-center',
|
|
|
- stopEvent: true,
|
|
|
- })
|
|
|
- state.map.addOverlay(state.ws.overlayTrack)
|
|
|
+ // state.map.on('movestart', e => {
|
|
|
+ // map.un('pointermove', mapPointerMove)
|
|
|
+ // map.un('singleclick', mapSingleClick)
|
|
|
+ // })
|
|
|
+ // state.map.on('moveend', e => {
|
|
|
+ // state.trackHover = new Date().getTime()
|
|
|
+ // state.zoom = e.map.getView().getZoom()
|
|
|
+ // switchZoom()
|
|
|
+ // map.on('singleclick', mapSingleClick)
|
|
|
+ // map.on('pointermove', mapPointerMove)
|
|
|
+ // })
|
|
|
+ // state.ws.overlayTrack = new ol.Overlay({
|
|
|
+ // element: trackPointDom,
|
|
|
+ // autoPan: false,
|
|
|
+ // offset: [0, -22],
|
|
|
+ // positioning: 'bottom-center',
|
|
|
+ // stopEvent: true,
|
|
|
+ // })
|
|
|
+ // state.map.addOverlay(state.ws.overlayTrack)
|
|
|
// 预警助手
|
|
|
initWarningWS()
|
|
|
}
|
|
@@ -383,7 +385,6 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
});
|
|
|
state.ws.layerShip.setSource(vectorSource)
|
|
|
}
|
|
|
-
|
|
|
const mockWarningWS = () => {
|
|
|
state.warningInfo = {
|
|
|
name: v4(),
|
|
@@ -391,6 +392,11 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
}
|
|
|
}
|
|
|
const initWarningWS = () => {
|
|
|
+ setInterval(() => {
|
|
|
+ if (state.warningOpen) {
|
|
|
+ mockWarningWS()
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
return {
|
|
|
...toRefs(state),
|