智慧农业后台管理页面
guoshilong
2022-09-13 9efc4f0df9e83643c3ff2e464941d51a7815348f
根据农场定位地图模式中心
1 files modified
15 ■■■■ changed files
src/components/map/plotMap.vue 15 ●●●● patch | view | raw | blame | history
src/components/map/plotMap.vue
@@ -7,6 +7,8 @@
<script>
import NCregion from "@/assets/region"
import { glob } from "glob"
import {getDetail } from "@/api/farm/farm"
import { mapGetters } from "vuex"
import * as turf from '@turf/turf'
var farmRegionLayer = null
@@ -22,6 +24,7 @@
    data () {
        return {
            polyline: null,
            farm:{},
        }
    },
    watch: {
@@ -32,14 +35,14 @@
        }
    },
    computed: {
        ...mapGetters(["$farmId"]),
    },
    mounted () {
        if (global.viewer != null) {
            global.viewer = null
        }
        function initViewer () {
        function initViewer (lat,lon) {
            global.viewer = new global.DC.Viewer('viewer-container', {
                contextOptions: {
                    webgl: {
@@ -214,7 +217,7 @@
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    116.56705776, 27.42386903, 1800.0
                    lon, lat, 1800.0
                ),
                orientation: {
                    // 指向
@@ -228,8 +231,12 @@
            // global.viewer.locationBar.enable = true
        }
        global.DC.ready(initViewer)
        getDetail(this.$farmId).then(res=>{
            this.farm.latitude = res.data.data.latitude
            this.farm.longitude = res.data.data.longitude
            global.DC.ready(initViewer(this.farm.latitude,this.farm.longitude))
        this.addRegionPolyLine(NCregion)
        })
    },
    methods: {
        /**