This commit is contained in:
2025-09-23 14:38:08 +08:00
parent 783de5cb7a
commit 16a04a9a90
8 changed files with 125 additions and 63 deletions

View File

@ -12,8 +12,8 @@ let repeat = 0
let currentRepeat = 0
const open = async (sdk, options = {}, _Dialog = {}) => {
let name = options.name || '飞线漫游'
const open = async (sdk, options = {}, _Dialog = {}, func) => {
let name = options.name || '漫游路径'
options.points || (options.points = [])
if (options.repeat) {
repeat = Number(options.repeat)
@ -74,8 +74,9 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
name = nameElm.value
})
let addListBtn = document.createElement('button');
addListBtn.innerHTML = '保存'
// let addListBtn = document.createElement('button');
let addListBtn = document.getElementsByClassName('saveRoam')[0];
// addListBtn.innerHTML = '保存'
addListBtn.addEventListener('click', () => {
if (!name) {
name = '漫游路径'
@ -85,6 +86,12 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
points.map((item) => {
newPoints.push(item)
})
func({
name: name,
points: newPoints,
repeat: repeat + ''
})
// _Dialog.clickSavePath && _Dialog.clickSavePath(
// {
// name: name,
@ -124,20 +131,20 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
addTrElm(data)
i++
})
let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
modifyBtn.addEventListener('click', () => {
if (!active) {
return
}
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
points[active - 1].position = position
points[active - 1].orientation = {
heading: viewer.camera.heading,
pitch: viewer.camera.pitch,
roll: viewer.camera.roll
}
tools.message({ text: '操作成功' })
})
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
// modifyBtn.addEventListener('click', () => {
// if (!active) {
// return
// }
// let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
// points[active - 1].position = position
// points[active - 1].orientation = {
// heading: viewer.camera.heading,
// pitch: viewer.camera.pitch,
// roll: viewer.camera.roll
// }
// tools.message({ text: '操作成功' })
// })
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
@ -287,11 +294,13 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
// }
})
e_time.addEventListener('input', (v) => {
console.log(isTotalTimeElm, 'isTotalTimeElm')
isTotalTimeElm.checked = false
data.duration = Number(e_time.value)
if (data.duration < 0) {
data.duration = 0
}
console.log(data.duration, 'duration')
})
e_time.addEventListener('blur', () => {
e_time.value = Number(Number(e_time.value).toFixed(2))
@ -325,6 +334,7 @@ const close = () => {
}
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
console.log(noStart, points, 'noStart')
if (clickHandler) {
clickHandler.destroy()
}

View File

@ -27,7 +27,7 @@ const convertToImage = (container, options = {}) => {
useCORS: true,//允许跨域
allowTaint: false, //允许跨域数据污染'被污染'的canvas
tainttest: true,
foreignObjectRendering: true, //在浏览器支持的情况下使用ForeignObject模式渲染图片
foreignObjectRendering: true, //在浏览器支持的情况下使用ForeignObject模式渲染图片
...options
};
@ -241,11 +241,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
start() {
if (sdk.viewer.scene.imageryLayers._layers.length <= 1) {
this.error = '未加载底图!'
window.ELEMENT && window.ELEMENT.Message({
message: this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: this.error })
console.warn(this.error)
return
}
@ -258,11 +259,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
}
if (!haveBaseMap) {
this.error = '未加载底图!'
window.ELEMENT && window.ELEMENT.Message({
message: this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: this.error })
console.warn(this.error)
return
}
@ -327,11 +329,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
if (!layer) {
if (!flag) {
_this.error = '当前范围内未找到底图数据!'
window.ELEMENT && window.ELEMENT.Message({
message: _this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: _this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: _this.error })
console.warn(_this.error)
}
return
@ -372,11 +375,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
);
if (!MinTile || !MaxTile) {
let error = '超出地球范围!'
window.ELEMENT && window.ELEMENT.Message({
message: error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: error })
console.warn(error)
return
}
@ -704,4 +708,4 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
}
export { ScreenShot, ScreenShotHD }
export { ScreenShot, ScreenShotHD }