cesium淹没分析(纯前端实现)

原理:利用polygon的extrudedHeight属性,动态增加(原理很简单,但效果挺好)

效果图:

cesium淹没分析(纯前端实现)_第1张图片

核心代码:

	_drawWater(targetHeight, adapCoordi) {
		let entity = this.earth.entities.add({
			polygon: {
				hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(adapCoordi),
				material: new GV.Color.fromBytes(64, 157, 253, 150),
				perPositionHeight: true,
				extrudedHeight: 0.0,
			}
		})
		this.waterEntities = entity
		let waterHeight = adapCoordi[2]
			this.timer = setInterval(() => {
			if (waterHeight < targetHeight) {
				waterHeight += 100
				if (waterHeight > targetHeight) {
					waterHeight = targetHeight
				}
				entity.polygon.extrudedHeight.setValue(waterHeight)
			}
		}, 100)
		this.entities.push(entity)
	}

 

你可能感兴趣的:(cesium,js)