修改线绘制 流动箭头,保存,然后再次编辑,未显示对应参数以及虚线远视角报错问题

This commit is contained in:
2025-08-08 15:31:11 +08:00
parent e2657ce0a8
commit 20a9388579
3 changed files with 89 additions and 72 deletions

View File

@ -1317,12 +1317,19 @@ class PolylineObject extends Base {
positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray),
width: that.options.width,
clampToGround: ground,
material: that.getMaterial(that.options.color, that.options.type, that.entity, that.options),
// material: that.getMaterial(that.options.color, that.options.type, that.entity, that.options),
zIndex: that.sdk._entityZIndex
}
})
that.entity.polyline.oriWidth = that.options.width
that.judgeLine(that.entity, that.options)
that.entity.polyline.material = that.getMaterial(
that.options.color,
that.options.type,
that.entity,
that.options
)
that.sdk._entityZIndex++
PolylineObject.createLabel(that)
// that.entity.polyline.positionsLngLat = positions
@ -1529,10 +1536,20 @@ class PolylineObject extends Base {
// this.attributeCamera = this.options.attribute.camera.content
// this.attributeGoods = this.options.attribute.goods.content
function tabClick(e) {
if (e === '2' || e === 2) {//点击线条样式
if (2 < _this.options.type && _this.options.type < 13) {//贴图参数
document.getElementById('dashTextureDom').style.display = 'flex'
} else {
document.getElementById('dashTextureDom').style.display = 'none'
}
}
}
// 创建标签页
let tabsElm = new cy_tabs(
'polyline-object-edit-tabs',
undefined,
tabClick,
this.sdk
)
// 颜色组件

View File

@ -1,76 +1,77 @@
class cy_tabs {
constructor(id, clickTabCallBack, sdk) {
let elm = document.getElementById(id);
let pane = elm.getElementsByTagName('DIV-cy-tab-pane')
constructor(id, clickTabCallBack, sdk) {
let elm = document.getElementById(id);
let pane = elm.getElementsByTagName('DIV-cy-tab-pane')
let tabTop = `<div class="DIV-cy-tab-top">`
let tabContent = `<div class="DIV-cy-tab-content">`
let tabindex = 0
for (let i = 0; i < pane.length; i++) {
let flag = false
if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) {
for (let m = 0; m < sdk.tabHide.length; m++) {
if (pane[i].getAttribute('label') === sdk.tabHide[m]) {
flag = true
break
}
}
}
if (flag) {
continue
}
let style = 'display: none;'
let active = ''
if (tabindex == 0) {
style = ''
active = 'is-active'
}
tabTop = tabTop + `
let tabTop = `<div class="DIV-cy-tab-top">`
let tabContent = `<div class="DIV-cy-tab-content">`
let tabindex = 0
for (let i = 0; i < pane.length; i++) {
let flag = false
if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) {
for (let m = 0; m < sdk.tabHide.length; m++) {
if (pane[i].getAttribute('label') === sdk.tabHide[m]) {
flag = true
break
}
}
}
if (flag) {
continue
}
let style = 'display: none;'
let active = ''
if (tabindex == 0) {
style = ''
active = 'is-active'
}
tabTop = tabTop + `
<div class="DIV-cy-tab-pane-title">
<div class="DIV-cy-tab-pane-title-p `+ active + `" tabindex="` + tabindex + `"><span>` + pane[i].getAttribute('label') + `</span></div>
</div>
`
tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>`
tabindex++
tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>`
tabindex++
}
tabTop = tabTop + `</div>`
tabContent = tabContent + `</div>`
let BoxElm = document.createElement('div');
BoxElm.setAttribute('id', id)
BoxElm.setAttribute('class', 'DIV-cy-tabs')
BoxElm.innerHTML = tabTop + tabContent
elm.parentNode.insertBefore(BoxElm, elm);
elm.parentNode.removeChild(elm);
// 点击事件
let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p')
for (let i = 0; i < tabs.length; i++) {
tabs[i].addEventListener('click', (e) => {
let tabindex = e.target.getAttribute('tabindex')
let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane')
clickTabCallBack && clickTabCallBack(tabindex)
for (let i = 0; i < contentElm.length; i++) {
if (i === parseInt(tabindex)) {
contentElm[i].style.display = ''
tabs[i].className = 'DIV-cy-tab-pane-title-p is-active'
}
else {
contentElm[i].style.display = 'none'
tabs[i].className = 'DIV-cy-tab-pane-title-p'
}
}
tabTop = tabTop + `</div>`
tabContent = tabContent + `</div>`
let BoxElm = document.createElement('div');
BoxElm.setAttribute('id', id)
BoxElm.setAttribute('class', 'DIV-cy-tabs')
BoxElm.innerHTML = tabTop + tabContent
elm.parentNode.insertBefore(BoxElm, elm);
elm.parentNode.removeChild(elm);
// 点击事件
let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p')
for (let i = 0; i < tabs.length; i++) {
tabs[i].addEventListener('click', (e) => {
let tabindex = e.target.getAttribute('tabindex')
let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane')
for (let i = 0; i < contentElm.length; i++) {
if (i === parseInt(tabindex)) {
contentElm[i].style.display = ''
tabs[i].className = 'DIV-cy-tab-pane-title-p is-active'
}
else {
contentElm[i].style.display = 'none'
tabs[i].className = 'DIV-cy-tab-pane-title-p'
}
}
contentElm[parseInt(tabindex)].style.display = ''
})
}
this.clickTabCallBack = clickTabCallBack
contentElm[parseInt(tabindex)].style.display = ''
})
}
clickTabCallBack() {
if (this.clickTabCallBack) {
this.clickTabCallBack()
}
this.clickTabCallBack = clickTabCallBack
}
clickTabCallBack() {
if (this.clickTabCallBack) {
this.clickTabCallBack()
}
}
}
export default cy_tabs
export default cy_tabs

View File

@ -638,7 +638,7 @@ class Tools {
// break
case 6: //流动虚线2
let that = this
let repeatX
material = new Cesium.FlowDashedLineFlowMaterialProperty({
color: color,
uType: type == 5 ? 0 : 1,
@ -660,11 +660,10 @@ class Tools {
let point2 = new Cesium.Cartesian2(that.sdk.viewer.canvas.clientWidth / 2, that.sdk.viewer.canvas.clientHeight)
var cartesian1 = that.sdk.viewer.scene.pickPosition(point1)
var cartesian2 = that.sdk.viewer.scene.pickPosition(point2)
var distance2 = Cesium.Cartesian3.distance(cartesian1, cartesian2);
let repeatX = distance2 * 2 / distance
if (cartesian1 && cartesian2) {
var distance2 = Cesium.Cartesian3.distance(cartesian1, cartesian2);
repeatX = distance2 * 2 / distance
}
return repeatX;
})
})