zouyaoji / vue-cesium-demo

Demos of vue-cesium component
http://zouyaoji.top/vue-cesium-demo/
Other
173 stars 56 forks source link

参考dynamic-render-data实现动态加载VcCollectionBillboard,导致多个VcCollectionBillboard时候,第二个图层以后的图片出现缩放重影 #26

Open flywin8 opened 6 months ago

flywin8 commented 6 months ago

import { randomPoint } from '@turf/turf'; const createBillboards = (url, zIndex) => randomPoint(1000, { bbox: [95, 41, 118, 25] }).features.map(({ geometry }, i) => ({ id: 'billboards-' + zIndex + '-' + i, name: '桥梁-' + i, image: url, width: 60, height: 60, verticalOrigin: 1, heightReference: 2, eyeOffset: { x: 0, y: 0, z: zIndex }, // 控制层级 disableDepthTestDistance: Number.POSITIVE_INFINITY, scaleByDistance: new Cesium.NearFarScalar(4.0e2, 1, 2.0e6, 0.1), position: { lng: geometry.coordinates[0], lat: geometry.coordinates[1] }, })); const dataLayer = { id:'id1', page: 'page1', datasets: [] }; let billboards = createBillboards('./resource/images/a.png',0) dataLayer.datasets.push({ component: 'VcCollectionBillboard', props: { billboards }}); mapStore.addDataLayer(dataLayer);

const dataLayer2 = { id:'id1', page: 'page1', datasets: [] }; billboards = createBillboards('./resource/images/b.png',100) dataLayer2.datasets.push({ component: 'VcCollectionBillboard', props: { billboards }}); mapStore.addDataLayer(dataLayer2);

image

flywin8 commented 6 months ago

const layers: any[] = []; layers.push(createBillboards('./resource/images/a.svg', 0)); layers.push(createBillboards('./resource/images/b.svg', 100)); billboardLayers.value = layers; 使用这种方式渲染就没有缩放重影的问题

image