shuishen
2023-08-15 92bf96aad000907f400ea6395ab8db9096d87439
警车轨迹的完善
3 files modified
50 ■■■■■ changed files
src/utils/turfPolygon.js 14 ●●●● patch | view | raw | blame | history
src/views/activity/index.vue 4 ●●●● patch | view | raw | blame | history
src/views/police/index.vue 32 ●●●● patch | view | raw | blame | history
src/utils/turfPolygon.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-31 10:52:25
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-07-11 15:30:20
 * @LastEditTime: 2023-08-15 09:30:00
 * @FilePath: \srs-police-affairs\src\utils\turfPolygon.js
 * @Description:
 *
@@ -61,7 +61,7 @@
  }
}
export const computerCapacity = (data, type = "") => {
export const computerCapacity = (data, type = "", multiple = 4) => {
  if (type != "") {
    const center = getAllRegionCenter(data);
@@ -93,7 +93,6 @@
      );
    }
  } else {
    console.log(data, 564);
    let pointArr = [];
    data.forEach((item) => {
      if (item.longitude && item.latitude) {
@@ -113,13 +112,6 @@
    // const poly = turf.polygon([[[0, 29], [3.5, 29], [2.5, 32], [0, 29]]])
    console.log([
      [scope[0], scope[1]],
      [scope[2], scope[1]],
      [scope[2], scope[3]],
      [scope[0], scope[3]],
    ]);
    var poly = turf.polygon([
      [
        [scope[0], scope[1]],
@@ -129,7 +121,7 @@
        [scope[0], scope[1]],
      ],
    ]);
    var scaledPoly = turf.transformScale(poly, 4);
    var scaledPoly = turf.transformScale(poly, multiple);
    let boxPoint = [];
    scaledPoly.geometry.coordinates[0].forEach((item) => {
src/views/activity/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-24 16:36:55
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-07-28 10:37:53
 * @LastEditTime: 2023-08-15 09:32:31
 * @FilePath: \srs-police-affairs\src\views\activity\index.vue
 * @Description: 
 * 
@@ -613,7 +613,7 @@
                    }
                })
                computerCapacity(positionArr)
                computerCapacity(positionArr, '')
                return
            } else if (type == 'arrow') {
src/views/police/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-08-14 15:30:04
 * @LastEditTime: 2023-08-15 09:23:24
 * @FilePath: \srs-police-affairs\src\views\police\index.vue
 * @Description: 辖区管理
 * 
@@ -50,12 +50,12 @@
                                        type="text" size="small" title="定位">
                                        <i class="el-icon-location" :style="{ color: positionColor(scope.row) }"></i>
                                    </el-button>
                                    <el-button v-show="navType != 1"
                                        @click="equipmentTrack(scope.row)" type="text" size="small" title="轨迹">
                                    <el-button v-show="navType != 1" @click="equipmentTrack(scope.row)" type="text"
                                        size="small" title="轨迹">
                                        <i class="el-icon-police-track"></i>
                                    </el-button>
                                    <el-button v-show="navType != 0 && navType != 2 && navType != 3" @click="play(scope.row)" type="text"
                                        size="small" title="播放视频">
                                    <el-button v-show="navType != 0 && navType != 2 && navType != 3"
                                        @click="play(scope.row)" type="text" size="small" title="播放视频">
                                        <i class="el-icon-video-play"></i>
                                    </el-button>
                                </template>
@@ -142,10 +142,9 @@
import { getDevices } from '@/api/video/index.js'
import flvjs from 'flv.js'
import { getEquipmentPaging } from '@/api/home/index.js'
import { computerCapacity } from "@/utils/turfPolygon.js"
let tc = null
let track = null
import { initMapPosition } from '@/utils/mapPositionInit'
export default {
    inject: ['userInfo'],
@@ -691,7 +690,11 @@
                }
            })
            track = new global.DC.Track(positionStr, 5000)
            track = new global.DC.Track(positionStr, 5000, () => {
            }, {
                headingOffset: -90
            })
            track.setModel('/model/qiche.gltf', {
                scale: 1
@@ -699,13 +702,12 @@
            tc.addTrack(track)
            this.$EventBus.$emit('toPosition', {
                siteJd: 114.928669,
                siteWd: 25.850383,
                siteGd: 500,
                siteHeading: 0,
                sitePitch: -90
            })
            computerCapacity(positionsArr.map(item => {
                return {
                    lng: Number(item.longitude),
                    lat: Number(item.latitude)
                }
            }), '', 2.5)
            tc.play()
        },