`
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 = `
`
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 =
`
` +
this.options.attribute.vr.content[i].name +
`
` +
this.options.attribute.vr.content[i].url +
`
`
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 = `
`
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
}
get billboardDefaultImage() {
return (
getBillboardDefaultUrl(this.options.billboard.defaultImage) ||
this.getSourceRootPath() + '/img/A-ablu-blank.png'
)
}
set billboardDefaultImage(v) {
let url = this.replaceHost(v, this.options.host)
setBillboardDefaultUrl(url, this.options.billboard.defaultImage)
this._elms.billboardDefaultImage &&
this._elms.billboardDefaultImage.forEach(item => {
item.src = url
})
}
get coordinate() {
return this.options.coordinate
}
set coordinate(v) {
this.options.coordinate = v
let position = this._proj.convert(
[
{
x: this.options.positions.lng,
y: this.options.positions.lat,
z: this.options.positions.alt
}
],
'EPSG:4326',
v
).points
if (
this._DialogObject &&
this._DialogObject._element &&
this._DialogObject._element.content &&
position[0]
) {
this._DialogObject._element.content.getElementsByClassName(
'convert-x'
)[0].value = position[0].x
this._DialogObject._element.content.getElementsByClassName(
'convert-y'
)[0].value = position[0].y
this._DialogObject._element.content.getElementsByClassName(
'convert-z'
)[0].value = position[0].z
}
this._elms.coordinate &&
this._elms.coordinate.forEach(item => {
item.value = v
})
}
/**
* @description 编辑框
* @param state=false {boolean} 状态: true打开, false关闭
*/
async edit(state = false) {
let _this = this
this.originalOptions = this.deepCopyObj(this.options)
// let elms = this.sdk.viewer._container.getElementsByClassName('YJ-custom-base-dialog')
// for (let i = elms.length - 1; i >= 0; i--) {
// this.sdk.viewer._container.removeChild(elms[i])
// }
if (this._DialogObject && this._DialogObject.close) {
this._DialogObject.close()
this._DialogObject = null
}
if (state) {
this._DialogObject = await new Dialog(
this.sdk,
this.options,
{
title: '点属性',
left: '180px',
top: '100px',
confirmCallBack: options => {
this.labelText = this.labelText.trim()
if (!this.labelText) {
this.labelText = '未命名对象'
}
this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject.close()
let cdoptions = this.deepCopyObj(this.options)
cdoptions.host = ''
this.Dialog.confirmCallBack &&
this.Dialog.confirmCallBack(cdoptions)
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
},
resetCallBack: () => {
this.reset()
this.Dialog.resetCallBack && this.Dialog.resetCallBack()
},
removeCallBack: () => {
this.Dialog.removeCallBack && this.Dialog.removeCallBack()
},
closeCallBack: () => {
this.positionEditing = false
setTimeout(() => {
this.reset()
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
}, 0)
},
showCallBack: show => {
this.show = show
this.Dialog.showCallBack && this.Dialog.showCallBack()
},
translationalCallBack: () => {
this.positionEditing = !this.positionEditing
},
updateHeightCallBack: () => {
this.updateHeight()
}
},
true
)
this._DialogObject._element.body.className =
this._DialogObject._element.body.className + ' billboard-object'
let contentElm = document.createElement('div')
contentElm.innerHTML = html(this)
this._DialogObject.contentAppChild(contentElm)
this.attributeType = this.options.attributeType
this.attributeCamera = this.options.attribute.camera.content
this.attributeISC = this.options.attribute.ISC.content
// let coordinateElm = contentElm.getElementsByClassName('coordinate-select')[0]
// let option = ''
// this._proj.epsg_map.forEach((value, key) => {
// if (!this.options.coordinate) {
// this.options.coordinate = key
// this.originalOptions.coordinate = key
// }
// option += ``
// })
// coordinateElm.innerHTML = option
// this.coordinate = this.options.coordinate
// 创建标签页
let tabsElm = new cy_tabs('point-object-edit-tabs', undefined, this.sdk)
// 颜色组件
let colorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName('labelColor')[0],
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
defaultColor: this.labelColor,
disabled: false, //是否禁止打开颜色选择器
openPickerAni: 'opacity', //打开颜色选择器动画
sure: color => {
this.labelColor = color
}, //点击确认按钮事件回调
clear: () => {
this.labelColor = 'rgba(255,255,255,1)'
} //点击清空按钮事件回调
})
// let diffuseColorPicker = new YJColorPicker({
// el: contentElm.getElementsByClassName("diffuseColor")[0],
// size: 'mini',//颜色box类型
// alpha: false,//是否开启透明度
// defaultColor: this.diffuseColor,
// disabled: false,//是否禁止打开颜色选择器
// openPickerAni: 'opacity',//打开颜色选择器动画
// sure: (color) => {
// this.diffuseColor = color
// },//点击确认按钮事件回调
// clear: () => {
// this.diffuseColor = 'rgba(255,255,255,1)'
// },//点击清空按钮事件回调
// })
// let scanColorPicker = new YJColorPicker({
// el: contentElm.getElementsByClassName("scanColor")[0],
// size: 'mini',//颜色box类型
// alpha: false,//是否开启透明度
// defaultColor: this.scanColor,
// disabled: false,//是否禁止打开颜色选择器
// openPickerAni: 'opacity',//打开颜色选择器动画
// sure: (color) => {
// this.scanColor = color
// },//点击确认按钮事件回调
// clear: () => {
// this.scanColor = 'rgba(255,255,255,1)'
// },//点击清空按钮事件回调
// })
let all_elm = contentElm.getElementsByTagName('*')
this._EventBinding.on(this, all_elm)
this._elms = this._EventBinding.element
this._elms.labelColor = [colorPicker]
// this._elms.diffuseColor = [diffuseColorPicker]
// this._elms.scanColor = [scanColorPicker]
setTimeout(async () => {
this.attributeLink = this.options.attribute.link.content
this.attributeVr = this.options.attribute.vr.content
// this.attributeCamera = this.options.attribute.camera
this.cameraSelect && this.cameraSelect()
this.ISCSelect && this.ISCSelect()
this.goodsSelect && this.goodsSelect()
let col = document.createElement('div')
col.className = 'col'
col.style.flex = '0 0 110px'
col.innerHTML = `
属性框
`
let row = this._DialogObject._element.content.getElementsByClassName('attribute')[0].getElementsByClassName('row')[0]
row.appendChild(col)
let boxSwitch = col.getElementsByClassName('btn-switch')[0]
boxSwitch.checked = this.attributeBoxState
boxSwitch.addEventListener('change', (e) => {
this.attributeBoxState = boxSwitch.checked
})
let tagData = this.attributeSelect
let attributeElm = this._DialogObject._element.content.getElementsByClassName(
'attribute-select-box'
)[0]
if (attributeElm) {
let legpObject = legp(attributeElm, '.attribute-select')
legpObject.legp_search(tagData)
let attributeSelectElm = this._DialogObject._element.content
.getElementsByClassName('attribute-select')[0]
.getElementsByTagName('input')[0]
for (let i = 0; i < tagData.length; i++) {
if (tagData[i].key === this.options.attributeType) {
attributeSelectElm.value = tagData[i].value
legpObject.legp_searchActive(tagData[i].value)
break
}
}
attributeSelectElm.addEventListener('input', () => {
for (let i = 0; i < tagData.length; i++) {
if (tagData[i].value === attributeSelectElm.value) {
this.attributeType = tagData[i].key
break
}
}
})
}
let coordinateData = []
this.epsg_map.forEach((value, key) => {
coordinateData.push({
name: `${value.name}(${value.epsg})`,
value: key
})
})
let coordinateDataLegpObject = legp(
this._DialogObject._element.content.getElementsByClassName(
'coordinate-select-box'
)[0],
'.coordinate-select'
)
if (coordinateDataLegpObject) {
coordinateDataLegpObject.legp_search(coordinateData)
let coordinateDataLegpElm = this._DialogObject._element.content
.getElementsByClassName('coordinate-select')[0]
.getElementsByTagName('input')[0]
if (!this.coordinate) {
this.coordinate = coordinateData[0].value
} else {
this.coordinate = this.coordinate
}
coordinateDataLegpElm.value = this.coordinate
for (let i = 0; i < coordinateData.length; i++) {
if (coordinateData[i].value === coordinateData.value) {
coordinateDataLegpObject.legp_searchActive(
coordinateData[i].value
)
break
}
}
coordinateDataLegpElm.addEventListener('input', () => {
for (let i = 0; i < coordinateData.length; i++) {
if (coordinateData[i].value === coordinateDataLegpElm.value) {
this.coordinate = coordinateData[i].value
break
}
}
})
}
let heightBoxElm = document.getElementsByClassName('height-box')[0]
let heightElm = heightBoxElm.getElementsByClassName('height')[0]
let heightModeData = [
{
name: '海拔高度',
value: '海拔高度',
key: '0'
},
{
name: '相对地表',
value: '相对地表',
key: '1'
},
{
name: '依附地表',
value: '依附地表',
key: '2'
},
{
name: '依附模型',
value: '依附模型',
key: '3'
}
]
let heightMode = this.heightMode
switch (heightMode) {
case 0:
case '0':
heightElm.value = this.alt
break
case 1:
case '1':
if (this.sdk.viewer.scene.terrainProvider.availability) {
Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.scene.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
).then(position => {
heightElm.value = Number(
(this.alt - Number(position[0].height.toFixed(2))).toFixed(2)
)
})
} else {
heightElm.value = Number(this.alt.toFixed(2))
}
break
case 2:
case '2':
case 3:
case '3':
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
this.getClampToHeight(this.options.positions, objectsToExclude).then(h => {
this.alt = Number(h.toFixed(2))
heightElm.value = this.alt
})
break
}
let heightModeObject = legp(
this._DialogObject._element.content.getElementsByClassName(
'height-mode-box'
)[0],
'.height-mode'
)
if (heightModeObject) {
heightModeObject.legp_search(heightModeData)
let heightModeDataLegpElm = this._DialogObject._element.content
.getElementsByClassName('height-mode')[0]
.getElementsByTagName('input')[0]
heightModeDataLegpElm.value = heightModeData[this.heightMode].value
for (let i = 0; i < heightModeData.length; i++) {
if (heightModeData[i].value == heightModeDataLegpElm.value) {
heightModeObject.legp_searchActive(heightModeData[i].value)
break
}
}
heightModeDataLegpElm.addEventListener('input', () => {
for (let i = 0; i < heightModeData.length; i++) {
if (heightModeData[i].value === heightModeDataLegpElm.value) {
heightMode = heightModeData[i].key
switch (heightMode) {
case 0:
case '0':
this.alt = Number(heightElm.value)
heightBoxElm.style.display = 'flex'
this.heightMode = 0
break
case 1:
case '1':
if (this.sdk.viewer.scene.terrainProvider.availability) {
Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.scene.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
).then(position => {
this.alt =
Number(heightElm.value) +
Number(position[0].height.toFixed(2))
})
} else {
this.alt = Number(heightElm.value)
}
heightBoxElm.style.display = 'flex'
this.heightMode = 1
break
case 2:
case '2':
this.heightMode = 2
break
case 3:
case '3':
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
this.getClampToHeight(this.options.positions, objectsToExclude).then(h => {
this.alt = Number(h.toFixed(2))
})
this.heightMode = 3
break
}
break
}
}
})
heightElm.addEventListener('input', () => {
switch (heightMode) {
case 0:
case '0':
this.options.positions.alt = Number(
Number(heightElm.value).toFixed(2)
)
break
case 1:
case '1':
if (this.sdk.viewer.scene.terrainProvider.availability) {
Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.scene.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
).then(position => {
this.alt =
Number(heightElm.value) +
Number(position[0].height.toFixed(2))
})
} else {
this.alt = Number(heightElm.value)
}
break
case 2:
case '2':
break
}
this.renewPoint()
this.coordinate = this.options.coordinate
this._elms.alt &&
this._elms.alt.forEach(item => {
item.value = this.options.positions.alt
})
})
this._elms.height = heightBoxElm
this._elms.heightMode = heightModeDataLegpElm
this.heightMode = this.heightMode
}
let fontData = getFontList()
let fontObject = legp(
this._DialogObject._element.content.getElementsByClassName(
'font-select-box'
)[0],
'.font-select'
)
if (fontObject) {
fontObject.legp_search(fontData)
let fontDataLegpElm = this._DialogObject._element.content
.getElementsByClassName('font-select')[0]
.getElementsByTagName('input')[0]
fontDataLegpElm.value = fontData[this.labelFontFamily].value
for (let i = 0; i < fontData.length; i++) {
if (fontData[i].value == fontDataLegpElm.value) {
fontObject.legp_searchActive(fontData[i].value)
break
}
}
fontDataLegpElm.addEventListener('input', () => {
for (let i = 0; i < fontData.length; i++) {
if (fontData[i].value === fontDataLegpElm.value) {
this.labelFontFamily = fontData[i].key
break
}
}
})
this._elms.labelFontFamily = [fontDataLegpElm]
}
}, 0)
let lngEln = contentElm.getElementsByClassName('lng')[0]
let latEln = contentElm.getElementsByClassName('lat')[0]
lngEln.value = this.lng
latEln.value = this.lat
this._elms.lng.push(lngEln)
this._elms.lat.push(latEln)
let projCheckboxBoxElms = this._DialogObject._element.content.getElementsByClassName(
'YJ-custom-checkbox-box'
)
let projCheckboxElms = this._DialogObject._element.content.getElementsByClassName(
'YJ-custom-checkbox'
)
let projInputBoxElms = this._DialogObject._element.content.getElementsByClassName(
'proj-input-box'
)
projCheckboxElms[0].checked = true
projInputBoxElms[1].style.display = 'none'
projInputBoxElms[2].style.display = 'none'
projCheckboxBoxElms[0].addEventListener('click', () => {
projCheckboxElms[0].checked = true
projInputBoxElms[0].style.display = 'block'
projCheckboxElms[1].checked = false
projInputBoxElms[1].style.display = 'none'
projCheckboxElms[2].checked = false
projInputBoxElms[2].style.display = 'none'
})
projCheckboxBoxElms[1].addEventListener('click', () => {
projCheckboxElms[1].checked = true
projInputBoxElms[1].style.display = 'block'
projCheckboxElms[0].checked = false
projInputBoxElms[0].style.display = 'none'
projCheckboxElms[2].checked = false
projInputBoxElms[2].style.display = 'none'
})
projCheckboxBoxElms[2].addEventListener('click', () => {
projCheckboxElms[2].checked = true
projInputBoxElms[2].style.display = 'block'
projCheckboxElms[0].checked = false
projInputBoxElms[0].style.display = 'none'
projCheckboxElms[1].checked = false
projInputBoxElms[1].style.display = 'none'
})
_this._projConvert = () => {
if (!this._DialogObject || this._DialogObject.isDestroy) {
return
}
let lng,
lat,
lngD,
lngM,
lngS,
latD,
latM,
latS,
lngDM,
latDM,
lngDMS,
latDMS,
lngdnArr1,
lngdnArr2,
latdnArr1,
latdnArr2,
lngdnsArr1,
lngdnsArr2,
lngdnsArr3,
latdnsArr1,
latdnsArr2,
latdnsArr3
lng = _this.lng
lat = _this.lat
lngDM = _this._proj.degreesToDMS(lng, true)
latDM = _this._proj.degreesToDMS(lat, true)
lngdnArr1 = lngDM.split('°')
lngdnArr2 = lngdnArr1[1].split("'")
latdnArr1 = latDM.split('°')
latdnArr2 = latdnArr1[1].split("'")
contentElm.getElementsByClassName('lng-dm-d')[0].value = lngdnArr1[0]
contentElm.getElementsByClassName('lng-dm-m')[0].value = lngdnArr2[0]
contentElm.getElementsByClassName('lat-dm-d')[0].value = latdnArr1[0]
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
lngDMS = _this._proj.degreesToDMS(lng)
latDMS = _this._proj.degreesToDMS(lat)
lngdnsArr1 = lngDMS.split('°')
lngdnsArr2 = lngdnsArr1[1].split("'")
lngdnsArr3 = lngdnsArr2[1].split('"')
latdnsArr1 = latDMS.split('°')
latdnsArr2 = latdnsArr1[1].split("'")
latdnsArr3 = latdnsArr2[1].split('"')
contentElm.getElementsByClassName('lng-dms-d')[0].value = lngdnsArr1[0]
contentElm.getElementsByClassName('lng-dms-m')[0].value = lngdnsArr2[0]
contentElm.getElementsByClassName('lng-dms-s')[0].value = lngdnsArr3[0]
contentElm.getElementsByClassName('lat-dms-d')[0].value = latdnsArr1[0]
contentElm.getElementsByClassName('lat-dms-m')[0].value = latdnsArr2[0]
contentElm.getElementsByClassName('lat-dms-s')[0].value = latdnsArr3[0]
}
_this._projConvert()
} else {
// if (this._element_style) {
// document.getElementsByTagName('head')[0].removeChild(this._element_style)
// this._element_style = null
// }
// if (this._DialogObject && this._DialogObject.remove) {
// this._DialogObject.remove()
// this._DialogObject = null
// }
}
}
renewPoint() {
let _this = this
let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
if (this.entity) {
this.entity.position = Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat,
this.options.positions.alt
)
if (this.options.scaleByDistance) {
this.entity.billboard.scaleByDistance = new Cesium.NearFarScalar(
this.options.near,
1,
this.options.far,
0
)
this.entity.billboard.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
this.options.near,
1,
this.options.far,
0
)
this.entity.label.scaleByDistance = new Cesium.NearFarScalar(
this.options.near,
1,
this.options.far,
0
)
this.entity.label.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
this.options.near,
1,
this.options.far,
0
)
} else {
this.entity.billboard.scaleByDistance = undefined
this.entity.billboard.pixelOffsetScaleByDistance = undefined
this.entity.label.scaleByDistance = undefined
this.entity.label.pixelOffsetScaleByDistance = undefined
}
// this.entity.billboard.pixelOffset = new Cesium.CallbackProperty(
// function () {
// let billboardH =
// _this.entity.billboard.imgHeight *
// (31 / _this.entity.billboard.imgWidth)
// return new Cesium.Cartesian2(
// 0,
// -(billboardH / 2) * _this.options.billboard.scale
// )
// },
// false
// )
this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
if (_this.options.billboard.show) {
let billboardH = _this.entity.billboard.imgHeight ?
_this.entity.billboard.imgHeight *
(31 / _this.entity.billboard.imgWidth) : 0
return new Cesium.Cartesian2(
0,
-billboardH * _this.options.billboard.scale -
_this.options.label.fontSize / 2 -
5
)
} else {
return new Cesium.Cartesian2(0, -_this.options.label.fontSize / 2 - 5)
}
}, false)
this.entity.label.font = this.options.label.fontSize + 'px ' + font
this.entity.label.fillColor = Cesium.Color.fromCssColorString(
this.options.label.color
)
this.entity.billboard.scale = this.options.billboard.scale
}
}
reset() {
if (!this.entity) {
return
}
this.options = this.deepCopyObj(this.originalOptions)
this.near = this.originalOptions.near
this.far = this.originalOptions.far
this.scaleByDistance = this.originalOptions.scaleByDistance
this.billboardShow = this.originalOptions.billboard.show
this.billboardImage = this.originalOptions.billboard.image
this.billboardScale = this.originalOptions.billboard.scale
this.labelText = this.originalOptions.label.text
this.labelShow = this.originalOptions.label.show
this.labelFontSize = this.originalOptions.label.fontSize
this.labelColor = this.originalOptions.label.color
this.lng = this.originalOptions.positions.lng
this.lat = this.originalOptions.positions.lat
this.alt = this.originalOptions.positions.alt
// this.diffuseShow = this.originalOptions.diffuseShow
// this.diffuseRadius = this.originalOptions.diffuseRadius
// this.diffuseDuration = this.originalOptions.diffuseDuration
// this.diffuseColor = this.originalOptions.diffuseColor
// this.scanShow = this.originalOptions.scanShow
// this.scanRadius = this.originalOptions.scanRadius
// this.scanDuration = this.originalOptions.scanDuration
// this.scanColor = this.originalOptions.scanColor
this.instruct = this.originalOptions.instruct
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.attributeBoxState = this.options.attributeBoxState
this.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
}
async remove() {
await remove_entity_from_cluster(this.sdk.viewer, this.entity)
this.entity = null
this.attributeBoxState = false
if (!this.sdk.viewer || !this.sdk.viewer.entities) {
return
}
// if (this.diffuse) {
// this.diffuse.remove()
// this.diffuse = null
// }
// if (this.scan) {
// this.scan.remove()
// this.scan = null
// }
if (this._DialogObject && !this._DialogObject.isDestroy) {
this._DialogObject.close()
this._DialogObject = null
}
this.event && this.event.destroy()
this.tip && this.tip.destroy()
await this.sdk.removeIncetance(this.options.id)
await syncData(this.sdk, this.options.id)
// this.entity = null
}
// 点击弹框内图标切换
clickChangeImage() {
this.Dialog.clickChangeImage && this.Dialog.clickChangeImage()
}
// 点击弹框内默认图标切换
clickChangeDefaultImage() {
this.Dialog.clickChangeDefaultImage && this.Dialog.clickChangeDefaultImage()
}
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
}
/**
* 打开富文本框
*/
openRichTextEditor(e) {
// var ue = UE.getEditor('app');
richText.open(
this.options.id,
this.options.name,
this.options.richTextContent
)
richText.primaryCallBack = content => {
this.options.richTextContent = content
}
}
async updateHeight() {
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) {
return
}
let height
let height2
let point1 = new Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat,
0
)
let point2 = new Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat,
10000000000000
)
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
let updatedCartesians = await this.sdk.viewer.scene.clampToHeightMostDetailed([point1], objectsToExclude)
if (updatedCartesians && updatedCartesians[0]) {
height = this.cartesian3Towgs84(updatedCartesians[0], this.sdk.viewer).alt
}
let direction = Cesium.Cartesian3.subtract(
point1,
point2,
new Cesium.Cartesian3()
)
let c = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3())
let ray = new Cesium.Ray(point2, c)
let r = {}
let pickedObjects = this.sdk.viewer.scene.drillPickFromRay(ray)
for (let i = pickedObjects.length - 1; i >= 0; i--) {
if (pickedObjects[i].position) {
r = pickedObjects[i]
break
}
}
if (r && r.position) {
height2 = this.cartesian3Towgs84(r.position, this.sdk.viewer).alt
}
let promise
try {
promise = await Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
)
} catch (error) { }
if ((height2 === void 0 || height2 < promise[0].height) && promise) {
height2 = promise[0].height
}
if (height === void 0 || height < height2) {
height = height2
}
if (height !== undefined) {
this.options.positions.alt = Number(Number(height).toFixed(2))
this.#_billboardHeight = this.options.positions.alt
this._elms.alt &&
this._elms.alt.forEach(item => {
item.value = this.options.positions.alt
})
// this.scan && (this.scan.alt = v)
// this.diffuse && (this.diffuse.alt = v)
this.renewPoint()
this.coordinate = this.options.coordinate
if (this._elms.height) {
let heightElm = this._elms.height.getElementsByClassName('height')[0]
if (heightElm) {
switch (this._elms.heightMode.value) {
case '海拔高度':
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break
case '相对地表':
if (this.sdk.viewer.scene.terrainProvider.availability) {
Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.scene.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
).then(position => {
heightElm.value = Number(
(this.options.positions.alt - position[0].height).toFixed(2)
)
this.#_billboardHeight = this.options.positions.alt
})
} else {
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
}
break
case '依附地表':
break
case '依附模型':
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break
}
}
}
}
}
async flyTo(options = {}) {
setActiveViewer(0)
closeRotateAround(this.sdk)
closeViewFollow(this.sdk)
if (
this.options.customView &&
this.options.customView.relativePosition &&
this.options.customView.orientation
) {
let orientation = {
heading: Cesium.Math.toRadians(
this.options.customView.orientation.heading || 0.0
),
pitch: Cesium.Math.toRadians(
this.options.customView.orientation.pitch || -60.0
),
roll: Cesium.Math.toRadians(
this.options.customView.orientation.roll || 0.0
)
}
let lng = this.options.customView.relativePosition.lng
let lat = this.options.customView.relativePosition.lat
let alt = this.options.customView.relativePosition.alt
let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
let position = { lng: 0, lat: 0 }
if (this.options.position) {
position = { ...this.options.position }
} else if (this.options.positions) {
position = { ...this.options.positions }
} else if (this.options.center) {
position = { ...this.options.center }
} else if (this.options.start) {
position = { ...this.options.start }
} else {
if (this.options.hasOwnProperty('lng')) {
position.lng = this.options.lng
}
if (this.options.hasOwnProperty('lat')) {
position.lat = this.options.lat
}
if (this.options.hasOwnProperty('alt')) {
position.alt = this.options.alt
}
}
// 如果没有高度值,则获取紧贴高度计算
if (!position.hasOwnProperty('alt')) {
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
position.alt = await this.getClampToHeight(position, objectsToExclude)
}
lng = this.options.customView.relativePosition.lng + position.lng
lat = this.options.customView.relativePosition.lat + position.lat
alt = this.options.customView.relativePosition.alt + position.alt
destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
this.sdk.viewer.camera.flyTo({
destination: destination,
orientation: orientation
})
} else {
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
let height = await this.getClampToHeight(this.options.positions, objectsToExclude)
this.sdk.viewer.camera.flyTo({
orientation: options.orientation,
destination: Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat,
height + (options.height || 500)
)
})
}
}
setPosition(v) {
this.options.positions.lng = v.position.lng
this.options.positions.lat = v.position.lat
this.options.positions.alt = v.position.alt
this.renewPoint()
}
/**@desc 打开平移功能
*
* @memberOf Source
* @param status {boolean}
*
* */
set positionEditing(status) {
if (!this.sdk || !this.sdk.viewer || !this.entity) {
return
}
this.operate.positionEditing = status
this.event && this.event.destroy()
this.event = new MouseEvent(this.sdk)
if (status === true) {
this.picking = false
this.tip && this.tip.destroy()
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
this.previous = {
positions: { ...this.options.positions }
}
let moveEvent = (movement, cartesian) => {
this.entity.position = new Cesium.CallbackProperty(function () {
return cartesian
}, false)
this.tip.setPosition(
cartesian,
movement.endPosition.x,
movement.endPosition.y
)
}
let leftEvent = (movement, cartesian) => {
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
this.lng = positions.lng
this.lat = positions.lat
this.alt = positions.alt
this.previous = {
positions: { ...this.options.positions }
}
this.event.mouse_move(() => { })
this.event.mouse_left(() => { })
this.event.mouse_right(() => { })
this.event.gesture_pinck_start(() => { })
this.event.gesture_pinck_end(() => { })
this.entity.position = new Cesium.CallbackProperty(function () {
return cartesian
}, false)
this.positionEditing = false
}
this.event.mouse_move(moveEvent)
this.event.mouse_left(leftEvent)
this.event.mouse_right((movement, cartesian) => {
this.positionEditing = false
})
this.event.gesture_pinck_start((movement, cartesian) => {
let startTime = new Date()
this.event.gesture_pinck_end(() => {
let endTime = new Date()
let pos = {
position: {
x: (movement.position1.x + movement.position2.x) / 2,
y: (movement.position1.y + movement.position2.y) / 2
}
}
if (endTime - startTime >= 500) {
// 长按取消
this.positionEditing = false
} else {
leftEvent(pos, cartesian)
}
})
})
} else {
this.picking = true
if (this.event) {
this.event.mouse_move(() => { })
this.event.mouse_left(() => { })
this.event.mouse_right(() => { })
this.event.gesture_pinck_start(() => { })
this.event.gesture_pinck_end(() => { })
this.event.destroy()
this.event = null
}
this.tip && this.tip.destroy()
this.lng = this.previous.positions.lng
this.lat = this.previous.positions.lat
this.alt = this.previous.positions.alt
this.renewPoint()
}
}
get positionEditing() {
return this.operate.positionEditing
}
setDIV(options = { domid: '', x: 10, y: 10 }) {
options.x = options.x || options.x === 0 ? options.x : 10
options.y = options.y || options.y === 0 ? options.y : 10
let siteInfoDom = document.getElementById(options.domid)
let siteInfoPosition = Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
this.sdk.viewer.scene.postRender.addEventListener(percentage => {
//转换到屏幕坐标
if (
siteInfoDom.style.display === 'block' ||
siteInfoDom.style.display === ''
) {
let winpos = this.sdk.viewer.scene.cartesianToCanvasCoordinates(
siteInfoPosition
)
if (winpos) {
siteInfoDom.style.left = (winpos.x + options.x).toFixed(0) + 'px'
siteInfoDom.style.top = (winpos.y + options.y).toFixed(0) + 'px'
}
}
})
}
async setCustomView(val) {
if (val) {
this.options.customView = val
} else {
let camera = this.sdk.viewer.camera
let cameraPosition84 = this.cartesian3Towgs84(
camera.position,
this.sdk.viewer
)
let position = { lng: 0, lat: 0 }
let relativePosition = { ...cameraPosition84 }
if (this.options.positions) {
position = { ...this.options.positions }
} else {
if (this.options.hasOwnProperty('lng')) {
position.lng = this.options.lng
}
if (this.options.hasOwnProperty('lat')) {
position.lat = this.options.lat
}
if (this.options.hasOwnProperty('alt')) {
position.alt = this.options.alt
}
}
// 如果没有高度值,则获取紧贴高度计算
if (!position.hasOwnProperty('alt')) {
let objectsToExclude = []
for (let [key, value] of this.sdk.entityMap) {
if (value.type === 'RadarScanStereoscopic' && value.entity) {
objectsToExclude.push(value.entity)
}
}
position.alt = await this.getClampToHeight(position, objectsToExclude)
}
relativePosition = {
lng: cameraPosition84.lng - position.lng,
lat: cameraPosition84.lat - position.lat,
alt: cameraPosition84.alt - position.alt
}
this.options.customView = {
orientation: {
heading: Cesium.Math.toDegrees(camera.heading),
pitch: Cesium.Math.toDegrees(camera.pitch),
roll: Cesium.Math.toDegrees(camera.roll)
},
relativePosition: relativePosition
}
this.originalOptions &&
(this.originalOptions.customView = this.options.customView)
}
}
get attributeBoxState() {
return this.options.attributeBoxState
}
set attributeBoxState(state) {
state = state ? true : false
this.options.attributeBoxState = state
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
if (this.attributeElm) {
this.sdk.viewer._element.removeChild(this.attributeElm)
this.attributeElm = null
}
this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
if (state && this.sdk && this.sdk.viewer && this.sdk.viewer._element && this.show) {
let attributeElm = document.createElement('div')
this.attributeElm = attributeElm
attributeElm.className = 'billboard-attribute-box'
attributeElm.style.top = '0px'
attributeElm.style.left = '0px'
attributeElm.style.width = 0
attributeElm.style.height = 0
if(getState()) {
attributeElm.style.display = 'none'
}
// attributeElm.innerHTML = this.options.richTextContent
this.sdk.viewer._element.appendChild(attributeElm)
let linkHtml = ''
let goodsHtml = ''
let richTextHtml = ''
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
linkHtml += ``
}
if (this.options.attribute.goods && this.options.attribute.goods.content && this.options.attribute.goods.content.length > 0) {
goodsHtml += `
序号
名称
数量
`
for (let i = 0; i < this.options.attribute.goods.content.length; i++) {
goodsHtml += `
${i + 1}
${this.options.attribute.goods.content[i].name}
${this.options.attribute.goods.content[i].cnt}
`
}
goodsHtml += `
`
}
if (this.options.richTextContent) {
richTextHtml = `
${this.options.richTextContent}
`
}
let boxHtml = `
`
if (!linkHtml && !goodsHtml && !richTextHtml) {
boxHtml = boxHtml + '
暂无属性信息
'
}
else {
boxHtml = boxHtml + `
${richTextHtml}
${goodsHtml}
${linkHtml}
`
}
attributeElm.innerHTML = boxHtml
if (attributeElm.getElementsByClassName('tabs')[0]) {
let tabsElm = new cy_tabs(attributeElm.getElementsByClassName('tabs')[0], undefined, this.sdk)
}
let imgElm = attributeElm.getElementsByTagName('img')
for (let i = 0; i < imgElm.length; i++) {
if (!imgElm[i].style.width) {
imgElm[i].style.width = '100%'
}
}
this.sdk.viewer.scene.postRender.addEventListener(this.#_postRenderEvent)
let leftOnmousedown = (e) => {
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
let x = e.x
let y = e.y
let width = this.options.attributePos.width
let height = this.options.attributePos.height
let positionx = this.options.attributePos.x
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.width = width + (x - e2.x)
this.options.attributePos.height = height + (y - e2.y)
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
else {
this.options.attributePos.x = positionx - (x - e2.x)
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
// this.options.attributePos.y = positiony + (y - e2.y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
let rightOnmousedown = (e) => {
let x = e.x
let y = e.y
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
let width = this.options.attributePos.width
let height = this.options.attributePos.height
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.width = width + (e2.x - x)
this.options.attributePos.height = height + (y - e2.y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
// leftTopElm.onmousedown = (e) => {
// console.log(1111111111)
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// let x = e.x
// let y = e.y
// let width = this.options.attributePos.width
// let height = this.options.attributePos.height
// let positionx = this.options.attributePos.x
// this.sdk.viewer._element.onmousemove = (e2) => {
// this.options.attributePos.width = width + (x - e2.x)
// this.options.attributePos.height = height + (y - e2.y)
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// else {
// this.options.attributePos.x = positionx - (x - e2.x)
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// // this.options.attributePos.y = positiony + (y - e2.y)
// }
// document.addEventListener('mouseup', this.#_destroyMouseEvent);
// document.addEventListener('mouseleave', this.#_destroyMouseEvent);
// }
// rightTopElm.onmousedown = (e) => {
// let x = e.x
// let y = e.y
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// let width = this.options.attributePos.width
// let height = this.options.attributePos.height
// this.sdk.viewer._element.onmousemove = (e2) => {
// this.options.attributePos.width = width + (e2.x - x)
// this.options.attributePos.height = height + (y - e2.y)
// }
// document.addEventListener('mouseup', this.#_destroyMouseEvent);
// document.addEventListener('mouseleave', this.#_destroyMouseEvent);
// }
attributeElm.onmousedown = (e) => {
attributeElm.style.pointerEvents = 'none'
if (e.target.className.indexOf('left-top') != -1) {
leftOnmousedown(e)
}
else if (e.target.className.indexOf('right-top') != -1) {
rightOnmousedown(e)
}
else {
let x = e.x
let y = e.y
let oldX = this.options.attributePos.x
let oldXY = this.options.attributePos.y
let height = this.options.attributePos.height
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.x = oldX + (e2.x - x)
this.options.attributePos.y = oldXY - (e2.y - y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
}
}
}
}
export default BillboardObject