飞行漫游
This commit is contained in:
@ -117,7 +117,8 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
let addBtn = contentElm.getElementsByClassName('add-point')[0]
|
||||||
addBtn.addEventListener('click', () => {
|
addBtn.addEventListener('click', () => {
|
||||||
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
|
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 = {
|
let data = {
|
||||||
duration: time,
|
duration: time,
|
||||||
position: position,
|
position: position,
|
||||||
@ -127,6 +128,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
roll: viewer.camera.roll
|
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)
|
points.splice(active, 0, data)
|
||||||
addTrElm(data)
|
addTrElm(data)
|
||||||
i++
|
i++
|
||||||
@ -147,11 +155,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
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']")
|
let repeatElm = contentElm.querySelector("input[name='repeat']")
|
||||||
isTotalTimeElm.addEventListener('change', () => {
|
isTotalTimeElm.addEventListener('click', () => {
|
||||||
let trList = tableBody.getElementsByClassName('tr')
|
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))
|
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
|
||||||
for (let i = 0; i < trList.length - 1; i++) {
|
for (let i = 0; i < trList.length - 1; i++) {
|
||||||
points[i].duration = time
|
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}">
|
<input class="input time" type="number" title="" min="0" max="999.99" step="0.01" name="time" value="${data.duration}">
|
||||||
</div>
|
</div>
|
||||||
<div class="td action">
|
<div class="td action">
|
||||||
<button class="play">播放</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 class="delete">删除</span>
|
<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>
|
</div>
|
||||||
`
|
`
|
||||||
tr.addEventListener('click', (v) => {
|
tr.addEventListener('click', (v) => {
|
||||||
@ -245,6 +256,25 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
let e_play = tr.getElementsByClassName('play')[0]
|
let e_play = tr.getElementsByClassName('play')[0]
|
||||||
let e_delete = tr.getElementsByClassName('delete')[0]
|
let e_delete = tr.getElementsByClassName('delete')[0]
|
||||||
let e_time = tr.querySelector("input[name='time']")
|
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', () => {
|
e_play.addEventListener('click', () => {
|
||||||
for (let m = 0; m < trList.length; m++) {
|
for (let m = 0; m < trList.length; m++) {
|
||||||
if (trList[m] === e_delete.parentNode.parentNode) {
|
if (trList[m] === e_delete.parentNode.parentNode) {
|
||||||
@ -294,13 +324,11 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
|
|||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
e_time.addEventListener('input', (v) => {
|
e_time.addEventListener('input', (v) => {
|
||||||
console.log(isTotalTimeElm, 'isTotalTimeElm')
|
|
||||||
isTotalTimeElm.checked = false
|
isTotalTimeElm.checked = false
|
||||||
data.duration = Number(e_time.value)
|
data.duration = Number(e_time.value)
|
||||||
if (data.duration < 0) {
|
if (data.duration < 0) {
|
||||||
data.duration = 0
|
data.duration = 0
|
||||||
}
|
}
|
||||||
console.log(data.duration, 'duration')
|
|
||||||
})
|
})
|
||||||
e_time.addEventListener('blur', () => {
|
e_time.addEventListener('blur', () => {
|
||||||
e_time.value = Number(Number(e_time.value).toFixed(2))
|
e_time.value = Number(Number(e_time.value).toFixed(2))
|
||||||
@ -322,7 +350,7 @@ const close = () => {
|
|||||||
// _DialogObject = null
|
// _DialogObject = null
|
||||||
// }
|
// }
|
||||||
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
let contentElm = document.getElementsByClassName('fly-roam')[0]
|
||||||
if(contentElm) {
|
if (contentElm) {
|
||||||
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
let tableBody = contentElm.getElementsByClassName('table-body')[0];
|
||||||
let trList = tableBody.getElementsByClassName('tr')
|
let trList = tableBody.getElementsByClassName('tr')
|
||||||
for (let i = trList.length - 1; i >= 0; i--) {
|
for (let i = trList.length - 1; i >= 0; i--) {
|
||||||
@ -335,7 +363,6 @@ const close = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
const executeFlyTo = (sdk, points = [], index = 0, noStart) => {
|
||||||
console.log(noStart, points, 'noStart')
|
|
||||||
if (clickHandler) {
|
if (clickHandler) {
|
||||||
clickHandler.destroy()
|
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() {
|
function setSvg() {
|
||||||
let svgElm = document.createElement('svg');
|
let svgElm = document.createElement('svg');
|
||||||
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
||||||
@ -14,7 +14,7 @@ function setSvg() {
|
|||||||
.then(r => r.text())
|
.then(r => r.text())
|
||||||
.then(b => {
|
.then(b => {
|
||||||
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
|
const xmlDoc = parser.parseFromString(b, 'text/xml').getElementsByTagName('svg')[0]
|
||||||
if(xmlDoc) {
|
if (xmlDoc) {
|
||||||
xmlDoc.id = 'yj-' + name
|
xmlDoc.id = 'yj-' + name
|
||||||
svgElm.appendChild(xmlDoc)
|
svgElm.appendChild(xmlDoc)
|
||||||
}
|
}
|
||||||
|
|||||||
1
static/custom/img/icon-delete.svg
Normal file
1
static/custom/img/icon-delete.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15.65869140625" height="16" viewBox="0 0 15.65869140625 16" fill="none"><path d="M14.9742 4.33334L0.682905 4.33334C0.308133 4.33334 0 4.03334 0 3.66666C0 3.3 0.308133 3 0.682905 3L14.9742 3C15.349 3 15.6571 3.3 15.6571 3.66666C15.6571 4.03334 15.349 4.33334 14.9742 4.33334Z" fill="#FFFFFF" ></path><path d="M6.02972 3.48334C6.01307 3.38334 6.00474 3.275 6.00474 3.16666C6.00474 2.15834 6.82924 1.33334 7.83697 1.33334C8.84469 1.33334 9.66919 2.15834 9.66919 3.16666C9.66919 3.275 9.66086 3.375 9.64421 3.48334L10.9851 3.48334C10.9934 3.38334 11.0017 3.275 11.0017 3.16666C11.0017 1.41666 9.5859 0 7.83697 0C6.08803 0 4.67223 1.41666 4.67223 3.16666C4.67223 3.275 4.68054 3.375 4.68888 3.48334L6.02972 3.48334ZM12.4925 3.64166L12.4925 14.6667L3.16481 14.6667L3.16481 3.64166L1.83228 3.64166L1.83228 14.9583C1.83228 15.5333 2.29867 16 2.87332 16L12.784 16C13.3586 16 13.825 15.5333 13.825 14.9583L13.825 3.64166L12.4925 3.64166Z" fill="#FFFFFF" ></path><path d="M5.50491 12.4834L5.48826 12.4834C5.12182 12.4834 4.83032 12.1917 4.83032 11.8251L4.83032 7.14172C4.83032 6.77506 5.12182 6.4834 5.48826 6.4834L5.50491 6.4834C5.87137 6.4834 6.16285 6.77506 6.16285 7.14172L6.16285 11.8334C6.16285 12.1917 5.87137 12.4834 5.50491 12.4834ZM7.83683 12.4834L7.82018 12.4834C7.45373 12.4834 7.16224 12.1917 7.16224 11.8251L7.16224 7.14172C7.16224 6.77506 7.45373 6.4834 7.82018 6.4834L7.83683 6.4834C8.20327 6.4834 8.49477 6.77506 8.49477 7.14172L8.49477 11.8334C8.49477 12.1917 8.20327 12.4834 7.83683 12.4834ZM10.1688 12.4834L10.1521 12.4834C9.78565 12.4834 9.49417 12.1917 9.49417 11.8251L9.49417 7.14172C9.49417 6.77506 9.78565 6.4834 10.1521 6.4834L10.1688 6.4834C10.5352 6.4834 10.8267 6.77506 10.8267 7.14172L10.8267 11.8334C10.8267 12.1917 10.5352 12.4834 10.1688 12.4834Z" fill="#FFFFFF" ></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.9 KiB |
1
static/custom/img/icon-resetView.svg
Normal file
1
static/custom/img/icon-resetView.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 31 KiB |
Reference in New Issue
Block a user