Compare commits

..

7 Commits

Author SHA1 Message Date
aefe966f45 修改 2025-09-11 18:04:44 +08:00
zh
1afc691ec2 Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0_new 2025-09-11 14:59:18 +08:00
zh
54afe11fa6 合并 2025-09-11 14:59:12 +08:00
89b52af2d6 工具 2025-09-10 10:31:58 +08:00
zh
d20db7c91b 合并 2025-09-08 17:27:42 +08:00
zh
b84a378ab9 Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0_new 2025-09-05 18:45:14 +08:00
zh
ae48dbd700 合并 2025-09-05 18:42:50 +08:00
31 changed files with 2887 additions and 7342 deletions

View File

@ -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 }

View File

@ -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: () => {

View File

@ -378,41 +378,42 @@ class Flat extends Base {
async edit(state) { async edit(state) {
if (state) { if (state) {
this.originalOptions = this.deepCopyObj(this.options) this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject = await new Dialog(this.sdk.viewer._container, { // this._DialogObject = await new Dialog(this.sdk.viewer._container, {
title: '压平面属性', left: '180px', top: '100px', // title: '压平面属性', left: '180px', top: '100px',
removeCallBack: () => { // removeCallBack: () => {
this.Dialog.removeCallBack && this.Dialog.removeCallBack() // this.Dialog.removeCallBack && this.Dialog.removeCallBack()
}, // },
closeCallBack: () => { // closeCallBack: () => {
this.reset() // this.reset()
this.Dialog.closeCallBack && this.Dialog.closeCallBack() // this.Dialog.closeCallBack && this.Dialog.closeCallBack()
} // }
}) // })
await this._DialogObject.init() // await this._DialogObject.init()
// 内容部分 // 内容部分
let contentElm = document.createElement('div'); // let contentElm = document.createElement('div');
contentElm.innerHTML = ` // contentElm.innerHTML = `
<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"> // <div class="col">
<span class="label" style="width: 56px;flex: 0 0 56px;">名称</span> // <span class="label" style="width: 56px;flex: 0 0 56px;">名称</span>
<input class="input input-name"> // <input class="input input-name">
</div> // </div>
</div> // </div>
<div class="row"> // <div class="row">
<div class="col"> // <div class="col">
<span class="label" style="width: 56px;flex: 0 0 56px;">压平高度</span> // <span class="label" style="width: 56px;flex: 0 0 56px;">压平高度</span>
<div class="input-number input-number-unit-1"> // <div class="input-number input-number-unit-1">
<input class="input flat-height" type="number" title="" min="-9999999" max="999999999"> // <input class="input flat-height" type="number" title="" min="-9999999" max="999999999">
<span class="unit">m</span> // <span class="unit">m</span>
<span class="arrow"></span> // <span class="arrow"></span>
</div> // </div>
</div> // </div>
</div> // </div>
</div> // </div>
` // `
this._DialogObject.contentAppChild(contentElm) // this._DialogObject.contentAppChild(contentElm)
let contentElm = document.getElementsByClassName('flatPlane')[0]
let name_elm = contentElm.getElementsByClassName('input-name')[0] let name_elm = contentElm.getElementsByClassName('input-name')[0]
name_elm.value = this.options.name name_elm.value = this.options.name
name_elm.addEventListener('input', () => { name_elm.addEventListener('input', () => {
@ -426,18 +427,18 @@ class Flat extends Base {
this.addFlat() this.addFlat()
}) })
let confirmElm = document.createElement('button'); // let confirmElm = document.createElement('button');
confirmElm.className = 'btn' // confirmElm.className = 'btn'
confirmElm.innerHTML = '确认' // confirmElm.innerHTML = '确认'
this._DialogObject.footAppChild(confirmElm) // this._DialogObject.footAppChild(confirmElm)
confirmElm.addEventListener('click', () => { // confirmElm.addEventListener('click', () => {
if (!this.options.name) { // if (!this.options.name) {
this.options.name = '压平面' // this.options.name = '压平面'
} // }
this.originalOptions = this.deepCopyObj(this.options) // this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject.close() // this._DialogObject.close()
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.options) // this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.options)
}) // })
// let flatElm = document.createElement('button'); // let flatElm = document.createElement('button');
// flatElm.className = 'btn' // flatElm.className = 'btn'
@ -458,6 +459,14 @@ class Flat extends Base {
} }
} }
sure() {
if (!this.options.name) {
this.options.name = '压平面'
}
this.originalOptions = this.deepCopyObj(this.options)
// this._DialogObject.close()
// this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.options)
}
reset() { reset() {
this.options = this.deepCopyObj(this.originalOptions) this.options = this.deepCopyObj(this.originalOptions)
this.name = this.options.name this.name = this.options.name

View File

@ -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()

View File

@ -28,7 +28,6 @@ class AssembleObject extends Base {
* @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色
* @param options.height {number} 高度 * @param options.height {number} 高度
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式 * @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
* @param options.areaUnit='平方米' {string} 面积单位
* @param options.line {object} 边框 * @param options.line {object} 边框
* @param options.line.width=2 {string} 边框宽 * @param options.line.width=2 {string} 边框宽
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
@ -80,7 +79,6 @@ class AssembleObject extends Base {
this.options.line = options.line || {} this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity this.entity
this.event = new MouseEvent(this.sdk) this.event = new MouseEvent(this.sdk)
this.operate = {} this.operate = {}
@ -105,13 +103,11 @@ class AssembleObject extends Base {
this.options.attribute = options.attribute || {} this.options.attribute = options.attribute || {}
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.vr = this.options.attribute.vr || {} delete this.options.attribute.vr
this.options.attribute.vr.content = this.options.attribute.vr.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.nodePoints = [] this.nodePoints = []
if (!this.options.positions || this.options.positions.length < 3) { if (!this.options.positions || this.options.positions.length < 3) {
this._error = '集结地最少需要三个坐标!' this._error = '集结地最少需要三个坐标!'
@ -189,7 +185,7 @@ class AssembleObject extends Base {
return return
} }
let heightModeName = '' let heightModeName = ''
AssembleObject.closeNodeEdit(this) this.closeNodeEdit()
let ground = false let ground = false
let disabled = false let disabled = false
this.renewPositions() this.renewPositions()
@ -314,45 +310,6 @@ class AssembleObject extends Base {
}) })
} }
get area() {
return this.options.area
}
set area(v) {
this.options.area = v
this._elms.area && this._elms.area.forEach((item) => {
item.value = v
})
}
get areaUnit() {
return this.options['area-unit']
}
set areaUnit(v) {
this.options['area-unit'] = v
this._elms.areaUnit && this._elms.areaUnit.forEach((item) => {
item.value = v
})
if (this.options.areaByMeter) {
switch (v) {
case '平方米':
this.area = this.options.areaByMeter
break;
case '平方千米':
this.area = Number((this.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
this.area = Number((this.options.areaByMeter / 10000).toFixed(6))
break;
default:
this.area = this.options.areaByMeter
}
}
}
get labelShow() { get labelShow() {
return this.options.label.show return this.options.label.show
} }
@ -564,319 +521,6 @@ class AssembleObject 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 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
}
static create(that) { static create(that) {
let positions = that.options.positions let positions = that.options.positions
let fromDegreesArray = [] let fromDegreesArray = []
@ -919,9 +563,10 @@ class AssembleObject extends Base {
break break
} }
if (!that.options.label.position) { // if (!that.options.label.position) {
// that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
// }
that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height } that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
}
let fromDegreesArray2 = [] let fromDegreesArray2 = []
for (let i = 0; i < points[0].length; i++) { for (let i = 0; i < points[0].length; i++) {
@ -939,7 +584,7 @@ class AssembleObject extends Base {
color: that.options.color color: that.options.color
}) })
} }
that.options.label.ground = ground // that.options.label.ground = ground
that.positionsH = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2) that.positionsH = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2)
that.entity = that.sdk.viewer.entities.add({ that.entity = that.sdk.viewer.entities.add({
@ -967,23 +612,8 @@ class AssembleObject extends Base {
for (let i = 0; i < positionsA.length; i++) { for (let i = 0; i < positionsA.length; i++) {
pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer)) pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer))
} }
that.options.areaByMeter = that.computeArea(pos84); that.areaByMeter = that.computeArea(pos84);
switch (that.options['area-unit']) { that.areaChangeCallBack && that.areaChangeCallBack()
case '平方米':
that.options.area = that.options.areaByMeter
break;
case '平方千米':
that.options.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
that.options.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
that.options.area = Number((that.options.areaByMeter / 10000).toFixed(6))
break;
default:
that.options.area = that.options.areaByMeter
}
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)
if (that.options.show) { if (that.options.show) {
setSplitDirection(0, that.options.id) setSplitDirection(0, that.options.id)
@ -1007,12 +637,13 @@ class AssembleObject extends Base {
scaleByDistance: that.options.label.scaleByDistance, scaleByDistance: that.options.label.scaleByDistance,
near: that.options.label.near, near: that.options.label.near,
far: that.options.label.far, far: that.options.label.far,
ground: that.options.label.ground, // ground: that.options.label.ground,
}) })
} }
// 编辑框 // 编辑框
async edit(state) { async edit(state) {
return
if (this._error) { if (this._error) {
return return
} }
@ -1446,7 +1077,6 @@ class AssembleObject extends Base {
if (unitDataLegpObject) { if (unitDataLegpObject) {
unitDataLegpObject.legp_search(unitData) unitDataLegpObject.legp_search(unitData)
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-select-unit')[0].getElementsByTagName('input')[0] let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-select-unit')[0].getElementsByTagName('input')[0]
unitDataLegpElm.value = this.options['area-unit']
for (let i = 0; i < unitData.length; i++) { for (let i = 0; i < unitData.length; i++) {
if (unitData[i].value === unitDataLegpElm.value) { if (unitData[i].value === unitDataLegpElm.value) {
unitDataLegpObject.legp_searchActive(unitData[i].value) unitDataLegpObject.legp_searchActive(unitData[i].value)
@ -1511,8 +1141,6 @@ class AssembleObject extends Base {
this.color = this.originalOptions.color this.color = this.originalOptions.color
this.lineColor = this.originalOptions.line.color this.lineColor = this.originalOptions.line.color
this.lineWidth = this.originalOptions.line.width this.lineWidth = this.originalOptions.line.width
this.area = this.originalOptions.area
this.areaUnit = this.originalOptions['area-unit']
this.labelShow = this.originalOptions.label.show this.labelShow = this.originalOptions.label.show
this.labelColor = this.originalOptions.label.color this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize this.labelFontSize = this.originalOptions.label.fontSize
@ -1525,12 +1153,6 @@ class AssembleObject extends Base {
this.labelLineColor = this.originalOptions.label.lineColor this.labelLineColor = this.originalOptions.label.lineColor
this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0]
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
this.attributeLink = this.options.attribute.link.content
this.attributeCamera = this.options.attribute.camera.content
this.attributeVr = this.options.attribute.vr.content
this.attributeGoods = this.options.attribute.goods.content
this.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
for (let i = 0; i < this.options.positions.length; i++) { for (let i = 0; i < this.options.positions.length; i++) {
@ -1572,51 +1194,6 @@ class AssembleObject extends Base {
await syncData(this.sdk, this.options.id) await syncData(this.sdk, this.options.id)
} }
_addLink() {
// document.getElementsByClassName
if (this._DialogObject._element.content.getElementsByClassName('link_add')[0] && 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
}
/** /**
* 飞到 * 飞到
*/ */
@ -1818,6 +1395,11 @@ class AssembleObject extends Base {
this.positions = newpositions this.positions = newpositions
this.previous = null this.previous = null
this.positionEditing = false this.positionEditing = false
if(this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
}) })
this.event.mouse_right((movement, cartesian) => { this.event.mouse_right((movement, cartesian) => {
this.positionEditing = false this.positionEditing = false
@ -1919,131 +1501,47 @@ class AssembleObject extends Base {
get positionEditing() { get positionEditing() {
return this.operate.positionEditing return this.operate.positionEditing
} }
openPositionEditing(cd) {
static EventBinding(that, elements) { this.positionEditing = true
for (let i = 0; i < elements.length; i++) { this._positionEditingCallback = cd
let Event = []
let isEvent = false
let removeName = []
if (!elements[i] || !elements[i].attributes) {
continue;
} }
for (let m of elements[i].attributes) { get areaChangeCallBack() {
switch (m.name) { return this._areaChangeCallBack
case '@model': {
isEvent = true
if (elements[i].type == 'checkbox') {
Event.push((e) => { that[m.value] = e.target.checked })
elements[i].checked = that[m.value]
}
else {
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number') {
if (e.data != '.' && (e.data != '-' || e.target.value)) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
that[m.value] = value
}
}
else {
that[m.value] = value
}
})
if (elements[i].nodeName == 'IMG') {
elements[i].src = that[m.value]
}
else {
elements[i].value = that[m.value]
}
}
if (that._elms[m.value]) {
that._elms[m.value].push(elements[i])
}
else {
that._elms[m.value] = [elements[i]]
}
removeName.push(m.name)
break;
}
case '@click': {
elements[i].addEventListener('click', (e) => {
if (typeof (that[m.value]) === 'function') {
that[m.value](e)
}
});
removeName.push(m.name)
// elements[i].attributes.removeNamedItem(m.name)
break;
}
case '@change': {
isEvent = true
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number' && value != '') {
value = Number(value)
e.target.value = value
}
if (typeof (that[m.value]) === 'function') {
that[m.value](e, value)
}
})
break;
}
}
// elements[i].attributes[m] = undefined
}
for (let n = 0; n < removeName.length; n++) {
elements[i].attributes.removeNamedItem(removeName[n])
} }
if (isEvent) { set areaChangeCallBack (cd) {
let ventType = 'input' this._areaChangeCallBack = cd
if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') {
ventType = 'change'
}
elements[i].addEventListener(ventType, (e) => {
for (let t = 0; t < Event.length; t++) {
Event[t](e)
}
});
}
}
} }
static nodeEdit(that, cb = () => { }) { nodeEdit(cb = () => { }) {
that.positionEditing = false this.positionEditing = false
if (YJ.Measure.GetMeasureStatus()) { if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束') cb('上一次测量未结束')
} else { } else {
YJ.Measure.SetMeasureStatus(true) YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('请选择一个顶点,右键取消', that.sdk) let _this = this
that.event = new MouseEvent(that.sdk) this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
that.nodePoints = [] this.event = new MouseEvent(this.sdk)
this.nodePoints = []
let selectPoint let selectPoint
let originalPosition let originalPosition
let fromDegreesArray = [] let fromDegreesArray = []
for (let i = 0; i < that.options.positions.length; i++) { for (let i = 0; i < this.options.positions.length; i++) {
fromDegreesArray.push(that.options.positions[i].lng, that.options.positions[i].lat) fromDegreesArray.push(this.options.positions[i].lng, this.options.positions[i].lat)
} }
let moveEvent = (movement, cartesian) => { let moveEvent = (movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
if (that._elms.lng && that._elms.lng[selectPoint.index]) { if (this._elms.lng && this._elms.lng[selectPoint.index]) {
that._elms.lng[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lng.toFixed(8) this._elms.lng[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lng.toFixed(8)
} }
if (that._elms.lat && that._elms.lat[selectPoint.index]) { if (this._elms.lat && this._elms.lat[selectPoint.index]) {
that._elms.lat[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lat.toFixed(8) this._elms.lat[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lat.toFixed(8)
} }
that.renewPositions() this.renewPositions()
} }
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.position ? movement.position.x : movement.endPosition.x, movement.position ? movement.position.x : movement.endPosition.x,
movement.position ? movement.position.y : movement.endPosition.y movement.position ? movement.position.y : movement.endPosition.y
@ -2052,25 +1550,25 @@ class AssembleObject extends Base {
let leftEvent = (movement, cartesian) => { let leftEvent = (movement, cartesian) => {
moveEvent(movement, cartesian) moveEvent(movement, cartesian)
let position84 = that.cartesian3Towgs84(cartesian, that.sdk.viewer) let position84 = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
if (selectPoint) { if (selectPoint) {
let index = selectPoint.index let index = selectPoint.index
let entity = that.sdk.viewer.entities.add({ let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: index, index: index,
position: Cesium.Cartesian3.fromDegrees(that.options.positions[selectPoint.index].lng, that.options.positions[selectPoint.index].lat, position84.alt), position: Cesium.Cartesian3.fromDegrees(this.options.positions[selectPoint.index].lng, this.options.positions[selectPoint.index].lat, position84.alt),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.splice(selectPoint.index, 0, entity) this.nodePoints.splice(selectPoint.index, 0, entity)
selectPoint = null selectPoint = null
that.tip.set_text('请选择一个顶点,右键取消') this.tip.set_text('请选择一个顶点,右键取消')
} }
else { else {
let position = movement.position let position = movement.position
@ -2080,49 +1578,50 @@ class AssembleObject extends Base {
y: (movement.position1.y + movement.position2.y) / 2 y: (movement.position1.y + movement.position2.y) / 2
} }
} }
var pick = that.sdk.viewer.scene.pick(position); var pick = this.sdk.viewer.scene.pick(position);
if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') { if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') {
selectPoint = pick.id selectPoint = pick.id
originalPosition = that.cartesian3Towgs84(pick.id.position.getValue(), that.sdk.viewer) originalPosition = this.cartesian3Towgs84(pick.id.position.getValue(), this.sdk.viewer)
that.nodePoints.splice(pick.id.index, 1) this.nodePoints.splice(pick.id.index, 1)
that.sdk.viewer.entities.remove(pick.id) this.sdk.viewer.entities.remove(pick.id)
that.tip.set_text('左键确认,右键取消') this.tip.set_text('左键确认,右键取消')
} }
} }
that.renewPositions() this.renewPositions()
cb('', [...this.options.positions])
} }
let rightEvent = () => { let rightEvent = () => {
that.event.mouse_move(() => { }) this.event.mouse_move(() => { })
that.event.mouse_left(() => { }) this.event.mouse_left(() => { })
that.event.mouse_right(() => { }) this.event.mouse_right(() => { })
that.event.gesture_pinck_start(() => { }) this.event.gesture_pinck_start(() => { })
if (selectPoint) { if (selectPoint) {
if (!originalPosition) { if (!originalPosition) {
that.options.positions.pop() this.options.positions.pop()
} }
else { else {
that.options.positions[selectPoint.index] = originalPosition this.options.positions[selectPoint.index] = originalPosition
} }
if (that._elms.lng && that._elms.lng[selectPoint.index]) { if (this._elms.lng && this._elms.lng[selectPoint.index]) {
that._elms.lng[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lng.toFixed(8) this._elms.lng[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lng.toFixed(8)
} }
if (that._elms.lat && that._elms.lat[selectPoint.index]) { if (this._elms.lat && this._elms.lat[selectPoint.index]) {
that._elms.lat[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lat.toFixed(8) this._elms.lat[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lat.toFixed(8)
} }
} }
that.heightMode = that.heightMode this.heightMode = this.heightMode
that.previous = null this.previous = null
} }
that.entity.polyline.clampToGround = true this.entity.polyline.clampToGround = true
that.entity.polyline.arcType = Cesium.ArcType.GEODESIC this.entity.polyline.arcType = Cesium.ArcType.GEODESIC
that.entity.polygon.perPositionHeight = false this.entity.polygon.perPositionHeight = false
that.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () { this.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
let arr = that.computeAssemble(that.options.positions) let arr = _this.computeAssemble(_this.options.positions)
return new Cesium.PolygonHierarchy(arr) return new Cesium.PolygonHierarchy(arr)
}, false) }, false)
that.entity.polyline.positions = new Cesium.CallbackProperty(function () { this.entity.polyline.positions = new Cesium.CallbackProperty(function () {
let arr = that.computeAssemble(that.options.positions) let arr = _this.computeAssemble(_this.options.positions)
if (arr.length >= 3) { if (arr.length >= 3) {
return [...arr, arr[0], arr[1]] return [...arr, arr[0], arr[1]]
} }
@ -2134,23 +1633,23 @@ class AssembleObject extends Base {
let points = [[]] let points = [[]]
let pos84 = [] let pos84 = []
for (let i = 0; i < that.positionsH.length; i++) { for (let i = 0; i < this.positionsH.length; i++) {
let position = that.cartesian3Towgs84(that.positionsH[i], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[i], this.sdk.viewer)
pos84.push(position) pos84.push(position)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
} }
let position = that.cartesian3Towgs84(that.positionsH[0], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[0], this.sdk.viewer)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
that this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1] lat: centroid.geometry.coordinates[1]
}, objectsToExclude) }, objectsToExclude)
.then(height => { .then(height => {
that.label.position = [ this.label.position = [
centroid.geometry.coordinates[0], centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1], centroid.geometry.coordinates[1],
height height
@ -2159,15 +1658,15 @@ class AssembleObject extends Base {
setTimeout(() => { setTimeout(() => {
that.event.mouse_left(leftEvent) this.event.mouse_left(leftEvent)
that.event.mouse_right(rightEvent) this.event.mouse_right(rightEvent)
that.event.mouse_move(moveEvent) this.event.mouse_move(moveEvent)
that.event.gesture_pinck_start((movement, cartesian) => { this.event.gesture_pinck_start((movement, cartesian) => {
let startTime = new Date() let startTime = new Date()
that.event.gesture_pinck_end(() => { this.event.gesture_pinck_end(() => {
let endTime = new Date() let endTime = new Date()
let pos = { let pos = {
position: { position: {
@ -2187,31 +1686,31 @@ class AssembleObject extends Base {
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [..._this.sdk.viewer.entities.values]
for (let i = 0; i < that.options.positions.length; i++) { for (let i = 0; i < _this.options.positions.length; i++) {
let height = await that.getClampToHeight(that.options.positions[i], objectsToExclude) let height = await _this.getClampToHeight(_this.options.positions[i], objectsToExclude)
let entity = that.sdk.viewer.entities.add({ let entity = _this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: i, index: i,
position: Cesium.Cartesian3.fromDegrees(that.options.positions[i].lng, that.options.positions[i].lat, height), position: Cesium.Cartesian3.fromDegrees(_this.options.positions[i].lng, _this.options.positions[i].lat, height),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: _this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.push(entity) _this.nodePoints.push(entity)
} }
} }
// for (let i = 0; i < that.options.positions.length; i++) { // for (let i = 0; i < this.options.positions.length; i++) {
// let entity = that.sdk.viewer.entities.add({ // let entity = this.sdk.viewer.entities.add({
// name: 'node-secondary-edit-point', // name: 'node-secondary-edit-point',
// index: i, // index: i,
// position: Cesium.Cartesian3.fromDegrees(that.options.positions[i].lng, that.options.positions[i].lat), // position: Cesium.Cartesian3.fromDegrees(this.options.positions[i].lng, this.options.positions[i].lat),
// billboard: { // billboard: {
// image: that.getSourceRootPath() + '/img/point.png', // image: this.getSourceRootPath() + '/img/point.png',
// width: 15, // width: 15,
// height: 15, // height: 15,
// disableDepthTestDistance: Number.POSITIVE_INFINITY, // disableDepthTestDistance: Number.POSITIVE_INFINITY,
@ -2222,17 +1721,17 @@ class AssembleObject extends Base {
} }
} }
static closeNodeEdit(that) { closeNodeEdit() {
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event && that.event.destroy() this.event && this.event.destroy()
that.tip && that.tip.destroy() this.tip && this.tip.destroy()
that.tip = null this.tip = null
for (let i = 0; i < that.nodePoints.length; i++) { for (let i = 0; i < this.nodePoints.length; i++) {
that.sdk.viewer.entities.remove(that.nodePoints[i]) this.sdk.viewer.entities.remove(this.nodePoints[i])
} }
that.nodePoints = [] this.nodePoints = []
that.picking = true this.picking = true
} }
setPosition(v) { setPosition(v) {
@ -2323,7 +1822,7 @@ class AssembleObject extends Base {
} }
// 更新坐标 // 更新坐标
renewPositions(position84) { renewPositions(position84, cd) {
if (this._error || !this.sdk.viewer) { if (this._error || !this.sdk.viewer) {
return return
} }
@ -2410,8 +1909,8 @@ class AssembleObject extends Base {
} }
// 计算投影面积 // 计算投影面积
this.options.areaByMeter = this.computeArea(pos84) this.areaByMeter = this.computeArea(pos84)
this.areaUnit = this.areaUnit this.areaChangeCallBack && this.areaChangeCallBack()
return fromDegreesArray return fromDegreesArray
} }
} }

View File

@ -83,7 +83,6 @@ class AttackArrowObject extends Base {
this.options.line = options.line || {} this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity this.entity
this.event = new MouseEvent(this.sdk) this.event = new MouseEvent(this.sdk)
this.operate = {} this.operate = {}
@ -112,13 +111,11 @@ class AttackArrowObject extends Base {
this.options.attribute = options.attribute || {} this.options.attribute = options.attribute || {}
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.vr = this.options.attribute.vr || {} delete this.options.attribute.vr
this.options.attribute.vr.content = this.options.attribute.vr.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'
if (!this.options.positions || this.options.positions.length < 3) { if (!this.options.positions || this.options.positions.length < 3) {
this._error = '箭头面最少需要三个坐标!' this._error = '箭头面最少需要三个坐标!'
@ -196,7 +193,7 @@ class AttackArrowObject extends Base {
return return
} }
let heightModeName = '' let heightModeName = ''
AttackArrowObject.closeNodeEdit(this) this.closeNodeEdit()
let ground = false let ground = false
let disabled = false let disabled = false
this.renewPositions() this.renewPositions()
@ -322,45 +319,6 @@ class AttackArrowObject extends Base {
}) })
} }
get area() {
return this.options.area
}
set area(v) {
this.options.area = v
this._elms.area && this._elms.area.forEach((item) => {
item.value = v
})
}
get areaUnit() {
return this.options['area-unit']
}
set areaUnit(v) {
this.options['area-unit'] = v
this._elms.areaUnit && this._elms.areaUnit.forEach((item) => {
item.value = v
})
if (this.options.areaByMeter) {
switch (v) {
case '平方米':
this.area = this.options.areaByMeter
break;
case '平方千米':
this.area = Number((this.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
this.area = Number((this.options.areaByMeter / 10000).toFixed(6))
break;
default:
this.area = this.options.areaByMeter
}
}
}
get labelShow() { get labelShow() {
return this.options.label.show return this.options.label.show
} }
@ -572,319 +530,6 @@ class AttackArrowObject 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 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
}
static create(that) { static create(that) {
let positions = that.options.positions let positions = that.options.positions
let fromDegreesArray = [] let fromDegreesArray = []
@ -928,10 +573,11 @@ class AttackArrowObject extends Base {
break break
} }
if (!that.options.label.position) { // if (!that.options.label.position) {
// that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
// }
that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height } that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
} // that.options.label.ground = ground
that.options.label.ground = ground
let fromDegreesArray2 = [] let fromDegreesArray2 = []
for (let i = 0; i < points[0].length; i++) { for (let i = 0; i < points[0].length; i++) {
@ -977,23 +623,8 @@ class AttackArrowObject extends Base {
for (let i = 0; i < positionsA.length; i++) { for (let i = 0; i < positionsA.length; i++) {
pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer)) pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer))
} }
that.options.areaByMeter = that.computeArea(pos84); that.areaByMeter = that.computeArea(pos84);
switch (that.options['area-unit']) { that.areaChangeCallBack && that.areaChangeCallBack()
case '平方米':
that.options.area = that.options.areaByMeter
break;
case '平方千米':
that.options.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
that.options.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
that.options.area = Number((that.options.areaByMeter / 10000).toFixed(6))
break;
default:
that.options.area = that.options.areaByMeter
}
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)
if (that.options.show) { if (that.options.show) {
@ -1020,12 +651,13 @@ class AttackArrowObject extends Base {
scaleByDistance: that.options.label.scaleByDistance, scaleByDistance: that.options.label.scaleByDistance,
near: that.options.label.near, near: that.options.label.near,
far: that.options.label.far, far: that.options.label.far,
ground: that.options.label.ground, // ground: that.options.label.ground,
}) })
} }
// 编辑框 // 编辑框
async edit(state) { async edit(state) {
return
if (this._error) { if (this._error) {
return return
} }
@ -1527,8 +1159,6 @@ class AttackArrowObject extends Base {
this.color = this.originalOptions.color this.color = this.originalOptions.color
this.lineColor = this.originalOptions.line.color this.lineColor = this.originalOptions.line.color
this.lineWidth = this.originalOptions.line.width this.lineWidth = this.originalOptions.line.width
this.area = this.originalOptions.area
this.areaUnit = this.originalOptions['area-unit']
this.labelShow = this.originalOptions.label.show this.labelShow = this.originalOptions.label.show
this.labelColor = this.originalOptions.label.color this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize this.labelFontSize = this.originalOptions.label.fontSize
@ -1541,12 +1171,6 @@ class AttackArrowObject extends Base {
this.labelLineColor = this.originalOptions.label.lineColor this.labelLineColor = this.originalOptions.label.lineColor
this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0]
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
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.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
for (let i = 0; i < this.options.positions.length; i++) { for (let i = 0; i < this.options.positions.length; i++) {
if (this._elms.lng && this._elms.lng[i]) { if (this._elms.lng && this._elms.lng[i]) {
@ -1597,51 +1221,6 @@ class AttackArrowObject extends Base {
await syncData(this.sdk, this.options.id) await syncData(this.sdk, this.options.id)
} }
_addLink() {
// document.getElementsByClassName
if (this._DialogObject._element.content.getElementsByClassName('link_add')[0] && 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
}
/** /**
* 飞到 * 飞到
*/ */
@ -1747,16 +1326,6 @@ class AttackArrowObject extends Base {
} }
} }
/**
* 打开富文本框
*/
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
}
}
/**@desc 打开平移功能 /**@desc 打开平移功能
* *
@ -1844,6 +1413,11 @@ class AttackArrowObject extends Base {
positions: [...this.positions] positions: [...this.positions]
} }
this.positionEditing = false this.positionEditing = false
if(this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
}) })
this.event.mouse_right((movement, cartesian) => { this.event.mouse_right((movement, cartesian) => {
this.positionEditing = false this.positionEditing = false
@ -1946,6 +1520,18 @@ class AttackArrowObject extends Base {
return this.operate.positionEditing return this.operate.positionEditing
} }
openPositionEditing(cd) {
this.positionEditing = true
this._positionEditingCallback = cd
}
get areaChangeCallBack() {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
this._areaChangeCallBack = cd
}
static EventBinding(that, elements) { static EventBinding(that, elements) {
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
let Event = [] let Event = []
@ -2045,28 +1631,29 @@ class AttackArrowObject extends Base {
} }
} }
static nodeEdit(that, cb = () => { }) { nodeEdit(cb = () => { }) {
that.positionEditing = false this.positionEditing = false
setTimeout(() => { setTimeout(() => {
if (YJ.Measure.GetMeasureStatus()) { if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束') cb('上一次测量未结束')
} else { } else {
that.removeAnimate() this.removeAnimate()
YJ.Measure.SetMeasureStatus(true) YJ.Measure.SetMeasureStatus(true)
that.event && that.event.destroy() let _this = this
that.tip && that.tip.destroy() this.event && this.event.destroy()
that.tip = new MouseTip('请选择一个顶点,右键取消', that.sdk) this.tip && this.tip.destroy()
that.event = new MouseEvent(that.sdk) this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
that.nodePoints = [] this.event = new MouseEvent(this.sdk)
this.nodePoints = []
let selectPoint let selectPoint
let originalPosition let originalPosition
let moveEvent = (movement, cartesian) => { let moveEvent = (movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
that.renewPositions() this.renewPositions()
} }
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.position ? movement.position.x : movement.endPosition.x, movement.position ? movement.position.x : movement.endPosition.x,
movement.position ? movement.position.y : movement.endPosition.y movement.position ? movement.position.y : movement.endPosition.y
@ -2075,17 +1662,17 @@ class AttackArrowObject extends Base {
let leftEvent = (movement, cartesian) => { let leftEvent = (movement, cartesian) => {
moveEvent(movement, cartesian) moveEvent(movement, cartesian)
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
let index = selectPoint.index let index = selectPoint.index
if (selectPoint.index === that.options.positions.length - 1) { if (selectPoint.index === this.options.positions.length - 1) {
index = index + 1 index = index + 1
} }
let entity = that.sdk.viewer.entities.add({ let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: index, index: index,
position: Cesium.Cartesian3.fromDegrees(that.options.positions[selectPoint.index].lng, that.options.positions[selectPoint.index].lat, that.options.positions[selectPoint.index].alt), position: Cesium.Cartesian3.fromDegrees(this.options.positions[selectPoint.index].lng, this.options.positions[selectPoint.index].lat, this.options.positions[selectPoint.index].alt),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
@ -2094,86 +1681,87 @@ class AttackArrowObject extends Base {
}) })
selectPoint = entity selectPoint = entity
originalPosition = that.options.positions[selectPoint.index] originalPosition = this.options.positions[selectPoint.index]
that.nodePoints.splice(selectPoint.index, 0, entity) this.nodePoints.splice(selectPoint.index, 0, entity)
if (index < that.options.positions.length) { if (index < this.options.positions.length) {
selectPoint = null selectPoint = null
that.tip.set_text('请选择一个顶点,右键取消') this.tip.set_text('请选择一个顶点,右键取消')
} }
else { else {
that.options.positions.splice(selectPoint.index, 0, that.options.positions[selectPoint.index]) this.options.positions.splice(selectPoint.index, 0, this.options.positions[selectPoint.index])
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
} }
that.renewPositions() this.renewPositions()
cb('', [...this.options.positions])
} }
else { else {
var pick = that.sdk.viewer.scene.pick(movement.position || movement.endPosition); var pick = this.sdk.viewer.scene.pick(movement.position || movement.endPosition);
if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') { if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') {
selectPoint = pick.id selectPoint = pick.id
originalPosition = that.cartesian3Towgs84(pick.id.position.getValue(), that.sdk.viewer) originalPosition = this.cartesian3Towgs84(pick.id.position.getValue(), this.sdk.viewer)
that.nodePoints.splice(pick.id.index, 1) this.nodePoints.splice(pick.id.index, 1)
that.sdk.viewer.entities.remove(pick.id) this.sdk.viewer.entities.remove(pick.id)
that.tip.set_text('左键确认右键结束CTRL+右键撤销') this.tip.set_text('左键确认右键结束CTRL+右键撤销')
} }
} }
} }
let rightEvent = (movement, cartesian) => { let rightEvent = (movement, cartesian) => {
that.event.mouse_move(() => { }) this.event.mouse_move(() => { })
that.event.mouse_left(() => { }) this.event.mouse_left(() => { })
that.event.mouse_right(() => { }) this.event.mouse_right(() => { })
that.event.gesture_pinck_start(() => { }) this.event.gesture_pinck_start(() => { })
if (selectPoint) { if (selectPoint) {
if (!originalPosition) { if (!originalPosition) {
that.options.positions.pop() this.options.positions.pop()
} }
else { else {
that.options.positions[selectPoint.index] = originalPosition this.options.positions[selectPoint.index] = originalPosition
if (that.options.positions.length > 3 && selectPoint.index === that.options.positions.length - 1) { if (this.options.positions.length > 3 && selectPoint.index === this.options.positions.length - 1) {
that.options.positions.splice(selectPoint.index + 1, 1) this.options.positions.splice(selectPoint.index + 1, 1)
} }
} }
if (that._elms.lng && that._elms.lng[selectPoint.index]) { if (this._elms.lng && this._elms.lng[selectPoint.index]) {
that._elms.lng[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lng.toFixed(8) this._elms.lng[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lng.toFixed(8)
} }
if (that._elms.lat && that._elms.lat[selectPoint.index]) { if (this._elms.lat && this._elms.lat[selectPoint.index]) {
that._elms.lat[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lat.toFixed(8) this._elms.lat[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lat.toFixed(8)
} }
} }
that.heightMode = that.heightMode this.heightMode = this.heightMode
that.previous = null this.previous = null
} }
that.entity.polyline.clampToGround = true this.entity.polyline.clampToGround = true
that.entity.polyline.arcType = Cesium.ArcType.GEODESIC this.entity.polyline.arcType = Cesium.ArcType.GEODESIC
that.entity.polygon.perPositionHeight = false this.entity.polygon.perPositionHeight = false
that.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () { this.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
return new Cesium.PolygonHierarchy(that.positionsH) return new Cesium.PolygonHierarchy(_this.positionsH)
}, false) }, false)
that.entity.polyline.positions = new Cesium.CallbackProperty(function () { this.entity.polyline.positions = new Cesium.CallbackProperty(function () {
return [...that.positionsH, that.positionsH[0], that.positionsH[1]] return [..._this.positionsH, _this.positionsH[0], _this.positionsH[1]]
}, false) }, false)
let points = [[]] let points = [[]]
let pos84 = [] let pos84 = []
for (let i = 0; i < that.positionsH.length; i++) { for (let i = 0; i < this.positionsH.length; i++) {
let position = that.cartesian3Towgs84(that.positionsH[i], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[i], this.sdk.viewer)
pos84.push(position) pos84.push(position)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
} }
let position = that.cartesian3Towgs84(that.positionsH[0], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[0], this.sdk.viewer)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
that this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1] lat: centroid.geometry.coordinates[1]
}, objectsToExclude) }, objectsToExclude)
.then(height => { .then(height => {
that.label.position = [ this.label.position = [
centroid.geometry.coordinates[0], centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1], centroid.geometry.coordinates[1],
height height
@ -2181,36 +1769,36 @@ class AttackArrowObject extends Base {
}) })
setTimeout(() => { setTimeout(() => {
that.event.mouse_left(leftEvent) this.event.mouse_left(leftEvent)
that.event.mouse_right(rightEvent) this.event.mouse_right(rightEvent)
that.event.mouse_move(moveEvent) this.event.mouse_move(moveEvent)
that.event.mouse_right_keyboard_ctrl((movement, cartesian) => { this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions.pop() this.options.positions.pop()
that.sdk.viewer.entities.remove(that.nodePoints[that.nodePoints.length - 1]) this.sdk.viewer.entities.remove(this.nodePoints[this.nodePoints.length - 1])
that.nodePoints.pop() this.nodePoints.pop()
if (!selectPoint.index) { if (!selectPoint.index) {
// selectPoint = null // selectPoint = null
} }
else if (selectPoint.index === that.options.positions.length) { else if (selectPoint.index === this.options.positions.length) {
if (that.nodePoints[selectPoint.index - 1]) { if (this.nodePoints[selectPoint.index - 1]) {
selectPoint = that.nodePoints[selectPoint.index - 1] selectPoint = this.nodePoints[selectPoint.index - 1]
} }
else { else {
selectPoint.index = selectPoint.index - 1 selectPoint.index = selectPoint.index - 1
} }
} }
that.renewPositions() this.renewPositions()
} }
}) })
that.event.gesture_pinck_start((movement, cartesian) => { this.event.gesture_pinck_start((movement, cartesian) => {
let startTime = new Date() let startTime = new Date()
that.event.gesture_pinck_end(() => { this.event.gesture_pinck_end(() => {
let endTime = new Date() let endTime = new Date()
let pos = { let pos = {
position: { position: {
@ -2230,31 +1818,31 @@ class AttackArrowObject extends Base {
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [..._this.sdk.viewer.entities.values]
for (let i = 0; i < that.options.positions.length; i++) { for (let i = 0; i < _this.options.positions.length; i++) {
let height = await that.getClampToHeight(that.options.positions[i], objectsToExclude) let height = await _this.getClampToHeight(_this.options.positions[i], objectsToExclude)
let entity = that.sdk.viewer.entities.add({ let entity = _this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: i, index: i,
position: Cesium.Cartesian3.fromDegrees(that.options.positions[i].lng, that.options.positions[i].lat, height), position: Cesium.Cartesian3.fromDegrees(_this.options.positions[i].lng, _this.options.positions[i].lat, height),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: _this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.push(entity) _this.nodePoints.push(entity)
} }
} }
// for (let i = 0; i < that.options.positions.length; i++) { // for (let i = 0; i < this.options.positions.length; i++) {
// let entity = that.sdk.viewer.entities.add({ // let entity = this.sdk.viewer.entities.add({
// name: 'node-secondary-edit-point', // name: 'node-secondary-edit-point',
// index: i, // index: i,
// position: Cesium.Cartesian3.fromDegrees(that.options.positions[i].lng, that.options.positions[i].lat), // position: Cesium.Cartesian3.fromDegrees(this.options.positions[i].lng, this.options.positions[i].lat),
// billboard: { // billboard: {
// image: that.getSourceRootPath() + '/img/point.png', // image: this.getSourceRootPath() + '/img/point.png',
// width: 15, // width: 15,
// height: 15, // height: 15,
// disableDepthTestDistance: Number.POSITIVE_INFINITY, // disableDepthTestDistance: Number.POSITIVE_INFINITY,
@ -2266,17 +1854,17 @@ class AttackArrowObject extends Base {
}, 0); }, 0);
} }
static closeNodeEdit(that) { closeNodeEdit() {
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event && that.event.destroy() this.event && this.event.destroy()
that.tip && that.tip.destroy() this.tip && this.tip.destroy()
that.tip = null this.tip = null
for (let i = 0; i < that.nodePoints.length; i++) { for (let i = 0; i < this.nodePoints.length; i++) {
that.sdk.viewer.entities.remove(that.nodePoints[i]) this.sdk.viewer.entities.remove(this.nodePoints[i])
} }
that.nodePoints = [] this.nodePoints = []
that.picking = true this.picking = true
} }
setPosition(v) { setPosition(v) {
@ -2679,8 +2267,8 @@ class AttackArrowObject extends Base {
// 计算投影面积 // 计算投影面积
if (!this.spreadState) { if (!this.spreadState) {
this.options.areaByMeter = this.computeArea(pos84) this.areaByMeter = this.computeArea(pos84)
this.areaUnit = this.areaUnit this.areaChangeCallBack && this.areaChangeCallBack()
} }
return fromDegreesArray return fromDegreesArray
} }

View File

@ -16,7 +16,7 @@ class Layer extends BaseLayer {
super(sdk, options) super(sdk, options)
this.object = {} this.object = {}
this.options.host = this.options.host || getHost() this.options.host = this.options.host || getHost()
this.on()
} }
get type() { get type() {
@ -24,21 +24,7 @@ class Layer extends BaseLayer {
} }
on() { on() {
return this.add() return this.loadLayer(this.options)
}
async add() {
let res = await this.requestResource()
let text = await res.text()
text = JSON.parse(text)
if ([0, 200].includes(text.code)) {
return this.loadLayer(text.data)
} else {
return new Promise((res, reject) => {
reject(text.msg || text.message)
})
}
} }
async loadLayer(data) { async loadLayer(data) {
@ -64,11 +50,11 @@ class Layer extends BaseLayer {
Cesium.Math.toRadians(this.object.north) Cesium.Math.toRadians(this.object.north)
), ),
} }
// if (this.object.scheme_name === "GeographicTilingScheme") { // if (this.object.schemaName === "GeographicTilingScheme") {
// console.log("添加GeographicTilingScheme") // console.log("添加GeographicTilingScheme")
// params.tilingScheme = new Cesium.GeographicTilingScheme() // params.tilingScheme = new Cesium.GeographicTilingScheme()
// } // }
// if (this.object.scheme_name === "amapMercatorTilingScheme") { // if (this.object.schemaName === "amapMercatorTilingScheme") {
// console.log("添加amapMercatorTilingScheme") // console.log("添加amapMercatorTilingScheme")
// params.tilingScheme = this.amapMercatorTilingScheme() // params.tilingScheme = this.amapMercatorTilingScheme()
// } // }
@ -80,14 +66,14 @@ class Layer extends BaseLayer {
// } else { // } else {
// tms = new Cesium.UrlTemplateImageryProvider(params) // tms = new Cesium.UrlTemplateImageryProvider(params)
// } // }
switch (this.object.scheme_name) { switch (this.object.schemaName) {
case "amapMercatorTilingScheme": case "amapMercatorTilingScheme":
params.tilingScheme = this.amapMercatorTilingScheme() params.tilingScheme = this.amapMercatorTilingScheme()
break; break;
case "": case "":
break; break;
default: default:
params.tilingScheme = new Cesium[this.object.scheme_name]() params.tilingScheme = new Cesium[this.object.schemaName]()
break; break;
} }
switch (this.object.load_method) { switch (this.object.load_method) {

View File

@ -46,6 +46,7 @@ class BIM extends BaseTileset {
this.exportProperty(this.exportStateArray) this.exportProperty(this.exportStateArray)
} }
this.features = new Map() this.features = new Map()
this.on()
} }
get type() { get type() {

View File

@ -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模型
@ -32,6 +31,7 @@ class Tileset extends BaseTileset {
constructor(earth, options = {}, _Dialog = {}) { constructor(earth, options = {}, _Dialog = {}) {
super(earth, options) super(earth, options)
this.picking = false this.picking = false
this.on()
this.Dialog = _Dialog this.Dialog = _Dialog
this._elms = {}; this._elms = {};
this._EventBinding = new EventBinding() this._EventBinding = new EventBinding()
@ -42,7 +42,7 @@ class Tileset extends BaseTileset {
} }
on() { on() {
return this.add() return this.loadTileset(this.options)
} }
get name() { get name() {
@ -198,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: () => {
@ -307,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) {

View File

@ -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,40 +68,15 @@ 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)
this.editObj.controllerCallBack = this.rotationEditingCallBack this.editObj.controllerCallBack = this.rotationEditingCallBack
} }
async add() {
if (this.options.url) {
return this.loadTileset({
url: this.options.url
})
} else {
let res = await this.requestResource()
let text = await res.text()
text = JSON.parse(text)
if ([0, 200].includes(text.code)) {
if (text.data.url.length)
return this.loadTileset(text.data)
else
return new Promise((res, reject) => {
reject('资源不存在')
})
} else {
return new Promise((res, reject) => {
reject(text.msg || text.message)
})
}
}
}
loadSceneTree() { loadSceneTree() {
} }
@ -392,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)
@ -469,7 +453,7 @@ class BaseTileset extends BaseSource {
on() { on() {
return this.add() return this.loadTileset(this.options)
} }
setDefaultValue() { setDefaultValue() {
@ -645,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

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -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,348 +669,6 @@ 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)
@ -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

View File

@ -33,7 +33,6 @@ class CircleObject extends Base {
* @param options.line.width=3 {number} 边框宽 * @param options.line.width=3 {number} 边框宽
* @param options.line.color="#ff000080" {string} 边框颜色 * @param options.line.color="#ff000080" {string} 边框颜色
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式 * @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
* @param options.areaUnit='平方米' {string} 面积单位
* @param options.customView {object} 默认视角 * @param options.customView {object} 默认视角
* @param options.customView.orientation {object} 默认视角方位 * @param options.customView.orientation {object} 默认视角方位
* @param options.customView.orientation.heading {number} 航向角 * @param options.customView.orientation.heading {number} 航向角
@ -87,7 +86,6 @@ class CircleObject extends Base {
this.options.line = options.line || {} this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
options.label = options.label || {} options.label = options.label || {}
this._elms = {}; this._elms = {};
this.options.label = { this.options.label = {
@ -108,13 +106,13 @@ class CircleObject extends Base {
this.options.attribute = options.attribute || {} this.options.attribute = options.attribute || {}
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.vr = this.options.attribute.vr || {}
this.options.attribute.vr.content = this.options.attribute.vr.content || [] delete this.options.attribute.camera
this.options.attribute.camera = this.options.attribute.camera || {} delete this.options.attribute.vr
this.options.attribute.camera.content = this.options.attribute.camera.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.event = new MouseEvent(this.sdk) this.event = new MouseEvent(this.sdk)
this.nodePoints = [] this.nodePoints = []
this.operate = {} this.operate = {}
@ -140,7 +138,7 @@ class CircleObject extends Base {
return return
} }
let heightModeName = '' let heightModeName = ''
CircleObject.closeNodeEdit(this) this.closeNodeEdit()
let ground = false let ground = false
let disabled = false let disabled = false
this.renewPositions() this.renewPositions()
@ -227,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 = [
@ -330,45 +328,6 @@ class CircleObject extends Base {
}) })
} }
get area() {
return this.options.area
}
set area(v) {
this.options.area = v
this._elms.area && this._elms.area.forEach((item) => {
item.value = v
})
}
get areaUnit() {
return this.options['area-unit']
}
set areaUnit(v) {
this.options['area-unit'] = v
this._elms.areaUnit && this._elms.areaUnit.forEach((item) => {
item.value = v
})
if (this.options.areaByMeter) {
switch (v) {
case '平方米':
this.area = this.options.areaByMeter
break;
case '平方千米':
this.area = Number((this.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
this.area = Number((this.options.areaByMeter / 10000).toFixed(6))
break;
default:
this.area = this.options.areaByMeter
}
}
}
get labelShow() { get labelShow() {
return this.options.label.show return this.options.label.show
} }
@ -580,320 +539,6 @@ class CircleObject 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 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
}
static create(that) { static create(that) {
let fromDegreesArray = that.createCircle(that.options.center, that.options.radius) let fromDegreesArray = that.createCircle(that.options.center, that.options.radius)
let ground let ground
@ -914,9 +559,10 @@ class CircleObject extends Base {
ground = true ground = true
break break
} }
if (!that.options.label.position) { // if (!that.options.label.position) {
// that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height }
// }
that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height } that.options.label.position = { lng: that.options.center.lng, lat: that.options.center.lat, alt: that.options.center.alt + height }
}
let material = Cesium.Color.fromCssColorString(that.options.color) let material = Cesium.Color.fromCssColorString(that.options.color)
if (that.sdk.viewer.scene.mode === 2) { if (that.sdk.viewer.scene.mode === 2) {
@ -930,7 +576,7 @@ class CircleObject extends Base {
for (let i = 0; i < fromDegreesArray.length; i += 2) { for (let i = 0; i < fromDegreesArray.length; i += 2) {
fromDegreesArray2.push(fromDegreesArray[i], fromDegreesArray[i + 1], that.options.center.alt + height) fromDegreesArray2.push(fromDegreesArray[i], fromDegreesArray[i + 1], that.options.center.alt + height)
} }
that.options.label.ground = ground // that.options.label.ground = ground
that.positions = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2) that.positions = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2)
positionsA = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray) positionsA = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
that.entity = that.sdk.viewer.entities.add({ that.entity = that.sdk.viewer.entities.add({
@ -953,23 +599,8 @@ class CircleObject extends Base {
}) })
that.sdk._entityZIndex++ that.sdk._entityZIndex++
CircleObject.createLabel(that) CircleObject.createLabel(that)
that.options.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius).toFixed(2)); that.areaByMeter = Number((Cesium.Math.PI * that.options.radius * that.options.radius).toFixed(2));
switch (that.options['area-unit']) { that.areaChangeCallBack && that.areaChangeCallBack()
case '平方米':
that.options.area = that.options.areaByMeter
break;
case '平方千米':
that.options.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
that.options.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
that.options.area = Number((that.options.areaByMeter / 10000).toFixed(6))
break;
default:
that.options.area = that.options.areaByMeter
}
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)
if (that.options.show) { if (that.options.show) {
@ -995,12 +626,12 @@ class CircleObject extends Base {
scaleByDistance: that.options.label.scaleByDistance, scaleByDistance: that.options.label.scaleByDistance,
near: that.options.label.near, near: that.options.label.near,
far: that.options.label.far, far: that.options.label.far,
ground: that.options.label.ground,
}) })
} }
// 编辑框 // 编辑框
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)
@ -1492,8 +1123,6 @@ class CircleObject extends Base {
this.name = this.originalOptions.name this.name = this.originalOptions.name
this.radius = this.originalOptions.radius this.radius = this.originalOptions.radius
this.color = this.originalOptions.color this.color = this.originalOptions.color
this.area = this.originalOptions.area
this.areaUnit = this.originalOptions['area-unit']
this.labelShow = this.originalOptions.label.show this.labelShow = this.originalOptions.label.show
this.labelFontSize = this.originalOptions.label.fontSize this.labelFontSize = this.originalOptions.label.fontSize
this.labelFontFamily = this.originalOptions.label.fontFamily this.labelFontFamily = this.originalOptions.label.fontFamily
@ -1509,12 +1138,6 @@ class CircleObject extends Base {
this.lineColor = this.originalOptions.line.color this.lineColor = this.originalOptions.line.color
this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0]
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
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.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
this.heightMode = this.originalOptions.heightMode this.heightMode = this.originalOptions.heightMode
@ -1554,51 +1177,6 @@ class CircleObject extends Base {
await syncData(this.sdk, this.options.id) await syncData(this.sdk, this.options.id)
} }
_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
}
/** /**
* 飞到 * 飞到
*/ */
@ -1803,6 +1381,11 @@ class CircleObject extends Base {
positions: { ...this.options.center } positions: { ...this.options.center }
} }
this.positionEditing = false this.positionEditing = false
if(this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
}) })
this.event.mouse_right((movement, cartesian) => { this.event.mouse_right((movement, cartesian) => {
this.positionEditing = false this.positionEditing = false
@ -1866,88 +1449,104 @@ class CircleObject extends Base {
return this.operate.positionEditing return this.operate.positionEditing
} }
static nodeEdit(that, cb = () => { }) { openPositionEditing(cd) {
that.positionEditing = false this.positionEditing = true
this._positionEditingCallback = cd
}
get areaChangeCallBack() {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
this._areaChangeCallBack = cd
}
nodeEdit(cb = () => { }) {
this.positionEditing = false
if (YJ.Measure.GetMeasureStatus()) { if (YJ.Measure.GetMeasureStatus()) {
} else { } else {
that.event && that.event.destroy() let _this = this
that.event = new MouseEvent(that.sdk) this.event && this.event.destroy()
this.event = new MouseEvent(this.sdk)
YJ.Measure.SetMeasureStatus(true) YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('左键确认,右键取消', that.sdk) this.tip = new MouseTip('左键确认,右键取消', this.sdk)
that.event = new MouseEvent(that.sdk) this.event = new MouseEvent(this.sdk)
that.nodePoints = [] this.nodePoints = []
let selectPoint let selectPoint
let originalPosition let originalPosition
let newpositions = [] let newpositions = []
let fromDegreesArray = [] let fromDegreesArray = []
let endpoint = { ...that.options.center } let endpoint = { ...this.options.center }
let moveRadius = null let moveRadius = null
let entity let entity
fromDegreesArray = that.createCircle(that.options.center, that.options.radius) fromDegreesArray = this.createCircle(this.options.center, this.options.radius)
that.entity.polyline.clampToGround = true this.entity.polyline.clampToGround = true
that.entity.polyline.arcType = Cesium.ArcType.GEODESIC this.entity.polyline.arcType = Cesium.ArcType.GEODESIC
that.entity.polygon.perPositionHeight = false this.entity.polygon.perPositionHeight = false
that.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () { this.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
return new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)) return new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray))
}, false) }, false)
that.entity.polyline.positions = new Cesium.CallbackProperty(function () { this.entity.polyline.positions = new Cesium.CallbackProperty(function () {
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray) return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
}, false) }, false)
setTimeout(() => { setTimeout(() => {
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
that this
.getClampToHeight({ .getClampToHeight({
lng: that.options.center.lng, lng: this.options.center.lng,
lat: that.options.center.lat lat: this.options.center.lat
}, objectsToExclude) }, objectsToExclude)
.then(height => { .then(height => {
that.label.position = [ this.label.position = [
that.options.center.lng, this.options.center.lng,
that.options.center.lat, this.options.center.lat,
height height
] ]
}) })
}, 50); }, 50);
setTimeout(() => { setTimeout(() => {
that.event.mouse_left((movement, cartesian) => { this.event.mouse_left((movement, cartesian) => {
if (entity) { if (entity) {
that.sdk.viewer.entities.remove(entity) this.sdk.viewer.entities.remove(entity)
entity = null entity = null
} }
endpoint = that.cartesian3Towgs84(cartesian, that.viewer) endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
let radius = that.computeDistance2([that.options.center, endpoint]) let radius = this.computeDistance2([this.options.center, endpoint])
that.radius = radius this.radius = radius
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event.destroy() this.event.destroy()
that.tip.destroy() this.tip.destroy()
that.heightMode = that.heightMode this.heightMode = this.heightMode
cb('', {...this.options.center})
}) })
that.event.mouse_right((movement, cartesian) => { this.event.mouse_right((movement, cartesian) => {
if (entity) { if (entity) {
that.sdk.viewer.entities.remove(entity) this.sdk.viewer.entities.remove(entity)
entity = null entity = null
} }
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event.destroy() this.event.destroy()
that.tip.destroy() this.tip.destroy()
that.heightMode = that.heightMode this.heightMode = this.heightMode
}) })
that.event.mouse_move((movement, cartesian) => { this.event.mouse_move((movement, cartesian) => {
entity && (entity.show = true) entity && (entity.show = true)
endpoint = that.cartesian3Towgs84(cartesian, that.viewer) endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
moveRadius = that.computeDistance2([that.options.center, endpoint]) moveRadius = this.computeDistance2([this.options.center, endpoint])
fromDegreesArray = that.createCircle(that.options.center, moveRadius) fromDegreesArray = this.createCircle(this.options.center, moveRadius)
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.endPosition.x, movement.endPosition.x,
movement.endPosition.y movement.endPosition.y
@ -1956,28 +1555,28 @@ class CircleObject extends Base {
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [..._this.sdk.viewer.entities.values]
let height = await that.getClampToHeight(that.options.center, objectsToExclude) let height = await _this.getClampToHeight(_this.options.center, objectsToExclude)
let entity = that.sdk.viewer.entities.add({ let entity = _this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
position: Cesium.Cartesian3.fromDegrees(that.options.center.lng, that.options.center.lat, height), position: Cesium.Cartesian3.fromDegrees(_this.options.center.lng, _this.options.center.lat, height),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: _this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.push(entity) _this.nodePoints.push(entity)
} }
entity = that.sdk.viewer.entities.add( entity = this.sdk.viewer.entities.add(
new Cesium.Entity({ new Cesium.Entity({
show: false, show: false,
position: new Cesium.CallbackProperty((e) => { position: new Cesium.CallbackProperty((e) => {
if (endpoint) { if (endpoint) {
let c = that.computeMidpoint(that.options.center, endpoint) let c = this.computeMidpoint(this.options.center, endpoint)
return Cesium.Cartesian3.fromDegrees(c.lng, c.lat, endpoint.alt) return Cesium.Cartesian3.fromDegrees(c.lng, c.lat, endpoint.alt)
} else { } else {
return Cesium.Cartesian3() return Cesium.Cartesian3()
@ -2000,7 +1599,7 @@ class CircleObject extends Base {
}, },
polyline: { polyline: {
positions: new Cesium.CallbackProperty((e) => { positions: new Cesium.CallbackProperty((e) => {
return Cesium.Cartesian3.fromDegreesArray([that.options.center.lng, that.options.center.lat, endpoint.lng, endpoint.lat]) return Cesium.Cartesian3.fromDegreesArray([this.options.center.lng, this.options.center.lat, endpoint.lng, endpoint.lat])
}, false), }, false),
width: 2, width: 2,
material: material:
@ -2010,22 +1609,22 @@ class CircleObject extends Base {
} }
}) })
) )
that.nodePoints.push(entity) this.nodePoints.push(entity)
} }
} }
static closeNodeEdit(that) { closeNodeEdit() {
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event && that.event.destroy() this.event && this.event.destroy()
that.tip && that.tip.destroy() this.tip && this.tip.destroy()
that.tip = null this.tip = null
for (let i = 0; i < that.nodePoints.length; i++) { for (let i = 0; i < this.nodePoints.length; i++) {
that.sdk.viewer.entities.remove(that.nodePoints[i]) this.sdk.viewer.entities.remove(this.nodePoints[i])
} }
that.nodePoints = [] this.nodePoints = []
that.picking = true this.picking = true
} }
@ -2205,8 +1804,8 @@ class CircleObject extends Base {
} }
// 计算投影面积 // 计算投影面积
this.options.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius).toFixed(2)) this.areaByMeter = Number((Cesium.Math.PI * this.options.radius * this.options.radius).toFixed(2))
this.areaUnit = this.areaUnit this.areaChangeCallBack && this.areaChangeCallBack()
return fromDegreesArray return fromDegreesArray
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -13,12 +13,11 @@ import {
} from '../../../Global/cluster/cluster' } from '../../../Global/cluster/cluster'
class LabelObject extends Base { class LabelObject extends Base {
#updateBillboardImageTimeout
#canvas = document.createElement('canvas')
#canvas2 = document.createElement('canvas')
constructor(sdk, options = {}, model) { constructor(sdk, options = {}, model) {
super(sdk, options) super(sdk, options)
this.model = model this.model = model
this._canvas = document.createElement('canvas')
this._canvas2 = document.createElement('canvas')
this.options.near = options.near || options.near === 0 ? options.near : 2000 this.options.near = options.near || options.near === 0 ? options.near : 2000
this.options.far = options.far || options.far === 0 ? options.far : 100000 this.options.far = options.far || options.far === 0 ? options.far : 100000
this.options.scaleByDistance = options.scaleByDistance || false this.options.scaleByDistance = options.scaleByDistance || false
@ -492,8 +491,8 @@ class LabelObject extends Base {
// } // }
getcanvas() { getcanvas() {
const ctx = this.#canvas.getContext('2d') const ctx = this._canvas.getContext('2d')
ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height); ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
ctx.font = this.options.fontSize + 'px ' + this.font ctx.font = this.options.fontSize + 'px ' + this.font
let texts = this.options.text.split('\n') let texts = this.options.text.split('\n')
let canvasWidth = 0 let canvasWidth = 0
@ -511,8 +510,8 @@ class LabelObject extends Base {
if (canvasWidth < this.options.lineWidth) { if (canvasWidth < this.options.lineWidth) {
canvasWidth = this.options.lineWidth canvasWidth = this.options.lineWidth
} }
this.#canvas.width = canvasWidth this._canvas.width = canvasWidth
this.#canvas.height = this.options.pixelOffset + canvasHeight this._canvas.height = this.options.pixelOffset + canvasHeight
const linearGradient = ctx.createLinearGradient( const linearGradient = ctx.createLinearGradient(
0, 0,
0, 0,
@ -559,14 +558,14 @@ class LabelObject extends Base {
ctx.stroke() ctx.stroke()
ctx.closePath() ctx.closePath()
const ctx2 = this.#canvas2.getContext('2d') const ctx2 = this._canvas2.getContext('2d')
this.#canvas2.width = this.#canvas.width + 10 this._canvas2.width = this._canvas.width + 10
this.#canvas2.height = this.#canvas.height + 10 this._canvas2.height = this._canvas.height + 10
ctx2.drawImage(this.#canvas, 5, 5); ctx2.drawImage(this._canvas, 5, 5);
// const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); // const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
// ctx.putImageData(imageData, 40, 40); // ctx.putImageData(imageData, 40, 40);
return this.#canvas2.toDataURL("image/png") return this._canvas2.toDataURL("image/png")
} }
remove() { remove() {

View File

@ -28,7 +28,6 @@ class PincerArrowObject extends Base {
* @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色 * @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色
* @param options.height {number} 高度 * @param options.height {number} 高度
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式 * @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
* @param options.areaUnit='平方米' {string} 面积单位
* @param options.line {object} 边框 * @param options.line {object} 边框
* @param options.line.width=2 {string} 边框宽 * @param options.line.width=2 {string} 边框宽
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色 * @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
@ -83,7 +82,6 @@ class PincerArrowObject extends Base {
this.options.line = options.line || {} this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3) this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)' this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.options.height = options.height this.options.height = options.height
this.options.loop = options.loop || false this.options.loop = options.loop || false
this.options.spreadState = options.spreadState || false this.options.spreadState = options.spreadState || false
@ -113,13 +111,10 @@ class PincerArrowObject extends Base {
this.options.attribute = options.attribute || {} this.options.attribute = options.attribute || {}
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.vr = this.options.attribute.vr || {} delete this.options.attribute.vr
this.options.attribute.vr.content = this.options.attribute.vr.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'
if (!this.options.positions || this.options.positions.length < 5) { if (!this.options.positions || this.options.positions.length < 5) {
this._error = '双箭头最少需要五个坐标!' this._error = '双箭头最少需要五个坐标!'
@ -208,7 +203,7 @@ class PincerArrowObject extends Base {
return return
} }
let heightModeName = '' let heightModeName = ''
PincerArrowObject.closeNodeEdit(this) this.closeNodeEdit()
let ground = false let ground = false
let disabled = false let disabled = false
this.renewPositions() this.renewPositions()
@ -332,45 +327,6 @@ class PincerArrowObject extends Base {
}) })
} }
get area() {
return this.options.area
}
set area(v) {
this.options.area = v
this._elms.area && this._elms.area.forEach((item) => {
item.value = v
})
}
get areaUnit() {
return this.options['area-unit']
}
set areaUnit(v) {
this.options['area-unit'] = v
this._elms.areaUnit && this._elms.areaUnit.forEach((item) => {
item.value = v
})
if (this.options.areaByMeter) {
switch (v) {
case '平方米':
this.area = this.options.areaByMeter
break;
case '平方千米':
this.area = Number((this.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
this.area = Number((this.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
this.area = Number((this.options.areaByMeter / 10000).toFixed(6))
break;
default:
this.area = this.options.areaByMeter
}
}
}
get labelShow() { get labelShow() {
return this.options.label.show return this.options.label.show
} }
@ -582,320 +538,6 @@ class PincerArrowObject 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 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
}
static create(that) { static create(that) {
let positions = that.options.positions let positions = that.options.positions
let fromDegreesArray = [] let fromDegreesArray = []
@ -939,9 +581,10 @@ class PincerArrowObject extends Base {
break break
} }
if (!that.options.label.position) { // if (!that.options.label.position) {
// that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
// }
that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height } that.options.label.position = { lng: centroid.geometry.coordinates[0], lat: centroid.geometry.coordinates[1], alt: that.height + height }
}
let fromDegreesArray2 = [] let fromDegreesArray2 = []
for (let i = 0; i < points[0].length; i++) { for (let i = 0; i < points[0].length; i++) {
@ -959,7 +602,7 @@ class PincerArrowObject extends Base {
color: that.options.color color: that.options.color
}) })
} }
that.options.label.ground = ground // that.options.label.ground = ground
that.positionsH = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2) that.positionsH = Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray2)
@ -987,23 +630,8 @@ class PincerArrowObject extends Base {
for (let i = 0; i < positionsA.length; i++) { for (let i = 0; i < positionsA.length; i++) {
pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer)) pos84.push(that.cartesian3Towgs84(positionsA[i], that.sdk.viewer))
} }
that.options.areaByMeter = that.computeArea(pos84); that.areaByMeter = that.computeArea(pos84);
switch (that.options['area-unit']) { that.areaChangeCallBack && that.areaChangeCallBack()
case '平方米':
that.options.area = that.options.areaByMeter
break;
case '平方千米':
that.options.area = Number((that.options.areaByMeter / 1000000).toFixed(8))
break;
case '亩':
that.options.area = Number((that.options.areaByMeter / 666.6666667).toFixed(4))
break;
case '公顷':
that.options.area = Number((that.options.areaByMeter / 10000).toFixed(6))
break;
default:
that.options.area = that.options.areaByMeter
}
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)
if (that.options.show) { if (that.options.show) {
@ -1030,12 +658,13 @@ class PincerArrowObject extends Base {
scaleByDistance: that.options.label.scaleByDistance, scaleByDistance: that.options.label.scaleByDistance,
near: that.options.label.near, near: that.options.label.near,
far: that.options.label.far, far: that.options.label.far,
ground: that.options.label.ground, // ground: that.options.label.ground,
}) })
} }
// 编辑框 // 编辑框
async edit(state) { async edit(state) {
return
if (this._error) { if (this._error) {
return return
} }
@ -1534,8 +1163,6 @@ class PincerArrowObject extends Base {
this.color = this.originalOptions.color this.color = this.originalOptions.color
this.lineColor = this.originalOptions.line.color this.lineColor = this.originalOptions.line.color
this.lineWidth = this.originalOptions.line.width this.lineWidth = this.originalOptions.line.width
this.area = this.originalOptions.area
this.areaUnit = this.originalOptions['area-unit']
this.labelShow = this.originalOptions.label.show this.labelShow = this.originalOptions.label.show
this.labelColor = this.originalOptions.label.color this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize this.labelFontSize = this.originalOptions.label.fontSize
@ -1548,12 +1175,7 @@ class PincerArrowObject extends Base {
this.labelLineColor = this.originalOptions.label.lineColor this.labelLineColor = this.originalOptions.label.lineColor
this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0] this.labelBackgroundColorStart = this.originalOptions.label.backgroundColor[0]
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1] this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
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.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
for (let i = 0; i < this.options.positions.length; i++) { for (let i = 0; i < this.options.positions.length; i++) {
if (this._elms.lng && this._elms.lng[i]) { if (this._elms.lng && this._elms.lng[i]) {
@ -1607,51 +1229,6 @@ class PincerArrowObject extends Base {
await syncData(this.sdk, this.options.id) await syncData(this.sdk, this.options.id)
} }
_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
}
/** /**
* 飞到 * 飞到
*/ */
@ -1852,6 +1429,11 @@ class PincerArrowObject extends Base {
positions: [...this.positions] positions: [...this.positions]
} }
this.positionEditing = false this.positionEditing = false
if(this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
}) })
this.event.mouse_right((movement, cartesian) => { this.event.mouse_right((movement, cartesian) => {
this.positionEditing = false this.positionEditing = false
@ -1954,208 +1536,122 @@ class PincerArrowObject extends Base {
get positionEditing() { get positionEditing() {
return this.operate.positionEditing return this.operate.positionEditing
} }
openPositionEditing(cd) {
static EventBinding(that, elements) { this.positionEditing = true
for (let i = 0; i < elements.length; i++) { this._positionEditingCallback = cd
let Event = []
let isEvent = false
let removeName = []
if (!elements[i] || !elements[i].attributes) {
continue
} }
for (let m of elements[i].attributes) { get areaChangeCallBack() {
switch (m.name) { return this._areaChangeCallBack
case '@model': {
isEvent = true
if (elements[i].type == 'checkbox') {
Event.push((e) => { that[m.value] = e.target.checked })
elements[i].checked = that[m.value]
}
else {
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number') {
if (e.data != '.' && (e.data != '-' || e.target.value)) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
that[m.value] = value
}
}
else {
that[m.value] = value
}
})
if (elements[i].nodeName == 'IMG') {
elements[i].src = that[m.value]
}
else {
elements[i].value = that[m.value]
}
}
if (that._elms[m.value]) {
that._elms[m.value].push(elements[i])
}
else {
that._elms[m.value] = [elements[i]]
}
removeName.push(m.name)
break;
}
case '@click': {
elements[i].addEventListener('click', (e) => {
if (typeof (that[m.value]) === 'function') {
that[m.value](e)
}
});
removeName.push(m.name)
// elements[i].attributes.removeNamedItem(m.name)
break;
}
case '@change': {
isEvent = true
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number' && value != '') {
value = Number(value)
e.target.value = value
}
if (typeof (that[m.value]) === 'function') {
that[m.value](e, value)
}
})
break;
}
}
// elements[i].attributes[m] = undefined
}
for (let n = 0; n < removeName.length; n++) {
elements[i].attributes.removeNamedItem(removeName[n])
} }
if (isEvent) { set areaChangeCallBack (cd) {
let ventType = 'input' this._areaChangeCallBack = cd
if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') {
ventType = 'change'
}
if (elements[i].className.indexOf('blur') !== -1) {
ventType = 'blur'
}
elements[i].addEventListener(ventType, (e) => {
for (let t = 0; t < Event.length; t++) {
Event[t](e)
}
});
}
}
} }
static nodeEdit(that, cb = () => { }) {
that.positionEditing = false nodeEdit(cb = () => { }) {
this.positionEditing = false
setTimeout(() => { setTimeout(() => {
if (YJ.Measure.GetMeasureStatus()) { if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束') cb('上一次测量未结束')
} else { } else {
that.removeAnimate() this.removeAnimate()
let _this = this
YJ.Measure.SetMeasureStatus(true) YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('请选择一个顶点,右键取消', that.sdk) this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
that.event = new MouseEvent(that.sdk) this.event = new MouseEvent(this.sdk)
that.nodePoints = [] this.nodePoints = []
let selectPoint let selectPoint
let originalPosition let originalPosition
let optionsPositions = [...that.options.positions] let optionsPositions = [...this.options.positions]
let leftEvent = (movement, cartesian) => { let leftEvent = (movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
optionsPositions[selectPoint.index] = that.options.positions[selectPoint.index] optionsPositions[selectPoint.index] = this.options.positions[selectPoint.index]
let index = selectPoint.index let index = selectPoint.index
let entity = that.sdk.viewer.entities.add({ let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: index, index: index,
position: Cesium.Cartesian3.fromDegrees(optionsPositions[selectPoint.index].lng, optionsPositions[selectPoint.index].lat, optionsPositions[selectPoint.index].alt), position: Cesium.Cartesian3.fromDegrees(optionsPositions[selectPoint.index].lng, optionsPositions[selectPoint.index].lat, optionsPositions[selectPoint.index].alt),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.splice(selectPoint.index, 0, entity) this.nodePoints.splice(selectPoint.index, 0, entity)
selectPoint = null selectPoint = null
that.tip.set_text('请选择一个顶点,右键取消') this.tip.set_text('请选择一个顶点,右键取消')
} }
else { else {
var pick = that.sdk.viewer.scene.pick(movement.position); var pick = this.sdk.viewer.scene.pick(movement.position);
if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') { if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') {
selectPoint = pick.id selectPoint = pick.id
originalPosition = that.cartesian3Towgs84(pick.id.position.getValue(), that.sdk.viewer) originalPosition = this.cartesian3Towgs84(pick.id.position.getValue(), this.sdk.viewer)
that.nodePoints.splice(pick.id.index, 1) this.nodePoints.splice(pick.id.index, 1)
that.sdk.viewer.entities.remove(pick.id) this.sdk.viewer.entities.remove(pick.id)
that.tip.set_text('左键确定,右键取消') this.tip.set_text('左键确定,右键取消')
} }
} }
that.renewPositions() this.renewPositions()
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.position.x, movement.position.x,
movement.position.y movement.position.y
) )
} }
let rightEvent = () => { let rightEvent = () => {
that.event.mouse_move(() => { }) this.event.mouse_move(() => { })
that.event.mouse_left(() => { }) this.event.mouse_left(() => { })
that.event.mouse_right(() => { }) this.event.mouse_right(() => { })
that.event.gesture_pinck_start(() => { }) this.event.gesture_pinck_start(() => { })
if (selectPoint) { if (selectPoint) {
optionsPositions[selectPoint.index] = originalPosition optionsPositions[selectPoint.index] = originalPosition
if (that._elms.lng && that._elms.lng[selectPoint.index]) { if (this._elms.lng && this._elms.lng[selectPoint.index]) {
that._elms.lng[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lng.toFixed(8) this._elms.lng[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lng.toFixed(8)
} }
if (that._elms.lat && that._elms.lat[selectPoint.index]) { if (this._elms.lat && this._elms.lat[selectPoint.index]) {
that._elms.lat[selectPoint.index].innerHTML = that.options.positions[selectPoint.index].lat.toFixed(8) this._elms.lat[selectPoint.index].innerHTML = this.options.positions[selectPoint.index].lat.toFixed(8)
} }
cb(null, optionsPositions) cb(null, optionsPositions)
} }
that.options.positions = [...optionsPositions] this.options.positions = [...optionsPositions]
that.heightMode = that.heightMode this.heightMode = this.heightMode
that.previous = null this.previous = null
} }
that.entity.polyline.clampToGround = true this.entity.polyline.clampToGround = true
that.entity.polyline.arcType = Cesium.ArcType.GEODESIC this.entity.polyline.arcType = Cesium.ArcType.GEODESIC
that.entity.polygon.perPositionHeight = false this.entity.polygon.perPositionHeight = false
that.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () { this.entity.polygon.hierarchy = new Cesium.CallbackProperty(function () {
return new Cesium.PolygonHierarchy(that.positionsH) return new Cesium.PolygonHierarchy(_this.positionsH)
}, false) }, false)
that.entity.polyline.positions = new Cesium.CallbackProperty(function () { this.entity.polyline.positions = new Cesium.CallbackProperty(function () {
return [...that.positionsH, that.positionsH[0], that.positionsH[1]] return [..._this.positionsH, _this.positionsH[0], _this.positionsH[1]]
}, false) }, false)
setTimeout(() => { setTimeout(() => {
that.event.mouse_left(leftEvent) this.event.mouse_left(leftEvent)
that.event.mouse_right(rightEvent) this.event.mouse_right(rightEvent)
that.event.mouse_move((movement, cartesian) => { this.event.mouse_move((movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(cartesian, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
that.renewPositions() this.renewPositions()
} }
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.endPosition.x, movement.endPosition.x,
movement.endPosition.y movement.endPosition.y
) )
}) })
that.event.gesture_pinck_start((movement, cartesian) => { this.event.gesture_pinck_start((movement, cartesian) => {
let startTime = new Date() let startTime = new Date()
let pos = { let pos = {
position: { position: {
@ -2163,7 +1659,7 @@ class PincerArrowObject extends Base {
y: (movement.position1.y + movement.position2.y) / 2 y: (movement.position1.y + movement.position2.y) / 2
} }
} }
that.event.gesture_pinck_end(() => { this.event.gesture_pinck_end(() => {
let endTime = new Date() let endTime = new Date()
if (endTime - startTime >= 500) { if (endTime - startTime >= 500) {
// 长按取消 // 长按取消
@ -2178,23 +1674,23 @@ class PincerArrowObject extends Base {
let points = [[]] let points = [[]]
let pos84 = [] let pos84 = []
for (let i = 0; i < that.positionsH.length; i++) { for (let i = 0; i < this.positionsH.length; i++) {
let position = that.cartesian3Towgs84(that.positionsH[i], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[i], this.sdk.viewer)
pos84.push(position) pos84.push(position)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
} }
let position = that.cartesian3Towgs84(that.positionsH[0], that.sdk.viewer) let position = this.cartesian3Towgs84(this.positionsH[0], this.sdk.viewer)
points[0].push([position.lng, position.lat]) points[0].push([position.lng, position.lat])
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
that this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1] lat: centroid.geometry.coordinates[1]
}, objectsToExclude) }, objectsToExclude)
.then(height => { .then(height => {
that.label.position = [ this.label.position = [
centroid.geometry.coordinates[0], centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1], centroid.geometry.coordinates[1],
height height
@ -2203,39 +1699,39 @@ class PincerArrowObject extends Base {
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [..._this.sdk.viewer.entities.values]
for (let i = 0; i < optionsPositions.length; i++) { for (let i = 0; i < optionsPositions.length; i++) {
let height = await that.getClampToHeight(that.options.positions[i], objectsToExclude) let height = await _this.getClampToHeight(_this.options.positions[i], objectsToExclude)
let entity = that.sdk.viewer.entities.add({ let entity = _this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: i, index: i,
position: Cesium.Cartesian3.fromDegrees(optionsPositions[i].lng, optionsPositions[i].lat, height), position: Cesium.Cartesian3.fromDegrees(optionsPositions[i].lng, optionsPositions[i].lat, height),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: _this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.push(entity) _this.nodePoints.push(entity)
} }
} }
} }
}, 0); }, 0);
} }
static closeNodeEdit(that) { closeNodeEdit() {
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event && that.event.destroy() this.event && this.event.destroy()
that.tip && that.tip.destroy() this.tip && this.tip.destroy()
that.tip = null this.tip = null
for (let i = 0; i < that.nodePoints.length; i++) { for (let i = 0; i < this.nodePoints.length; i++) {
that.sdk.viewer.entities.remove(that.nodePoints[i]) this.sdk.viewer.entities.remove(this.nodePoints[i])
} }
that.nodePoints = [] this.nodePoints = []
that.picking = true this.picking = true
} }
setPosition(v) { setPosition(v) {
@ -2673,8 +2169,8 @@ class PincerArrowObject extends Base {
// 计算投影面积 // 计算投影面积
if (!this.spreadState) { if (!this.spreadState) {
this.options.areaByMeter = this.computeArea(pos84) this.areaByMeter = this.computeArea(pos84)
this.areaUnit = this.areaUnit this.areaChangeCallBack && this.areaChangeCallBack()
} }
return fromDegreesArray return fromDegreesArray
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -195,22 +195,23 @@ class RoutePlanning extends Base {
this._element_style.type = 'text/css' this._element_style.type = 'text/css'
this._element_style.setAttribute('data-name', 'YJ_style_dialog') this._element_style.setAttribute('data-name', 'YJ_style_dialog')
this._element_style.innerHTML = css() this._element_style.innerHTML = css()
this._DialogObject = await new Dialog(this.sdk.viewer._container, { // this._DialogObject = await new Dialog(this.sdk.viewer._container, {
title: '路径规划', // title: '路径规划',
closeCallBack: () => { // closeCallBack: () => {
this.tip && this.tip.destroy() // this.tip && this.tip.destroy()
this.event && this.event.destroy() // this.event && this.event.destroy()
this.Dialog.closeCallBack && this.Dialog.closeCallBack() // this.Dialog.closeCallBack && this.Dialog.closeCallBack()
} // }
}) // })
await this._DialogObject.init() // await this._DialogObject.init()
let div = document.createElement('div') let div = document.createElement('div')
div.style.position = 'absolute' div.style.position = 'absolute'
div.style.left = '24px' div.style.left = '24px'
div.style.flet = '0' div.style.flet = '0'
div.style.display = 'flex' div.style.display = 'flex'
this._DialogObject.footAppChild(div) document.getElementsByClassName('RoutePlanning')[0].getElementsByClassName('foot')[0].appendChild(div)
// this._DialogObject.footAppChild(div)
let queryBtn = document.createElement('button') let queryBtn = document.createElement('button')
queryBtn.className = 'default' queryBtn.className = 'default'
@ -285,10 +286,10 @@ class RoutePlanning extends Base {
div.appendChild(cleanBtn) div.appendChild(cleanBtn)
document.getElementsByTagName('head')[0].appendChild(this._element_style) document.getElementsByTagName('head')[0].appendChild(this._element_style)
let contentElm = document.createElement('div') // let contentElm = document.createElement('div')
contentElm.innerHTML = html() // contentElm.innerHTML = html()
this._DialogObject.contentAppChild(contentElm) // this._DialogObject.contentAppChild(contentElm)
let contentElm = document.getElementsByClassName('RoutePlanning')[0]
if (this.options.gps) { if (this.options.gps) {
let locateCurrentBtn = document.createElement('button') let locateCurrentBtn = document.createElement('button')
locateCurrentBtn.innerHTML = '当前位置' locateCurrentBtn.innerHTML = '当前位置'
@ -300,7 +301,7 @@ class RoutePlanning extends Base {
let startColElm = contentElm.getElementsByClassName('start-col')[0] let startColElm = contentElm.getElementsByClassName('start-col')[0]
startColElm.appendChild(locateCurrentBtn) startColElm.appendChild(locateCurrentBtn)
let endPickBtnElm = this._DialogObject._element.body.getElementsByClassName( let endPickBtnElm = contentElm._element.body.getElementsByClassName(
'end-pick-btn' 'end-pick-btn'
)[0] )[0]
endPickBtnElm.style.marginRight = '91px' endPickBtnElm.style.marginRight = '91px'

View File

@ -17,6 +17,7 @@ class GroundText extends Base {
* @param options.id {string} 唯一标识 * @param options.id {string} 唯一标识
* @param options.show=true {boolean} 显示/隐藏 * @param options.show=true {boolean} 显示/隐藏
* @param options.text {string} 文字 * @param options.text {string} 文字
* @param options.color=#FFC107 {string} 颜色
* @param options.angle=0 {number} 旋转角度 * @param options.angle=0 {number} 旋转角度
* @param options.scale=1 {number} 缩放比例 * @param options.scale=1 {number} 缩放比例
* @param options.speed=1 {number} 文字滚动速度 * @param options.speed=1 {number} 文字滚动速度
@ -49,20 +50,21 @@ class GroundText extends Base {
textArray.splice(70 - textArray.length) textArray.splice(70 - textArray.length)
} }
this.options.text = textArray.join('\n') this.options.text = textArray.join('\n')
this.options.name = this.options.text
this.options.show = this.options.show =
options.show || options.show === false ? options.show : true options.show || options.show === false ? options.show : true
this.options.angle = options.angle || 0 this.options.angle = options.angle || 0
this.options.scale = this.options.scale =
options.scale || options.scale === 0 ? options.scale : 1 options.scale || options.scale === 0 ? options.scale : 1
this.options.fontSize = options.fontSize || 20 // this.options.fontSize = options.fontSize || 20
this.options.duration = // this.options.duration =
options.duration || options.duration === 0 ? options.duration : 50000 // options.duration || options.duration === 0 ? options.duration : 50000
this.options.speed = this.options.speed =
options.speed || options.speed === 0 ? options.speed : 1 options.speed || options.speed === 0 ? options.speed : 1
this.options.color = options.color || '#FFC107' this.options.color = options.color || '#FFC107'
this.options.position = options.position this.options.position = options.position
delete this.options.name
if (!this.options.position && this.options.positions) { if (!this.options.position && this.options.positions) {
this.options.position = { lng: (this.options.positions[0].lng + this.options.positions[1].lng) / 2, lat: (this.options.positions[0].lat + this.options.positions[1].lat) / 2 } this.options.position = { lng: (this.options.positions[0].lng + this.options.positions[1].lng) / 2, lat: (this.options.positions[0].lat + this.options.positions[1].lat) / 2 }
let point1 = turf.point([this.options.positions[0].lng, this.options.positions[0].lat]); let point1 = turf.point([this.options.positions[0].lng, this.options.positions[0].lat]);
@ -102,6 +104,7 @@ class GroundText extends Base {
this.options.scale = distance1 / distance2 this.options.scale = distance1 / distance2
} }
this.duration = 50000
this.entity this.entity
this._positionEditing = false this._positionEditing = false
this.Dialog = _Dialog this.Dialog = _Dialog
@ -137,6 +140,9 @@ class GroundText extends Base {
}) })
} }
get name() {
return
}
get text() { get text() {
return this.options.text return this.options.text
} }
@ -172,7 +178,7 @@ class GroundText extends Base {
image: canvas.toDataURL('image/png'), image: canvas.toDataURL('image/png'),
color: this.options.color, color: this.options.color,
repeat: new Cesium.Cartesian2(1.0, 1.0), repeat: new Cesium.Cartesian2(1.0, 1.0),
duration: this.options.duration / this.options.speed, duration: this.duration / this.options.speed,
fltr: false, fltr: false,
is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false
}) })
@ -200,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
@ -212,45 +218,45 @@ 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
}) })
} }
get duration() { // get duration() {
return this.options.duration // return this.options.duration
} // }
set duration(v) { // set duration(v) {
this.options.duration = v // this.options.duration = 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'),
color: this.options.color, // color: this.options.color,
repeat: new Cesium.Cartesian2(1.0, 1.0), // repeat: new Cesium.Cartesian2(1.0, 1.0),
duration: this.options.duration / this.options.speed, // duration: this.options.duration / this.options.speed,
fltr: false, // fltr: false,
is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false // is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false
}) // })
this._elms.duration && // this._elms.duration &&
this._elms.duration.forEach(item => { // this._elms.duration.forEach(item => {
item.value = v // item.value = v
}) // })
} // }
get speed() { get speed() {
return this.options.speed return this.options.speed
} }
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'),
color: this.options.color, color: this.options.color,
repeat: new Cesium.Cartesian2(1.0, 1.0), repeat: new Cesium.Cartesian2(1.0, 1.0),
duration: this.options.duration / this.options.speed, duration: this.duration / this.options.speed,
fltr: false, fltr: false,
is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false
}) })
@ -270,7 +276,7 @@ class GroundText extends Base {
image: canvas.toDataURL('image/png'), image: canvas.toDataURL('image/png'),
color: this.options.color, color: this.options.color,
repeat: new Cesium.Cartesian2(1.0, 1.0), repeat: new Cesium.Cartesian2(1.0, 1.0),
duration: this.options.duration / this.options.speed, duration: this.duration / this.options.speed,
fltr: false, fltr: false,
is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false
}) })
@ -328,7 +334,7 @@ class GroundText extends Base {
image: canvas.toDataURL('image/png'), image: canvas.toDataURL('image/png'),
color: this.options.color, color: this.options.color,
repeat: new Cesium.Cartesian2(1.0, 1.0), repeat: new Cesium.Cartesian2(1.0, 1.0),
duration: this.options.duration / this.options.speed, duration: this.duration / this.options.speed,
fltr: false, fltr: false,
is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false is2D: this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE2D ? true : false
}), }),
@ -505,6 +511,10 @@ class GroundText extends Base {
}) })
}) })
} else { } else {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
if (this.event) { if (this.event) {
this.event.mouse_move(() => { }) this.event.mouse_move(() => { })
this.event.mouse_left(() => { }) this.event.mouse_left(() => { })
@ -520,6 +530,11 @@ class GroundText extends Base {
return this._positionEditing return this._positionEditing
} }
openPositionEditing(cd) {
this.positionEditing = true
this._positionEditingCallback = cd
}
/** /**
* 飞到 * 飞到
*/ */

View File

@ -56,13 +56,9 @@ class StandText extends Base {
this.options.show = (options.show || options.show === false) ? options.show : true this.options.show = (options.show || options.show === false) ? options.show : true
this.nodePoints = [] this.nodePoints = []
this.entity this.entity
this.options.instruct = options.instruct || ""
this.options.operatingPoint = options.operatingPoint || "" delete this.options.name
this.options.attribute = options.attribute || {}
this.options.attribute.link = this.options.attribute.link || {}
this.options.attribute.link.content = this.options.attribute.link.content || []
this.options.attribute.camera = this.options.attribute.camera || []
this.options.attributeType = options.attributeType || 'richText'
this.extrudedHeight this.extrudedHeight
this._EventBinding = new EventBinding() this._EventBinding = new EventBinding()
this.Dialog = _Dialog this.Dialog = _Dialog
@ -71,6 +67,9 @@ class StandText extends Base {
StandText.create(this) StandText.create(this)
} }
get name() {
return
}
get text() { get text() {
return this.options.text return this.options.text
} }
@ -164,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
@ -297,14 +296,6 @@ class StandText extends Base {
// } // }
get attributeCamera() {
return this.options.attribute.camera
}
set attributeCamera(v) {
this.options.attribute.camera = v
}
//创建 //创建
static async create(that) { static async create(that) {
@ -397,15 +388,13 @@ class StandText extends Base {
this.Dialog.showCallBack && this.Dialog.showCallBack() this.Dialog.showCallBack && this.Dialog.showCallBack()
}, },
secondaryEditCallBack: () => { secondaryEditCallBack: () => {
StandText.nodeEdit(this) this.nodeEdit()
} }
}) })
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' stand-text' this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' stand-text'
let contentElm = document.createElement('div'); let contentElm = document.createElement('div');
contentElm.innerHTML = html(this) contentElm.innerHTML = html(this)
this._DialogObject.contentAppChild(contentElm) this._DialogObject.contentAppChild(contentElm)
this.attributeType = this.options.attributeType
this.attributeCamera = this.options.attribute.camera
// setTimeout(() => { // setTimeout(() => {
// this.attributeLink = this.options.attribute.link.content // this.attributeLink = this.options.attribute.link.content
// this.cameraSelect() // this.cameraSelect()
@ -538,23 +527,24 @@ class StandText extends Base {
} }
} }
static nodeEdit(that, cb = () => { }) { nodeEdit(cb = () => { }) {
if (YJ.Measure.GetMeasureStatus()) { if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束') cb('上一次测量未结束')
} else { } else {
YJ.Measure.SetMeasureStatus(true) YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('请选择一个顶点,右键取消', that.sdk) this._nodeEditCallback = cb
that.event = new MouseEvent(that.sdk) this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
that.nodePoints = [] this.event = new MouseEvent(this.sdk)
this.nodePoints = []
let selectPoint let selectPoint
let originalPosition let originalPosition
let positions = that.options.positions let positions = this.options.positions
let fromDegreesArray = [] let fromDegreesArray = []
let minimumHeights = [] let minimumHeights = []
let maximumHeights = [] let maximumHeights = []
let width = that.computeDistance2(positions) let width = this.computeDistance2(positions)
let extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0 let extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
for (let i = 0; i < positions.length; i++) { for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat) fromDegreesArray.push(positions[i].lng, positions[i].lat)
minimumHeights.push(positions[i].alt) minimumHeights.push(positions[i].alt)
@ -565,55 +555,55 @@ class StandText extends Base {
let leftEvent = (movement, cartesian) => { let leftEvent = (movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
isAdd = true isAdd = true
let pos3 = that.sdk.viewer.scene.clampToHeight(cartesian, [that.entity]) let pos3 = this.sdk.viewer.scene.clampToHeight(cartesian, [this.entity])
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(pos3, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(pos3, this.sdk.viewer)
originalPosition = that.options.positions[selectPoint.index] originalPosition = this.options.positions[selectPoint.index]
let entity = that.sdk.viewer.entities.add({ let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
position: Cesium.Cartesian3.fromDegrees(that.options.positions[selectPoint.index].lng, that.options.positions[selectPoint.index].lat, that.options.positions[selectPoint.index].alt), position: Cesium.Cartesian3.fromDegrees(this.options.positions[selectPoint.index].lng, this.options.positions[selectPoint.index].lat, this.options.positions[selectPoint.index].alt),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.splice(selectPoint.index, 0, entity) this.nodePoints.splice(selectPoint.index, 0, entity)
that.options.positions.splice(selectPoint.index, 0, that.options.positions[selectPoint.index]) this.options.positions.splice(selectPoint.index, 0, this.options.positions[selectPoint.index])
let positions = that.options.positions let positions = this.options.positions
fromDegreesArray = [] fromDegreesArray = []
minimumHeights = [] minimumHeights = []
maximumHeights = [] maximumHeights = []
width = that.computeDistance2(positions) width = this.computeDistance2(positions)
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0 extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
for (let i = 0; i < positions.length; i++) { for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat) fromDegreesArray.push(positions[i].lng, positions[i].lat)
minimumHeights.push(positions[i].alt) minimumHeights.push(positions[i].alt)
maximumHeights.push(positions[i].alt + extrudedHeight) maximumHeights.push(positions[i].alt + extrudedHeight)
} }
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.position.x, movement.position.x,
movement.position.y movement.position.y
) )
} }
else { else {
var pick = that.sdk.viewer.scene.pick(movement.position); var pick = this.sdk.viewer.scene.pick(movement.position);
if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') { if (pick && pick.id && pick.id.name && pick.id.name === 'node-secondary-edit-point') {
selectPoint = pick.id selectPoint = pick.id
that.nodePoints.splice(pick.id.index, 1) this.nodePoints.splice(pick.id.index, 1)
that.sdk.viewer.entities.remove(pick.id) this.sdk.viewer.entities.remove(pick.id)
that.tip.set_text('左键开始右键结束CTRL+右键撤销') this.tip.set_text('左键开始右键结束CTRL+右键撤销')
originalPosition = that.cartesian3Towgs84(cartesian, that.sdk.viewer) originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
that.entity.wall.positions = new Cesium.CallbackProperty(function () { this.entity.wall.positions = new Cesium.CallbackProperty(function () {
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray) return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
}, false) }, false)
that.entity.wall.maximumHeights = new Cesium.CallbackProperty(function () { this.entity.wall.maximumHeights = new Cesium.CallbackProperty(function () {
return maximumHeights return maximumHeights
}, false) }, false)
that.entity.wall.minimumHeights = new Cesium.CallbackProperty(function () { this.entity.wall.minimumHeights = new Cesium.CallbackProperty(function () {
return minimumHeights return minimumHeights
}, false) }, false)
} }
@ -621,69 +611,69 @@ class StandText extends Base {
} }
let rightEvent = (movement, cartesian) => { let rightEvent = (movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions[selectPoint.index] = originalPosition this.options.positions[selectPoint.index] = originalPosition
if(isAdd) { if(isAdd) {
that.options.positions.splice(selectPoint.index, 1) this.options.positions.splice(selectPoint.index, 1)
} }
cb(null, that.options.positions) cb(null, this.options.positions)
} }
let positions = that.options.positions let positions = this.options.positions
fromDegreesArray = [] fromDegreesArray = []
minimumHeights = [] minimumHeights = []
maximumHeights = [] maximumHeights = []
width = that.computeDistance2(positions) width = this.computeDistance2(positions)
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0 extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
for (let i = 0; i < positions.length; i++) { for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat) fromDegreesArray.push(positions[i].lng, positions[i].lat)
minimumHeights.push(positions[i].alt) minimumHeights.push(positions[i].alt)
maximumHeights.push(positions[i].alt + extrudedHeight) maximumHeights.push(positions[i].alt + extrudedHeight)
} }
that.entity.wall.positions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray) this.entity.wall.positions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
for (let i = 0; i < that.nodePoints.length; i++) { for (let i = 0; i < this.nodePoints.length; i++) {
that.sdk.viewer.entities.remove(that.nodePoints[i]) this.sdk.viewer.entities.remove(this.nodePoints[i])
} }
that.nodePoints = [] this.nodePoints = []
YJ.Measure.SetMeasureStatus(false) YJ.Measure.SetMeasureStatus(false)
that.event.destroy() this.event.destroy()
that.tip.destroy() this.tip.destroy()
} }
that.event.mouse_left(leftEvent) this.event.mouse_left(leftEvent)
that.event.mouse_right(rightEvent) this.event.mouse_right(rightEvent)
that.event.mouse_move((movement, cartesian) => { this.event.mouse_move((movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
let pos3 = that.sdk.viewer.scene.clampToHeight(cartesian, [that.entity]) let pos3 = this.sdk.viewer.scene.clampToHeight(cartesian, [this.entity])
that.options.positions[selectPoint.index] = that.cartesian3Towgs84(pos3, that.sdk.viewer) this.options.positions[selectPoint.index] = this.cartesian3Towgs84(pos3, this.sdk.viewer)
let positions = that.options.positions let positions = this.options.positions
fromDegreesArray = [] fromDegreesArray = []
minimumHeights = [] minimumHeights = []
maximumHeights = [] maximumHeights = []
width = that.computeDistance2(positions) width = this.computeDistance2(positions)
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0 extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
for (let i = 0; i < positions.length; i++) { for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat) fromDegreesArray.push(positions[i].lng, positions[i].lat)
minimumHeights.push(positions[i].alt) minimumHeights.push(positions[i].alt)
maximumHeights.push(positions[i].alt + extrudedHeight) maximumHeights.push(positions[i].alt + extrudedHeight)
} }
} }
that.tip.setPosition( this.tip.setPosition(
cartesian, cartesian,
movement.endPosition.x, movement.endPosition.x,
movement.endPosition.y movement.endPosition.y
) )
}) })
that.event.mouse_right_keyboard_ctrl((movement, cartesian) => { this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
if (selectPoint) { if (selectPoint) {
that.options.positions.pop() this.options.positions.pop()
that.sdk.viewer.entities.remove(that.nodePoints[that.nodePoints.length - 1]) this.sdk.viewer.entities.remove(this.nodePoints[this.nodePoints.length - 1])
that.nodePoints.pop() this.nodePoints.pop()
if (selectPoint.index === that.options.positions.length) { if (selectPoint.index === this.options.positions.length) {
if (that.nodePoints[selectPoint.index - 1]) { if (this.nodePoints[selectPoint.index - 1]) {
selectPoint = that.nodePoints[selectPoint.index - 1] selectPoint = this.nodePoints[selectPoint.index - 1]
} }
else { else {
selectPoint.index = 0 selectPoint.index = 0
@ -692,7 +682,7 @@ class StandText extends Base {
} }
}) })
that.event.gesture_pinck_start((movement, cartesian) => { this.event.gesture_pinck_start((movement, cartesian) => {
let startTime = new Date() let startTime = new Date()
let pos = { let pos = {
position: { position: {
@ -700,7 +690,7 @@ class StandText extends Base {
y: (movement.position1.y + movement.position2.y) / 2 y: (movement.position1.y + movement.position2.y) / 2
} }
} }
that.event.gesture_pinck_end(() => { this.event.gesture_pinck_end(() => {
let endTime = new Date() let endTime = new Date()
if (endTime - startTime >= 500) { if (endTime - startTime >= 500) {
// 长按取消 // 长按取消
@ -712,20 +702,20 @@ class StandText extends Base {
}) })
}) })
for (let i = 0; i < that.options.positions.length; i++) { for (let i = 0; i < this.options.positions.length; i++) {
let entity = that.sdk.viewer.entities.add({ let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point', name: 'node-secondary-edit-point',
index: i, index: i,
position: Cesium.Cartesian3.fromDegrees(that.options.positions[i].lng, that.options.positions[i].lat, that.options.positions[i].alt), position: Cesium.Cartesian3.fromDegrees(this.options.positions[i].lng, this.options.positions[i].lat, this.options.positions[i].alt),
billboard: { billboard: {
image: that.getSourceRootPath() + '/img/point.png', image: this.getSourceRootPath() + '/img/point.png',
width: 15, width: 15,
height: 15, height: 15,
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
color: Cesium.Color.WHITE.withAlpha(0.99) color: Cesium.Color.WHITE.withAlpha(0.99)
}, },
}) })
that.nodePoints.push(entity) this.nodePoints.push(entity)
} }
} }
} }

View File

@ -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.fuelLabel.fontSize = v
this.label.pixelOffset = this.options.label.pixelOffset + v + 20
}
else {
this.label.pixelOffset = this.options.label.pixelOffset 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

View File

@ -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 {

View File

@ -15,8 +15,6 @@ import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global' import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
class Base extends Tools { class Base extends Tools {
#_showView
#_isShowView
constructor(sdk, options = {}) { constructor(sdk, options = {}) {
super(sdk, options); super(sdk, options);
if (!sdk || !sdk.viewer) { if (!sdk || !sdk.viewer) {
@ -32,8 +30,14 @@ 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.#_showView = this.options.showView || 0 // this.options.customView = options.customView ||{
// relativePosition: undefined,
// orientation: undefined
// }
this.options.customView = options.customView
// this._showView = this.options.showView || 0
this.setDefaultValue() this.setDefaultValue()
this._showView
// this.sdk.addIncetance(this.options.id, this) // this.sdk.addIncetance(this.options.id, this)
} }
@ -60,7 +64,7 @@ class Base extends Tools {
// } // }
get showView() { get showView() {
return this.#_showView return this._showView
} }
set showView(v) { set showView(v) {
@ -68,28 +72,28 @@ class Base extends Tools {
let sdk2D = get2DSdk().sdkD let sdk2D = get2DSdk().sdkD
if (!sdk2D) { if (!sdk2D) {
this.#_showView = v this._showView = v
if (this.entity) { if (this.entity) {
this.entity._showView = v this.entity._showView = v
} }
return return
} }
if (this.sdk === sdk2D) { if (this.sdk === sdk2D) {
this.#_showView = 0 this._showView = 0
return return
} }
if (!this.#_showView && !this.show) { if (!this._showView && !this.show) {
return return
} }
if (this.sdk === sdk2D) { if (this.sdk === sdk2D) {
this.#_showView = 0 this._showView = 0
return return
} }
if (v != 2 && v != 3) { if (v != 2 && v != 3) {
this.#_showView = 0 this._showView = 0
} }
else { else {
this.#_showView = v this._showView = v
} }
this.isShowView = true this.isShowView = true
@ -98,7 +102,7 @@ class Base extends Tools {
// return // return
// } // }
if (!this.#_showView) { if (!this._showView) {
this.show = true this.show = true
} }
else { else {
@ -502,7 +506,10 @@ class Base extends Tools {
// 重置视角 // 重置视角
resetCustomView() { resetCustomView() {
this.options.customView = undefined this.options.customView = {
relativePosition: undefined,
orientation: undefined
}
} }

View File

@ -17,6 +17,7 @@ class EventBinding {
} }
on(that, elements) { on(that, elements) {
return
this.element = {} this.element = {}
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
if (!elements[i] || !elements[i].attributes) { if (!elements[i] || !elements[i].attributes) {

View File

@ -127,9 +127,9 @@ class Tools {
var alt = cartographic.height < 0 ? 0 : cartographic.height var alt = cartographic.height < 0 ? 0 : cartographic.height
// var alt = cartographic.height // var alt = cartographic.height
return { return {
lng: lng, lng: Number(lng.toFixed(8)),
lat: lat, lat: Number(lat.toFixed(8)),
alt: alt, alt: Number(alt.toFixed(2)),
} }
} }
@ -141,13 +141,14 @@ class Tools {
* @param [fractionDigits=2] 保留小数点位数 * @param [fractionDigits=2] 保留小数点位数
* @param [ground=true] 是否贴地 * @param [ground=true] 是否贴地
* */ * */
async computeDistance(positions = [], fractionDigits = 2, type = '空间长度') { async computeDistance(positions = [], fractionDigits = 2, type = 0) {
if (positions.length < 2) { if (positions.length < 2) {
return 0 return 0
} else { } else {
let length = 0 let length = 0
switch (type) { switch (type) {
case '空间长度': case '0':
case 0:
for (let i = 0; i < positions.length - 1; i++) { for (let i = 0; i < positions.length - 1; i++) {
const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, positions[i].alt); const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, positions[i].alt);
const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, positions[i + 1].alt); const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, positions[i + 1].alt);
@ -155,7 +156,8 @@ class Tools {
length = length + distance length = length + distance
} }
break break
case '投影长度': case '1':
case 1:
for (let i = 0; i < positions.length - 1; i++) { for (let i = 0; i < positions.length - 1; i++) {
const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, 0); const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, 0);
const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, 0); const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, 0);
@ -163,7 +165,8 @@ class Tools {
length = length + distance length = length + distance
} }
break break
case '地表长度': case '2':
case 2:
let meters let meters
let lineString2 = [] let lineString2 = []
positions.forEach((item) => { positions.forEach((item) => {
@ -1243,14 +1246,28 @@ class Tools {
* */ * */
deepCopyObj(obj) { deepCopyObj(obj) {
let newobj = null; let newobj = null;
//判断是否需要继续进行递归 // 处理数组 - 使用原生Array构造函数创建新数组
if (typeof (obj) == 'object' && obj !== null) { if (Array.isArray(obj)) {
newobj = obj instanceof Array ? [] : {}; //进行下一层递归克隆 newobj = [];
// 只拷贝数组元素,不拷贝可能存在的扩展方法
for (let i = 0; i < obj.length; i++) {
newobj[i] = this.deepCopyObj(obj[i]);
}
return newobj;
}
// 处理对象
else if (obj && typeof obj === 'object') {
newobj = {};
for (let i in obj) { for (let i in obj) {
if (i != 'earth' && i != 'Dialog') // 排除指定属性和方法属性
newobj[i] = this.deepCopyObj(obj[i]) if (i !== 'earth' && i !== 'Dialog' && typeof obj[i] !== 'function') {
} //如果不是对象直接赋值 newobj[i] = this.deepCopyObj(obj[i]);
} else newobj = obj; }
}
return newobj;
}
else newobj = obj;
return newobj; return newobj;
} }
@ -1517,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

View File

@ -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++) {

View File

@ -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 }

View File

@ -31,6 +31,8 @@ import YJColorPicker from "../Obj/Element/yj-color-picker";
class YJEarth { class YJEarth {
#_requestAnimationFrameEventId = undefined #_requestAnimationFrameEventId = undefined
#_BillboardCollection
#_LabelCollection
/** /**
* @constructor * @constructor
* @param div_id {string} 地球所在的dom id * @param div_id {string} 地球所在的dom id
@ -272,6 +274,34 @@ class YJEarth {
this.viewer.scene.fxaa = true this.viewer.scene.fxaa = true
this.viewer.scene.postProcessStages.fxaa.enabled = true this.viewer.scene.postProcessStages.fxaa.enabled = true
this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = true //true 禁止 false 允许 this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = true //true 禁止 false 允许
const BillboardCollection = this.viewer.scene.primitives.add(new Cesium.BillboardCollection({
scene: this.viewer.scene,
}));
const labelCollection = this.viewer.scene.primitives.add(new Cesium.LabelCollection({
scene: this.viewer.scene,
}));
this.#_BillboardCollection = BillboardCollection
this.#_LabelCollection = labelCollection
createCluster(this.viewer) createCluster(this.viewer)
keyboardMapRoamingInit(this.viewer) keyboardMapRoamingInit(this.viewer)
let a = Cesium.viewerCesiumNavigationMixin(this.viewer, { let a = Cesium.viewerCesiumNavigationMixin(this.viewer, {
@ -522,6 +552,13 @@ class YJEarth {
} }
get collection() {
return {
billboard: this.#_BillboardCollection,
label: this.#_LabelCollection
}
}
destroy() { destroy() {
cancelAnimationFrame(this.#_requestAnimationFrameEventId) cancelAnimationFrame(this.#_requestAnimationFrameEventId)
for (let [id, obj] of this.entityMap) { for (let [id, obj] of this.entityMap) {

View File

@ -65,7 +65,7 @@
position: absolute; position: absolute;
color: var(--color-sdk-auxiliary-public); color: var(--color-sdk-auxiliary-public);
font-size: 14px; font-size: 14px;
z-index: 999999; z-index: 99;
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6); background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
border: 1.5px solid; border: 1.5px solid;
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1; border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
@ -76,8 +76,6 @@
} }
.YJ-custom-base-dialog * { .YJ-custom-base-dialog * {
margin: 0px;
padding: 0px;
box-sizing: border-box; box-sizing: border-box;
} }
@ -171,7 +169,7 @@
position: relative; position: relative;
} }
.YJ-custom-base-dialog button:not(button[disabled="disabled"]):hover { .YJ-custom-base-dialog button:not(button[disabled]):hover {
border-color: rgba(var(--color-sdk-base-rgb), 1) !important; border-color: rgba(var(--color-sdk-base-rgb), 1) !important;
cursor: pointer; cursor: pointer;
} }
@ -3888,3 +3886,81 @@
/* 移回顶部外 */ /* 移回顶部外 */
} }
} }
.yj-custom-icon {
display: inline-block;
width: 22px;
height: 10px;
margin-right: 5px;
}
.yj-custom-icon.line {
border: 1px solid rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.yj-custom-icon.dash-line {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.yj-custom-icon.light-line {
border: 1px solid rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
box-shadow: 0 0 3px #fff
}
.yj-custom-icon.tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.mult-tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.flow-dash-line1 {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.yj-custom-icon.flow-dash-line2 {
border: 1px dashed rgba(255, 255, 255, 1);
height: 0px;
margin-top: 4px;
}
.yj-custom-icon.pic-line1 {
background: url(../../img/arrow/1.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.pic-line2 {
background: url(../../img/arrow/2.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.pic-line3 {
background: url(../../img/arrow/3.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.pic-line4 {
background: url(../../img/arrow/4.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.pic-line5 {
background: url(../../img/arrow/5.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.yj-custom-icon.pic-line6 {
background: url(../../img/arrow/6.png) 100% 100% no-repeat;
background-size: 100% 100%;
}

222
yarn.lock
View File

@ -24,7 +24,7 @@
resolved "https://registry.npmmirror.com/@babel/compat-data/-/compat-data-7.26.2.tgz" resolved "https://registry.npmmirror.com/@babel/compat-data/-/compat-data-7.26.2.tgz"
integrity sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg== integrity sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==
"@babel/core@^7.4.0": "@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.0.0-0 || ^8.0.0-0 <8.0.0", "@babel/core@^7.12.0", "@babel/core@^7.13.0", "@babel/core@^7.4.0", "@babel/core@^7.4.0 || ^8.0.0-0 <8.0.0":
version "7.26.0" version "7.26.0"
resolved "https://registry.npmmirror.com/@babel/core/-/core-7.26.0.tgz" resolved "https://registry.npmmirror.com/@babel/core/-/core-7.26.0.tgz"
integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==
@ -971,7 +971,7 @@
resolved "https://registry.npmmirror.com/@types/linkify-it/-/linkify-it-5.0.0.tgz" resolved "https://registry.npmmirror.com/@types/linkify-it/-/linkify-it-5.0.0.tgz"
integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q== integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==
"@types/markdown-it@^12.2.3": "@types/markdown-it@*", "@types/markdown-it@^12.2.3":
version "12.2.3" version "12.2.3"
resolved "https://registry.npmmirror.com/@types/markdown-it/-/markdown-it-12.2.3.tgz" resolved "https://registry.npmmirror.com/@types/markdown-it/-/markdown-it-12.2.3.tgz"
integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==
@ -1144,7 +1144,7 @@ acorn-jsx@^5.0.0:
resolved "https://registry.npmmirror.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz" resolved "https://registry.npmmirror.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz"
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
acorn@^6.0.7, acorn@^6.4.1: "acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^6.0.7, acorn@^6.4.1:
version "6.4.2" version "6.4.2"
resolved "https://registry.npmmirror.com/acorn/-/acorn-6.4.2.tgz" resolved "https://registry.npmmirror.com/acorn/-/acorn-6.4.2.tgz"
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
@ -1159,7 +1159,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1, ajv-keywords@^3.5.2:
resolved "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz" resolved "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz"
integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==
ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.9.1: ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.9.1, ajv@>=5.0.0:
version "6.12.6" version "6.12.6"
resolved "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz" resolved "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz"
integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
@ -1422,11 +1422,6 @@ balanced-match@^1.0.0:
resolved "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz" resolved "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
base64-js@^1.0.2:
version "1.5.1"
resolved "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
base@^0.11.1: base@^0.11.1:
version "0.11.2" version "0.11.2"
resolved "https://registry.npmmirror.com/base/-/base-0.11.2.tgz" resolved "https://registry.npmmirror.com/base/-/base-0.11.2.tgz"
@ -1440,6 +1435,11 @@ base@^0.11.1:
mixin-deep "^1.2.0" mixin-deep "^1.2.0"
pascalcase "^0.1.1" pascalcase "^0.1.1"
base64-js@^1.0.2:
version "1.5.1"
resolved "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
big.js@^5.2.2: big.js@^5.2.2:
version "5.2.2" version "5.2.2"
resolved "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz" resolved "https://registry.npmmirror.com/big.js/-/big.js-5.2.2.tgz"
@ -1455,19 +1455,22 @@ binary-extensions@^2.0.0:
resolved "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz" resolved "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz"
integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==
bindings@^1.5.0:
version "1.5.0"
resolved "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
dependencies:
file-uri-to-path "1.0.0"
bluebird@^3.5.5, bluebird@^3.7.2: bluebird@^3.5.5, bluebird@^3.7.2:
version "3.7.2" version "3.7.2"
resolved "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz" resolved "https://registry.npmmirror.com/bluebird/-/bluebird-3.7.2.tgz"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: bn.js@^4.0.0:
version "4.12.1"
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.1.tgz"
integrity sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==
bn.js@^4.1.0:
version "4.12.1"
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.1.tgz"
integrity sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==
bn.js@^4.11.9:
version "4.12.1" version "4.12.1"
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.1.tgz" resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.1.tgz"
integrity sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg== integrity sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==
@ -1576,7 +1579,7 @@ browserify-zlib@^0.2.0:
dependencies: dependencies:
pako "~1.0.5" pako "~1.0.5"
browserslist@^4.24.0, browserslist@^4.24.2: browserslist@^4.24.0, browserslist@^4.24.2, "browserslist@>= 4.21.0":
version "4.24.2" version "4.24.2"
resolved "https://registry.npmmirror.com/browserslist/-/browserslist-4.24.2.tgz" resolved "https://registry.npmmirror.com/browserslist/-/browserslist-4.24.2.tgz"
integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==
@ -2006,7 +2009,14 @@ data-view-byte-offset@^1.0.0:
es-errors "^1.3.0" es-errors "^1.3.0"
is-data-view "^1.0.1" is-data-view "^1.0.1"
debug@^2.2.0, debug@^2.3.3: debug@^2.2.0:
version "2.6.9"
resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
dependencies:
ms "2.0.0"
debug@^2.3.3:
version "2.6.9" version "2.6.9"
resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz" resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
@ -2444,7 +2454,7 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
resolved "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz" resolved "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint@^5.15.3: "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9", eslint@^5.15.3, "eslint@>= 4.12.1", eslint@>=3.14.1, eslint@>=4.19.1, eslint@>=5.0.0:
version "5.16.0" version "5.16.0"
resolved "https://registry.npmmirror.com/eslint/-/eslint-5.16.0.tgz" resolved "https://registry.npmmirror.com/eslint/-/eslint-5.16.0.tgz"
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
@ -2519,7 +2529,12 @@ estraverse@^4.1.1:
resolved "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz" resolved "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz"
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
estraverse@^5.1.0, estraverse@^5.2.0: estraverse@^5.1.0:
version "5.3.0"
resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
estraverse@^5.2.0:
version "5.3.0" version "5.3.0"
resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz" resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
@ -2639,11 +2654,6 @@ file-entry-cache@^5.0.1:
dependencies: dependencies:
flat-cache "^2.0.1" flat-cache "^2.0.1"
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
fill-range@^4.0.0: fill-range@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.npmmirror.com/fill-range/-/fill-range-4.0.0.tgz" resolved "https://registry.npmmirror.com/fill-range/-/fill-range-4.0.0.tgz"
@ -2768,19 +2778,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz" resolved "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fsevents@^1.2.7:
version "1.2.13"
resolved "https://registry.npmmirror.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38"
integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==
dependencies:
bindings "^1.5.0"
nan "^2.12.1"
fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
function-bind@^1.1.2: function-bind@^1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz" resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz"
@ -3131,7 +3128,7 @@ inflight@^1.0.4:
once "^1.3.0" once "^1.3.0"
wrappy "1" wrappy "1"
inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3, inherits@2:
version "2.0.4" version "2.0.4"
resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz" resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@ -3297,6 +3294,11 @@ is-extendable@^0.1.0, is-extendable@^0.1.1:
resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-0.1.1.tgz" resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-0.1.1.tgz"
integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==
is-extendable@^0.1.1:
version "0.1.1"
resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-0.1.1.tgz"
integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==
is-extendable@^1.0.1: is-extendable@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-1.0.1.tgz" resolved "https://registry.npmmirror.com/is-extendable/-/is-extendable-1.0.1.tgz"
@ -3449,7 +3451,7 @@ is-wsl@^1.1.0:
resolved "https://registry.npmmirror.com/is-wsl/-/is-wsl-1.1.0.tgz" resolved "https://registry.npmmirror.com/is-wsl/-/is-wsl-1.1.0.tgz"
integrity sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw== integrity sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw==
isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: isarray@^1.0.0, isarray@~1.0.0, isarray@1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz" resolved "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz"
integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==
@ -3542,7 +3544,14 @@ json-stable-stringify-without-jsonify@^1.0.1:
resolved "https://registry.npmmirror.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" resolved "https://registry.npmmirror.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz"
integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==
json5@^1.0.1, json5@^1.0.2: json5@^1.0.1:
version "1.0.2"
resolved "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"
json5@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz" resolved "https://registry.npmmirror.com/json5/-/json5-1.0.2.tgz"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
@ -3554,7 +3563,21 @@ json5@^2.1.2, json5@^2.2.3:
resolved "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz" resolved "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: kind-of@^3.0.2:
version "3.2.2"
resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz"
integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==
dependencies:
is-buffer "^1.1.5"
kind-of@^3.0.3:
version "3.2.2"
resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz"
integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==
dependencies:
is-buffer "^1.1.5"
kind-of@^3.2.0:
version "3.2.2" version "3.2.2"
resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz" resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz"
integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ== integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==
@ -3600,7 +3623,16 @@ loader-runner@^2.4.0:
resolved "https://registry.npmmirror.com/loader-runner/-/loader-runner-2.4.0.tgz" resolved "https://registry.npmmirror.com/loader-runner/-/loader-runner-2.4.0.tgz"
integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==
loader-utils@^1.2.3, loader-utils@^1.4.0: loader-utils@^1.2.3:
version "1.4.2"
resolved "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^1.0.1"
loader-utils@^1.4.0:
version "1.4.2" version "1.4.2"
resolved "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz" resolved "https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.2.tgz"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg== integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
@ -3682,7 +3714,7 @@ markdown-it-anchor@^8.4.1:
resolved "https://registry.npmmirror.com/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz" resolved "https://registry.npmmirror.com/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz"
integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA== integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==
markdown-it@^12.3.2: markdown-it@*, markdown-it@^12.3.2:
version "12.3.2" version "12.3.2"
resolved "https://registry.npmmirror.com/markdown-it/-/markdown-it-12.3.2.tgz" resolved "https://registry.npmmirror.com/markdown-it/-/markdown-it-12.3.2.tgz"
integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==
@ -3847,26 +3879,21 @@ move-concurrently@^1.0.1:
rimraf "^2.5.4" rimraf "^2.5.4"
run-queue "^1.0.3" run-queue "^1.0.3"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz"
integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==
ms@^2.1.1, ms@^2.1.3: ms@^2.1.1, ms@^2.1.3:
version "2.1.3" version "2.1.3"
resolved "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz" resolved "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz"
integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==
mute-stream@0.0.7: mute-stream@0.0.7:
version "0.0.7" version "0.0.7"
resolved "https://registry.npmmirror.com/mute-stream/-/mute-stream-0.0.7.tgz" resolved "https://registry.npmmirror.com/mute-stream/-/mute-stream-0.0.7.tgz"
integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ== integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ==
nan@^2.12.1:
version "2.22.2"
resolved "https://registry.npmmirror.com/nan/-/nan-2.22.2.tgz#6b504fd029fb8f38c0990e52ad5c26772fdacfbb"
integrity sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==
nanomatch@^1.2.9: nanomatch@^1.2.9:
version "1.2.13" version "1.2.13"
resolved "https://registry.npmmirror.com/nanomatch/-/nanomatch-1.2.13.tgz" resolved "https://registry.npmmirror.com/nanomatch/-/nanomatch-1.2.13.tgz"
@ -4258,7 +4285,7 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^1.16.4: prettier@^1.16.4, prettier@>=1.13.0:
version "1.19.1" version "1.19.1"
resolved "https://registry.npmmirror.com/prettier/-/prettier-1.19.1.tgz" resolved "https://registry.npmmirror.com/prettier/-/prettier-1.19.1.tgz"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
@ -4325,7 +4352,12 @@ pumpify@^1.3.3:
inherits "^2.0.3" inherits "^2.0.3"
pump "^2.0.0" pump "^2.0.0"
punycode@^1.2.4, punycode@^1.4.1: punycode@^1.2.4:
version "1.4.1"
resolved "https://registry.npmmirror.com/punycode/-/punycode-1.4.1.tgz"
integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==
punycode@^1.4.1:
version "1.4.1" version "1.4.1"
resolved "https://registry.npmmirror.com/punycode/-/punycode-1.4.1.tgz" resolved "https://registry.npmmirror.com/punycode/-/punycode-1.4.1.tgz"
integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==
@ -4362,7 +4394,7 @@ randomfill@^1.0.4:
randombytes "^2.0.5" randombytes "^2.0.5"
safe-buffer "^5.1.0" safe-buffer "^5.1.0"
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@^2.3.8, readable-stream@~2.3.6: readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@^2.3.8, readable-stream@~2.3.6, "readable-stream@1 || 2":
version "2.3.8" version "2.3.8"
resolved "https://registry.npmmirror.com/readable-stream/-/readable-stream-2.3.8.tgz" resolved "https://registry.npmmirror.com/readable-stream/-/readable-stream-2.3.8.tgz"
integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
@ -4564,13 +4596,6 @@ ret@~0.1.10:
resolved "https://registry.npmmirror.com/ret/-/ret-0.1.15.tgz" resolved "https://registry.npmmirror.com/ret/-/ret-0.1.15.tgz"
integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==
rimraf@2.6.3:
version "2.6.3"
resolved "https://registry.npmmirror.com/rimraf/-/rimraf-2.6.3.tgz"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
rimraf@^2.5.4, rimraf@^2.6.3: rimraf@^2.5.4, rimraf@^2.6.3:
version "2.7.1" version "2.7.1"
resolved "https://registry.npmmirror.com/rimraf/-/rimraf-2.7.1.tgz" resolved "https://registry.npmmirror.com/rimraf/-/rimraf-2.7.1.tgz"
@ -4578,6 +4603,13 @@ rimraf@^2.5.4, rimraf@^2.6.3:
dependencies: dependencies:
glob "^7.1.3" glob "^7.1.3"
rimraf@2.6.3:
version "2.6.3"
resolved "https://registry.npmmirror.com/rimraf/-/rimraf-2.6.3.tgz"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
ripemd160@^2.0.0, ripemd160@^2.0.1: ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.2" version "2.0.2"
resolved "https://registry.npmmirror.com/ripemd160/-/ripemd160-2.0.2.tgz" resolved "https://registry.npmmirror.com/ripemd160/-/ripemd160-2.0.2.tgz"
@ -4683,7 +4715,12 @@ schema-utils@^3.0.0:
ajv "^6.12.5" ajv "^6.12.5"
ajv-keywords "^3.5.2" ajv-keywords "^3.5.2"
semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: semver@^5.5.0, semver@^5.5.1:
version "5.7.2"
resolved "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz"
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
semver@^5.6.0:
version "5.7.2" version "5.7.2"
resolved "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz" resolved "https://registry.npmmirror.com/semver/-/semver-5.7.2.tgz"
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
@ -4931,6 +4968,13 @@ stream-shift@^1.0.0:
resolved "https://registry.npmmirror.com/stream-shift/-/stream-shift-1.0.3.tgz" resolved "https://registry.npmmirror.com/stream-shift/-/stream-shift-1.0.3.tgz"
integrity sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ== integrity sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==
string_decoder@^1.0.0, string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
dependencies:
safe-buffer "~5.1.0"
string-width@^2.1.0: string-width@^2.1.0:
version "2.1.1" version "2.1.1"
resolved "https://registry.npmmirror.com/string-width/-/string-width-2.1.1.tgz" resolved "https://registry.npmmirror.com/string-width/-/string-width-2.1.1.tgz"
@ -4939,7 +4983,16 @@ string-width@^2.1.0:
is-fullwidth-code-point "^2.0.0" is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0" strip-ansi "^4.0.0"
string-width@^3.0.0, string-width@^3.1.0: string-width@^3.0.0:
version "3.1.0"
resolved "https://registry.npmmirror.com/string-width/-/string-width-3.1.0.tgz"
integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==
dependencies:
emoji-regex "^7.0.1"
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"
string-width@^3.1.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.npmmirror.com/string-width/-/string-width-3.1.0.tgz" resolved "https://registry.npmmirror.com/string-width/-/string-width-3.1.0.tgz"
integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==
@ -4976,13 +5029,6 @@ string.prototype.trimstart@^1.0.8:
define-properties "^1.2.1" define-properties "^1.2.1"
es-object-atoms "^1.0.0" es-object-atoms "^1.0.0"
string_decoder@^1.0.0, string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
dependencies:
safe-buffer "~5.1.0"
strip-ansi@^4.0.0: strip-ansi@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-4.0.0.tgz" resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-4.0.0.tgz"
@ -5080,6 +5126,11 @@ text-table@^0.2.0:
resolved "https://registry.npmmirror.com/text-table/-/text-table-0.2.0.tgz" resolved "https://registry.npmmirror.com/text-table/-/text-table-0.2.0.tgz"
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
through@^2.3.6:
version "2.3.8"
resolved "https://registry.npmmirror.com/through/-/through-2.3.8.tgz"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
through2@^2.0.0: through2@^2.0.0:
version "2.0.5" version "2.0.5"
resolved "https://registry.npmmirror.com/through2/-/through2-2.0.5.tgz" resolved "https://registry.npmmirror.com/through2/-/through2-2.0.5.tgz"
@ -5088,11 +5139,6 @@ through2@^2.0.0:
readable-stream "~2.3.6" readable-stream "~2.3.6"
xtend "~4.0.1" xtend "~4.0.1"
through@^2.3.6:
version "2.3.8"
resolved "https://registry.npmmirror.com/through/-/through-2.3.8.tgz"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
timers-browserify@^2.0.4: timers-browserify@^2.0.4:
version "2.0.12" version "2.0.12"
resolved "https://registry.npmmirror.com/timers-browserify/-/timers-browserify-2.0.12.tgz" resolved "https://registry.npmmirror.com/timers-browserify/-/timers-browserify-2.0.12.tgz"
@ -5428,7 +5474,7 @@ webpack-sources@^1.4.0, webpack-sources@^1.4.1:
source-list-map "^2.0.0" source-list-map "^2.0.0"
source-map "~0.6.1" source-map "~0.6.1"
webpack@^4.29.6: webpack@^4.0.0, "webpack@^4.0.0 || ^5.0.0", webpack@^4.29.6, webpack@>=2, webpack@4.x.x:
version "4.47.0" version "4.47.0"
resolved "https://registry.npmmirror.com/webpack/-/webpack-4.47.0.tgz" resolved "https://registry.npmmirror.com/webpack/-/webpack-4.47.0.tgz"
integrity sha512-td7fYwgLSrky3fI1EuU5cneU4+pbH6GgOfuKNS1tNPcfdGinGELAqsb/BP4nnvZyKSG2i/xFGU7+n2PvZA8HJQ== integrity sha512-td7fYwgLSrky3fI1EuU5cneU4+pbH6GgOfuKNS1tNPcfdGinGELAqsb/BP4nnvZyKSG2i/xFGU7+n2PvZA8HJQ==
@ -5513,7 +5559,21 @@ which-typed-array@^1.1.14, which-typed-array@^1.1.15:
gopd "^1.0.1" gopd "^1.0.1"
has-tostringtag "^1.0.2" has-tostringtag "^1.0.2"
which@^1.2.14, which@^1.2.9, which@^1.3.1: which@^1.2.14:
version "1.3.1"
resolved "https://registry.npmmirror.com/which/-/which-1.3.1.tgz"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
dependencies:
isexe "^2.0.0"
which@^1.2.9:
version "1.3.1"
resolved "https://registry.npmmirror.com/which/-/which-1.3.1.tgz"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
dependencies:
isexe "^2.0.0"
which@^1.3.1:
version "1.3.1" version "1.3.1"
resolved "https://registry.npmmirror.com/which/-/which-1.3.1.tgz" resolved "https://registry.npmmirror.com/which/-/which-1.3.1.tgz"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==