This commit is contained in:
takeshita
2025-11-28 18:11:37 +08:00
4 changed files with 72 additions and 15 deletions

View File

@ -18,6 +18,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
if (options.repeat) { if (options.repeat) {
repeat = Number(options.repeat) repeat = Number(options.repeat)
} }
if (options.defaultTime) {
let contentElm = document.getElementsByClassName('fly-roam')[0]
contentElm.querySelector("input[name='defaultTime']").value = options.defaultTime
}
if (options.totalTime) {
let contentElm = document.getElementsByClassName('fly-roam')[0]
contentElm.querySelector("input[name='totalTime']").value = options.totalTime
}
let viewer = sdk.viewer let viewer = sdk.viewer
let tools = new Tools(sdk) let tools = new Tools(sdk)
let active = 0 let active = 0
@ -72,6 +80,23 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
nameElm.value = name nameElm.value = name
nameElm.addEventListener('input', () => { nameElm.addEventListener('input', () => {
name = nameElm.value name = nameElm.value
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
let defaultTimeDom = contentElm.querySelector("input[name='defaultTime']")
nameElm.addEventListener('input', () => {
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
}) })
// let addListBtn = document.createElement('button'); // let addListBtn = document.createElement('button');
@ -90,7 +115,9 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
func({ func({
name: name, name: name,
points: newPoints, points: newPoints,
repeat: repeat + '' repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
}) })
// _Dialog.clickSavePath && _Dialog.clickSavePath( // _Dialog.clickSavePath && _Dialog.clickSavePath(
// { // {
@ -138,6 +165,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
points.splice(active, 0, data) points.splice(active, 0, data)
addTrElm(data) addTrElm(data)
i++ i++
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
}) })
// let modifyBtn = contentElm.getElementsByClassName('modify-point')[0] // let modifyBtn = contentElm.getElementsByClassName('modify-point')[0]
// modifyBtn.addEventListener('click', () => { // modifyBtn.addEventListener('click', () => {
@ -184,6 +219,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
} }
trList[trList.length - 1].querySelector("input[name='time']").value = 0 trList[trList.length - 1].querySelector("input[name='time']").value = 0
} }
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
}) })
repeatElm.checked = (repeat === Infinity ? true : false) repeatElm.checked = (repeat === Infinity ? true : false)
repeatElm.addEventListener('change', () => { repeatElm.addEventListener('change', () => {
@ -194,6 +236,13 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
repeat = 0 repeat = 0
} }
currentRepeat = repeat currentRepeat = repeat
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
_Dialog.changeRepeatStateCallBack && _Dialog.changeRepeatStateCallBack(repeatElm.checked) _Dialog.changeRepeatStateCallBack && _Dialog.changeRepeatStateCallBack(repeatElm.checked)
}) })
@ -260,7 +309,7 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
let modifyBtn = tr.getElementsByClassName('modify-point')[0] let modifyBtn = tr.getElementsByClassName('modify-point')[0]
modifyBtn.addEventListener('click', () => { modifyBtn.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.parentNode) {
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer) let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
points[m].position = position points[m].position = position
points[m].orientation = { points[m].orientation = {
@ -277,14 +326,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
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_play.parentNode.parentNode.parentNode) {
flyTo(sdk, points, m) flyTo(sdk, points, m)
} }
} }
}) })
e_delete.addEventListener("click", (v) => { e_delete.addEventListener("click", (v) => {
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.parentNode) {
points.splice(m, 1) points.splice(m, 1)
points[points.length - 1] && (points[points.length - 1].duration = 0) points[points.length - 1] && (points[points.length - 1].duration = 0)
tableBody.removeChild(tr) tableBody.removeChild(tr)
@ -322,6 +371,14 @@ const open = async (sdk, options = {}, _Dialog = {}, func) => {
// if (trList.length > 0) { // if (trList.length > 0) {
// trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled' // trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
// } // }
func({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
}) })
e_time.addEventListener('input', (v) => { e_time.addEventListener('input', (v) => {
isTotalTimeElm.checked = false isTotalTimeElm.checked = false

View File

@ -181,13 +181,13 @@ const MouseCoordinate = (sdk, status) => {
// contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` // contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
switch (positionType || '度') { switch (positionType || '度') {
case '度': case '度':
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${degrees.lng.toFixed(6)}°</p><p style='margin: 0;'>维度:${degrees.lat.toFixed(6)}°</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
break; break;
case '度分': case '度分':
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, true)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, true)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, true)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, true)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
break; break;
case '度分秒': case '度分秒':
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, false)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, false)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:${proj.degreesToDMS(degrees.lng, false)}</p><p style='margin: 0;'>维度:${proj.degreesToDMS(degrees.lat, false)}</p><p style='margin: 0;'>海拔:${degrees.alt.toFixed(2)} m</p></div>`
break; break;
default: default:
break; break;
@ -197,19 +197,18 @@ const MouseCoordinate = (sdk, status) => {
// let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem) // let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem)
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees)) let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees))
position = result.points[0] position = result.points[0]
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x${position.x.toFixed(6)}</p><p style='margin: 0;'>y${position.y.toFixed(6)}</p><p style='margin: 0;'>z${position.z.toFixed(6)}</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x${position.x.toFixed(6)}</p><p style='margin: 0;'>y${position.y.toFixed(6)}</p><p style='margin: 0;'>z${position.z.toFixed(6)}</p></div>`
} }
} }
else { else {
let coordinateSystem = getCoordinateSystem() let coordinateSystem = getCoordinateSystem()
if (coordinateSystem === 'EPSG:4326') { if (coordinateSystem === 'EPSG:4326') {
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:-</p><p style='margin: 0;'>维度:-</p><p style='margin: 0;'>海拔:-</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:-</p><p style='margin: 0;'>维度:-</p><p style='margin: 0;'>海拔:-</p></div>`
} }
else { else {
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x-</p><p style='margin: 0;'>y-</p><p style='margin: 0;'>z-</p></div>` contentElm.innerHTML = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x-</p><p style='margin: 0;'>y-</p><p style='margin: 0;'>z-</p></div>`
} }
} }
} }
animateUpdate() animateUpdate()

View File

@ -50,7 +50,7 @@ class BatchModel extends Base {
let tools = new Tools(sdk) let tools = new Tools(sdk)
// BatchModel.computeDis(this) // BatchModel.computeDis(this)
// if (this.options.positions.length > 0 || this.options.positions.lng) { // if (this.options.positions.length > 0 || this.options.positions.lng) {
if (this.options.spacing < 0 || options.spacing * 1 === 0) { if (options.type != '点' && (this.options.spacing < 0 || options.spacing * 1 === 0)) {
tools.message({ type: 'warning', text: '请输入正确的间距!' }) tools.message({ type: 'warning', text: '请输入正确的间距!' })
return; return;
} }

View File

@ -709,7 +709,8 @@ class Tools {
color: color, color: color,
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`, image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
space: newParam.space, space: newParam.space,
speed: newParam.speed speed: newParam.speed,
rotate: newParam.rotate
} }
param.speed = newParam.rotate ? param.speed : 0 - param.speed param.speed = newParam.rotate ? param.speed : 0 - param.speed
@ -733,11 +734,11 @@ class Tools {
myImg.src = options.image myImg.src = options.image
myImg.onload = function () { myImg.onload = function () {
options.space = Math.max(0.1, options.space); options.space = Math.max(0.1, options.space);
if (options.speed > 0 || options.speed == 0) { if (options.speed > 0 || (options.speed == 0 && options.rotate)) {
canvasEle.width = myImg.width * (options.space + 1) canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height canvasEle.height = myImg.height
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0) ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
} else { } else if (options.speed < 0 || (options.speed == 0 && !options.rotate)) {
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height); ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
canvasEle.width = myImg.width * (options.space + 1) canvasEle.width = myImg.width * (options.space + 1)
canvasEle.height = myImg.height canvasEle.height = myImg.height