Cesium实现——日照分析
? ? ? ? ?隨著地球的自傳,太陽照射在建筑物上的影子也隨便變化而變化;
?1、實現思路
? ? ? ? 先添加建筑物3dtiles模型;
????????var tmp_tileset = this.model.add3DTiles(
? ? ? ? ? url,
? ? ? ? ? id,
? ? ? ? ? function (tmp_tileset) {
? ? ? ? ? ? if (height) {
? ? ? ? ? ? ? window.model.adjuest3DtilesVerticalPosition(tmp_tileset, height);
? ? ? ? ? ? } else {
? ? ? ? ? ? ? window.model.adjuest3DtilesVerticalPosition(tmp_tileset, -2);
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? );
2、可以設置時間、透明度、速度等相關參數
? ?設置好相關的參數點擊開始分析? ? ? ??
startSunshine(option) {
? ? this.viewer.scene.globe.enableLighting = true
? ? this.viewer.shadows = true
? ? this.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY
? ? this.viewer.shadowMap.darkness = option.darkness //陰影透明度--越大越透明
? ? let time = 0
? ? this.inter = setInterval(() => {
? ? ? let date = option.date + time;
? ? ? if (null == option.date) { //時間傳空的時候,就從當前時間開始
? ? ? ? date = new Date().getTime() + time
? ? ? }
? ? ? let utc = Cesium.JulianDate.fromDate(new Date(date))
? ? ? this.viewer.clockViewModel.currentTime = Cesium.JulianDate.addHours(utc, 0, new Cesium.JulianDate())
? ? ? time = time + 1000 * 60
? ? }, option.speed)
?}
?移除分析
clearOpenLight() {
????????this.viewer.scene.globe.enableLighting = false
? ? ? ? this.viewer.shadows = false
? ? ? ? this.viewer.terrainShadows = Cesium.ShadowMode.DISABLED
????????if (this.inter) {
????????????????clearInterval(this.inter)
????????????????this.inter = null;
????????}
}
總結
以上是生活随笔為你收集整理的Cesium实现——日照分析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于腾讯地图的输入自动提示与补全功能
- 下一篇: [MySQL]教学管理系统