diff --git a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java index 05f0b5c08..c6735707e 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java +++ b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java @@ -50,6 +50,7 @@ public class VideoManagerConstants { public static final String WAITE_SEND_PUSH_STREAM = "VMP_WAITE_SEND_PUSH_STREAM:"; public static final String START_SEND_PUSH_STREAM = "VMP_START_SEND_PUSH_STREAM:"; public static final String SSE_TASK_KEY = "SSE_TASK_"; + public static final String DRAW_THIN_PROCESS_PREFIX = "VMP_DRAW_THIN_PROCESS_"; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DrawThinProcess.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DrawThinProcess.java new file mode 100644 index 000000000..9438798fb --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DrawThinProcess.java @@ -0,0 +1,17 @@ +package com.genersoft.iot.vmp.gb28181.bean; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DrawThinProcess { + + private double process; + private String msg; + + public DrawThinProcess(double process, String msg) { + this.process = process; + this.msg = msg; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java index 2a9a09f71..77acf0cef 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java @@ -502,7 +502,37 @@ public class ChannelController { channelService.resetLevel(); } - @Operation(summary = "为地图提供标准的mvt图层", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Operation(summary = "执行抽稀", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @PostMapping("/map/thin/draw") + public String drawThin(@RequestBody DrawThinParam param){ + if(param == null || param.getZoomParam() == null || param.getZoomParam().isEmpty()) { + throw new ControllerException(ErrorCode.ERROR400); + } + return channelService.drawThin(param.getZoomParam(), param.getExtent(), param.getGeoCoordSys()); + } + + @Operation(summary = "清除未保存的抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "id", description = "抽稀ID", required = true) + @GetMapping("/map/thin/clear") + public void clearThin(String id){ + + } + + @Operation(summary = "保存的抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "id", description = "抽稀ID", required = true) + @GetMapping("/map/thin/save") + public void saveThin(String id){ + + } + + @Operation(summary = "获取抽稀执行的进度", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "id", description = "抽稀ID", required = true) + @GetMapping("/map/thin/progress") + public DrawThinProcess thinProgress(String id){ + return channelService.thinProgress(id); + } + + @Operation(summary = "为地图提供标准mvt图层", security = @SecurityRequirement(name = JwtUtils.HEADER)) @GetMapping(value = "/map/tile/{z}/{x}/{y}", produces = "application/x-protobuf") @Parameter(name = "geoCoordSys", description = "地理坐标系, WGS84/GCJ02") public ResponseEntity getTile(@PathVariable int z, @PathVariable int x, @PathVariable int y, String geoCoordSys){ @@ -519,5 +549,24 @@ public class ChannelController { } } + @Operation(summary = "为地图提供经过抽稀的标准mvt图层", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @GetMapping(value = "/map/thin/tile/{z}/{x}/{y}", produces = "application/x-protobuf") + @Parameter(name = "geoCoordSys", description = "地理坐标系, WGS84/GCJ02") + @Parameter(name = "thinId", description = "抽稀结果ID") + public ResponseEntity getThinTile(@PathVariable int z, @PathVariable int x, @PathVariable int y, + String geoCoordSys, @RequestParam(required = false) String thinId){ + + try { + byte[] mvt = channelService.getTile(z, x, y, geoCoordSys); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.parseMediaType("application/x-protobuf")); + headers.setContentLength(mvt.length); + return new ResponseEntity<>(mvt, headers, HttpStatus.OK); + } catch (Exception e) { + log.error("构建矢量瓦片失败: z: {}, x: {}, y:{}", z, x, y, e); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); + } + } + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/DrawThinParam.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/DrawThinParam.java new file mode 100644 index 000000000..bd43b66c2 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/DrawThinParam.java @@ -0,0 +1,18 @@ +package com.genersoft.iot.vmp.gb28181.controller.bean; + +import lombok.Getter; +import lombok.Setter; + +import java.util.Map; + +@Getter +@Setter +public class DrawThinParam { + private Map zoomParam; + private Extent extent; + + /** + * 地理坐标系, WGS84/GCJ02, 用来标识 extent 参数的坐标系 + */ + private String geoCoordSys; +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/Extent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/Extent.java new file mode 100644 index 000000000..33c923e51 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/bean/Extent.java @@ -0,0 +1,13 @@ +package com.genersoft.iot.vmp.gb28181.controller.bean; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Extent { + private Double minLng; + private Double maxLng; + private Double minLat; + private Double maxLat; +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 5cfb1e6c9..681a594b5 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.gb28181.dao; import com.genersoft.iot.vmp.gb28181.bean.*; +import com.genersoft.iot.vmp.gb28181.controller.bean.Extent; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelForThin; import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; @@ -676,4 +677,20 @@ public interface CommonGBChannelMapper { @SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelInBox") List queryCameraChannelInBox(@Param("minLon") double minLon, @Param("maxLon") double maxLon, @Param("minLat") double minLat, @Param("maxLat") double maxLat); + + @Select("select " + + "MAX(coalesce(gb_longitude, longitude)) as maxLng, " + + "MIN(coalesce(gb_longitude, longitude)) as minLng, " + + "MAX(coalesce(gb_latitude, latitude)) as maxLat, " + + "MIN(coalesce(gb_latitude, latitude)) as minLat " + + " from wvp_device_channel " + + " where channel_type = 0") + Extent queryExtent(); + + @SelectProvider(type = ChannelProvider.class, method = "queryAllWithPosition") + List queryAllWithPosition(); + + @SelectProvider(type = ChannelProvider.class, method = "queryListInExtent") + List queryListInExtent(Extent extent); + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java index 81a7721cc..3571dadfa 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java @@ -307,14 +307,14 @@ public interface GroupMapper { Group queryGroupByAliasAndBusinessGroup(@Param("alias") String alias, @Param("deviceId") String businessGroup); - @Select(" diff --git a/web/src/views/jtDevice/channel/edit.vue b/web/src/views/jtDevice/channel/edit.vue index ca9c2877c..a33db8d10 100644 --- a/web/src/views/jtDevice/channel/edit.vue +++ b/web/src/views/jtDevice/channel/edit.vue @@ -22,7 +22,7 @@ - + diff --git a/web/src/views/map/dialog/drawThinProgress.vue b/web/src/views/map/dialog/drawThinProgress.vue new file mode 100755 index 000000000..47ae756b5 --- /dev/null +++ b/web/src/views/map/dialog/drawThinProgress.vue @@ -0,0 +1,84 @@ + + + diff --git a/web/src/views/map/index.vue b/web/src/views/map/index.vue index 6b10e2b99..438893425 100755 --- a/web/src/views/map/index.vue +++ b/web/src/views/map/index.vue @@ -11,31 +11,23 @@
- + - 图层关闭 - 图层关闭 + 图层关闭 + 图层关闭 - 直接展示 - 直接展示 + 直接展示 + 直接展示 - 碰撞检测 - 碰撞检测 + 抽稀图层 + 抽稀图层 - - 抽稀图层 - 抽稀图层 - - - - -
@@ -77,7 +69,7 @@
快速抽稀 - 局部抽稀 + 局部抽稀 数据还原 保存 取消 @@ -107,7 +99,8 @@
播放 - 编辑 + 编辑 + 位置
@@ -119,7 +112,7 @@
-
{{dragChannel.gbName}} ({{dragChannel.gbDeviceId}})
+
{{dragChannel.gbName}} ({{dragChannel.gbDeviceId}})
经度: 纬度: @@ -129,6 +122,8 @@
+ +
@@ -137,15 +132,19 @@ import DeviceTree from '../common/DeviceTree.vue' import queryTrace from './queryTrace.vue' import MapComponent from '../common/MapComponent.vue' import devicePlayer from '../common/channelPlayer/index.vue' +import CommonChannelEditDialog from '../dialog/commonChannelEditDialog.vue' +import DrawThinProgress from './dialog/drawThinProgress.vue' let cameraListForSource = [] let cameraList = [] let cameraListForLevelMap = new Map() let cameraLayerExtent = [] -let channelLayer = null +let channelLayer, channelTileLayer = null export default { name: 'Map', components: { + DrawThinProgress, + CommonChannelEditDialog, DeviceTree, devicePlayer, queryTrace, @@ -170,9 +169,11 @@ export default { zoomValue: 10, showDrawThin: false, quicklyDrawThinLoading: false, - saveDrawThinLoading: false, - layerStyle: 0, + boxDrawThinLoading: false, + drawThinId: null, drawThinLayer: null, + saveDrawThinLoading: false, + layerType: 0, layerGroupSource: null } }, @@ -184,64 +185,32 @@ export default { }, methods: { initChannelLayer: function () { - this.mapTileList = this.$refs.mapComponent.mapTileList // 获取所有有位置的通道 this.closeInfoBox() - this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => { - cameraListForSource = data - console.log(data.length) - let minLng = data[0].gbLongitude - let maxLng = data[0].gbLongitude - let minLat = data[0].gbLatitude - let maxLat = data[0].gbLatitude - for (let i = 1; i < data.length; i++) { - let item = data[i] - if (item.gbLongitude < minLng) { - minLng = item.gbLongitude + + let clientEvent = data => { + this.closeInfoBox() + this.$nextTick(() => { + if (data[0].edit) { + this.showEditInfo(data[0]) + }else { + this.showChannelInfo(data[0]) } - if (item.gbLongitude > maxLng) { - maxLng = item.gbLongitude - } - if (item.gbLatitude < minLat) { - minLat = item.gbLatitude - } - if (item.gbLatitude > maxLat) { - maxLat = item.gbLatitude - } - if (item.gbLongitude && item.gbLatitude) { - let position = [item.gbLongitude, item.gbLatitude] - let cameraData = { - id: item.gbId, - position: position, - status: item.gbStatus, - data: item, - image: { - anchor: [0.5, 1], - src: this.getImageByChannel(item) - } - } - cameraList.push(cameraData) - if (item.mapLevel) { - if (cameraListForLevelMap.has(item.mapLevel)) { - let list = cameraListForLevelMap.get(item.mapLevel) - list.push(cameraData) - }else { - cameraListForLevelMap.set(item.mapLevel, [cameraData]) - } - }else { - cameraListForLevelMap.set(0, [cameraData]) - } - } - } - cameraLayerExtent = [minLng, minLat, maxLng, maxLat] - this.updateChannelLayer() - }) + }) + } + + channelLayer = this.$refs.mapComponent.addPointLayer([], clientEvent, null) }, refreshLayer(){ this.closeInfoBox() - this.$refs.mapComponent.clearLayer(channelLayer) - this.initChannelLayer() + // 刷新瓦片图层 + if (channelLayer) { + this.$refs.mapComponent.refreshLayer(channelLayer) + } + if (channelTileLayer) { + this.$refs.mapComponent.refreshLayer(channelTileLayer) + } }, treeChannelClickEvent: function (id) { this.closeInfoBox() @@ -281,7 +250,18 @@ export default { } }, { - label: '编辑位置', + label: '修改位置', + icon: 'el-icon-coordinate', + type: 1, + onClick: (event, data, node) => { + this.$store.dispatch('commonChanel/queryOne', data.id) + .then(data => { + this.editPosition(data) + }) + } + }, + { + label: '编辑通道', icon: 'el-icon-edit', type: 1, onClick: (event, data, node) => { @@ -291,15 +271,6 @@ export default { }) } } - // , - // { - // label: '轨迹查询', - // icon: 'el-icon-map-location', - // type: 1, - // onClick: (event, data, node) => { - // - // } - // } ] }, showChannelInfo: function(data) { @@ -312,9 +283,8 @@ export default { data: data, status: data.gbStatus } - if (!this.$refs.mapComponent.hasFeature(channelLayer, data.gbId)) { - this.$refs.mapComponent.addFeature(channelLayer, cameraData) - } + this.$refs.mapComponent.addFeature(channelLayer, cameraData) + this.infoBoxId = this.$refs.mapComponent.openInfoBox(position, this.$refs.infobox, [0, -50]) }, zoomChange: function(zoom) {}, @@ -329,74 +299,37 @@ export default { } this.$refs.mapComponent.changeMapTile(index) }, - changeLayerStyle: function (index) { - if (this.layerStyle === index) { + clientEvent(data){ + this.closeInfoBox() + this.$nextTick(() => { + if (data[0].edit) { + this.showEditInfo(data[0]) + }else { + this.showChannelInfo(data[0]) + } + }) + }, + changeLayerType: function (index) { + if (this.layerType === index) { return } - this.layerStyle = index - this.$refs.mapComponent.removeLayer(channelLayer) - this.channelLayer = null - this.updateChannelLayer() - }, - updateChannelLayer: function() { - let clientEvent = data => { - this.closeInfoBox() - this.$nextTick(() => { - if (data[0].edit) { - this.showEditInfo(data[0]) - }else { - this.showChannelInfo(data[0]) - } - }) + this.layerType = index + if (index === 0) { + this.$refs.mapComponent.removeLayer(channelTileLayer) } - switch (this.layerStyle) { - case 0: - channelLayer = this.$refs.mapComponent.addPointLayer([], clientEvent, null) - - break - case 1: - console.log(22221112222) - console.log(channelLayer) - // 直接展示 - if (channelLayer) { - channelLayer = this.$refs.mapComponent.updatePointLayer(channelLayer, cameraList, true) - }else { - console.log(cameraList.length) - setTimeout(() => { - channelLayer = this.$refs.mapComponent.addPointLayer(cameraList, clientEvent, null) - }) - } - break - case 2: - // 碰撞检测 - if (channelLayer) { - channelLayer = this.$refs.mapComponent.updatePointLayer(channelLayer, cameraList, true) - }else { - setTimeout(() => { - channelLayer = this.$refs.mapComponent.addPointLayer(cameraList, clientEvent, { - declutter: true - }) - }) - } - break - case 3: - // 抽稀图层 - this.$refs.mapComponent.removeLayer(channelLayer) - channelLayer = this.$refs.mapComponent.addPointLayerGroup(cameraListForLevelMap, clientEvent) - break - // case 4: - // // 聚合图层 - // - // break - } - }, - getImageByChannel: function (channel) { - if (channel.gbStatus === 'ON') { - return 'static/images/gis/camera1.png' - } else { - return 'static/images/gis/camera1-offline.png' + let geoCoordSys = this.$refs.mapComponent.getCoordSys() + const baseUrl = window.baseUrl ? window.baseUrl : '' + let baseApi = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + let tileUrl = null + if (index === 1) { + tileUrl = baseApi + `/api/common/channel/map/tile/{z}/{x}/{y}?geoCoordSys=${geoCoordSys}&accessToken=${this.$store.getters.token}` + }else if (index === 2) { + tileUrl = baseApi + `/api/common/channel/map/thin/tile/{z}/{x}/{y}?geoCoordSys=${geoCoordSys}&accessToken=${this.$store.getters.token}` + }else { + return } + channelTileLayer = this.$refs.mapComponent.addVectorTileLayer(tileUrl. this.clientEvent) }, closeInfoBox: function () { if (this.infoBoxId !== null) { @@ -423,6 +356,9 @@ export default { }) }, edit: function (channel) { + this.$refs.commonChannelEditDialog.openDialog(channel.gbId) + }, + editPosition: function (channel) { this.closeInfoBox() // 开启图标可拖动 this.$refs.mapComponent.dragInteraction.addFeatureId(channel.gbId, @@ -459,6 +395,7 @@ export default { }else { this.showEditInfo(channel) } + // 标记可编辑图标为红色 this.$refs.mapComponent.setFeaturePositionById(channelLayer, channel.gbId, { id: channel.gbId, @@ -466,6 +403,10 @@ export default { data: channel, status: 'checked' }) + // 如果开启了瓦片图层,此时应该让瓦片图层不再显示这个feature + if (channelTileLayer) { + this.$refs.mapComponent.hideFeature(channelTileLayer, channel.gbId) + } }, showEditInfo: function(data) { this.dragChannel = data @@ -483,6 +424,9 @@ export default { data: channel, status: channel.gbStatus }) + if (channelTileLayer) { + this.$refs.mapComponent.cancelHideFeature(channelTileLayer, channel.gbId) + } }, submitEdit: function(channel) { let position = [channel.gbLongitude, channel.gbLatitude] @@ -507,89 +451,65 @@ export default { }) }, - getTrace: function (data) { - this.clean() - this.$refs.queryTrace.openDialog(data, (channelPositions) => { - if (channelPositions.length === 0) { - this.$message.warning({ - showClose: true, - message: '未查询到轨迹信息' - }) - } else { - let positions = [] - for (let i = 0; i < channelPositions.length; i++) { - if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) { - positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]]) - } - - } - if (positions.length === 0) { - this.$message.warning({ - showClose: true, - message: '未查询到轨迹信息' - }) - return - } - } - }) - }, - clean: function (){ - if (this.infoBoxId !== null) { - this.$refs.mapComponent.closeInfoBox(this.infoBoxId) - } - }, - testArray: function (){ - this.$store.dispatch('commonChanel/test') - }, showDrawThinBox: function(show){ this.showDrawThin = show setTimeout(() => { if (!show) { // 关闭抽稀预览 + if (this.drawThinId !== null) { + // 发送消息 清空抽稀结果 + this.$store.dispatch('commonChanel/clearThin', this.drawThinId) + this.drawThinId = null + } if (this.drawThinLayer !== null) { this.$refs.mapComponent.removeLayer(this.drawThinLayer) this.drawThinLayer = null } - // 清空预览数据 - this.layerGroupSource = null - this.updateChannelLayer() - }else { - // } }, 1) }, quicklyDrawThin: function (){ - if (this.channelLayer) { + if (channelLayer) { this.$refs.mapComponent.removeLayer(channelLayer) } + if (channelTileLayer) { + this.$refs.mapComponent.removeLayer(channelTileLayer) + } if (this.drawThinLayer !== null) { this.$refs.mapComponent.removeLayer(this.drawThinLayer) this.drawThinLayer = null } - // 获取待抽稀数据 - let cameraList = cameraListForSource.slice() - this.quicklyDrawThinLoading = true - setTimeout(() => { - this.drawThin(cameraList).then((layerGroupSource) => { - this.layerGroupSource = layerGroupSource - this.drawThinLayer = this.$refs.mapComponent.addPointLayerGroup(layerGroupSource, data => { + console.log(222) + console.log(this.getDrawThinParam()) + // 获取每一个图层的抽稀参数 + this.$store.dispatch('commonChanel/drawThin', { + zoomParam: this.getDrawThinParam() + }) + .then(drawThinId => { + // 显示抽稀进度 + this.drawThinId = drawThinId + this.$refs.drawThinProgress.openDialog(drawThinId, () => { this.closeInfoBox() - // this.$nextTick(() => { - // if (data[0].edit) { - // this.showEditInfo(data[0]) - // }else { - // this.showChannelInfo(data[0]) - // } - // }) - }) - this.quicklyDrawThinLoading = false - this.$message.success({ - showClose: true, - message: '抽稀完成,请预览无误后保存抽稀结果' + this.$message.success({ + showClose: true, + message: '抽稀完成,请预览无误后保存抽稀结果' + }) + // 展示抽稀结果 + this.showDrawThinLayer(drawThinId) }) }) - }) + .finally(() => { + this.quicklyDrawThinLoading = false + }) + }, + showDrawThinLayer(thinId) { + // 展示抽稀结果 + let geoCoordSys = this.$refs.mapComponent.getCoordSys() + const baseUrl = window.baseUrl ? window.baseUrl : '' + let baseApi = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + let tileUrl = baseApi + `/api/common/channel/map/thin/tile/{z}/{x}/{y}?geoCoordSys=${geoCoordSys}&thinId=${thinId}&accessToken=${this.$store.getters.token}` + this.drawThinLayer = this.$refs.mapComponent.addVectorTileLayer(tileUrl, null) }, boxDrawThin: function (){ this.$message.warning({ @@ -601,92 +521,54 @@ export default { // 清理默认的摄像头图层 if (channelLayer) { - this.$refs.mapComponent.clearLayer(channelLayer) + this.$refs.mapComponent.removeLayer(channelLayer) } - this.$message.warning({ - showClose: true, - message: '正在抽稀,请稍等' + if (channelTileLayer) { + this.$refs.mapComponent.removeLayer(channelTileLayer) + } + if (this.drawThinLayer !== null) { + this.$refs.mapComponent.removeLayer(this.drawThinLayer) + this.drawThinLayer = null + } + this.boxDrawThinLoading = true + // 获取每一个图层的抽稀参数 + this.$store.dispatch('commonChanel/drawThin', { + zoomParam: this.getDrawThinParam(), + extent: extent }) - setTimeout(() => { - let zoomExtent = this.$refs.mapComponent.getZoomExtent() - let cameraListInExtent = [] - let cameraListOutExtent = [] - if (this.layerGroupSource !== null) { - // 从当前预览的数据里,获取待抽稀的数据 - let sourceCameraList = this.layerGroupSource.get(0) - console.log(sourceCameraList) - if (!sourceCameraList) { - this.$message.warning({ - showClose: true, - message: '数据已经全部抽稀' - }) - return - } - for (let i = 0; i < sourceCameraList.length; i++) { - let value = sourceCameraList[i] - if (!value.data.gbLongitude || !value.data.gbLatitude) { - continue - } - if (value.data.gbLongitude >= extent[0] && value.data.gbLongitude <= extent[2] - && value.data.gbLatitude >= extent[1] && value.data.gbLatitude <= extent[3]) { - cameraListInExtent.push(value.data) - }else { - cameraListOutExtent.push(value.data) - } - } - }else { - for (let i = 0; i < cameraListForSource.length; i++) { - let value = cameraListForSource[i] - if (!value.gbLongitude || !value.gbLatitude) { - continue - } - if (value.gbLongitude >= extent[0] && value.gbLongitude <= extent[2] - && value.gbLatitude >= extent[1] && value.gbLatitude <= extent[3]) { - cameraListInExtent.push(value) - }else { - cameraListOutExtent.push(value) - } - } - } - // 如果已经在预览,清理预览图层 - if (this.drawThinLayer !== null) { - this.$refs.mapComponent.removeLayer(this.drawThinLayer) - this.drawThinLayer = null - } - this.drawThin(cameraListInExtent).then((layerGroupSource) => { - if (this.layerGroupSource !== null) { - let zoom = zoomExtent[0] - // 按照层级合并每次的抽稀结果 - while (zoom < zoomExtent[1]) { - Array.prototype.push.apply(layerGroupSource.get(zoom), this.layerGroupSource.get(zoom)) - zoom += 1 - } - } - if (cameraListOutExtent.length > 0) { - let layerSourceForOutExtent = this.createZoomLayerSource(cameraListOutExtent, zoomExtent[0]) - layerGroupSource.set(0, layerSourceForOutExtent) - } - this.layerGroupSource = layerGroupSource - this.drawThinLayer = this.$refs.mapComponent.addPointLayerGroup(layerGroupSource, data => { + .then(drawThinId => { + // 显示抽稀进度 + this.drawThinId = drawThinId + this.$refs.drawThinProgress.openDialog(drawThinId, () => { this.closeInfoBox() - // this.$nextTick(() => { - // if (data[0].edit) { - // this.showEditInfo(data[0]) - // }else { - // this.showChannelInfo(data[0]) - // } - // }) - }) - this.$message.success({ - showClose: true, - message: '抽稀完成,请预览无误后保存抽稀结果,如需继续,请再次点击局部抽稀按钮' + this.$message.success({ + showClose: true, + message: '抽稀完成,请预览无误后保存抽稀结果' + }) + // 展示抽稀结果 + this.showDrawThinLayer(drawThinId) }) }) - }, 100) - - + .finally(() => { + this.boxDrawThinLoading = false + }) }) }, + getDrawThinParam() { + // 获取全部层级 + let zoomExtent = this.$refs.mapComponent.getZoomExtent() + let zoomMap = {} + let zoom = zoomExtent[0] + while (zoom < zoomExtent[1]) { + // 计算经纬度差值 + let diff = this.$refs.mapComponent.computeDiff(this.diffPixels, zoom) + if (diff && diff > 0) { + zoomMap[zoom] = diff + } + zoom += 1 + } + return zoomMap + }, drawThin: function (cameraListInExtent){ return new Promise((resolve, reject) => { try { @@ -778,30 +660,10 @@ export default { return dataArray }, saveDrawThin: function(){ - if (!this.layerGroupSource) { + if (!this.drawThinId) { return } - this.saveDrawThinLoading = true - let param = [] - let keys = Array.from(this.layerGroupSource.keys()) - for (let i = 0; i < keys.length; i++) { - let zoom = keys[i] - let values = this.layerGroupSource.get(zoom) - for (let j = 0; j < values.length; j++) { - let value = values[j] - if (zoom === 0) { - param.push({ - gbId: value.id - }) - }else { - param.push({ - gbId: value.id, - mapLevel: zoom - }) - } - } - } - this.$store.dispatch('commonChanel/saveLevel', param) + this.$store.dispatch('commonChanel/saveThin', this.drawThinId) .then((data) => { this.$message.success({ showClose: true, @@ -812,7 +674,6 @@ export default { .finally(() => { this.saveDrawThinLoading = false }) - }, resetDrawThinData(){ this.$confirm('确定移除抽稀结果?', '操作提示', { diff --git a/web/src/views/map/index2.vue b/web/src/views/map/index2.vue new file mode 100755 index 000000000..af57d4f85 --- /dev/null +++ b/web/src/views/map/index2.vue @@ -0,0 +1,989 @@ + + + + + diff --git a/web/src/views/streamProxy/edit.vue b/web/src/views/streamProxy/edit.vue index f5f8421f9..2b4ad5355 100644 --- a/web/src/views/streamProxy/edit.vue +++ b/web/src/views/streamProxy/edit.vue @@ -98,7 +98,7 @@ - +
diff --git a/web/src/views/streamPush/edit.vue b/web/src/views/streamPush/edit.vue index bbc4029ac..de8e98911 100644 --- a/web/src/views/streamPush/edit.vue +++ b/web/src/views/streamPush/edit.vue @@ -32,7 +32,7 @@ - +