坐标类型
This commit is contained in:
@ -26,7 +26,12 @@ export default class Sunshine {
|
||||
this.viewer = sdk.viewer
|
||||
this.options = { ...options }
|
||||
this.sdk = { ...sdk }
|
||||
this.options.time = options.time || new Date()
|
||||
|
||||
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||
this.options.time = options.time
|
||||
this.options.hour = options.hour
|
||||
this.options.speed = options.speed || 1000
|
||||
this.options.darkness = options.darkness || 0.4
|
||||
this.options.softShadow = options.softShadow || true
|
||||
@ -47,9 +52,16 @@ export default class Sunshine {
|
||||
that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY
|
||||
that.viewer.shadowMap.darkness = 1.0 - that.options.darkness //阴影透明度--越大越透明
|
||||
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||
that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now);
|
||||
// const now = new Date();
|
||||
// now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||
let date
|
||||
if (that.options.time && that.options.hour) {
|
||||
date = new Date(that.options.time + " " + that.options.hour)
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||
}
|
||||
that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(date);
|
||||
that.viewer.clock.multiplier = that.options.speed;
|
||||
that.viewer.shadowMap.softShadows = that.options.softShadow;
|
||||
that.viewer.shadowMap.cascadesEnabled = true
|
||||
@ -61,7 +73,7 @@ export default class Sunshine {
|
||||
lightCamera.frustum.far = 10000; // 扩大远平面距离
|
||||
that.viewer.shadowMap.normalOffset = true; // 避免深度冲突导致的阴影闪烁
|
||||
|
||||
that.edit(true)
|
||||
// that.edit(true)
|
||||
}
|
||||
get darkness() {
|
||||
return this.options.darkness
|
||||
@ -74,6 +86,27 @@ export default class Sunshine {
|
||||
item.value = v
|
||||
})
|
||||
}
|
||||
get time() {
|
||||
return this.options.time
|
||||
}
|
||||
set time(v) {
|
||||
this.options.time = v
|
||||
const now = new Date();
|
||||
let timeData = now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||
this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData));
|
||||
|
||||
// _that.timeLine.updateTime(timeData)
|
||||
}
|
||||
set timeBar(v) {
|
||||
let timeData = this.time + " " + v
|
||||
this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData));
|
||||
this.viewer.scene.requestRender();
|
||||
}
|
||||
set realTime(v) {
|
||||
const now = new Date();
|
||||
this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now);
|
||||
}
|
||||
|
||||
|
||||
get speed() {
|
||||
return this.options.speed
|
||||
@ -85,7 +118,7 @@ export default class Sunshine {
|
||||
item.value = v
|
||||
})
|
||||
this.viewer.clock.multiplier = this.options.speed;
|
||||
this.timeLine.setSpeed(v)
|
||||
// this.timeLine.setSpeed(v)
|
||||
}
|
||||
get softShadow() {
|
||||
return this.options.softShadow
|
||||
@ -115,41 +148,41 @@ export default class Sunshine {
|
||||
|
||||
if (state) {
|
||||
let _this = this
|
||||
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||
title: '光照属性', left: '180px', top: '100px',
|
||||
// confirmCallBack: (options) => {
|
||||
// this.originalOptions = tools.deepCopyObj(this.options)
|
||||
// this._DialogObject.close()
|
||||
// this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
||||
// syncData(this.sdk, this.options.id)
|
||||
// syncSplitData(this.sdk, this.options.id)
|
||||
// this.remove()
|
||||
// },
|
||||
resetCallBack: () => {
|
||||
this.reset()
|
||||
this.Dialog.resetCallBack && this.Dialog.resetCallBack()
|
||||
},
|
||||
// removeCallBack: () => {
|
||||
// this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
||||
// },
|
||||
closeCallBack: () => {
|
||||
this.reset()
|
||||
_this.remove()
|
||||
// this.entity.style = new Cesium.Cesium3DTileStyle({
|
||||
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
||||
// show: true,
|
||||
// });
|
||||
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||
},
|
||||
showCallBack: (show) => {
|
||||
this.show = show
|
||||
this.Dialog.showCallBack && this.Dialog.showCallBack()
|
||||
}
|
||||
}, true)
|
||||
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface'
|
||||
let contentElm = document.createElement('div');
|
||||
contentElm.innerHTML = html()
|
||||
this._DialogObject.contentAppChild(contentElm)
|
||||
// this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||
// title: '光照属性', left: '180px', top: '100px',
|
||||
// // confirmCallBack: (options) => {
|
||||
// // this.originalOptions = tools.deepCopyObj(this.options)
|
||||
// // this._DialogObject.close()
|
||||
// // this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
||||
// // syncData(this.sdk, this.options.id)
|
||||
// // syncSplitData(this.sdk, this.options.id)
|
||||
// // this.remove()
|
||||
// // },
|
||||
// resetCallBack: () => {
|
||||
// this.reset()
|
||||
// this.Dialog.resetCallBack && this.Dialog.resetCallBack()
|
||||
// },
|
||||
// // removeCallBack: () => {
|
||||
// // this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
||||
// // },
|
||||
// closeCallBack: () => {
|
||||
// this.reset()
|
||||
// _this.remove()
|
||||
// // this.entity.style = new Cesium.Cesium3DTileStyle({
|
||||
// // color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
||||
// // show: true,
|
||||
// // });
|
||||
// this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||
// },
|
||||
// showCallBack: (show) => {
|
||||
// this.show = show
|
||||
// this.Dialog.showCallBack && this.Dialog.showCallBack()
|
||||
// }
|
||||
// }, true)
|
||||
// this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface'
|
||||
// let contentElm = document.createElement('div');
|
||||
// contentElm.innerHTML = html()
|
||||
// this._DialogObject.contentAppChild(contentElm)
|
||||
|
||||
//时间轴
|
||||
let _that = this
|
||||
@ -159,8 +192,6 @@ export default class Sunshine {
|
||||
let timeData = _that.time + " " + item
|
||||
_that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData));
|
||||
_that.viewer.scene.requestRender();
|
||||
|
||||
|
||||
})
|
||||
let jeDateObject
|
||||
let printDateElm = contentElm.getElementsByClassName('sunshine-date')[0]
|
||||
@ -228,7 +259,7 @@ export default class Sunshine {
|
||||
this.viewer.clock.multiplier = 1.0
|
||||
this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date());
|
||||
this.entity = null
|
||||
this.timeLine.clear()
|
||||
this.timeLine && this.timeLine.clear()
|
||||
|
||||
this.viewer.shadowMap.cascadesEnabled = false
|
||||
this.viewer.shadowMap.size = 1024;
|
||||
|
||||
Reference in New Issue
Block a user