| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2022-08-18 16:18:17 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2023-02-20 09:19:10 |
| | | * @LastEditTime: 2023-02-21 14:17:31 |
| | | * @FilePath: \srs-police-affairs\src\views\home\index.vue |
| | | * @Description: 小区-栋-层-房屋 |
| | | * |
| | |
| | | <div class="home-page container"> |
| | | <left-container |
| | | class="left-container" |
| | | @createCyLinder="createCyLinder" |
| | | @showpeopledetail="showpeopledetail" |
| | | @showlanddetail="showlanddetail" |
| | | @showkeypersondetail="showkeypersondetail" |
| | |
| | | if (item.id == this.userInfo.dept_id) currentItem = item |
| | | }) |
| | | |
| | | this.initAreaOptionLayer(currentItem) |
| | | this.getPoliceStationTree(2, this.userInfo.dept_id) |
| | | this.policeStaionChecked = currentItem |
| | | |
| | |
| | | |
| | | } else if (type == 2) { |
| | | this.areaOptions = res.data.data |
| | | |
| | | this.initAreaOptionLayer() |
| | | |
| | | this.areaOptions.unshift({ |
| | | name: '全部', |
| | |
| | | this.policeStaionID = '' |
| | | } else { |
| | | cylinderLayer.clear() |
| | | this.initAreaOptionLayer(item) |
| | | this.getPoliceStationTree(2, item.id) |
| | | this.areaCheckValue = '请选择责任区' |
| | | this.housingCheckValue = '请选择小区' |
| | | this.getPoliceStationTree(2, item.id) |
| | | |
| | | this.policeStaionID = item.id |
| | | } |
| | |
| | | areaSelect (item) { |
| | | this.areaCheckValue = item.name |
| | | if (item.name == "全部") { |
| | | this.initAreaOptionLayer(this.policeStaionChecked) |
| | | this.initAreaOptionLayer() |
| | | this.housingOptions = [] |
| | | this.housingCheckValue = '请选择小区' |
| | | } else { |
| | | this.housingCheckValue = '请选择小区' |
| | | this.getPoliceStationTree(3, item.id) |
| | | this.areaChecked = item |
| | | this.initAreaOptionLayer(item) |
| | | this.initAreaOptionLayer() |
| | | } |
| | | }, |
| | | |
| | |
| | | type: 'VectorLayer' |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | createCyLinder (res) { |
| | | console.log(res, 9599999) |
| | | }, |
| | | |
| | | houseSiteClick (e) { |
| | |
| | | |
| | | arr.push(arr[0]) |
| | | |
| | | return this.$turf.centroid(this.$turf.polygon([arr])).geometry.coordinates |
| | | if (arr.length == 1) { |
| | | return arr[0] |
| | | } else if (arr.length == 2) { |
| | | |
| | | return this.$turf.centroid(this.$turf.midpoint(this.$turf.point(arr[0]), this.$turf.point(arr[1]))).geometry.coordinates |
| | | } else { |
| | | arr.push(arr[0]) |
| | | |
| | | return this.$turf.centroid(this.$turf.polygon([arr])).geometry.coordinates |
| | | } |
| | | }, |
| | | |
| | | drawText (style) { |
| | | const text = style.text |
| | | var c = document.createElement("canvas") |
| | | const d = (text + "").length * style.fontSize |
| | | c.width = d |
| | | c.height = style.fontSize |
| | | var ctx = c.getContext("2d") |
| | | |
| | | ctx.fillStyle = style.color |
| | | ctx.font = "bold " + style.fontSize + "px 微软雅黑" //设置字体 |
| | | ctx.textBaseline = 'hanging' //在绘制文本时使用的当前文本基线 |
| | | //绘制文本 |
| | | ctx.fillText(text, 0, 0) |
| | | return c |
| | | }, |
| | | |
| | | // 加载面数据的方法 |
| | | initPoliceStationLayer () { |
| | | const that = this |
| | | cylinderLayer = new global.DC.PrimitiveLayer('cylinderLayer') |
| | | global.viewer.addLayer(cylinderLayer) |
| | | |
| | |
| | | |
| | | const center = this.getRegionCenter(item.position) |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'polygonLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 1, |
| | | text: item.name, |
| | | outW: 20 |
| | | }, |
| | | distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | }) |
| | | |
| | | |
| | | // this.$EventBus.$emit('layerPointAdd', { |
| | | // layerName: 'polygonLayer', |
| | |
| | | // lng: center[0], |
| | | // lat: center[1], |
| | | // alt: 0, |
| | | // text: item.policeStationName, |
| | | // text: `${item.name}`, |
| | | // outW: 20 |
| | | // }, |
| | | // distanceDisplayCondition: { "near": 0, "far": 200000 } |
| | | // }) |
| | | // let cylinder = new global.DC.LightCylinderPrimitive(new global.DC.Position(center[0] + 0.02, center[1] - 0.01), 1200, 1, 600) |
| | | // cylinder.setStyle({ |
| | | // color: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | // 102, 176, 255, |
| | | // 255 |
| | | // ) |
| | | // }) |
| | | // cylinderLayer.addOverlay(cylinder) |
| | | |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'polygonLayer', |
| | | positions: `${center[0] - 0.01},${center[1] - 0.0018}; |
| | | ${center[0] + 0.01},${center[1] - 0.0018}; |
| | | ${center[0] + 0.01},${center[1] + 0.0018}; |
| | | ${center[0] - 0.01},${center[1] + 0.0018};`, |
| | | material: new global.DC.Namespace.Cesium.ImageMaterialProperty({ |
| | | image: that.drawText({ |
| | | fontSize: 16, |
| | | color: 'red', |
| | | text: item.name |
| | | }), |
| | | transparent: true, |
| | | color: global.DC.Namespace.Cesium.Color.WHITE |
| | | }), |
| | | }) |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'personNumLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 1, |
| | | text: `${item.num}`, |
| | | outW: 20 |
| | | }, |
| | | distanceDisplayCondition: { "near": 0, "far": 160000 } |
| | | }) |
| | | |
| | | let cylinder = new global.DC.LightCylinderPrimitive(new global.DC.Position(center[0], center[1]), 600, 1, 300) |
| | | cylinder.setStyle({ |
| | | color: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 2, 27, 121, |
| | | 255 |
| | | ) |
| | | }) |
| | | cylinderLayer.addOverlay(cylinder) |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | | |
| | | const center = this.getAllRegionCenter(this.policeStationOptions) |
| | | |
| | |
| | | this.houseChange(true) |
| | | }, |
| | | |
| | | initAreaOptionLayer (item) { |
| | | initAreaOptionLayer () { |
| | | this.clearPolygonLayer() |
| | | item.position.forEach((sourceItem, index) => { |
| | | this.areaOptions.forEach((item, index) => { |
| | | |
| | | |
| | | const Json = { ...JSON.parse(sourceItem) } |
| | | global.DC.Namespace.Cesium.GeoJsonDataSource.load(Json, { |
| | | stroke: positionColor[index], |
| | | fill: positionColor[index], //注意:颜色必须大写,即不能为blue |
| | | strokeWidth: 0, |
| | | }).then(function (dataSource) { |
| | | DataSourcesArray.push(dataSource) |
| | | global.viewer.dataSources.add(dataSource) |
| | | item.position.forEach(sourceItem => { |
| | | const Json = { ...JSON.parse(sourceItem) } |
| | | global.DC.Namespace.Cesium.GeoJsonDataSource.load(Json, { |
| | | stroke: positionColor[index], |
| | | fill: positionColor[index], //注意:颜色必须大写,即不能为blue |
| | | strokeWidth: 0, |
| | | }).then(function (dataSource) { |
| | | DataSourcesArray.push(dataSource) |
| | | global.viewer.dataSources.add(dataSource) |
| | | }) |
| | | }) |
| | | |
| | | |
| | | const center = this.getRegionCenter(item.position) |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'personNumLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 200, |
| | | text: `${item.num}`, |
| | | outW: 20 |
| | | }, |
| | | distanceDisplayCondition: { "near": 0, "far": 160000 } |
| | | }) |
| | | |
| | | let cylinder = new global.DC.LightCylinderPrimitive(new global.DC.Position(center[0], center[1]), 200, 1, 50) |
| | | cylinder.setStyle({ |
| | | color: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 2, 27, 121, |
| | | 255 |
| | | ) |
| | | }) |
| | | cylinderLayer.addOverlay(cylinder) |
| | | }) |
| | | |
| | | const center = this.getRegionCenter(item.position) |
| | | const center = this.getAllRegionCenter(this.areaOptions) |
| | | |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: center[0], |
| | | siteWd: center[1], |
| | | siteGd: 15000, |
| | | siteJd: center[0] + 0.008, |
| | | siteWd: center[1] - 0.13, |
| | | siteGd: 12000, |
| | | siteHeading: -3, |
| | | sitePitch: -90 |
| | | sitePitch: -45 |
| | | }) |
| | | }, |
| | | |
| | |
| | | layerName: 'polygonLayer', |
| | | type: 'VectorLayer' |
| | | }) |
| | | |
| | | this.$EventBus.$emit('mapClearLayer', { |
| | | layerName: 'personNumLayer', |
| | | type: 'VectorLayer' |
| | | }) |
| | | |
| | | cylinderLayer.clear() |
| | | }, |
| | | |
| | | getAreaCenter (name) { |
| | |
| | | destroyed () { |
| | | this.clearPolygonLayer() |
| | | |
| | | cylinderLayer != null && cylinderLayer != undefined && cylinderLayer != '' && cylinderLayer.remove() |
| | | |
| | | this.$store.commit('SET_DETAILSPOPUP', { |
| | | showBox: false, |
| | | showBtn: false |