校园-江西科技师范大学-前端
shuishen
2023-12-14 e733164e1c779b3aef7245936b9daf7875bf791e
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
<template>
    <div>
        <public-box class="technique-box">
            <template slot="public-box-header">
                <div class="title">
                    <span>视频融合</span>
                </div>
                <img class="close deblurring" :src="publicPath + 'img/navicon/close.png'" alt @click="closeModel" />
            </template>
            <template slot="public-box-content">
                <el-button type="primary" size="mini" @click.stop="showClick">显示</el-button>
 
                <el-button type="danger" size="mini" @click.stop="closeClick">关闭</el-button>
            </template>
        </public-box>
 
        <video id="video" style="position: fixed; visibility: hidden" muted autoplay loop crossorigin controls>
            <source src="https://dc.dvgis.cn/examples/data/demo.mp4" type="video/mp4" />
        </video>
    </div>
</template>
 
<script>
let videoLayer = null
let cameraVideo = null
 
export default {
    data () {
        return {
            publicPath: process.env.BASE_URL,
 
        }
    },
    created () { },
    mounted () {
    },
    methods: {
        closeModel () {
            this.$router.push('/pcLayout/default')
        },
        showClick () {
            if (videoLayer != null) return
            videoLayer = new global.DC.CameraVideoLayer('video-layer').addTo(
                global.viewer
            )
 
            cameraVideo = new global.DC.CameraVideo(
                new global.DC.Position(114.03935976, 27.62939045, 155, 4.2, -90),
                document.getElementById('video')
            )
            cameraVideo.setStyle({
                fov: 60,
                far: 120,
                near: 1,
                aspectRatio: 1.3,
                alpha: 0.7
            })
 
            videoLayer.addOverlay(cameraVideo)
 
            global.viewer.flyToPosition(
                new global.DC.Position(
                    114.03935976,
                    27.62939045,
                    300,
                    Number(180),
                    Number(-90),
                    Number(0)
                )
            )
        },
 
        closeClick () {
            cameraVideo != null && videoLayer.removeOverlay(cameraVideo)
            cameraVideo = null
            videoLayer != null && global.viewer.removeLayer(videoLayer)
            videoLayer = null
        }
    },
    destroyed () {
        this.closeClick()
    }
}
</script>
 
<style lang="sass" scoped>
.move
    cursor: move
</style>