Compare commits
3 Commits
d20db7c91b
...
master
Author | SHA1 | Date | |
---|---|---|---|
1afc691ec2 | |||
54afe11fa6 | |||
89b52af2d6 |
@ -30,6 +30,7 @@ let halfIntervalContourColor = '#64b6d9'
|
|||||||
let supplementaryContourShow = false
|
let supplementaryContourShow = false
|
||||||
let supplementaryContourWidth = 1.0
|
let supplementaryContourWidth = 1.0
|
||||||
let supplementaryContourColor = '#d084d1'
|
let supplementaryContourColor = '#d084d1'
|
||||||
|
let paramData = {}
|
||||||
|
|
||||||
|
|
||||||
activeHeightElm = document.createElement('div')
|
activeHeightElm = document.createElement('div')
|
||||||
@ -72,6 +73,55 @@ function accordingToCameraHeight() {
|
|||||||
// console.log(cameraHeight)
|
// console.log(cameraHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function startDraw(sdk, showData) {
|
||||||
|
show = showData
|
||||||
|
|
||||||
|
Object.keys(paramData).forEach(item => {
|
||||||
|
material.uniforms[item] = paramData[item]
|
||||||
|
})
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
let height = sdk.viewer.camera.positionCartographic.height
|
||||||
|
if (height > 16360) {
|
||||||
|
let cartographic = sdk.viewer.camera.positionCartographic
|
||||||
|
let options = {
|
||||||
|
position: {
|
||||||
|
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||||
|
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||||
|
alt: 16360,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
flyTo(sdk, options, 0.5)
|
||||||
|
}
|
||||||
|
showContour(sdk)
|
||||||
|
} else {
|
||||||
|
hideContour(sdk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function reset() {
|
||||||
|
// if (handler) {
|
||||||
|
// handler.destroy()
|
||||||
|
// }
|
||||||
|
secondaryLinesCount = 19
|
||||||
|
// show = true
|
||||||
|
equalHeightDistance = 10
|
||||||
|
activeColor = '#ffd000'
|
||||||
|
indexContourShow = true
|
||||||
|
indexContourWidth = 2.5
|
||||||
|
indexContourColor = '#43cf7c'
|
||||||
|
intermediateContourShow = true
|
||||||
|
intermediateContourWidth = 1.8
|
||||||
|
intermediateContourColor = '#ff0000'
|
||||||
|
halfIntervalContourShow = false
|
||||||
|
halfIntervalContourWidth = 1.0
|
||||||
|
halfIntervalContourColor = '#64b6d9'
|
||||||
|
supplementaryContourShow = false
|
||||||
|
supplementaryContourWidth = 1.0
|
||||||
|
supplementaryContourColor = '#d084d1'
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
async function dialog(sdk) {
|
async function dialog(sdk) {
|
||||||
_sdk = sdk
|
_sdk = sdk
|
||||||
@ -106,44 +156,44 @@ async function dialog(sdk) {
|
|||||||
sdk.viewer.scene.postRender.addEventListener(accordingToCameraHeight)
|
sdk.viewer.scene.postRender.addEventListener(accordingToCameraHeight)
|
||||||
|
|
||||||
// 显示
|
// 显示
|
||||||
let showBtn = contentElm.getElementsByClassName('show')[0]
|
// let showBtn = contentElm.getElementsByClassName('show')[0]
|
||||||
showBtn.checked = show
|
// showBtn.checked = show
|
||||||
if (showBtn.checked) {
|
// if (showBtn.checked) {
|
||||||
let height = sdk.viewer.camera.positionCartographic.height
|
// let height = sdk.viewer.camera.positionCartographic.height
|
||||||
if (height > 16360) {
|
// if (height > 16360) {
|
||||||
let cartographic = sdk.viewer.camera.positionCartographic
|
// let cartographic = sdk.viewer.camera.positionCartographic
|
||||||
let options = {
|
// let options = {
|
||||||
position: {
|
// position: {
|
||||||
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
// lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||||
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
// lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||||
alt: 16360,
|
// alt: 16360,
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
flyTo(sdk, options, 0.5)
|
// flyTo(sdk, options, 0.5)
|
||||||
}
|
// }
|
||||||
showContour(sdk)
|
// showContour(sdk)
|
||||||
}
|
// }
|
||||||
showBtn.addEventListener('change', (e) => {
|
// showBtn.addEventListener('change', (e) => {
|
||||||
if (e.target.checked) {
|
// if (e.target.checked) {
|
||||||
show = true
|
// show = true
|
||||||
let height = sdk.viewer.camera.positionCartographic.height
|
// let height = sdk.viewer.camera.positionCartographic.height
|
||||||
if (height > 16360) {
|
// if (height > 16360) {
|
||||||
let cartographic = sdk.viewer.camera.positionCartographic
|
// let cartographic = sdk.viewer.camera.positionCartographic
|
||||||
let options = {
|
// let options = {
|
||||||
position: {
|
// position: {
|
||||||
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
// lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||||
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
// lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||||
alt: 16360,
|
// alt: 16360,
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
flyTo(sdk, options, 0.5)
|
// flyTo(sdk, options, 0.5)
|
||||||
}
|
// }
|
||||||
showContour(sdk)
|
// showContour(sdk)
|
||||||
} else {
|
// } else {
|
||||||
show = false
|
// show = false
|
||||||
hideContour(sdk)
|
// hideContour(sdk)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
// 等高距
|
// 等高距
|
||||||
let equalHeightDistanceInput = contentElm.getElementsByClassName('equal-height-distance')[0]
|
let equalHeightDistanceInput = contentElm.getElementsByClassName('equal-height-distance')[0]
|
||||||
equalHeightDistanceInput.value = equalHeightDistance
|
equalHeightDistanceInput.value = equalHeightDistance
|
||||||
@ -152,7 +202,8 @@ async function dialog(sdk) {
|
|||||||
equalHeightDistance = value
|
equalHeightDistance = value
|
||||||
equalHeightDistanceInput.value = value
|
equalHeightDistanceInput.value = value
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.spacing = equalHeightDistance * 5
|
// material.uniforms.spacing = equalHeightDistance * 5
|
||||||
|
paramData.spacing = equalHeightDistance * 5
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -188,13 +239,15 @@ async function dialog(sdk) {
|
|||||||
sure: color => {
|
sure: color => {
|
||||||
activeColor = color
|
activeColor = color
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
paramData.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear: () => {
|
||||||
activeColor = 'rgba(255,255,255,1)'
|
activeColor = 'rgba(255,255,255,1)'
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
paramData.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -205,7 +258,8 @@ async function dialog(sdk) {
|
|||||||
indexContourSwitch.addEventListener('change', (e) => {
|
indexContourSwitch.addEventListener('change', (e) => {
|
||||||
indexContourShow = e.target.checked
|
indexContourShow = e.target.checked
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.indexContourShow = indexContourShow
|
// material.uniforms.indexContourShow = indexContourShow
|
||||||
|
paramData.indexContourShow = indexContourShow
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 计曲线颜色
|
// 计曲线颜色
|
||||||
@ -219,13 +273,15 @@ async function dialog(sdk) {
|
|||||||
sure: color => {
|
sure: color => {
|
||||||
indexContourColor = color
|
indexContourColor = color
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
// material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
|
paramData.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear: () => {
|
||||||
indexContourColor = 'rgba(255,255,255,1)'
|
indexContourColor = 'rgba(255,255,255,1)'
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
// material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
|
paramData.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -237,7 +293,8 @@ async function dialog(sdk) {
|
|||||||
indexContourWidth = value
|
indexContourWidth = value
|
||||||
indexContourWidthInput.value = value
|
indexContourWidthInput.value = value
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.indexContourWidth = indexContourWidth
|
// material.uniforms.indexContourWidth = indexContourWidth
|
||||||
|
paramData.indexContourWidth = indexContourWidth
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -247,7 +304,8 @@ async function dialog(sdk) {
|
|||||||
intermediateContourSwitch.addEventListener('change', (e) => {
|
intermediateContourSwitch.addEventListener('change', (e) => {
|
||||||
intermediateContourShow = e.target.checked
|
intermediateContourShow = e.target.checked
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.intermediateContourShow = intermediateContourShow
|
// material.uniforms.intermediateContourShow = intermediateContourShow
|
||||||
|
paramData.intermediateContourShow = intermediateContourShow
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 首曲线颜色
|
// 首曲线颜色
|
||||||
@ -261,13 +319,15 @@ async function dialog(sdk) {
|
|||||||
sure: color => {
|
sure: color => {
|
||||||
intermediateContourColor = color
|
intermediateContourColor = color
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
// material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
|
paramData.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear: () => {
|
||||||
intermediateContourColor = 'rgba(255,255,255,1)'
|
intermediateContourColor = 'rgba(255,255,255,1)'
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
// material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
|
paramData.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -279,7 +339,8 @@ async function dialog(sdk) {
|
|||||||
intermediateContourWidth = value
|
intermediateContourWidth = value
|
||||||
intermediateContourWidthInput.value = value
|
intermediateContourWidthInput.value = value
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.intermediateContourWidth = intermediateContourWidth
|
// material.uniforms.intermediateContourWidth = intermediateContourWidth
|
||||||
|
paramData.intermediateContourWidth = intermediateContourWidth
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -289,7 +350,8 @@ async function dialog(sdk) {
|
|||||||
halfIntervalContourSwitch.addEventListener('change', (e) => {
|
halfIntervalContourSwitch.addEventListener('change', (e) => {
|
||||||
halfIntervalContourShow = e.target.checked
|
halfIntervalContourShow = e.target.checked
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.halfIntervalContourShow = halfIntervalContourShow
|
// material.uniforms.halfIntervalContourShow = halfIntervalContourShow
|
||||||
|
paramData.halfIntervalContourShow = halfIntervalContourShow
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 间曲线颜色
|
// 间曲线颜色
|
||||||
@ -303,13 +365,15 @@ async function dialog(sdk) {
|
|||||||
sure: color => {
|
sure: color => {
|
||||||
halfIntervalContourColor = color
|
halfIntervalContourColor = color
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
// material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
|
paramData.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear: () => {
|
||||||
halfIntervalContourColor = 'rgba(255,255,255,1)'
|
halfIntervalContourColor = 'rgba(255,255,255,1)'
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
// material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
|
paramData.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -321,7 +385,8 @@ async function dialog(sdk) {
|
|||||||
halfIntervalContourWidth = value
|
halfIntervalContourWidth = value
|
||||||
halfIntervalContourWidthInput.value = value
|
halfIntervalContourWidthInput.value = value
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.halfIntervalContourWidth = halfIntervalContourWidth
|
// material.uniforms.halfIntervalContourWidth = halfIntervalContourWidth
|
||||||
|
paramData.halfIntervalContourWidth = halfIntervalContourWidth
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -331,7 +396,8 @@ async function dialog(sdk) {
|
|||||||
supplementaryContourSwitch.addEventListener('change', (e) => {
|
supplementaryContourSwitch.addEventListener('change', (e) => {
|
||||||
supplementaryContourShow = e.target.checked
|
supplementaryContourShow = e.target.checked
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.supplementaryContourShow = supplementaryContourShow
|
// material.uniforms.supplementaryContourShow = supplementaryContourShow
|
||||||
|
paramData.supplementaryContourShow = supplementaryContourShow
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 助曲线颜色
|
// 助曲线颜色
|
||||||
@ -345,13 +411,15 @@ async function dialog(sdk) {
|
|||||||
sure: color => {
|
sure: color => {
|
||||||
supplementaryContourColor = color
|
supplementaryContourColor = color
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
// material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
|
paramData.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear: () => {
|
||||||
supplementaryContourColor = 'rgba(255,255,255,1)'
|
supplementaryContourColor = 'rgba(255,255,255,1)'
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
// material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
|
paramData.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -363,7 +431,8 @@ async function dialog(sdk) {
|
|||||||
supplementaryContourWidth = value
|
supplementaryContourWidth = value
|
||||||
supplementaryContourWidthInput.value = value
|
supplementaryContourWidthInput.value = value
|
||||||
if (material) {
|
if (material) {
|
||||||
material.uniforms.supplementaryContourWidth = supplementaryContourWidth
|
// material.uniforms.supplementaryContourWidth = supplementaryContourWidth
|
||||||
|
paramData.supplementaryContourWidth = supplementaryContourWidth
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -638,4 +707,4 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export { dialog }
|
export { dialog, startDraw, reset }
|
||||||
|
@ -69,7 +69,7 @@ import {
|
|||||||
} from '../Global/MultiViewportMode'
|
} from '../Global/MultiViewportMode'
|
||||||
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
||||||
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
||||||
import { dialog as ContourDialog } from '../Global/Contour'
|
import { dialog as ContourDialog, startDraw as ContourStartDraw, reset as ContourReset } from '../Global/Contour'
|
||||||
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk } from '../Global/SplitScreen'
|
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk } from '../Global/SplitScreen'
|
||||||
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
||||||
|
|
||||||
@ -346,7 +346,9 @@ if (!window.YJ) {
|
|||||||
setActiveId: SplitScreenSetActiveId,
|
setActiveId: SplitScreenSetActiveId,
|
||||||
getSdk
|
getSdk
|
||||||
},
|
},
|
||||||
Contour: ContourDialog
|
Contour: ContourDialog,
|
||||||
|
ContourStartDraw,
|
||||||
|
ContourReset
|
||||||
}, //测量
|
}, //测量
|
||||||
Measure: {
|
Measure: {
|
||||||
GetMeasureStatus: () => {
|
GetMeasureStatus: () => {
|
||||||
|
@ -434,7 +434,7 @@ class ViewShedStage extends Tools {
|
|||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
this.end()
|
// this.end()
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.event && this.event.destroy()
|
this.event && this.event.destroy()
|
||||||
this.tip = null
|
this.tip = null
|
||||||
@ -492,6 +492,7 @@ class ViewShedStage extends Tools {
|
|||||||
text: '上一次测量未结束',
|
text: '上一次测量未结束',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
|
return
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.editevent && this.editevent.destroy()
|
this.editevent && this.editevent.destroy()
|
||||||
|
@ -13,7 +13,6 @@ import { syncSplitData } from '../../../../../Global/SplitScreen'
|
|||||||
import Dialog from '../../../../Element/Dialog';
|
import Dialog from '../../../../Element/Dialog';
|
||||||
|
|
||||||
class Tileset extends BaseTileset {
|
class Tileset extends BaseTileset {
|
||||||
#updateModelTimeout;
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @description 加载Tileset模型
|
* @description 加载Tileset模型
|
||||||
@ -199,7 +198,26 @@ class Tileset extends BaseTileset {
|
|||||||
this.oldData.type = this.type
|
this.oldData.type = this.type
|
||||||
this.oldData.accuracy = this.newData.accuracy
|
this.oldData.accuracy = this.newData.accuracy
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack({ ...this.oldData, type: this.type })
|
let newOptions = {
|
||||||
|
id: this.newData.id,
|
||||||
|
name: this.newData.name,
|
||||||
|
height: this.newData.height,
|
||||||
|
accuracy: this.newData.accuracy,
|
||||||
|
transparency: this.newData.transparency,
|
||||||
|
scale: this.newData.scale,
|
||||||
|
url: this.newData.url,
|
||||||
|
orientation: {
|
||||||
|
roll: this.newData.roll,
|
||||||
|
heading: this.newData.heading,
|
||||||
|
pitch: this.newData.pitch
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
lng: this.newData.lng,
|
||||||
|
lat: this.newData.lat,
|
||||||
|
alt: this.newData.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack({ ...newOptions })
|
||||||
syncSplitData(this.sdk, this.oldData.id)
|
syncSplitData(this.sdk, this.oldData.id)
|
||||||
},
|
},
|
||||||
resetCallBack: () => {
|
resetCallBack: () => {
|
||||||
@ -308,9 +326,9 @@ class Tileset extends BaseTileset {
|
|||||||
}
|
}
|
||||||
this.editObj && this.editObj.update()
|
this.editObj && this.editObj.update()
|
||||||
|
|
||||||
clearTimeout(this.#updateModelTimeout)
|
clearTimeout(this._updateModelTimeout)
|
||||||
this.#updateModelTimeout = setTimeout(() => {
|
this._updateModelTimeout = setTimeout(() => {
|
||||||
clearTimeout(this.#updateModelTimeout)
|
clearTimeout(this._updateModelTimeout)
|
||||||
let center = this.cartesian3Towgs84(this.entity.boundingSphere.center, this.sdk.viewer)
|
let center = this.cartesian3Towgs84(this.entity.boundingSphere.center, this.sdk.viewer)
|
||||||
let circle = turf.circle([center.lng, center.lat], this.entity.boundingSphere.radius / 1000, { steps: 360, units: 'kilometers' });
|
let circle = turf.circle([center.lng, center.lat], this.entity.boundingSphere.radius / 1000, { steps: 360, units: 'kilometers' });
|
||||||
for (let [key, entity] of this.sdk.entityMap) {
|
for (let [key, entity] of this.sdk.entityMap) {
|
||||||
|
@ -32,6 +32,8 @@ class BaseTileset extends BaseSource {
|
|||||||
* */
|
* */
|
||||||
constructor(sdk, options) {
|
constructor(sdk, options) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
|
this._loadEvent = void 0
|
||||||
|
this._loaded = false
|
||||||
this.setDefaultValue()
|
this.setDefaultValue()
|
||||||
this.watchs = []
|
this.watchs = []
|
||||||
this.positionCallBack = null
|
this.positionCallBack = null
|
||||||
@ -40,6 +42,7 @@ class BaseTileset extends BaseSource {
|
|||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
this._element_style = null
|
this._element_style = null
|
||||||
this.options.accuracy = options.accuracy ? Number(options.accuracy.toFixed(1)) : 1
|
this.options.accuracy = options.accuracy ? Number(options.accuracy.toFixed(1)) : 1
|
||||||
|
this.options.orientation = this.options.orientation || {}
|
||||||
this.options.position = this.options.position || {}
|
this.options.position = this.options.position || {}
|
||||||
this.oldData = {
|
this.oldData = {
|
||||||
id: this.options.id,
|
id: this.options.id,
|
||||||
@ -51,9 +54,9 @@ class BaseTileset extends BaseSource {
|
|||||||
lng: this.options.position.lng,
|
lng: this.options.position.lng,
|
||||||
lat: this.options.position.lat,
|
lat: this.options.position.lat,
|
||||||
scale: (this.options.scale || this.options.scale === 0) ? this.options.scale : 1,
|
scale: (this.options.scale || this.options.scale === 0) ? this.options.scale : 1,
|
||||||
roll: this.options.roll || 0,
|
roll: this.options.orientation.roll || 0,
|
||||||
heading: this.options.heading || 0,
|
heading: this.options.orientation.heading || 0,
|
||||||
pitch: this.options.pitch || 0
|
pitch: this.options.orientation.pitch || 0
|
||||||
}
|
}
|
||||||
this.newData = {
|
this.newData = {
|
||||||
id: this.options.id,
|
id: this.options.id,
|
||||||
@ -65,9 +68,9 @@ class BaseTileset extends BaseSource {
|
|||||||
lng: this.options.position.lng,
|
lng: this.options.position.lng,
|
||||||
lat: this.options.position.lat,
|
lat: this.options.position.lat,
|
||||||
scale: (this.options.scale || this.options.scale === 0) ? this.options.scale : 1,
|
scale: (this.options.scale || this.options.scale === 0) ? this.options.scale : 1,
|
||||||
roll: this.options.roll || 0,
|
roll: this.options.orientation.roll || 0,
|
||||||
heading: this.options.heading || 0,
|
heading: this.options.orientation.heading || 0,
|
||||||
pitch: this.options.pitch || 0
|
pitch: this.options.orientation.pitch || 0
|
||||||
}
|
}
|
||||||
this.tileset = undefined
|
this.tileset = undefined
|
||||||
this.editObj = new Controller(this.sdk)
|
this.editObj = new Controller(this.sdk)
|
||||||
@ -367,6 +370,12 @@ class BaseTileset extends BaseSource {
|
|||||||
this.pitch = this.oldData.pitch
|
this.pitch = this.oldData.pitch
|
||||||
this.transparency = this.oldData.transparency
|
this.transparency = this.oldData.transparency
|
||||||
|
|
||||||
|
this.loaded = true
|
||||||
|
this._loaded = true
|
||||||
|
if (this._loadEvent) {
|
||||||
|
this._loadEvent(this.entity)
|
||||||
|
}
|
||||||
|
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
|
||||||
regMoveCallback(this.entity.id, this.mouseMoveCB, this)
|
regMoveCallback(this.entity.id, this.mouseMoveCB, this)
|
||||||
@ -620,6 +629,15 @@ class BaseTileset extends BaseSource {
|
|||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
load(callback) {
|
||||||
|
if (this._loaded) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._loadEvent = callback
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BaseTileset
|
export default BaseTileset
|
||||||
|
@ -12,7 +12,7 @@ import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
|
|||||||
import MouseTip from '../../../MouseTip'
|
import MouseTip from '../../../MouseTip'
|
||||||
import CircleDiffuseMaterialProperty from '../../Materail/CircleRippleMaterialProperty'
|
import CircleDiffuseMaterialProperty from '../../Materail/CircleRippleMaterialProperty'
|
||||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
|
|
||||||
class CircleDiffuse extends Base {
|
class CircleDiffuse extends Base {
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ class CircleDiffuse extends Base {
|
|||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.lng = options.lng
|
this.options.lng = options.lng
|
||||||
this.options.lat = options.lat
|
this.options.lat = options.lat
|
||||||
this.options.color = options.color || '#1FA8E3'
|
this.options.color = options.color || '#ff0000'
|
||||||
this.options.transparency = (options.transparency || options.transparency === 0) ? options.transparency : 1
|
this.options.transparency = (options.transparency || options.transparency === 0) ? options.transparency : 1
|
||||||
if (this.options.transparency > 1) {
|
if (this.options.transparency > 1) {
|
||||||
this.options.transparency = 1
|
this.options.transparency = 1
|
||||||
@ -86,7 +86,7 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
this.options.circle = options.circle || [{ radius: 10 }]
|
this.options.circle = options.circle || [{ radius: 10 }]
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if(this.options.circle[i].radius>999999) {
|
if (this.options.circle[i].radius > 999999) {
|
||||||
this.options.circle[i].radius = 999999
|
this.options.circle[i].radius = 999999
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,6 @@ class CircleDiffuse extends Base {
|
|||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
|
||||||
show: options.label.show || false,
|
show: options.label.show || false,
|
||||||
position: options.label.position,
|
position: options.label.position,
|
||||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||||
@ -114,17 +113,12 @@ class CircleDiffuse extends Base {
|
|||||||
this.options.instruct = options.instruct || ''
|
this.options.instruct = options.instruct || ''
|
||||||
this.options.operatingPoint = options.operatingPoint || ''
|
this.options.operatingPoint = options.operatingPoint || ''
|
||||||
this.options.attribute = options.attribute || {}
|
this.options.attribute = options.attribute || {}
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
|
||||||
this.options.attribute.link = this.options.attribute.link || {}
|
this.options.attribute.link = this.options.attribute.link || {}
|
||||||
this.options.attribute.link.content = this.options.attribute.link.content || []
|
this.options.attribute.link.content = this.options.attribute.link.content || []
|
||||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
|
||||||
this.options.attribute.camera.content = this.options.attribute.camera.content || []
|
delete this.options.attribute.camera
|
||||||
this.options.attribute.ISC = this.options.attribute.ISC || {}
|
delete this.options.attribute.vr
|
||||||
this.options.attribute.ISC.content = this.options.attribute.ISC.content || []
|
delete this.options.attribute.goods
|
||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
|
||||||
|
|
||||||
let radius = 0
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
@ -356,8 +350,7 @@ class CircleDiffuse extends Base {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.picking = true
|
this.picking = true
|
||||||
}, 500);
|
}, 500);
|
||||||
if(this.label && this.label.entity && this.label.entity.billboard)
|
if (this.label && this.label.entity && this.label.entity.billboard) {
|
||||||
{
|
|
||||||
this.label.entity.billboard.color = Cesium.Color.fromCssColorString(`rgba(255,255,255,1)`)
|
this.label.entity.billboard.color = Cesium.Color.fromCssColorString(`rgba(255,255,255,1)`)
|
||||||
}
|
}
|
||||||
if (this.event) {
|
if (this.event) {
|
||||||
@ -407,14 +400,18 @@ class CircleDiffuse extends Base {
|
|||||||
return this.options.circle
|
return this.options.circle
|
||||||
}
|
}
|
||||||
set circle(v) {
|
set circle(v) {
|
||||||
console.log(v)
|
|
||||||
this.options.circle = v || [{ radius: 10 }]
|
this.options.circle = v || [{ radius: 10 }]
|
||||||
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if(this.options.circle[i].radius>999999) {
|
if (Number(this.options.circle[i].radius) > 999999) {
|
||||||
this.options.circle[i].radius = 999999
|
this.options.circle[i].radius = 999999
|
||||||
}
|
}
|
||||||
|
if (Number(this.options.circle[i].radius) > radius) {
|
||||||
|
radius = Number(this.options.circle[i].radius)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._createCircleElm()
|
this._radius = radius
|
||||||
|
CircleDiffuse.create(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
get speed() {
|
get speed() {
|
||||||
@ -672,352 +669,10 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get instruct() {
|
|
||||||
return this.options.instruct
|
|
||||||
}
|
|
||||||
set instruct(v) {
|
|
||||||
this.options.instruct = v
|
|
||||||
this._elms.instruct && this._elms.instruct.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
get operatingPoint() {
|
|
||||||
return this.options.operatingPoint
|
|
||||||
}
|
|
||||||
set operatingPoint(v) {
|
|
||||||
this.options.operatingPoint = v
|
|
||||||
this._elms.operatingPoint && this._elms.operatingPoint.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeType() {
|
|
||||||
return this.options.attributeType
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeType(v) {
|
|
||||||
this.options.attributeType = v
|
|
||||||
this._elms.attributeType && this._elms.attributeType.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
let attributeContent = this._DialogObject._element.content.getElementsByClassName('attribute-content')
|
|
||||||
for (let i = 0; i < attributeContent.length; i++) {
|
|
||||||
if (attributeContent[i].className.indexOf('attribute-content-' + v) > -1) {
|
|
||||||
attributeContent[i].style.display = 'block';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributeContent[i].style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeLink() {
|
|
||||||
return this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeLink(v) {
|
|
||||||
this.options.attribute.link.content = v
|
|
||||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-link').length == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
tableContent.innerHTML = ''
|
|
||||||
if (this.options.attribute.link.content.length > 0) {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
|
|
||||||
let tr = `
|
|
||||||
<div class="tr">
|
|
||||||
<div class="td">` + this.options.attribute.link.content[i].name + `</div>
|
|
||||||
<div class="td">` + this.options.attribute.link.content[i].url + `</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="linkEdit">编辑</button>
|
|
||||||
<button @click="linkDelete">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>`
|
|
||||||
let trElm = document.createRange().createContextualFragment(tr)
|
|
||||||
tableContent.appendChild(trElm)
|
|
||||||
}
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
let fun = {
|
|
||||||
linkEdit: async (index) => {
|
|
||||||
this.attributeLink = await this.options.attribute.link.content
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
if (index === i) {
|
|
||||||
let height = item[i].offsetHeight
|
|
||||||
let html = `
|
|
||||||
<div class="td">
|
|
||||||
<input class="input" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<textarea class="input link-edit" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="confirmEdit">确认</button>
|
|
||||||
<button @click="cancelEdit">取消</button>
|
|
||||||
</div>`
|
|
||||||
item[i].innerHTML = html
|
|
||||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
|
||||||
textareaElm.style.height = (height - 10) + 'px'
|
|
||||||
let td = item[i].getElementsByClassName('td')
|
|
||||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].name
|
|
||||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].url
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] || !btn[n].attributes) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
linkDelete: (i) => {
|
|
||||||
this.options.attribute.link.content.splice(i, 1)
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmEdit: (value, i) => {
|
|
||||||
let name = value.name && value.name.replace(/\s/g, "")
|
|
||||||
let url = value.url && value.url.replace(/\s/g, "")
|
|
||||||
if (name && url) {
|
|
||||||
this.options.attribute.link.content[i] = value
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
|
||||||
message: '名称或链接不能为空!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
cancelEdit: () => {
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
fileSelect: (value, i) => {
|
|
||||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
|
||||||
fileElm.click()
|
|
||||||
fileElm.removeEventListener('change', fileSelect)
|
|
||||||
fileElm.addEventListener('change', fileSelect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let fileSelect = (event) => {
|
|
||||||
if (event.target.value) {
|
|
||||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
|
||||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
|
||||||
event.target.value = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] ||!btn[n].attributes) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value](i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeCamera() {
|
|
||||||
return this.options.attribute.camera.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeCamera(v) {
|
|
||||||
this.options.attribute.camera.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeISC() {
|
|
||||||
return this.options.attribute.ISC.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeISC(v) {
|
|
||||||
this.options.attribute.ISC.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeVr() {
|
|
||||||
return this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeVr(v) {
|
|
||||||
this.options.attribute.vr.content = v
|
|
||||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-vr').length == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
tableContent.innerHTML = ''
|
|
||||||
if (this.options.attribute.vr.content.length > 0) {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.options.attribute.vr.content.length; i++) {
|
|
||||||
let tr = `
|
|
||||||
<div class="tr">
|
|
||||||
<div class="td">` + this.options.attribute.vr.content[i].name + `</div>
|
|
||||||
<div class="td">` + this.options.attribute.vr.content[i].url + `</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="vrEdit">编辑</button>
|
|
||||||
<button @click="vrDelete">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>`
|
|
||||||
let trElm = document.createRange().createContextualFragment(tr)
|
|
||||||
tableContent.appendChild(trElm)
|
|
||||||
}
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
let fun = {
|
|
||||||
vrEdit: async (index) => {
|
|
||||||
this.attributeVr = await this.options.attribute.vr.content
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
if (index === i) {
|
|
||||||
let height = item[i].offsetHeight
|
|
||||||
let html = `
|
|
||||||
<div class="td">
|
|
||||||
<input class="input" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<textarea class="input link-edit" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="confirmEdit">确认</button>
|
|
||||||
<button @click="cancelEdit">取消</button>
|
|
||||||
</div>`
|
|
||||||
item[i].innerHTML = html
|
|
||||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
|
||||||
textareaElm.style.height = (height - 10) + 'px'
|
|
||||||
let td = item[i].getElementsByClassName('td')
|
|
||||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].name
|
|
||||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].url
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] ||!btn[n].attributes) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
vrDelete: (i) => {
|
|
||||||
this.options.attribute.vr.content.splice(i, 1)
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmEdit: (value, i) => {
|
|
||||||
let name = value.name && value.name.replace(/\s/g, "")
|
|
||||||
let url = value.url && value.url.replace(/\s/g, "")
|
|
||||||
if (name && url) {
|
|
||||||
this.options.attribute.vr.content[i] = value
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
|
||||||
message: '名称或链接不能为空!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
cancelEdit: () => {
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
fileSelect: (value, i) => {
|
|
||||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
|
||||||
fileElm.click()
|
|
||||||
fileElm.removeEventListener('change', fileSelect)
|
|
||||||
fileElm.addEventListener('change', fileSelect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let fileSelect = (event) => {
|
|
||||||
if (event.target.value) {
|
|
||||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
|
||||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
|
||||||
event.target.value = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] ||!btn[n].attributes) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value](i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeGoods() {
|
|
||||||
return this.options.attribute.goods.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeGoods(v) {
|
|
||||||
this.options.attribute.goods.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
async flyTo(options = {}) {
|
async flyTo(options = {}) {
|
||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
closeViewFollow(this.sdk)
|
closeViewFollow(this.sdk)
|
||||||
|
|
||||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||||
let orientation = {
|
let orientation = {
|
||||||
@ -1084,6 +739,7 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
async edit(state) {
|
async edit(state) {
|
||||||
|
return
|
||||||
let _this = this
|
let _this = this
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
|
|
||||||
@ -1340,13 +996,6 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
||||||
this.instruct = this.originalOptions.instruct
|
this.instruct = this.originalOptions.instruct
|
||||||
this.operatingPoint = this.originalOptions.operatingPoint
|
this.operatingPoint = this.originalOptions.operatingPoint
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
this.attributeCamera = this.options.attribute.camera.content
|
|
||||||
this.attributeGoods = this.options.attribute.goods.content
|
|
||||||
this.attributeISC = this.options.attribute.ISC.content
|
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
|
|
||||||
let radius = 0
|
let radius = 0
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
@ -1374,224 +1023,6 @@ class CircleDiffuse extends Base {
|
|||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
instructSubmit() {
|
|
||||||
this.Dialog.instructSubmit && this.Dialog.instructSubmit(this.options.id, this.options.label.text, this.instruct)
|
|
||||||
this.originalOptions.instruct = this.instruct
|
|
||||||
}
|
|
||||||
|
|
||||||
operatingPointSubmit() {
|
|
||||||
this.Dialog.operatingPointSubmit && this.Dialog.operatingPointSubmit(this.options.id, this.options.label.text, this.operatingPoint)
|
|
||||||
this.originalOptions.operatingPoint = this.operatingPoint
|
|
||||||
}
|
|
||||||
|
|
||||||
_createCircleElm() {
|
|
||||||
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
|
|
||||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
|
||||||
let unit = unitDataLegpElm ? unitDataLegpElm.value : '米'
|
|
||||||
let circleContentElm = this._DialogObject._element.content.getElementsByClassName('circle-content-box')[0]
|
|
||||||
circleContentElm.innerHTML = ''
|
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
|
||||||
let circleElm = document.createElement('div');
|
|
||||||
circleElm.className = 'row'
|
|
||||||
let addString = ''
|
|
||||||
let deleteString = '<button class="circle-minus"><svg class="icon-minus"><use xlink:href="#yj-icon-minus"></use></svg></button>'
|
|
||||||
if (i === 0 && i === this.options.circle.length - 1) {
|
|
||||||
deleteString = ''
|
|
||||||
}
|
|
||||||
if (i === this.options.circle.length - 1) {
|
|
||||||
addString = `<button class="circle-add" style="margin-left: 5px;"><svg class="icon-add2"><use xlink:href="#yj-icon-add2"></use></svg></button>`
|
|
||||||
}
|
|
||||||
circleElm.innerHTML = `
|
|
||||||
<div class="col">
|
|
||||||
<span class="label">半径</span>
|
|
||||||
<div class="input-number input-number-unit-1">
|
|
||||||
<input class="input" type="number" title="" min="0" max="999999" style="width: 130px;">
|
|
||||||
<span class="unit">${unit === '米' ? 'm' : 'km'}</span>
|
|
||||||
<span class="arrow"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col" style="flex-direction: row-reverse;">
|
|
||||||
<div class="color"></div>
|
|
||||||
<span class="label">扩散颜色</span>
|
|
||||||
</div>
|
|
||||||
<div class="col" style="flex-direction: row-reverse;">
|
|
||||||
${addString}
|
|
||||||
${deleteString}
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
let inputElm = circleElm.getElementsByClassName('input')[0]
|
|
||||||
inputElm.value = this.options.circle[i].radius / (unit === '米' ? 1 : 1000)
|
|
||||||
inputElm.addEventListener('input', (e) => {
|
|
||||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
|
||||||
let unit = unitDataLegpElm.value
|
|
||||||
if (e.target.value || e.target.value === 0) {
|
|
||||||
let value = e.target.value
|
|
||||||
value = Number(value)
|
|
||||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
|
||||||
if (((!e.target.max) && (!e.target.min)) || ((value <= (Number(e.target.max) / (unit === '米' ? 1 : 1000))) && value >= Number(e.target.min))) {
|
|
||||||
if (unit === '米') {
|
|
||||||
value = Math.floor(value * 100) / 100
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = Math.floor(value * 100000) / 100000
|
|
||||||
}
|
|
||||||
this.options.circle[i].radius = value * (unit === '米' ? 1 : 1000)
|
|
||||||
let radius = 0
|
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
|
||||||
if (Number(this.options.circle[i].radius) > radius) {
|
|
||||||
radius = Number(this.options.circle[i].radius)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._radius = radius
|
|
||||||
// inputElm.value = value
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
inputElm.addEventListener('blur', (e) => {
|
|
||||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
|
||||||
let unit = unitDataLegpElm.value
|
|
||||||
if (e.target.value || e.target.value === 0) {
|
|
||||||
let value = e.target.value
|
|
||||||
value = Number(value)
|
|
||||||
if ((e.target.max) && value > (Number(e.target.max) / (unit === '米' ? 1 : 1000))) {
|
|
||||||
value = (Number(e.target.max) / (unit === '米' ? 1 : 1000))
|
|
||||||
}
|
|
||||||
if ((e.target.min) && value < Number(e.target.min)) {
|
|
||||||
value = Number(e.target.min)
|
|
||||||
}
|
|
||||||
if (unit === '米') {
|
|
||||||
value = Math.floor(value * 100) / 100
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = Math.floor(value * 100000) / 100000
|
|
||||||
}
|
|
||||||
this.options.circle[i].radius = value * (unit === '米' ? 1 : 1000)
|
|
||||||
let radius = 0
|
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
|
||||||
if (Number(this.options.circle[i].radius) > radius) {
|
|
||||||
radius = Number(this.options.circle[i].radius)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._radius = radius
|
|
||||||
inputElm.value = value
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 颜色组件
|
|
||||||
let colorPicker = new YJColorPicker({
|
|
||||||
el: circleElm.getElementsByClassName("color")[0],
|
|
||||||
size: 'mini',//颜色box类型
|
|
||||||
alpha: false,//是否开启透明度
|
|
||||||
defaultColor: this.options.circle[i].color || this.options.color,
|
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
|
||||||
sure: (color) => {
|
|
||||||
this.options.circle[i].color = color
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
},//点击确认按钮事件回调
|
|
||||||
clear: () => {
|
|
||||||
this.options.circle[i].color = 'rgba(255,255,255,1)'
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
},//点击清空按钮事件回调
|
|
||||||
})
|
|
||||||
// 减
|
|
||||||
let minusElm = circleElm.getElementsByClassName('circle-minus')[0]
|
|
||||||
minusElm && minusElm.addEventListener('click', () => {
|
|
||||||
this.options.circle.splice(i, 1)
|
|
||||||
let radius = 0
|
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
|
||||||
if (Number(this.options.circle[i].radius) > radius) {
|
|
||||||
radius = Number(this.options.circle[i].radius)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._radius = radius
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
this._createCircleElm()
|
|
||||||
})
|
|
||||||
// 加
|
|
||||||
let addElm = circleElm.getElementsByClassName('circle-add')[0]
|
|
||||||
addElm && addElm.addEventListener('click', () => {
|
|
||||||
this.options.circle.push({
|
|
||||||
radius: 0,
|
|
||||||
color: 'rgba(255,255,255,1)'
|
|
||||||
})
|
|
||||||
let radius = 0
|
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
|
||||||
if (Number(this.options.circle[i].radius) > radius) {
|
|
||||||
radius = Number(this.options.circle[i].radius)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._radius = radius
|
|
||||||
CircleDiffuse.create(this)
|
|
||||||
this._createCircleElm()
|
|
||||||
})
|
|
||||||
|
|
||||||
circleContentElm.appendChild(circleElm)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_addLink() {
|
|
||||||
// document.getElementsByClassName
|
|
||||||
if (this._DialogObject._element.content.getElementsByClassName('link_add')[0].value) {
|
|
||||||
this.options.attribute.link.content.push({
|
|
||||||
name: '链接',
|
|
||||||
url: this._DialogObject._element.content.getElementsByClassName('link_add')[0].value
|
|
||||||
})
|
|
||||||
this._DialogObject._element.content.getElementsByClassName('link_add')[0].value = ''
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Dialog.clickAddLink && this.Dialog.clickAddLink()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addAttributeLink(link) {
|
|
||||||
this.options.attribute.link.content.push({
|
|
||||||
name: '链接',
|
|
||||||
url: link
|
|
||||||
})
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
|
|
||||||
_addRr() {
|
|
||||||
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
|
|
||||||
this.options.attribute.vr.content.push({
|
|
||||||
name: '全景图' ,
|
|
||||||
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
|
|
||||||
})
|
|
||||||
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Dialog.clickAddVr && this.Dialog.clickAddVr()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addAttributeRr(vr) {
|
|
||||||
this.options.attribute.vr.content.push({
|
|
||||||
name: '全景图' ,
|
|
||||||
url: vr
|
|
||||||
})
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开富文本框
|
|
||||||
*/
|
|
||||||
openRichTextEditor(e) {
|
|
||||||
richText.open(this.options.id, this.options.name, this.options.richTextContent)
|
|
||||||
richText.primaryCallBack = (content) => {
|
|
||||||
this.options.richTextContent = content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
||||||
options.x = (options.x || options.x === 0) ? options.x : 10
|
options.x = (options.x || options.x === 0) ? options.x : 10
|
||||||
options.y = (options.y || options.y === 0) ? options.y : 10
|
options.y = (options.y || options.y === 0) ? options.y : 10
|
||||||
|
@ -225,7 +225,7 @@ class CircleObject extends Base {
|
|||||||
return this.options.radius
|
return this.options.radius
|
||||||
}
|
}
|
||||||
set radius(v) {
|
set radius(v) {
|
||||||
this.options.radius = v
|
this.options.radius = Number(v)
|
||||||
this.renewPositions()
|
this.renewPositions()
|
||||||
this.entity.polygon.hierarchy = new Cesium.PolygonHierarchy(this.positions)
|
this.entity.polygon.hierarchy = new Cesium.PolygonHierarchy(this.positions)
|
||||||
this.entity.polyline.positions = [
|
this.entity.polyline.positions = [
|
||||||
|
@ -256,7 +256,7 @@ class CurvelineObject extends Base {
|
|||||||
return this.options.wordsName
|
return this.options.wordsName
|
||||||
}
|
}
|
||||||
set wordsName(v) {
|
set wordsName(v) {
|
||||||
this.options.wordsName = v
|
this.options.wordsName = Number(v)
|
||||||
|
|
||||||
let _this = this
|
let _this = this
|
||||||
if (!this.noseToTail) {
|
if (!this.noseToTail) {
|
||||||
|
@ -263,7 +263,7 @@ class PolylineObject extends Base {
|
|||||||
return this.options.wordsName
|
return this.options.wordsName
|
||||||
}
|
}
|
||||||
set wordsName(v) {
|
set wordsName(v) {
|
||||||
this.options.wordsName = v
|
this.options.wordsName = Number(v)
|
||||||
|
|
||||||
let _this = this
|
let _this = this
|
||||||
if (!this.noseToTail) {
|
if (!this.noseToTail) {
|
||||||
|
@ -206,7 +206,7 @@ class GroundText extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set angle(v) {
|
set angle(v) {
|
||||||
this.options.angle = v
|
this.options.angle = Number(v)
|
||||||
this._elms.angle &&
|
this._elms.angle &&
|
||||||
this._elms.angle.forEach(item => {
|
this._elms.angle.forEach(item => {
|
||||||
item.value = v
|
item.value = v
|
||||||
@ -218,7 +218,7 @@ class GroundText extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set scale(v) {
|
set scale(v) {
|
||||||
this.options.scale = v
|
this.options.scale = Number(v)
|
||||||
this._elms.scale &&
|
this._elms.scale &&
|
||||||
this._elms.scale.forEach(item => {
|
this._elms.scale.forEach(item => {
|
||||||
item.value = v
|
item.value = v
|
||||||
@ -250,7 +250,7 @@ class GroundText extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set speed(v) {
|
set speed(v) {
|
||||||
this.options.speed = v
|
this.options.speed = Number(v)
|
||||||
let canvas = this.getcanvas()
|
let canvas = this.getcanvas()
|
||||||
this.entity.rectangle.material = new Cesium.CustomMaterialSource({
|
this.entity.rectangle.material = new Cesium.CustomMaterialSource({
|
||||||
image: canvas.toDataURL('image/png'),
|
image: canvas.toDataURL('image/png'),
|
||||||
|
@ -163,7 +163,7 @@ class StandText extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set speed(v) {
|
set speed(v) {
|
||||||
this.options.speed = v
|
this.options.speed = Number(v)
|
||||||
this.entity.wall.material = this.getMaterial()
|
this.entity.wall.material = this.getMaterial()
|
||||||
this._elms.speed && this._elms.speed.forEach((item) => {
|
this._elms.speed && this._elms.speed.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
|
@ -15,11 +15,6 @@ import { setSplitDirection, syncSplitData, setActiveId, getSdk } from '../../../
|
|||||||
|
|
||||||
class TrajectoryMotion extends Base {
|
class TrajectoryMotion extends Base {
|
||||||
#timeoutEventObject = null
|
#timeoutEventObject = null
|
||||||
#lineEdit = false
|
|
||||||
#_requestAnimationFrameEventId
|
|
||||||
#_requestAnimationFrameEventId2
|
|
||||||
#mouseRightevent
|
|
||||||
#firstPersonViewEvent
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @description 轨迹运动
|
* @description 轨迹运动
|
||||||
@ -99,12 +94,13 @@ class TrajectoryMotion extends Base {
|
|||||||
this.options.line.smooth = options.line.smooth ? options.line.smooth : false
|
this.options.line.smooth = options.line.smooth ? options.line.smooth : false
|
||||||
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
|
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
|
||||||
this.positions_smooth = []
|
this.positions_smooth = []
|
||||||
this.options.unitFuelConsumption = options.unitFuelConsumption || 0
|
|
||||||
this.options.ground = options.ground || false
|
this.options.ground = options.ground || false
|
||||||
this.options.state = (options.state || options.state === false) ? options.state : true
|
this.options.state = (options.state || options.state === false) ? options.state : true
|
||||||
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
|
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
|
||||||
this.keyPoints = []
|
this.keyPoints = []
|
||||||
this.realTimePositions = []
|
this.realTimePositions = []
|
||||||
|
this._lineEdit = false
|
||||||
|
this._keyPoint = false
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this.realTimeRouteArray = []
|
this.realTimeRouteArray = []
|
||||||
@ -114,7 +110,6 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
|
||||||
show: options.label.show || false,
|
show: options.label.show || false,
|
||||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||||
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
||||||
@ -203,7 +198,6 @@ class TrajectoryMotion extends Base {
|
|||||||
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false)
|
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false)
|
||||||
}
|
}
|
||||||
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
|
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
|
||||||
this.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
|
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
|
||||||
@ -226,7 +220,6 @@ class TrajectoryMotion extends Base {
|
|||||||
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false
|
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false
|
||||||
}
|
}
|
||||||
this.label && (this.label.show = false)
|
this.label && (this.label.show = false)
|
||||||
this.fuelLabel && (this.fuelLabel.show = false)
|
|
||||||
this.viewFollow = false
|
this.viewFollow = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,17 +274,14 @@ class TrajectoryMotion extends Base {
|
|||||||
// Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix)
|
// Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix)
|
||||||
// Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position)
|
// Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position)
|
||||||
this.label && (this.label.show = this.label.show)
|
this.label && (this.label.show = this.label.show)
|
||||||
this.fuelLabel && (this.fuelLabel.show = this.fuelLabel.show)
|
|
||||||
if (this.options.label.position) {
|
if (this.options.label.position) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.options.label.position.alt) {
|
if (this.options.label.position.alt) {
|
||||||
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
|
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
|
||||||
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
|
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
|
||||||
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height])
|
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height])
|
||||||
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height])
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 0)
|
}, 0)
|
||||||
@ -640,7 +630,7 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
set state(v) {
|
set state(v) {
|
||||||
this.options.state = v
|
this.options.state = v
|
||||||
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||||
if (this.editObj) {
|
if (this.editObj) {
|
||||||
this.editObj.destroy()
|
this.editObj.destroy()
|
||||||
this.editObj = null
|
this.editObj = null
|
||||||
@ -667,7 +657,7 @@ class TrajectoryMotion extends Base {
|
|||||||
let positionCamera = { ...this.sdk.viewer.camera._position }
|
let positionCamera = { ...this.sdk.viewer.camera._position }
|
||||||
|
|
||||||
let _this = this
|
let _this = this
|
||||||
this.#_requestAnimationFrameEventId = requestAnimationFrame(function fn() {
|
this._requestAnimationFrameEventId = requestAnimationFrame(function fn() {
|
||||||
if (_this.firstPersonView) {
|
if (_this.firstPersonView) {
|
||||||
_this.sdk.viewer.camera.setView({
|
_this.sdk.viewer.camera.setView({
|
||||||
destination: { ...positionCamera },
|
destination: { ...positionCamera },
|
||||||
@ -678,7 +668,7 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_this.#_requestAnimationFrameEventId = requestAnimationFrame(fn)
|
_this._requestAnimationFrameEventId = requestAnimationFrame(fn)
|
||||||
})
|
})
|
||||||
this.TweenAnimate.pause()
|
this.TweenAnimate.pause()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -817,10 +807,10 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get keyPointShow() {
|
get keyPointShow() {
|
||||||
return this.options.line.keyPoint
|
return this._keyPoint
|
||||||
}
|
}
|
||||||
set keyPointShow(v) {
|
set keyPointShow(v) {
|
||||||
this.options.line.keyPoint = v
|
this._keyPoint = v
|
||||||
for (let i = 0; i < this.keyPoints.length; i++) {
|
for (let i = 0; i < this.keyPoints.length; i++) {
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
this.keyPoints[i].show = v
|
this.keyPoints[i].show = v
|
||||||
@ -831,7 +821,7 @@ class TrajectoryMotion extends Base {
|
|||||||
})
|
})
|
||||||
if (!v && this.lineEdit) {
|
if (!v && this.lineEdit) {
|
||||||
// 关闭线编辑
|
// 关闭线编辑
|
||||||
this.#lineEdit = v
|
this._lineEdit = v
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
this.event && this.event.destroy()
|
this.event && this.event.destroy()
|
||||||
this.ControllerObject && this.ControllerObject.destroy()
|
this.ControllerObject && this.ControllerObject.destroy()
|
||||||
@ -844,7 +834,7 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get lineEdit() {
|
get lineEdit() {
|
||||||
return this.#lineEdit
|
return this._lineEdit
|
||||||
}
|
}
|
||||||
|
|
||||||
set lineEdit(v) {
|
set lineEdit(v) {
|
||||||
@ -963,7 +953,7 @@ class TrajectoryMotion extends Base {
|
|||||||
this.keyPointShow = v
|
this.keyPointShow = v
|
||||||
this.ControllerObject.destroy()
|
this.ControllerObject.destroy()
|
||||||
}
|
}
|
||||||
this.#lineEdit = v
|
this._lineEdit = v
|
||||||
this._elms.lineEdit && this._elms.lineEdit.forEach((item) => {
|
this._elms.lineEdit && this._elms.lineEdit.forEach((item) => {
|
||||||
item.checked = v
|
item.checked = v
|
||||||
})
|
})
|
||||||
@ -1008,8 +998,8 @@ class TrajectoryMotion extends Base {
|
|||||||
if (get2DView() || splitSdk.sdkD || !this.show) {
|
if (get2DView() || splitSdk.sdkD || !this.show) {
|
||||||
v = false
|
v = false
|
||||||
}
|
}
|
||||||
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||||
this.#firstPersonViewEvent && this.#firstPersonViewEvent.destroy()
|
this._firstPersonViewEvent && this._firstPersonViewEvent.destroy()
|
||||||
this.sdk.viewer._firstPersonView = v
|
this.sdk.viewer._firstPersonView = v
|
||||||
this.options.firstPersonView = v
|
this.options.firstPersonView = v
|
||||||
if (this.options.firstPersonView) {
|
if (this.options.firstPersonView) {
|
||||||
@ -1040,18 +1030,18 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
let targetEntity = targetSdk ? targetSdk.entityMap.get(this.options.id) : undefined
|
let targetEntity = targetSdk ? targetSdk.entityMap.get(this.options.id) : undefined
|
||||||
if (this.sdk)
|
if (this.sdk)
|
||||||
this.#firstPersonViewEvent = new MouseEvent(this.sdk)
|
this._firstPersonViewEvent = new MouseEvent(this.sdk)
|
||||||
this.#firstPersonViewEvent.mouse_right_down((movement, cartesian) => {
|
this._firstPersonViewEvent.mouse_right_down((movement, cartesian) => {
|
||||||
let startPosition = { ...movement.position }
|
let startPosition = { ...movement.position }
|
||||||
this.#firstPersonViewEvent.mouse_move((movement2, cartesian2) => {
|
this._firstPersonViewEvent.mouse_move((movement2, cartesian2) => {
|
||||||
this.firstPersonHeadingPitch.heading = this.firstPersonHeadingPitch.heading + ((movement2.endPosition.x - startPosition.x) / 20)
|
this.firstPersonHeadingPitch.heading = this.firstPersonHeadingPitch.heading + ((movement2.endPosition.x - startPosition.x) / 20)
|
||||||
this.firstPersonHeadingPitch.pitch = this.firstPersonHeadingPitch.pitch + ((startPosition.y - movement2.endPosition.y) / 10)
|
this.firstPersonHeadingPitch.pitch = this.firstPersonHeadingPitch.pitch + ((startPosition.y - movement2.endPosition.y) / 10)
|
||||||
targetEntity && (targetEntity.firstPersonHeadingPitch = { ...this.firstPersonHeadingPitch })
|
targetEntity && (targetEntity.firstPersonHeadingPitch = { ...this.firstPersonHeadingPitch })
|
||||||
startPosition = { ...movement2.endPosition }
|
startPosition = { ...movement2.endPosition }
|
||||||
}, true)
|
}, true)
|
||||||
}, true)
|
}, true)
|
||||||
this.#firstPersonViewEvent.mouse_right_up((movement, cartesian) => {
|
this._firstPersonViewEvent.mouse_right_up((movement, cartesian) => {
|
||||||
this.#firstPersonViewEvent.mouse_move(() => { })
|
this._firstPersonViewEvent.mouse_move(() => { })
|
||||||
}, true)
|
}, true)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1197,7 +1187,7 @@ class TrajectoryMotion extends Base {
|
|||||||
if (this.show) {
|
if (this.show) {
|
||||||
if (this.label) {
|
if (this.label) {
|
||||||
this.label.show = show
|
this.label.show = show
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset + (this.fuelShow ? this.labelFontSize + 20 : 0)
|
this.label.pixelOffset = this.options.label.pixelOffset
|
||||||
if (this.options.label.position) {
|
if (this.options.label.position) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.options.label.position.alt) {
|
if (this.options.label.position.alt) {
|
||||||
@ -1227,7 +1217,6 @@ class TrajectoryMotion extends Base {
|
|||||||
set labelFontFamily(v) {
|
set labelFontFamily(v) {
|
||||||
this.options.label.fontFamily = v || 0
|
this.options.label.fontFamily = v || 0
|
||||||
this.label && (this.label.fontFamily = this.options.label.fontFamily)
|
this.label && (this.label.fontFamily = this.options.label.fontFamily)
|
||||||
this.fuelLabel && (this.fuelLabel.fontFamily = this.options.label.fontFamily)
|
|
||||||
|
|
||||||
let name = getFontFamilyName(this.labelFontFamily) || ''
|
let name = getFontFamilyName(this.labelFontFamily) || ''
|
||||||
this._elms.labelFontFamily &&
|
this._elms.labelFontFamily &&
|
||||||
@ -1242,7 +1231,6 @@ class TrajectoryMotion extends Base {
|
|||||||
set labelColor(v) {
|
set labelColor(v) {
|
||||||
this.options.label.color = v
|
this.options.label.color = v
|
||||||
this.label && (this.label.color = v)
|
this.label && (this.label.color = v)
|
||||||
this.fuelLabel && (this.fuelLabel.color = v)
|
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new YJColorPicker({
|
let labelColorPicker = new YJColorPicker({
|
||||||
@ -1270,13 +1258,7 @@ class TrajectoryMotion extends Base {
|
|||||||
set labelFontSize(v) {
|
set labelFontSize(v) {
|
||||||
this.options.label.fontSize = v
|
this.options.label.fontSize = v
|
||||||
this.label && (this.label.fontSize = v)
|
this.label && (this.label.fontSize = v)
|
||||||
if (this.fuelLabel) {
|
this.label.pixelOffset = this.options.label.pixelOffset
|
||||||
this.fuelLabel.fontSize = v
|
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset + v + 20
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset
|
|
||||||
}
|
|
||||||
this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => {
|
this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
@ -1288,7 +1270,6 @@ class TrajectoryMotion extends Base {
|
|||||||
set labelScaleByDistance(v) {
|
set labelScaleByDistance(v) {
|
||||||
this.options.label.scaleByDistance = v
|
this.options.label.scaleByDistance = v
|
||||||
this.label && (this.label.scaleByDistance = v)
|
this.label && (this.label.scaleByDistance = v)
|
||||||
this.fuelLabel && (this.fuelLabel.scaleByDistance = v)
|
|
||||||
this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => {
|
this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => {
|
||||||
item.checked = v
|
item.checked = v
|
||||||
})
|
})
|
||||||
@ -1304,7 +1285,6 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
this.options.label.near = near
|
this.options.label.near = near
|
||||||
this.label && (this.label.near = near)
|
this.label && (this.label.near = near)
|
||||||
this.fuelLabel && (this.fuelLabel.near = near)
|
|
||||||
this._elms.labelNear && this._elms.labelNear.forEach((item) => {
|
this._elms.labelNear && this._elms.labelNear.forEach((item) => {
|
||||||
item.value = near
|
item.value = near
|
||||||
})
|
})
|
||||||
@ -1320,66 +1300,11 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
this.options.label.far = far
|
this.options.label.far = far
|
||||||
this.label && (this.label.far = far)
|
this.label && (this.label.far = far)
|
||||||
this.fuelLabel && (this.fuelLabel.far = far)
|
|
||||||
this._elms.labelFar && this._elms.labelFar.forEach((item) => {
|
this._elms.labelFar && this._elms.labelFar.forEach((item) => {
|
||||||
item.value = far
|
item.value = far
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
get unitFuelConsumption() {
|
|
||||||
return this.options.unitFuelConsumption
|
|
||||||
}
|
|
||||||
|
|
||||||
set unitFuelConsumption(v) {
|
|
||||||
this.options.unitFuelConsumption = v
|
|
||||||
this._elms.unitFuelConsumption && this._elms.unitFuelConsumption.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
get fuelShow() {
|
|
||||||
return this.options.fuelShow
|
|
||||||
}
|
|
||||||
|
|
||||||
set fuelShow(v) {
|
|
||||||
this.options.fuelShow = v
|
|
||||||
let show = v
|
|
||||||
if (this.show && (!this.showView || this.showView == 3)) {
|
|
||||||
show = v
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
show = false
|
|
||||||
}
|
|
||||||
if (this.show) {
|
|
||||||
if (this.fuelLabel) {
|
|
||||||
this.fuelLabel.show = show
|
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset + (show ? this.labelFontSize + 20 : 0)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset
|
|
||||||
}
|
|
||||||
if (this.options.label.position) {
|
|
||||||
setTimeout(() => {
|
|
||||||
if (this.options.label.position.alt) {
|
|
||||||
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
|
|
||||||
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.fuelLabel && (this.fuelLabel.show = false)
|
|
||||||
this.label.pixelOffset = this.options.label.pixelOffset
|
|
||||||
}
|
|
||||||
this._elms.fuelShow && this._elms.fuelShow.forEach((item) => {
|
|
||||||
item.checked = v
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建路径
|
// 创建路径
|
||||||
static addLine(that) {
|
static addLine(that) {
|
||||||
let positions_smooth = that.renewLinePositions(that.options.line.positions)
|
let positions_smooth = that.renewLinePositions(that.options.line.positions)
|
||||||
@ -1422,11 +1347,11 @@ class TrajectoryMotion extends Base {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
that.sdk._entityZIndex++
|
that.sdk._entityZIndex++
|
||||||
if (that.#mouseRightevent) {
|
if (that._mouseRightevent) {
|
||||||
that.#mouseRightevent.destroy()
|
that._mouseRightevent.destroy()
|
||||||
}
|
}
|
||||||
that.#mouseRightevent = new MouseEvent(that.sdk)
|
that._mouseRightevent = new MouseEvent(that.sdk)
|
||||||
that.#mouseRightevent.mouse_right((movement, cartesian) => {
|
that._mouseRightevent.mouse_right((movement, cartesian) => {
|
||||||
let splitSdk = getSdk()
|
let splitSdk = getSdk()
|
||||||
let targetSdk
|
let targetSdk
|
||||||
if (that.sdk === splitSdk.sdkP) {
|
if (that.sdk === splitSdk.sdkP) {
|
||||||
@ -1498,7 +1423,6 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights)
|
let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights)
|
||||||
TrajectoryMotion.createLabel(that)
|
TrajectoryMotion.createLabel(that)
|
||||||
TrajectoryMotion.createFuelLabel(that)
|
|
||||||
that.modelMove(pos)
|
that.modelMove(pos)
|
||||||
|
|
||||||
|
|
||||||
@ -1514,7 +1438,7 @@ class TrajectoryMotion extends Base {
|
|||||||
fontSize: that.options.label.fontSize,
|
fontSize: that.options.label.fontSize,
|
||||||
fontFamily: that.options.label.fontFamily,
|
fontFamily: that.options.label.fontFamily,
|
||||||
color: that.options.label.color,
|
color: that.options.label.color,
|
||||||
pixelOffset: that.options.label.pixelOffset + (that.options.fuelShow ? that.options.label.fontSize + 20 : 0),
|
pixelOffset: that.options.label.pixelOffset,
|
||||||
backgroundColor: that.options.label.backgroundColor,
|
backgroundColor: that.options.label.backgroundColor,
|
||||||
lineColor: that.options.label.lineColor,
|
lineColor: that.options.label.lineColor,
|
||||||
lineWidth: that.options.label.lineWidth,
|
lineWidth: that.options.label.lineWidth,
|
||||||
@ -1524,26 +1448,6 @@ class TrajectoryMotion extends Base {
|
|||||||
}, that.model)
|
}, that.model)
|
||||||
}
|
}
|
||||||
|
|
||||||
static async createFuelLabel(that) {
|
|
||||||
let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer)
|
|
||||||
that.fuelLabel = new LabelObject(that.sdk, {
|
|
||||||
show: that.options.show ? (that.options.fuelShow ? true : false) : false,
|
|
||||||
// show: true,
|
|
||||||
position: [labelPosition.lng, labelPosition.lat, labelPosition.alt],
|
|
||||||
text: '总油耗:',
|
|
||||||
fontSize: that.options.label.fontSize,
|
|
||||||
fontFamily: that.options.label.fontFamily,
|
|
||||||
color: that.options.label.color,
|
|
||||||
pixelOffset: 0,
|
|
||||||
backgroundColor: ['#6e6e6e', '#6e6e6e'],
|
|
||||||
lineColor: '#00ffff00',
|
|
||||||
lineWidth: 0,
|
|
||||||
scaleByDistance: that.options.label.scaleByDistance,
|
|
||||||
near: that.options.label.near,
|
|
||||||
far: that.options.label.far
|
|
||||||
}, that.model)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建关键点
|
// 创建关键点
|
||||||
static async addKeyPoint(that) {
|
static async addKeyPoint(that) {
|
||||||
for (let i = 0; i < that.options.line.positions.length; i++) {
|
for (let i = 0; i < that.options.line.positions.length; i++) {
|
||||||
@ -1552,7 +1456,7 @@ class TrajectoryMotion extends Base {
|
|||||||
let entity = that.sdk.viewer.entities.add({
|
let entity = that.sdk.viewer.entities.add({
|
||||||
name: 'node-secondary-edit-point',
|
name: 'node-secondary-edit-point',
|
||||||
index: i,
|
index: i,
|
||||||
show: that.options.line.keyPoint || false,
|
show: that._keyPoint || false,
|
||||||
position: that.ground ? result : Cesium.Cartesian3.fromDegrees(that.options.line.positions[i].lng, that.options.line.positions[i].lat, that.options.line.positions[i].alt),
|
position: that.ground ? result : Cesium.Cartesian3.fromDegrees(that.options.line.positions[i].lng, that.options.line.positions[i].lat, that.options.line.positions[i].alt),
|
||||||
billboard: {
|
billboard: {
|
||||||
image: that.getSourceRootPath() + '/img/point.png',
|
image: that.getSourceRootPath() + '/img/point.png',
|
||||||
@ -1568,7 +1472,7 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
// 模型移动
|
// 模型移动
|
||||||
async modelMove(positions, option = { time: 0 }) {
|
async modelMove(positions, option = { time: 0 }) {
|
||||||
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||||
let _this = this
|
let _this = this
|
||||||
let time = option.time || 0
|
let time = option.time || 0
|
||||||
let startDistance = option.distance
|
let startDistance = option.distance
|
||||||
@ -1654,7 +1558,7 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
animateUpdate()
|
animateUpdate()
|
||||||
function animateUpdate() {
|
function animateUpdate() {
|
||||||
_this.#_requestAnimationFrameEventId2 = requestAnimationFrame(
|
_this._requestAnimationFrameEventId2 = requestAnimationFrame(
|
||||||
animateUpdate
|
animateUpdate
|
||||||
)
|
)
|
||||||
if (_this.options.firstPersonView) {
|
if (_this.options.firstPersonView) {
|
||||||
@ -1672,8 +1576,6 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setPosition(distance) {
|
async function setPosition(distance) {
|
||||||
_this.totalFuelConsumption = Number((distance / 100 * _this.unitFuelConsumption).toFixed(2))
|
|
||||||
_this.fuelLabel.text = '总油耗:' + _this.totalFuelConsumption + ' L'
|
|
||||||
_this.model.isMove = true
|
_this.model.isMove = true
|
||||||
let sdk2D = get2DView()
|
let sdk2D = get2DView()
|
||||||
let splitSdk = getSdk()
|
let splitSdk = getSdk()
|
||||||
@ -1886,7 +1788,6 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer)
|
let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer)
|
||||||
_this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
|
_this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
|
||||||
_this.fuelLabel.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
|
|
||||||
lastDistance = distance
|
lastDistance = distance
|
||||||
// console.log(position)
|
// console.log(position)
|
||||||
_this.realTimeRouteArray.push(position)
|
_this.realTimeRouteArray.push(position)
|
||||||
@ -2010,6 +1911,7 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
async edit(state) {
|
async edit(state) {
|
||||||
|
return
|
||||||
if (this._error) {
|
if (this._error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2259,7 +2161,7 @@ class TrajectoryMotion extends Base {
|
|||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
|
|
||||||
if (this.options.customView) {
|
if (this.options.customView && this.options.customView.position && this.options.customView.orientation) {
|
||||||
this.sdk.viewer.camera.flyTo({
|
this.sdk.viewer.camera.flyTo({
|
||||||
destination: this.options.customView.position,
|
destination: this.options.customView.position,
|
||||||
orientation: this.options.customView.orientation
|
orientation: this.options.customView.orientation
|
||||||
@ -2283,7 +2185,6 @@ class TrajectoryMotion extends Base {
|
|||||||
this.sdk.viewer.entities.remove(this.line)
|
this.sdk.viewer.entities.remove(this.line)
|
||||||
this.sdk.viewer.entities.remove(this.realTimeLine)
|
this.sdk.viewer.entities.remove(this.realTimeLine)
|
||||||
this.label && this.label.remove()
|
this.label && this.label.remove()
|
||||||
this.fuelLabel && this.fuelLabel.remove()
|
|
||||||
for (let i = 0; i < this.keyPointShow.length; i++) {
|
for (let i = 0; i < this.keyPointShow.length; i++) {
|
||||||
this.sdk.viewer.entities.remove(this.keyPointShow[i])
|
this.sdk.viewer.entities.remove(this.keyPointShow[i])
|
||||||
}
|
}
|
||||||
@ -2291,20 +2192,19 @@ class TrajectoryMotion extends Base {
|
|||||||
this.realTimeLine = null
|
this.realTimeLine = null
|
||||||
this.model = null
|
this.model = null
|
||||||
this.label = null
|
this.label = null
|
||||||
this.fuelLabel = null
|
|
||||||
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
}
|
}
|
||||||
if (this.#mouseRightevent) {
|
if (this._mouseRightevent) {
|
||||||
this.#mouseRightevent.destroy()
|
this._mouseRightevent.destroy()
|
||||||
}
|
}
|
||||||
this.removeModelAnimate()
|
this.removeModelAnimate()
|
||||||
let sdk2D = get2DView()
|
let sdk2D = get2DView()
|
||||||
if (!sdk2D || sdk2D !== this.sdk) {
|
if (!sdk2D || sdk2D !== this.sdk) {
|
||||||
this.viewFollow = false
|
this.viewFollow = false
|
||||||
}
|
}
|
||||||
cancelAnimationFrame(this.#_requestAnimationFrameEventId)
|
cancelAnimationFrame(this._requestAnimationFrameEventId)
|
||||||
await this.sdk.removeIncetance(this.options.id)
|
await this.sdk.removeIncetance(this.options.id)
|
||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
|
|
||||||
@ -2326,7 +2226,7 @@ class TrajectoryMotion extends Base {
|
|||||||
(this.noseToTail !== this.originalOptions.line.noseToTail) && (this.noseToTail = this.originalOptions.line.noseToTail);
|
(this.noseToTail !== this.originalOptions.line.noseToTail) && (this.noseToTail = this.originalOptions.line.noseToTail);
|
||||||
(this.height !== this.originalOptions.height) && (this.height = this.originalOptions.height);
|
(this.height !== this.originalOptions.height) && (this.height = this.originalOptions.height);
|
||||||
(this.lineShow !== this.originalOptions.line.show) && (this.lineShow = this.originalOptions.line.show);
|
(this.lineShow !== this.originalOptions.line.show) && (this.lineShow = this.originalOptions.line.show);
|
||||||
this.keyPointShow = this.originalOptions.line.keyPoint;
|
this.keyPointShow = false;
|
||||||
this.routeDirection = this.originalOptions.routeDirection;
|
this.routeDirection = this.originalOptions.routeDirection;
|
||||||
this.scale = this.originalOptions.model.scale;
|
this.scale = this.originalOptions.model.scale;
|
||||||
(this.loop !== this.originalOptions.loop) && (this.loop = this.originalOptions.loop);
|
(this.loop !== this.originalOptions.loop) && (this.loop = this.originalOptions.loop);
|
||||||
@ -2345,7 +2245,6 @@ class TrajectoryMotion extends Base {
|
|||||||
this.model && (this.model.show = false)
|
this.model && (this.model.show = false)
|
||||||
}
|
}
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.fuelLabelShow = this.originalOptions.fuelShow
|
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
this.labelFontFamily = this.originalOptions.label.fontFamily
|
this.labelFontFamily = this.originalOptions.label.fontFamily
|
||||||
|
@ -72,14 +72,12 @@ class WallStereoscopic extends Base {
|
|||||||
this.options.material = (Number(options.material) || Number(options.material) === 0) ? Number(options.material) : 3
|
this.options.material = (Number(options.material) || Number(options.material) === 0) ? Number(options.material) : 3
|
||||||
this.options.duration = (options.duration || options.duration === 0) ? options.duration : 1000
|
this.options.duration = (options.duration || options.duration === 0) ? options.duration : 1000
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options['nose-to-tail'] = options['nose-to-tail'] || false
|
this.options.noseToTail = options.noseToTail || false
|
||||||
this.entity
|
this.entity
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this.options.label = {
|
this.options.label = {
|
||||||
text: this.options.name,
|
|
||||||
show: options.label.show || false,
|
show: options.label.show || false,
|
||||||
position: options.label.position,
|
|
||||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||||
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
@ -94,17 +92,13 @@ class WallStereoscopic extends Base {
|
|||||||
this.options.instruct = options.instruct || ""
|
this.options.instruct = options.instruct || ""
|
||||||
this.options.operatingPoint = options.operatingPoint || ""
|
this.options.operatingPoint = options.operatingPoint || ""
|
||||||
this.options.attribute = options.attribute || {}
|
this.options.attribute = options.attribute || {}
|
||||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
|
||||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
|
||||||
this.options.attribute.link = this.options.attribute.link || {}
|
this.options.attribute.link = this.options.attribute.link || {}
|
||||||
this.options.attribute.link.content = this.options.attribute.link.content || []
|
this.options.attribute.link.content = this.options.attribute.link.content || []
|
||||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
|
||||||
this.options.attribute.camera = this.options.attribute.camera.content || []
|
delete this.options.attribute.camera
|
||||||
this.options.attribute.ISC = this.options.attribute.ISC || {}
|
delete this.options.attribute.vr
|
||||||
this.options.attribute.ISC.content = this.options.attribute.ISC.content || []
|
delete this.options.attribute.goods
|
||||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
|
||||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
|
||||||
this.options.attributeType = options.attributeType || 'richText'
|
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
if (!this.options.positions || this.options.positions.length < 2) {
|
if (!this.options.positions || this.options.positions.length < 2) {
|
||||||
@ -186,11 +180,11 @@ class WallStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get noseToTail() {
|
get noseToTail() {
|
||||||
return this.options['nose-to-tail']
|
return this.options.noseToTail
|
||||||
}
|
}
|
||||||
|
|
||||||
set noseToTail(v) {
|
set noseToTail(v) {
|
||||||
this.options['nose-to-tail'] = v
|
this.options.noseToTail = v
|
||||||
let positions = this.options.positions
|
let positions = this.options.positions
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
@ -455,324 +449,6 @@ class WallStereoscopic extends Base {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
get attributeType() {
|
|
||||||
return this.options.attributeType
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeType(v) {
|
|
||||||
this.options.attributeType = v
|
|
||||||
this._elms.attributeType && this._elms.attributeType.forEach((item) => {
|
|
||||||
item.value = v
|
|
||||||
})
|
|
||||||
let attributeContent = this._DialogObject._element.content.getElementsByClassName('attribute-content')
|
|
||||||
for (let i = 0; i < attributeContent.length; i++) {
|
|
||||||
if (attributeContent[i].className.indexOf('attribute-content-' + v) > -1) {
|
|
||||||
attributeContent[i].style.display = 'block';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributeContent[i].style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeLink() {
|
|
||||||
return this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeLink(v) {
|
|
||||||
this.options.attribute.link.content = v
|
|
||||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-link').length == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
tableContent.innerHTML = ''
|
|
||||||
if (this.options.attribute.link.content.length > 0) {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
|
|
||||||
let tr = `
|
|
||||||
<div class="tr">
|
|
||||||
<div class="td">` + this.options.attribute.link.content[i].name + `</div>
|
|
||||||
<div class="td">` + this.options.attribute.link.content[i].url + `</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="linkEdit">编辑</button>
|
|
||||||
<button @click="linkDelete">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>`
|
|
||||||
let trElm = document.createRange().createContextualFragment(tr)
|
|
||||||
tableContent.appendChild(trElm)
|
|
||||||
}
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
let fun = {
|
|
||||||
linkEdit: async (index) => {
|
|
||||||
this.attributeLink = await this.options.attribute.link.content
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
if (index === i) {
|
|
||||||
let height = item[i].offsetHeight
|
|
||||||
let html = `
|
|
||||||
<div class="td">
|
|
||||||
<input class="input" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<textarea class="input link-edit" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="confirmEdit">确认</button>
|
|
||||||
<button @click="cancelEdit">取消</button>
|
|
||||||
</div>`
|
|
||||||
item[i].innerHTML = html
|
|
||||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
|
||||||
textareaElm.style.height = (height - 10) + 'px'
|
|
||||||
let td = item[i].getElementsByClassName('td')
|
|
||||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].name
|
|
||||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].url
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] || !btn[n].attributes) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
linkDelete: (i) => {
|
|
||||||
this.options.attribute.link.content.splice(i, 1)
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmEdit: (value, i) => {
|
|
||||||
let name = value.name && value.name.replace(/\s/g, "")
|
|
||||||
let url = value.url && value.url.replace(/\s/g, "")
|
|
||||||
if (name && url) {
|
|
||||||
this.options.attribute.link.content[i] = value
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
|
||||||
message: '名称或链接不能为空!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
cancelEdit: () => {
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
},
|
|
||||||
fileSelect: (value, i) => {
|
|
||||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
|
||||||
fileElm.click()
|
|
||||||
fileElm.removeEventListener('change', fileSelect)
|
|
||||||
fileElm.addEventListener('change', fileSelect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let fileSelect = (event) => {
|
|
||||||
if (event.target.value) {
|
|
||||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
|
||||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
|
||||||
event.target.value = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] || !btn[n].attributes) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value](i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeCamera() {
|
|
||||||
return this.options.attribute.camera.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeCamera(v) {
|
|
||||||
this.options.attribute.camera.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeISC() {
|
|
||||||
return this.options.attribute.ISC.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeISC(v) {
|
|
||||||
this.options.attribute.ISC.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeVr() {
|
|
||||||
return this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeVr(v) {
|
|
||||||
this.options.attribute.vr.content = v
|
|
||||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-vr').length == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
tableContent.innerHTML = ''
|
|
||||||
if (this.options.attribute.vr.content.length > 0) {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.options.attribute.vr.content.length; i++) {
|
|
||||||
let tr = `
|
|
||||||
<div class="tr">
|
|
||||||
<div class="td">` + this.options.attribute.vr.content[i].name + `</div>
|
|
||||||
<div class="td">` + this.options.attribute.vr.content[i].url + `</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="vrEdit">编辑</button>
|
|
||||||
<button @click="vrDelete">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>`
|
|
||||||
let trElm = document.createRange().createContextualFragment(tr)
|
|
||||||
tableContent.appendChild(trElm)
|
|
||||||
}
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
let fun = {
|
|
||||||
vrEdit: async (index) => {
|
|
||||||
this.attributeVr = await this.options.attribute.vr.content
|
|
||||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
|
||||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
|
||||||
let item = tableContent.getElementsByClassName('tr')
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
if (index === i) {
|
|
||||||
let height = item[i].offsetHeight
|
|
||||||
let html = `
|
|
||||||
<div class="td">
|
|
||||||
<input class="input" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<textarea class="input link-edit" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="td">
|
|
||||||
<button @click="confirmEdit">确认</button>
|
|
||||||
<button @click="cancelEdit">取消</button>
|
|
||||||
</div>`
|
|
||||||
item[i].innerHTML = html
|
|
||||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
|
||||||
textareaElm.style.height = (height - 10) + 'px'
|
|
||||||
let td = item[i].getElementsByClassName('td')
|
|
||||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].name
|
|
||||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].url
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
if (!btn[n] || !btn[n].attributes) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
vrDelete: (i) => {
|
|
||||||
this.options.attribute.vr.content.splice(i, 1)
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmEdit: (value, i) => {
|
|
||||||
let name = value.name && value.name.replace(/\s/g, "")
|
|
||||||
let url = value.url && value.url.replace(/\s/g, "")
|
|
||||||
if (name && url) {
|
|
||||||
this.options.attribute.vr.content[i] = value
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
|
||||||
message: '名称或链接不能为空!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
cancelEdit: () => {
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
},
|
|
||||||
fileSelect: (value, i) => {
|
|
||||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
|
||||||
fileElm.click()
|
|
||||||
fileElm.removeEventListener('change', fileSelect)
|
|
||||||
fileElm.addEventListener('change', fileSelect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let fileSelect = (event) => {
|
|
||||||
if (event.target.value) {
|
|
||||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
|
||||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
|
||||||
event.target.value = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < item.length; i++) {
|
|
||||||
let btn = item[i].getElementsByTagName('button')
|
|
||||||
for (let n = 0; n < btn.length; n++) {
|
|
||||||
for (let m of btn[n].attributes) {
|
|
||||||
if (!btn[n] || !btn[n].attributes) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (m.name === '@click') {
|
|
||||||
btn[n].addEventListener('click', (e) => {
|
|
||||||
if (typeof (fun[m.value]) === 'function') {
|
|
||||||
fun[m.value](i)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btn[n].attributes.removeNamedItem(m.name)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get attributeGoods() {
|
|
||||||
return this.options.attribute.goods.content
|
|
||||||
}
|
|
||||||
|
|
||||||
set attributeGoods(v) {
|
|
||||||
this.options.attribute.goods.content = v
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建
|
//创建
|
||||||
static async create(that) {
|
static async create(that) {
|
||||||
|
|
||||||
@ -825,6 +501,7 @@ class WallStereoscopic extends Base {
|
|||||||
|
|
||||||
// 编辑框
|
// 编辑框
|
||||||
async edit(state) {
|
async edit(state) {
|
||||||
|
return
|
||||||
let _this = this
|
let _this = this
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
|
|
||||||
@ -1108,13 +785,6 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
||||||
this.instruct = this.originalOptions.instruct
|
this.instruct = this.originalOptions.instruct
|
||||||
this.operatingPoint = this.originalOptions.operatingPoint
|
this.operatingPoint = this.originalOptions.operatingPoint
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
this.attributeCamera = this.options.attribute.camera.content
|
|
||||||
this.attributeGoods = this.options.attribute.goods.content
|
|
||||||
this.attributeISC = this.options.attribute.ISC.content
|
|
||||||
this.cameraSelect && this.cameraSelect()
|
|
||||||
this.goodsSelect && this.goodsSelect()
|
|
||||||
|
|
||||||
let positions = this.options.positions
|
let positions = this.options.positions
|
||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
@ -1147,61 +817,6 @@ class WallStereoscopic extends Base {
|
|||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
instructSubmit() {
|
|
||||||
this.Dialog.instructSubmit && this.Dialog.instructSubmit(this.options.id, this.options.label.text, this.instruct)
|
|
||||||
this.originalOptions.instruct = this.instruct
|
|
||||||
}
|
|
||||||
|
|
||||||
operatingPointSubmit() {
|
|
||||||
this.Dialog.operatingPointSubmit && this.Dialog.operatingPointSubmit(this.options.id, this.options.label.text, this.operatingPoint)
|
|
||||||
this.originalOptions.operatingPoint = this.operatingPoint
|
|
||||||
}
|
|
||||||
|
|
||||||
_addLink() {
|
|
||||||
// document.getElementsByClassName
|
|
||||||
if (this._DialogObject._element.content.getElementsByClassName('link_add')[0].value) {
|
|
||||||
this.options.attribute.link.content.push({
|
|
||||||
name: '链接',
|
|
||||||
url: this._DialogObject._element.content.getElementsByClassName('link_add')[0].value
|
|
||||||
})
|
|
||||||
this._DialogObject._element.content.getElementsByClassName('link_add')[0].value = ''
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Dialog.clickAddLink && this.Dialog.clickAddLink()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addAttributeLink(link) {
|
|
||||||
this.options.attribute.link.content.push({
|
|
||||||
name: '链接',
|
|
||||||
url: link
|
|
||||||
})
|
|
||||||
this.attributeLink = this.options.attribute.link.content
|
|
||||||
}
|
|
||||||
|
|
||||||
_addRr() {
|
|
||||||
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
|
|
||||||
this.options.attribute.vr.content.push({
|
|
||||||
name: '全景图' ,
|
|
||||||
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
|
|
||||||
})
|
|
||||||
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Dialog.clickAddVr && this.Dialog.clickAddVr()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addAttributeRr(vr) {
|
|
||||||
this.options.attribute.vr.content.push({
|
|
||||||
name: '全景图' ,
|
|
||||||
url: vr
|
|
||||||
})
|
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
|
||||||
}
|
|
||||||
|
|
||||||
getMaterial() {
|
getMaterial() {
|
||||||
let material
|
let material
|
||||||
switch (this.options.material) {
|
switch (this.options.material) {
|
||||||
@ -1305,7 +920,8 @@ class WallStereoscopic extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static nodeEdit(that, cb = () => { }) {
|
nodeEdit(cb = () => { }) {
|
||||||
|
let that = this
|
||||||
if (YJ.Measure.GetMeasureStatus()) {
|
if (YJ.Measure.GetMeasureStatus()) {
|
||||||
cb('上一次测量未结束')
|
cb('上一次测量未结束')
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,10 +30,11 @@ class Base extends Tools {
|
|||||||
this.rightClickCallBack = null
|
this.rightClickCallBack = null
|
||||||
this.picking = true
|
this.picking = true
|
||||||
this.options.host = this.options.host || getHost()
|
this.options.host = this.options.host || getHost()
|
||||||
this.options.customView = options.customView ||{
|
// this.options.customView = options.customView ||{
|
||||||
relativePosition: undefined,
|
// relativePosition: undefined,
|
||||||
orientation: undefined
|
// orientation: undefined
|
||||||
}
|
// }
|
||||||
|
this.options.customView = options.customView
|
||||||
// this._showView = this.options.showView || 0
|
// this._showView = this.options.showView || 0
|
||||||
this.setDefaultValue()
|
this.setDefaultValue()
|
||||||
this._showView
|
this._showView
|
||||||
|
@ -1534,7 +1534,13 @@ class Tools {
|
|||||||
document.body.appendChild(message)
|
document.body.appendChild(message)
|
||||||
message.classList.add(type)
|
message.classList.add(type)
|
||||||
}
|
}
|
||||||
|
/**两点之间的距离 */
|
||||||
|
pointDistance(p1, p2) {
|
||||||
|
let centerDegress = Cesium.Cartesian3.fromDegrees(p1.lng, p1.lat)
|
||||||
|
let point = Cesium.Cartesian3.fromDegrees(p2, p2)
|
||||||
|
let distance = Cesium.Cartesian3.distance(point, centerDegress)
|
||||||
|
return distance
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Tools
|
export default Tools
|
||||||
|
@ -1,138 +1,141 @@
|
|||||||
import Dialog from '../BaseDialog'
|
import Dialog from '../BaseDialog'
|
||||||
import { Proj } from './proj'
|
import { Proj } from './proj'
|
||||||
import { legp } from '../Obj/Element/datalist';
|
import { legp } from '../Obj/Element/datalist';
|
||||||
|
import Tools from "../Tools";
|
||||||
let _DialogObject
|
let _DialogObject
|
||||||
const open = async (sdk, closeCallBack) => {
|
const open = async (sdk, closeCallBack) => {
|
||||||
let proj = new Proj()
|
let proj = new Proj()
|
||||||
if (_DialogObject && _DialogObject.close) {
|
let tools = new Tools(sdk)
|
||||||
_DialogObject.close()
|
// if (_DialogObject && _DialogObject.close) {
|
||||||
_DialogObject = null
|
// _DialogObject.close()
|
||||||
}
|
// _DialogObject = null
|
||||||
_DialogObject = await new Dialog(sdk.viewer._container, {
|
// }
|
||||||
title: '度分秒',
|
// _DialogObject = await new Dialog(sdk.viewer._container, {
|
||||||
left: '180px',
|
// title: '度分秒',
|
||||||
top: '100px',
|
// left: '180px',
|
||||||
closeCallBack: () => {
|
// top: '100px',
|
||||||
closeCallBack && closeCallBack()
|
// closeCallBack: () => {
|
||||||
}
|
// closeCallBack && closeCallBack()
|
||||||
})
|
// }
|
||||||
await _DialogObject.init()
|
// })
|
||||||
|
// await _DialogObject.init()
|
||||||
|
|
||||||
let html = `
|
// let html = `
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
<div class="div-item">
|
// <div class="div-item">
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<div class="col input-select-box">
|
// <div class="col input-select-box">
|
||||||
<span class="label" style="flex: 0 0 60px;">输入格式</span>
|
// <span class="label" style="flex: 0 0 60px;">输入格式</span>
|
||||||
<div class="input-select"></div>
|
// <div class="input-select"></div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="div-item item" data-type="${0}">
|
// <div class="div-item item" data-type="${0}">
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||||
<span style="margin-right: 10px;">度</span>
|
// <span style="margin-right: 10px;">度</span>
|
||||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
||||||
</p>
|
// </p>
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<div class="col">
|
// <div class="col">
|
||||||
<span class="label" style="flex: auto;">经度</span>
|
// <span class="label" style="flex: auto;">经度</span>
|
||||||
<input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
// <input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
||||||
</div>
|
// </div>
|
||||||
<div class="col" style="margin: 0;">
|
// <div class="col" style="margin: 0;">
|
||||||
<span class="label">纬度</span>
|
// <span class="label">纬度</span>
|
||||||
<input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
// <input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
||||||
</div>
|
// </div>
|
||||||
<div class="col" style="flex: 0 0 24px;">
|
// <div class="col" style="flex: 0 0 24px;">
|
||||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
||||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||||
</i>
|
// </i>
|
||||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="div-item item" data-type="${1}">
|
// <div class="div-item item" data-type="${1}">
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||||
<span style="margin-right: 10px;">度分</span>
|
// <span style="margin-right: 10px;">度分</span>
|
||||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
||||||
</p>
|
// </p>
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<div class="col" style="flex-direction: column;">
|
// <div class="col" style="flex-direction: column;">
|
||||||
<div class="row" style="margin-bottom: 15px;">
|
// <div class="row" style="margin-bottom: 15px;">
|
||||||
<span class="label">经度</span>
|
// <span class="label">经度</span>
|
||||||
<input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
// <input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||||
<input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||||
<span class="top-line"></span>
|
// <span class="top-line"></span>
|
||||||
</div>
|
// </div>
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<span class="label">纬度</span>
|
// <span class="label">纬度</span>
|
||||||
<input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
// <input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||||
<input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||||
<span class="bottom-line"></span>
|
// <span class="bottom-line"></span>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="col" style="flex: 0 0 24px;margin: 0;">
|
// <div class="col" style="flex: 0 0 24px;margin: 0;">
|
||||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||||
</i>
|
// </i>
|
||||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="div-item item" data-type="${2}">
|
// <div class="div-item item" data-type="${2}">
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||||
<span style="margin-right: 10px;">度分秒</span>
|
// <span style="margin-right: 10px;">度分秒</span>
|
||||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
||||||
</p>
|
// </p>
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<div class="col" style="flex-direction: column;">
|
// <div class="col" style="flex-direction: column;">
|
||||||
<div class="row" style="margin-bottom: 15px;">
|
// <div class="row" style="margin-bottom: 15px;">
|
||||||
<span class="label">经度</span>
|
// <span class="label">经度</span>
|
||||||
<input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
// <input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||||
<input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||||
<input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||||
<span class="top-line"></span>
|
// <span class="top-line"></span>
|
||||||
</div>
|
// </div>
|
||||||
<div class="row">
|
// <div class="row">
|
||||||
<span class="label">纬度</span>
|
// <span class="label">纬度</span>
|
||||||
<input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
// <input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||||
<input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||||
<input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
// <input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||||
<span class="bottom-line"></span>
|
// <span class="bottom-line"></span>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="col" style="flex: 0 0 24px; margin: 0;">
|
// <div class="col" style="flex: 0 0 24px; margin: 0;">
|
||||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||||
</i>
|
// </i>
|
||||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
// <span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
||||||
`
|
// `
|
||||||
_DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
// _DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
||||||
let contentElm = document.createElement('div')
|
// let contentElm = document.createElement('div')
|
||||||
contentElm.style.width = '460px'
|
// contentElm.style.width = '460px'
|
||||||
contentElm.style.display = 'flex'
|
// contentElm.style.display = 'flex'
|
||||||
contentElm.style.flexDirection = 'column'
|
// contentElm.style.flexDirection = 'column'
|
||||||
contentElm.innerHTML = html
|
// contentElm.innerHTML = html
|
||||||
_DialogObject.contentAppChild(contentElm)
|
// _DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
|
let contentElm = document.getElementsByClassName('proj-convert')[0].getElementsByClassName('content')[0]
|
||||||
|
|
||||||
let items = contentElm.getElementsByClassName('item')
|
let items = contentElm.getElementsByClassName('item')
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
let type = items[i].getAttribute('data-type')
|
let type = items[i].getAttribute('data-type')
|
||||||
let convertElm = items[i].getElementsByClassName('convert')[0]
|
let convertElm = items[i].getElementsByClassName('convert')[0]
|
||||||
@ -183,20 +186,10 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
clipboard.on('success', function (e) {
|
clipboard.on('success', function (e) {
|
||||||
window.ELEMENT &&
|
tools.message({ text: '已复制到剪切板' })
|
||||||
window.ELEMENT.Message({
|
|
||||||
message: '已复制到剪切板',
|
|
||||||
type: 'success',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
clipboard.on('error', function (e) {
|
clipboard.on('error', function (e) {
|
||||||
window.ELEMENT &&
|
tools.message({ type: 'warning', text: '复制失败' })
|
||||||
window.ELEMENT.Message({
|
|
||||||
message: '复制失败',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
convertElm.addEventListener('click', () => {
|
convertElm.addEventListener('click', () => {
|
||||||
// let a = proj.degreesToDMS(100.345546743)
|
// let a = proj.degreesToDMS(100.345546743)
|
||||||
@ -317,12 +310,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
|
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
window.ELEMENT &&
|
tools.message({ text: '转换成功' })
|
||||||
window.ELEMENT.Message({
|
|
||||||
message: '转换成功',
|
|
||||||
type: 'success',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
for (let m = 0; m < items.length; m++) {
|
for (let m = 0; m < items.length; m++) {
|
||||||
items[m].style.display = 'block'
|
items[m].style.display = 'block'
|
||||||
}
|
}
|
||||||
@ -372,10 +360,10 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
let selectDataLegpObject = legp(_DialogObject._element.content.getElementsByClassName('input-select-box')[0], ".input-select")
|
let selectDataLegpObject = legp(contentElm.getElementsByClassName('input-select-box')[0], ".input-select")
|
||||||
if (selectDataLegpObject) {
|
if (selectDataLegpObject) {
|
||||||
selectDataLegpObject.legp_search(selectData)
|
selectDataLegpObject.legp_search(selectData)
|
||||||
let selectDataLegpElm = _DialogObject._element.content.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
let selectDataLegpElm = contentElm.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
||||||
selectDataLegpElm.value = selectData[0].value
|
selectDataLegpElm.value = selectData[0].value
|
||||||
selectDataLegpElm.addEventListener('input', () => {
|
selectDataLegpElm.addEventListener('input', () => {
|
||||||
for (let i = 0; i < selectData.length; i++) {
|
for (let i = 0; i < selectData.length; i++) {
|
||||||
|
@ -5,77 +5,78 @@ import MouseEvent from '../Event/index'
|
|||||||
import MouseTip from '../MouseTip'
|
import MouseTip from '../MouseTip'
|
||||||
import Tools from '../Tools'
|
import Tools from '../Tools'
|
||||||
let _DialogObject
|
let _DialogObject
|
||||||
|
let tip
|
||||||
|
let event
|
||||||
const open = async (sdk, closeCallBack) => {
|
const open = async (sdk, closeCallBack) => {
|
||||||
let topls = new Tools()
|
let topls = new Tools()
|
||||||
let proj = new Proj()
|
let proj = new Proj()
|
||||||
let tip
|
// if (_DialogObject && _DialogObject.close) {
|
||||||
let event
|
// _DialogObject.close()
|
||||||
if (_DialogObject && _DialogObject.close) {
|
// _DialogObject = null
|
||||||
_DialogObject.close()
|
// }
|
||||||
_DialogObject = null
|
// _DialogObject = await new Dialog(sdk.viewer._container, {
|
||||||
}
|
// title: '投影转换', left: '180px', top: '100px',
|
||||||
_DialogObject = await new Dialog(sdk.viewer._container, {
|
// closeCallBack: () => {
|
||||||
title: '投影转换', left: '180px', top: '100px',
|
// closeCallBack && closeCallBack()
|
||||||
closeCallBack: () => {
|
// },
|
||||||
closeCallBack && closeCallBack()
|
// })
|
||||||
},
|
// await _DialogObject.init()
|
||||||
})
|
|
||||||
await _DialogObject.init()
|
|
||||||
|
|
||||||
let html = `
|
// let html = `
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
<div style="width: 540px;display: flex;">
|
// <div style="width: 540px;display: flex;">
|
||||||
<div class="row left" style="flex: 1;margin-bottom: 0;">
|
// <div class="row left" style="flex: 1;margin-bottom: 0;">
|
||||||
<div style="margin: 10px 0;flex: 1;display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
// <div style="margin: 10px 0;flex: 1;display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||||
<span class="lable-left-line">源坐标</span>
|
// <span class="lable-left-line">源坐标</span>
|
||||||
<button class="btn pick" style="margin-left: 20px;"><svg class="icon-edit"><use xlink:href="#yj-icon-edit"></use></svg>坐标拾取</button>
|
// <button class="btn pick" style="margin-left: 20px;"><svg class="icon-edit"><use xlink:href="#yj-icon-edit"></use></svg>坐标拾取</button>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
// <span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||||
<div class="datalist_left"></div>
|
// <div class="datalist_left"></div>
|
||||||
</div>
|
// </div>
|
||||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
// <span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||||
<input class="input left-x" type="number" title="">
|
// <input class="input left-x" type="number" title="">
|
||||||
</div>
|
// </div>
|
||||||
<div style="display: flex;margin-bottom: 10px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
// <span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||||
<input class="input left-y" type="number" title="">
|
// <input class="input left-y" type="number" title="">
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div style="display: flex;flex-direction: column;justify-content: center;margin: 28px 15px 0 15px;">
|
// <div style="display: flex;flex-direction: column;justify-content: center;margin: 28px 15px 0 15px;">
|
||||||
<button class="btn convert">坐标转换<i style="margin-top: 2px;margin-left: 5px;" class="el-icon-right"></i></button>
|
// <button class="btn convert">坐标转换<i style="margin-top: 2px;margin-left: 5px;" class="el-icon-right"></i></button>
|
||||||
</div>
|
// </div>
|
||||||
<div class="row right" style="flex: 1;margin-bottom: 0;">
|
// <div class="row right" style="flex: 1;margin-bottom: 0;">
|
||||||
<div style="margin: 10px 0;height: 32px; display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
// <div style="margin: 10px 0;height: 32px; display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||||
<span class="lable-left-line">目标坐标</span>
|
// <span class="lable-left-line">目标坐标</span>
|
||||||
<button class="btn copy" data-clipboard-action="copy" data-clipboard-target=".input" style="margin-left: 20px;"><svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制</button>
|
// <button class="btn copy" data-clipboard-action="copy" data-clipboard-target=".input" style="margin-left: 20px;"><svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制</button>
|
||||||
</div>
|
// </div>
|
||||||
<div>
|
// <div>
|
||||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
// <span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||||
<div class="datalist_right"></div>
|
// <div class="datalist_right"></div>
|
||||||
</div>
|
// </div>
|
||||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
// <span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||||
<input class="input right-x" readonly="readonly">
|
// <input class="input right-x" readonly="readonly">
|
||||||
</div>
|
// </div>
|
||||||
<div style="display: flex;margin-bottom: 10px;align-items: center;">
|
// <div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||||
<span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
// <span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||||
<input class="input right-y" readonly="readonly">
|
// <input class="input right-y" readonly="readonly">
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<span class="custom-divider"></span>
|
// <span class="custom-divider"></span>
|
||||||
`
|
// `
|
||||||
let contentElm = document.createElement('div');
|
// let contentElm = document.createElement('div');
|
||||||
contentElm.innerHTML = html
|
// contentElm.innerHTML = html
|
||||||
_DialogObject.contentAppChild(contentElm)
|
// _DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
// legp(contentElm, ".datalist").legp_search(tagData)
|
// legp(contentElm, ".datalist").legp_search(tagData)
|
||||||
|
let contentElm = document.getElementsByClassName('projection-convert')[0].getElementsByClassName('content')[0]
|
||||||
|
|
||||||
let tagData = []
|
let tagData = []
|
||||||
let i = 0
|
let i = 0
|
||||||
@ -95,6 +96,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
|
|
||||||
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
||||||
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
||||||
|
let sourceCopyElm = contentElm.getElementsByClassName('sourceCopy')[0]
|
||||||
let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
||||||
datalistLeftInput.value = tagData[0].value
|
datalistLeftInput.value = tagData[0].value
|
||||||
legpObjectLeft.legp_searchActive(tagData[0].value)
|
legpObjectLeft.legp_searchActive(tagData[0].value)
|
||||||
@ -137,11 +139,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
if (!leftXElm.value || !leftYElm.value) {
|
if (!leftXElm.value || !leftYElm.value) {
|
||||||
rightXElm.value = ''
|
rightXElm.value = ''
|
||||||
rightYElm.value = ''
|
rightYElm.value = ''
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
topls.message({ type: 'warning', text: '请输入源坐标' })
|
||||||
message: '请输入源坐标',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], datalistLeftInput.value, datalistRightInput.value)
|
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], datalistLeftInput.value, datalistRightInput.value)
|
||||||
@ -150,11 +148,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
rightYElm.value = result.points[0].y
|
rightYElm.value = result.points[0].y
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
topls.message({ type: 'warning', text: result.message })
|
||||||
message: result.message,
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -164,11 +158,7 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
if (!rightXElm.value || !rightYElm.value) {
|
if (!rightXElm.value || !rightYElm.value) {
|
||||||
rightXElm.value = ''
|
rightXElm.value = ''
|
||||||
rightYElm.value = ''
|
rightYElm.value = ''
|
||||||
window.ELEMENT && window.ELEMENT.Message({
|
topls.message({ type: 'warning', text: '复制失败,目标坐标为空!' })
|
||||||
message: '复制失败,目标坐标为空!',
|
|
||||||
type: 'warning',
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let text = `${rightXElm.value},${rightYElm.value}`
|
let text = `${rightXElm.value},${rightYElm.value}`
|
||||||
@ -177,13 +167,26 @@ const open = async (sdk, closeCallBack) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
clipboard.on('success', function (e) {
|
clipboard.on('success', function (e) {
|
||||||
window.ELEMENT &&
|
topls.message({ text: '已复制到剪切板' })
|
||||||
window.ELEMENT.Message({
|
});
|
||||||
message: '已复制到剪切板',
|
|
||||||
type: 'success',
|
let sourcelipboard = new ClipboardJS(sourceCopyElm, {
|
||||||
duration: 1500
|
text: (trigger) => {
|
||||||
})
|
if (!leftXElm.value || !leftYElm.value) {
|
||||||
|
leftXElm.value = ''
|
||||||
|
leftYElm.value = ''
|
||||||
|
topls.message({ type: 'warning', text: '复制失败,目标坐标为空!' })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let text = `${leftXElm.value},${leftYElm.value}`
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sourcelipboard.on('success', function (e) {
|
||||||
|
topls.message({ text: '已复制到剪切板' })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +195,8 @@ const close = () => {
|
|||||||
_DialogObject.close()
|
_DialogObject.close()
|
||||||
_DialogObject = null
|
_DialogObject = null
|
||||||
}
|
}
|
||||||
|
tip && tip.destroy()
|
||||||
|
event && event.destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
export { open, close }
|
export { open, close }
|
Reference in New Issue
Block a user