| | |
| | | monitoringLayer: null, |
| | | panoramaLayer: null |
| | | } |
| | | let polygonObj = {} |
| | | |
| | | let tilesetLayer = null |
| | | |
| | |
| | | }) |
| | | |
| | | this.$EventBus.$on('layerPolygonAdd', (params) => { |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition) |
| | | if ('polygonName' in params) { |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, params.polygonName) |
| | | } else { |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, 'polygon') |
| | | } |
| | | }) |
| | | |
| | | this.$EventBus.$on('layerPolylineAdd', (params) => { |
| | |
| | | }) |
| | | |
| | | this.$EventBus.$on('flytoLayer', (params) => { |
| | | that.flytoLayer(params.layerName, params.duration) |
| | | that.flytoLayer(params.polygonName, params.duration) |
| | | }) |
| | | |
| | | }, |
| | |
| | | * @param {*} material 颜色 |
| | | * @param {*} distanceDisplayCondition 可见距离 |
| | | */ |
| | | layerPolygonAdd (layerName, positions, material, distanceDisplayCondition) { |
| | | layerPolygonAdd (layerName, positions, material, distanceDisplayCondition, polygonName) { |
| | | if (!layersObjcect[layerName] || layersObjcect[layerName] == null) { |
| | | this.mapAddLayer(layerName, 'VectorLayer') |
| | | |
| | | layersObjcect[layerName].allowDrillPicking = true |
| | | } |
| | | |
| | | let polygon = new global.DC.Polygon(positions) |
| | | |
| | | polygon.setStyle({ |
| | | // let polygon = new global.DC.Polygon(positions) |
| | | // let polygonObj = {}//要在全局定义 |
| | | polygonObj[polygonName] = new global.DC.Polygon(positions) |
| | | // polygon.setStyle({ |
| | | polygonObj[polygonName].setStyle({ |
| | | material: material, |
| | | distanceDisplayCondition: distanceDisplayCondition, |
| | | perPositionHeight: true, |
| | | }) |
| | | |
| | | layersObjcect[layerName].addOverlay(polygon) |
| | | // layersObjcect[layerName].addOverlay(polygon) |
| | | layersObjcect[layerName].addOverlay(polygonObj[polygonName]) |
| | | }, |
| | | |
| | | /** |
| | |
| | | // sdTilesetLayer |
| | | |
| | | /** |
| | | * 飞到指定图层 |
| | | * @param {*} layerName 图层名称 |
| | | * 飞到指定范围 |
| | | * @param {*} polygonName 范围名称 |
| | | * @param {*} duration 时间 |
| | | */ |
| | | flytoLayer (layerName, duration = 3) { |
| | | global.viewer.flyTo(layersObjcect[layerName], duration) |
| | | flytoLayer (polygonName, duration = 3) { |
| | | global.viewer.flyTo(polygonObj[polygonName], duration) |
| | | }, |
| | | |
| | | /** |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="id" label="操作" min-width="50%"> |
| | | <template slot-scope="scope"> |
| | | <button |
| | | class="btn" |
| | | <el-button |
| | | @click="deleteRegionSaveList(scope.row.id)" |
| | | >删除</button> |
| | | <button class="btn" @click="flytoRange(scope.row)">定位</button> |
| | | type="text" |
| | | size="small" |
| | | title="删除" |
| | | > |
| | | <i class="el-icon-delete"></i> |
| | | </el-button> |
| | | <el-button |
| | | @click="flytoRange(scope.row)" |
| | | type="text" |
| | | size="small" |
| | | title="定位" |
| | | > |
| | | <i class="el-icon-location"></i> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | created () { |
| | | this.getVideoList() |
| | | this.getRegionSaveList() |
| | | |
| | | }, |
| | | |
| | | mounted () { |
| | |
| | | getRegionSaveList () { |
| | | getRegionSaveList(1, 10).then(res => { |
| | | this.saveRangeList = res.data.data.records |
| | | this.initRangeListLayer() |
| | | }) |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | flytoRange (data) { |
| | | let positionStr = data.positions |
| | | positionStr = data.positions.slice(11, positionStr.length - 1) |
| | | this.$EventBus.$emit('flytoLayer', { |
| | | polygonName: 'polygon' + data.id, |
| | | duration: 3 |
| | | }) |
| | | |
| | | }, |
| | | |
| | | initRangeListLayer () { |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'rangeLayer', |
| | | type: 'VectorLayer' |
| | | }) |
| | | this.saveRangeList.forEach(item => { |
| | | let positionStr = this.convertPositionDate(item.positions) |
| | | let polygonName = 'polygon' + item.id |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'rangeLayer', |
| | | positions: positionStr, |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 255, 0, 0, 100 |
| | | ), |
| | | polygonName: polygonName |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | |
| | | convertPositionDate (data) { |
| | | let positionStr = data |
| | | positionStr = data.slice(11, positionStr.length - 1) |
| | | let positionArr = positionStr.split(",") |
| | | positionArr = positionArr.slice(0, positionArr.length - 1) |
| | | let positionNewStr = '' |
| | |
| | | let lat = item.split(' ')[1] |
| | | positionNewStr += lng + ',' + lat + ';' |
| | | }) |
| | | this.$EventBus.$emit('mapRemoveLayer', { |
| | | layerName: 'rangeLayer', |
| | | type: 'VectorLayer' |
| | | }) |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'rangeLayer', |
| | | positions: positionNewStr, |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 255, 0, 0, 100 |
| | | ), |
| | | }) |
| | | this.$EventBus.$emit('flytoLayer', { |
| | | layerName: 'rangeLayer', |
| | | duration: 3 |
| | | }) |
| | | |
| | | return positionNewStr |
| | | }, |
| | | |
| | | async getDevices (id) { |