Compare commits

..

10 Commits

6 changed files with 291 additions and 33 deletions

View File

@ -61,6 +61,10 @@ export default class Sunshine {
set darkness(v) {
this.options.darkness = v
this.viewer.shadowMap.darkness = 1.0 - this.options.darkness
this._elms.darkness &&
this._elms.darkness.forEach(item => {
item.value = v
})
}
get speed() {
@ -101,14 +105,14 @@ export default class Sunshine {
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()
},
// 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()

View File

@ -3,7 +3,8 @@ export default class TimeLine {
this.sdk = { ...sdk };
this.progress = document.getElementById('progress');
this.handle = document.getElementById('handle');
this.timeline = document.getElementById('timeline');
// this.timeline = document.getElementById('timeline');
this.timeline = document.getElementsByClassName('timeline-container')[0];
this.currentTime = document.getElementById('currentTime');
this.timelineCon = document.getElementsByClassName('timeline-container')[0];
this.speed = speed;
@ -53,17 +54,25 @@ export default class TimeLine {
document.getElementById('timePause').addEventListener('click', function () {
that.pauseed = !that.pauseed;
if (that.pauseed) {
if (that.pauseed) {//暂停
document.getElementById('timePause').textContent = '播放';
that.animationId && cancelAnimationFrame(that.animationId);
that.pausedTime = Date.now(); // 记录暂停时刻
that.sdk.viewer.clock.shouldAnimate = false
} else {
} else {//播放
document.getElementById('timePause').textContent = '暂停';
that.manualPosition = null
const pausedDuration = Date.now() - that.pausedTime;
that.startTime += pausedDuration; // 补偿暂停期间的时间差
if (that.changeDate) {//切换日期后让时间从0开始
if (that.changeDateGrag) {
that.changeDateGrag = undefined
} else {
that.startTime = Date.now()
}
that.changeDate = undefined
}
that.sdk.viewer.clock.shouldAnimate = true
that.update(); // 重启动画循环
}
@ -77,7 +86,7 @@ export default class TimeLine {
// that.sdk.viewer.clock.shouldAnimate = true
that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed);
that.manualPosition = null;
that.changeDate && (that.changeDateGrag = true)
if (!that.pauseed) {
that.update()
func(that.time)
@ -98,30 +107,55 @@ export default class TimeLine {
update() {
if (this.manualPosition !== null) return;
const elapsed = (Date.now() - this.startTime) * this.speed;
const totalSeconds = elapsed / 1000;
const daySeconds = totalSeconds % 86400;
if (this.changeDate) {//切换日期后让时间从0开始
this.startTime = Date.now()
}
let elapsed = (Date.now() - this.startTime) * this.speed;
// if (this.elapsed) {
// elapsed = elapsed + this.elapsed
// this.elapsed = undefined
// }
const totalSeconds = elapsed / 1000;//秒
const daySeconds = totalSeconds % 86400;//天
const percentage = daySeconds / 86400;
this.progress.style.width = `${percentage * 100}%`;
this.time = this.formatTime(daySeconds)
this.currentTime.textContent = this.time;
this.animationId = requestAnimationFrame(this.update);
if (!this.pauseed) {
this.animationId && cancelAnimationFrame(this.animationId);
this.animationId = requestAnimationFrame(this.update);
}
}
setSpeed(v) {
const currentProgress = this.manualPosition ??
(Date.now() - this.startTime) * this.speed / (86400 * 1000);
if (!this.pauseed) {
const currentProgress = this.manualPosition ??
(Date.now() - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
this.speed = v;
this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
} else {
let pausedDuration = Date.now() - this.pausedTime;
this.startTime += pausedDuration; // 补偿暂停期间的时间差
const currentProgress = this.manualPosition ??
(Date.now() - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
this.pausedTime = Date.now(); // 记录切换speed暂停时刻
this.speed = v;
}
this.manualPosition = null;
this.update();
// this.update();
}
updateTime() {
this.startTime = Date.now() - (this.manualPosition * 86400 * 1000 / this.speed);
this.manualPosition = null;
this.startTime = Date.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
this.pauseed && (this.changeDate = true)
this.changeDateGrag = undefined
this.update();
}
clear() {

View File

@ -89,6 +89,7 @@ class FlowLine extends Base {
const minLat = Math.min(...lats), maxLat = Math.max(...lats);
const points = [];
let that = this
while (points.length < count) {
const lon = minLon + Math.random() * (maxLon - minLon);
const lat = minLat + Math.random() * (maxLat - minLat);
@ -100,9 +101,14 @@ class FlowLine extends Base {
const isInside = turf.booleanPointInPolygon(point, polygon);
if (isInside) {
let posi = Cesium.Cartesian3.fromDegrees(lon, lat);
const cartographic = that.viewer.scene.globe.ellipsoid.cartesianToCartographic(posi);
const height = cartographic.height;
points.push([
lon,
lat
lat,
height
]);
}
}
@ -126,15 +132,16 @@ class FlowLine extends Base {
positions.forEach((item, index) => {
let point = item
//根据点设置起始点位置
let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0)
// let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0)
let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2])
//根据点设置结束点位置
let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], that.options.height + Math.random() * that.options.heightDifference)
let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] + that.options.height + Math.random() * that.options.heightDifference)
//创建线
that.viewer.entities.add({
parent: celiangEntity,
polyline: {
positions: [start, end],
width: 2,
width: that.options.width,
// material:Cesium.Color.RED
material: new Cesium.FlowLineMaterialProperty({
color: that.options.color,
@ -425,7 +432,7 @@ class FlowLine extends Base {
let a = Cesium.Cartesian3.fromDegrees(
this.positions[i][0],
this.positions[i][1],
this.options.height + this.options.heightDifference / 2
this.positions[i][2] + this.options.height + this.options.heightDifference / 2
)
positionArray.push(a.x, a.y, a.z)
}

View File

@ -61,7 +61,7 @@ class EventBinding {
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if((e.target.dataset.min) && value<Number(e.target.dataset.min)) {
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
}
@ -121,4 +121,4 @@ class EventBinding {
}
}
export default EventBinding;
export default EventBinding;

View File

@ -9,7 +9,7 @@ const open = async (sdk, closeCallBack) => {
_DialogObject = null
}
_DialogObject = await new Dialog(sdk.viewer._container, {
title: '功能转换',
title: '度分秒',
left: '180px',
top: '100px',
closeCallBack: () => {

View File

@ -1665,6 +1665,7 @@
display: flex;
align-items: center;
height: 32px;
line-height: 32px;
}
.YJ-custom-base-dialog>.content .cy_datalist dl dd:hover {
@ -1934,6 +1935,89 @@
.YJ-custom-base-dialog.water-surface>.content>div .row .label {
flex: 0 0 60px;
}
/* 流光飞线 */
.YJ-custom-base-dialog.flow-line-surface>.content {
width: 586px;
}
.YJ-custom-base-dialog.flow-line-surface>.content>div .row .label {
flex: 0 0 60px;
}
/* 光照 */
.YJ-custom-base-dialog.sun-shine-surface>.content {
width: 586px;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .row .label {
flex: 0 0 60px;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .timeline-container {
width: 100%;
padding: 20px 0;
position: relative;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .timeline {
height: 8px;
background: #f0f0f0;
border-radius: 15px;
position: relative;
cursor: pointer;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .progress {
height: 100%;
width: 0;
background: rgba(var(--color-sdk-base-rgb), 1);
border-radius: 15px;
position: relative;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .handle {
width: 16px;
height: 16px;
background: white;
/* border: 3px solid #4285f4; */
background: rgba(var(--color-sdk-base-rgb), 1);
border-radius: 50%;
position: absolute;
right: -8px;
top: 50%;
transform: translateY(-50%);
cursor: grab;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .time-marks {
display: flex;
justify-content: space-between;
margin-top: 5px;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .time-mark {
font-size: 12px;
color: #fff;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .controls {
margin: 15px 0;
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div .current-time {
font-size: 12px;
position: absolute;
width: 50px;
text-align: center;
right: -25px;
top: -200%;
transform: translateY(-50%);
}
.YJ-custom-base-dialog.sun-shine-surface>.content>div #timePause {
margin-top: 10px;
}
/* 电子围墙 */
.YJ-custom-base-dialog.wall-stereoscopic>.content {
@ -2665,6 +2749,9 @@
.YJ-custom-base-dialog.polyline>.content {
width: 580px;
}
.YJ-custom-base-dialog.polyline>.content>div #dashTextureDom {
display: none;
}
.YJ-custom-base-dialog.polyline>.content>div .row .col {
margin: 0 10px;
@ -2713,6 +2800,132 @@
.YJ-custom-base-dialog.polyline>.content>div .spatial-info-table .table-body {
max-height: 185px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit-box textarea {
border-radius: unset !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit .datalist {
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 4px 0px 0px 4px !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) .datalist {
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 4px 0px, 0px, 4px !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) .datalist {
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 0px 4px 4px 0px !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) input {
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) input {
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.YJ-custom-base-dialog.polyline>.content input.input-text {
background-color: rgba(0, 0, 0, 0.5) !important;
border-radius: unset !important;
border-top: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
border-bottom: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist input {
padding-left: 35px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .icon-active {
position: absolute;
top: 11px;
left: 10px;
-webkit-pointer-events: none;
-moz-pointer-events: none;
-ms-pointer-events: none;
-o-pointer-events: none;
pointer-events: none;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.icon {
display: inline-block;
width: 22px;
height: 10px;
margin-right: 5px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.line {
border: 1px solid rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.dash-line {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.light-line {
border: 1px solid rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
box-shadow: 0 0 3px #fff
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.mult-tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line1 {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line2 {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line1 {
background: url(../../img/arrow/1.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line2 {
background: url(../../img/arrow/2.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line3 {
background: url(../../img/arrow/3.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line4 {
background: url(../../img/arrow/4.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line5 {
background: url(../../img/arrow/5.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line6 {
background: url(../../img/arrow/6.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit-box textarea {
border-radius: unset!important;
@ -3253,4 +3466,4 @@
.YJ-custom-base-dialog.contour>.content .label {
flex: unset;
}
}