1
mayisheng
2022-08-15 81f54040c2cb65537c6c6e1db8358a39a57dea0d
src/components/map/index.vue
@@ -1,18 +1,6 @@
/* eslint-disable camelcase */
<template>
    <div id="viewer-container" style="height: 100%; width: 100%" @click="mapClick($event)">
        <video
            id="video"
            style="position: fixed; visibility: hidden"
            muted
            autoplay
            loop
            crossorigin
            controls
        >
            <source src="http://dc.dvgis.cn/examples/data/demo.mp4" type="video/mp4" />
        </video>
        <div
            style="
                position: fixed;
@@ -241,13 +229,9 @@
                        preserveDrawingBuffer: true
                    }
                }
            }).setOptions({
                globe: {
                    baseColor: new global.DC.Color(1, 1, 1, 1)
                }
            })
            console.log(window.devicePixelRatio)
            global.viewer.scene.globe.baseColor = global.DC.Namespace.Cesium.Color.WHITE
            if (global.DC.Namespace.Cesium.FeatureDetection.supportsImageRenderingPixelated()) { // 判断是否支持图像渲染像素化处理
                global.viewer.setOptions({
@@ -291,14 +275,13 @@
                selectionIndicator: false,
                timeline: false,
                navigationHelpButton: false,
                navigationInstructionsInitiallyVisible: false,
                creditContainer: undefined
                navigationInstructionsInitiallyVisible: false
                // sceneMode: global.DC.Namespace.Cesium.SceneMode.SCENE2D
            })
            global.eagleViewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=9ae78c51a0a28f06444d541148496e36',
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0',
                    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
                    format: 'image/jpeg',
                    show: true,
@@ -308,7 +291,7 @@
            global.eagleViewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=9ae78c51a0a28f06444d541148496e36',
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0',
                    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
                    format: 'image/jpeg',
                    show: true,
@@ -460,9 +443,7 @@
            //     })
            // })
            that.$refs.leftNav.initialize()
            // const key = '0f7c1d161d7352116a21aacf0e9f44c1'
            // const key = 'e9533f5acb2ac470b07f406a4d24b4f0'
            // const vec = global.DC.ImageryLayerFactory.createTdtImageryLayer({
            //     key
            // })
@@ -603,6 +584,8 @@
        }
        global.DC.ready(initViewer)
        that.$refs.leftNav.initialize()
    },
    methods: {
        changeWheel (val, type) {
@@ -869,10 +852,8 @@
                var res = []
                for (var i = 0; i < data.length; i++) {
                    var dataItem = data[i]
                    //          console.log('dataItem',dataItem) //第二个数据
                    var fromCoord = [115.8716, 28.7436]
                    var toCoord = chinaGeoCoordMap[dataItem[0].name]
                    //          console.log('toCoord',toCoord);//第一个地址
                    if (fromCoord && toCoord) {
                        res.push([
                            {
@@ -939,7 +920,6 @@
                                    // color: '#f00'
                                    color: function (params) {
                                        // 圆环显示文字
                                        // console.log('redName',redName)
                                        return '#ffa022'
                                    },
@@ -960,7 +940,6 @@
                                extraCssText: 'z-index:100',
                                formatter: function (params, ticket, callback) {
                                    // 根据业务自己拓展要显示的内容
                                    // console.log('params--2',params)
                                    let res = ''
                                    const name = params.data.dataItem[0].name
                                    const price = params.data.dataItem[0].price
@@ -977,7 +956,6 @@
                                }
                            },
                            data: item[1].map(function (dataItem) {
                                //    console.log('dataItem',dataItem[0]);
                                return {
                                    dataItem: dataItem,
                                    name: dataItem[0].name,