飞行漫游
This commit is contained in:
@ -117,7 +117,8 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
||||
addBtn.addEventListener('click', () => {
|
||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
||||
let time = 0
|
||||
let defaultTime = Number(contentElm.querySelector("input[name='defaultTime']").value)
|
||||
let time = points.length === active ? 0 : defaultTime
|
||||
let data = {
|
||||
duration: time,
|
||||
position: position,
|
||||
@ -127,6 +128,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
}
|
||||
if (points.length === active && active !== 0) {
|
||||
points[points.length - 1].duration = defaultTime
|
||||
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
trList[points.length - 1].querySelector("input[name='time']").value = defaultTime
|
||||
|
||||
}
|
||||
points.splice(active, 0, data)
|
||||
addTrElm(data)
|
||||
i++
|
||||
@ -147,11 +155,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
// })
|
||||
|
||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
||||
let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
|
||||
// let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
|
||||
let isTotalTimeElm = contentElm.getElementsByClassName('isTotalTime')[0]
|
||||
let repeatElm = contentElm.querySelector("input[name='repeat']")
|
||||
isTotalTimeElm.addEventListener('change', () => {
|
||||
isTotalTimeElm.addEventListener('click', () => {
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
if (isTotalTimeElm.checked && trList.length > 0) {
|
||||
// if (isTotalTimeElm.checked && trList.length > 0) {
|
||||
if (trList.length > 0) {
|
||||
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
|
||||
for (let i = 0; i < trList.length - 1; i++) {
|
||||
points[i].duration = time
|
||||
@ -211,8 +221,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
<input class="input time" type="number" title="" min="0" max="999.99" step="0.01" name="time" value="${data.duration}">
|
||||
</div>
|
||||
<div class="td action">
|
||||
<button class="play">播放</span>
|
||||
<button class="delete">删除</span>
|
||||
<button title="更新视角" class='iconBut'><svg class="icon-resetView modify-point" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-resetView"></use></svg></button>
|
||||
<button title="播放" class='iconBut'><svg class="icon-play play" style='width:15px;height:15px;cursor: pointer;margin-top: -4px;'><use xlink:href="#yj-icon-play"></use></svg></button>
|
||||
<button title="删除" class='iconBut'><svg class="icon-delete delete" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-delete"></use></svg></button>
|
||||
</div>
|
||||
`
|
||||
tr.addEventListener('click', (v) => {
|
||||
@ -245,6 +256,25 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
let e_play = tr.getElementsByClassName('play')[0]
|
||||
let e_delete = tr.getElementsByClassName('delete')[0]
|
||||
let e_time = tr.querySelector("input[name='time']")
|
||||
|
||||
let modifyBtn = tr.getElementsByClassName('modify-point')[0]
|
||||
modifyBtn.addEventListener('click', () => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
||||
points[m].position = position
|
||||
points[m].orientation = {
|
||||
heading: viewer.camera.heading,
|
||||
pitch: viewer.camera.pitch,
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
tools.message({ text: '更新视角成功' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
e_play.addEventListener('click', () => {
|
||||
for (let m = 0; m < trList.length; m++) {
|
||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||
@ -294,13 +324,11 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
||||
// }
|
||||
})
|
||||
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))
|
||||
@ -322,7 +350,7 @@ const close = () => {
|
||||
// _DialogObject = null
|
||||
// }
|
||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||
if(contentElm) {
|
||||
if (contentElm) {
|
||||
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
||||
let trList = tableBody.getElementsByClassName('tr')
|
||||
for (let i = trList.length - 1; i >= 0; i--) {
|
||||
@ -335,7 +363,6 @@ const close = () => {
|
||||
}
|
||||
|
||||
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
||||
console.log(noStart, points, 'noStart')
|
||||
if (clickHandler) {
|
||||
clickHandler.destroy()
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm']
|
||||
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm', 'icon-delete', 'icon-resetView']
|
||||
function setSvg() {
|
||||
let svgElm = document.createElement('svg');
|
||||
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
||||
@ -14,7 +14,7 @@ function setSvg() {
|
||||
.then(r => r.text())
|
||||
.then(b => {
|
||||
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
|
||||
if(xmlDoc) {
|
||||
if (xmlDoc) {
|
||||
xmlDoc.id = 'yj-' + name
|
||||
svgElm.appendChild(xmlDoc)
|
||||
}
|
||||
@ -23,4 +23,4 @@ function setSvg() {
|
||||
}
|
||||
}
|
||||
|
||||
export { setSvg }
|
||||
export { setSvg }
|
||||
|
||||
Reference in New Issue
Block a user