1
mayisheng
2022-08-15 81f54040c2cb65537c6c6e1db8358a39a57dea0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* * @Author: Morpheus * @Name: 地图测距 * @Date: 2021-11-13 16:04:27 * @Last
Modified by: Morpheus * @Last Modified time: 2022-02-15 14:28:44 */
 
<template>
    <public-box class="technique-box">
        <template slot="public-box-header">
            <div class="title">
                <span>漫游</span>
            </div>
            <img class="close deblurring" src="/img/navicon/close.png" alt @click="closeModel" />
        </template>
        <template slot="public-box-content">
            <ul>
                <li>
                    自动漫游
                    <el-switch
                        v-model="pathShow"
                        :active-value="true"
                        :inactive-value="false"
                        @change="pathChange"
                    ></el-switch>
                </li>
                <li>
                    定点巡航
                    <el-button type="primary" size="mini" @click="fixedPointStart">开始</el-button>
                    <el-button type="primary" size="mini" @click="fixedPointPause">暂停</el-button>
                    <el-button type="primary" size="mini" @click="fixedPointRestore">继续</el-button>
                </li>
            </ul>
        </template>
    </public-box>
</template>
 
<script>
 
let rc = null
let pathOne = null
 
let flying
 
export default {
    data () {
        return {
            pathShow: false
        }
    },
    mounted () {
        flying = new global.DC.Flying(global.viewer, {
            loop: true,
            dwellTime: 3
        })
        flying.positions = [
            { lng: 121.46748793889597, lat: 31.22345700031846, alt: 1082.6691622203975, heading: 0.9161118327237789, pitch: -38.63414039808751 },
            { lng: 121.49543157056694, lat: 31.219611353179484, alt: 663.5376240776116, heading: 0.9161124649627334, pitch: -38.63418986635751 },
            { lng: 121.53162234574106, lat: 31.228003869427294, alt: 1891.926162456467, heading: 298.6565902579582, pitch: -33.67285705092492 },
            { lng: 121.54438164431083, lat: 31.25201585389836, alt: 1441.4625182144541, heading: 298.65660919687264, pitch: -33.6728415156399 }
        ]
 
        rc = new global.DC.RoamingController(global.viewer)
        pathOne = new global.DC.RoamingPath('120.38105869, 31.10115627;120.38105869,32.10115627', 60)
        rc.addPaths([pathOne])
    },
    methods: {
        closeModel () {
            this.$router.push('/pcLayout/default')
        },
        loadPath () {
            rc.activate(pathOne, {
                pitch: -30
            })
        },
        removePath () {
            rc.deactivate()
        },
        pathChange (e) {
            if (e) {
                this.fixedPointPause()
                this.loadPath()
            } else {
                this.removePath()
            }
        },
        fixedPointStart () {
            if (this.pathShow == true) {
                this.removePath()
                this.pathShow = false
            }
            flying.start()
        },
        fixedPointPause () {
            flying.pause()
        },
        fixedPointRestore () {
            flying.restore()
        }
    },
    destroyed () {
        rc.deactivate()
        this.fixedPointPause()
    }
}
</script>
 
<style lang="sass" scoped>
.move
    cursor: move
</style>