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;
@@ -227,15 +215,33 @@
            global.viewer.measure.deactivate()
        }
        if (global.viewer != null) {
            global.viewer = null
            global.eagleViewer = null
        }
        function initViewer () {
            global.viewer = new global.DC.Viewer('viewer-container', {
                contextOptions: {
                    webgl: {
                        alpha: true,
                        stencil: true,
                        preserveDrawingBuffer: true
                    }
                }
            })
            global.viewer.scene.globe.baseColor = global.DC.Namespace.Cesium.Color.WHITE
            if (global.DC.Namespace.Cesium.FeatureDetection.supportsImageRenderingPixelated()) { // 判断是否支持图像渲染像素化处理
                global.viewer.setOptions({
                    resolutionScale: window.devicePixelRatio
                })
            }
            // 是否开启抗锯齿
            // global.viewer.scene.fxaa = true
            // global.viewer.scene.postProcessStages.fxaa.enabled = true
            // .setOptions({
            //     // showAtmosphere: false, 大气层
            //     showMoon: true, // 月亮
@@ -249,7 +255,7 @@
            // chartLayer.setOption(that.busPathsInit())
            // global.viewer.scene.backgroundColor = global.DC.Namespace.Cesium.Color.fromBytes(245, 244, 238)
            // global.viewer.scene.backgroundColor = global.DC.Namespace.Cesium.Color.fromBytes(255, 255, 255)
            // global.viewer.use(new global.DC.Weather())
            // global.viewer.weather.cloud.enable = true
@@ -269,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,
@@ -286,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,
@@ -438,9 +443,7 @@
            //     })
            // })
            that.$refs.leftNav.initialize()
            // const key = '0f7c1d161d7352116a21aacf0e9f44c1'
            // const key = 'e9533f5acb2ac470b07f406a4d24b4f0'
            // const vec = global.DC.ImageryLayerFactory.createTdtImageryLayer({
            //     key
            // })
@@ -581,6 +584,8 @@
        }
        global.DC.ready(initViewer)
        that.$refs.leftNav.initialize()
    },
    methods: {
        changeWheel (val, type) {
@@ -847,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([
                            {
@@ -917,7 +920,6 @@
                                    // color: '#f00'
                                    color: function (params) {
                                        // 圆环显示文字
                                        // console.log('redName',redName)
                                        return '#ffa022'
                                    },
@@ -938,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
@@ -955,7 +956,6 @@
                                }
                            },
                            data: item[1].map(function (dataItem) {
                                //    console.log('dataItem',dataItem[0]);
                                return {
                                    dataItem: dataItem,
                                    name: dataItem[0].name,