shuishen
2023-02-21 46cc4eaccd30144fae53fc26da2641881593acfd
文件更新
4 files modified
1 files renamed
18150 ■■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
package-lock.json 17969 ●●●●● patch | view | raw | blame | history
public/index.html 4 ●●●● patch | view | raw | blame | history
public/static/config.js patch | view | raw | blame | history
src/views/home/index.vue 176 ●●●● patch | view | raw | blame | history
.gitignore
@@ -3,6 +3,7 @@
/dist
/dist.zip
/public/sd
/public/sryx
/vue.config.js
# local env files
package-lock.json
Diff too large
public/index.html
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-09-07 09:34:58
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-02-20 10:09:19
 * @LastEditTime: 2023-02-21 14:16:53
 * @FilePath: \srs-police-affairs\public\index.html
 * @Description: 
 * 
@@ -20,7 +20,7 @@
        信州公安VR指挥平台
    </title>
    <script src="./config.js"></script>
    <script src="./static/config.js"></script>
    <script src="./depend/vue.min.js"></script>
public/static/config.js
src/views/home/index.vue
@@ -2,7 +2,7 @@
 * @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: 小区-栋-层-房屋
 *
@@ -13,7 +13,6 @@
    <div class="home-page container">
        <left-container
            class="left-container"
            @createCyLinder="createCyLinder"
            @showpeopledetail="showpeopledetail"
            @showlanddetail="showlanddetail"
            @showkeypersondetail="showkeypersondetail"
@@ -864,7 +863,6 @@
                            if (item.id == this.userInfo.dept_id) currentItem = item
                        })
                        this.initAreaOptionLayer(currentItem)
                        this.getPoliceStationTree(2, this.userInfo.dept_id)
                        this.policeStaionChecked = currentItem
@@ -876,6 +874,8 @@
                } else if (type == 2) {
                    this.areaOptions = res.data.data
                    this.initAreaOptionLayer()
                    this.areaOptions.unshift({
                        name: '全部',
@@ -1005,10 +1005,9 @@
                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
            }
@@ -1029,14 +1028,14 @@
        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()
            }
        },
@@ -1091,10 +1090,6 @@
                    type: 'VectorLayer'
                })
            }
        },
        createCyLinder (res) {
            console.log(res, 9599999)
        },
        houseSiteClick (e) {
@@ -1426,11 +1421,37 @@
            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)
@@ -1457,18 +1478,7 @@
                    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',
@@ -1477,23 +1487,53 @@
                    //         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)
@@ -1508,30 +1548,55 @@
            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
            })
        },
@@ -1598,6 +1663,13 @@
                layerName: 'polygonLayer',
                type: 'VectorLayer'
            })
            this.$EventBus.$emit('mapClearLayer', {
                layerName: 'personNumLayer',
                type: 'VectorLayer'
            })
            cylinderLayer.clear()
        },
        getAreaCenter (name) {
@@ -2032,6 +2104,8 @@
    destroyed () {
        this.clearPolygonLayer()
        cylinderLayer != null && cylinderLayer != undefined && cylinderLayer != '' && cylinderLayer.remove()
        this.$store.commit('SET_DETAILSPOPUP', {
            showBox: false,
            showBtn: false