diff --git a/src/In/index.js b/src/In/index.js
index ebfff60..ac158cb 100644
--- a/src/In/index.js
+++ b/src/In/index.js
@@ -187,7 +187,7 @@ import DrawTakeOff from '../Obj/AirLine/DrawTakeOff'
import FlowLine from '../Obj/Base/FlowLine'
import Sunshine from '../Global/efflect/Sunshine'
// import Road2 from '../Obj/Base/RoadObject'
-import TextBox from '../Obj/Base/TextBox'
+// import TextBox from '../Obj/Base/TextBox'
import BatchModel from '../Obj/Base/BatchModel'
const YJEarthismeasuring = Symbol('测量状态')
@@ -262,7 +262,7 @@ if (!window.YJ) {
Dialog,
FlowLine,
// Road2,
- TextBox,
+ // TextBox,
BatchModel
},
YJEarth,
diff --git a/src/Obj/Base/BillboardObject/index.js b/src/Obj/Base/BillboardObject/index.js
index 8a222b8..3bd6bfc 100644
--- a/src/Obj/Base/BillboardObject/index.js
+++ b/src/Obj/Base/BillboardObject/index.js
@@ -40,11 +40,6 @@ import {
import { getGoodsList } from '../../../Tools/getGoodsList'
class BillboardObject extends Base {
- #_postRenderEvent = null
- #_destroyMouseEvent = null
- #_billboardHeight = 0
-
-
/**
* @constructor
* @description 创建点标注
@@ -123,7 +118,6 @@ class BillboardObject extends Base {
this.options.positions.alt = Number(
Number(options.positions.alt || 0).toFixed(2)
)
- this.#_billboardHeight = this.options.positions.alt
// this.options.diffuseShow = options.diffuseShow || false
// this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10
// this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000
@@ -151,18 +145,11 @@ class BillboardObject extends Base {
this.options.attribute.goods.content || []
this.options.attributeType = options.attributeType || 'richText'
this.options.coordinate = options.coordinate || ''
- this.options.attributeBoxState = options.attributeBoxState || false
this.operate = {}
this._elms = {}
this.previous = {
positions: { ...this.options.positions }
}
- this.options.attributePos = options.attributePos || {
- x: 60,
- y: 60,
- width: 200,
- height: 120
- }
this.entity
this._proj = this.sdk.proj
@@ -195,109 +182,7 @@ class BillboardObject extends Base {
- this.#_destroyMouseEvent = () => {
- this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset')
- this.sdk.viewer._element.onmousemove = null
- document.removeEventListener('mouseup', this.#_destroyMouseEvent)
- document.removeEventListener('mouseleave', this.#_destroyMouseEvent)
- }
- this.#_postRenderEvent = () => {
- let siteInfoPosition = Cesium.Cartesian3.fromDegrees(
- this.options.positions.lng,
- this.options.positions.lat,
- this.#_billboardHeight
- )
- if (this.attributeElm && this.entity) {
- let winpos = this.sdk.viewer.scene.cartesianToCanvasCoordinates(
- siteInfoPosition
- )
- let pixelOffset = this.entity.label.pixelOffset.getValue()
- if (winpos) {
- let scale = getCurrentBillboardScale(this.entity, this.sdk.viewer.scene)
- let height = ((this.entity.billboard.height.getValue() * (this.options.billboard.scale || 0)) + this.options.label.fontSize) * (1 - (scale * scale))
- let flag = false
- let lineElm = this.attributeElm.getElementsByClassName('billboard-attribute-box-line')[0]
- let leftTopElm = this.attributeElm.getElementsByClassName('left-top')[0]
- let rightTopElm = this.attributeElm.getElementsByClassName('right-top')[0]
- this.attributeElm.style.left = (winpos.x + this.options.attributePos.x).toFixed(0) + 'px'
- this.attributeElm.style.top = (winpos.y + pixelOffset.y - (this.options.label.show ? (this.options.label.fontSize / 2) : -(this.options.label.fontSize / 2)) - this.attributeElm.offsetHeight - this.options.attributePos.y + height).toFixed(0) + 'px'
- this.attributeElm.style.width = this.options.attributePos.width + 'px'
- this.attributeElm.style.height = this.options.attributePos.height + 'px'
- lineElm.style.zIndex = '-1'
- if (this.options.attributePos.x < -this.options.attributePos.width / 2) {
- flag = true
- lineElm.style.left = 'unset'
- lineElm.style.right = '0'
- leftTopElm.style.display = 'block'
- rightTopElm.style.display = 'none'
- }
- else {
- lineElm.style.left = '0'
- lineElm.style.right = 'unset'
- leftTopElm.style.display = 'none'
- rightTopElm.style.display = 'block'
- }
-
- let lineLength
- let lineAngleRad
- let lineAngle
- let x
- let y
- if (flag) {
- x = this.attributeElm.offsetWidth + this.options.attributePos.x
- y = this.options.attributePos.y ? this.options.attributePos.y : 0
- }
- else {
- x = this.options.attributePos.x
- y = this.options.attributePos.y ? this.options.attributePos.y : 0
- }
- lineLength = Math.sqrt((x * x) + (y * y)).toFixed(2);
- lineAngleRad = Math.atan(x / y);
- lineAngle = parseFloat((lineAngleRad * 180 / Math.PI).toFixed(2));
- if (this.options.attributePos.y < 0) {
- lineAngle = lineAngle + 180
- }
- // if(this.options.attributePos.y<-this.options.attributePos.height/2) {
- // lineElm.style.bottom = 'unset'
- // lineElm.style.top = '0'
- // }
- // else {
- // lineElm.style.bottom = -lineLength + 'px'
- // lineElm.style.top = 'unset'
- // }
- lineElm.style.height = lineLength + 'px'
- lineElm.style.transform = 'rotate(' + lineAngle + 'deg)'
- }
- }
- }
-
- function getCurrentBillboardScale(entity, scene) {
- // 获取相机到Billboard的距离
- const distance = Cesium.Cartesian3.distance(
- scene.camera.positionWC,
- entity.position.getValue()
- );
- // 获取缩放距离配置
- const scaleByDistance = entity.billboard.scaleByDistance ? entity.billboard.scaleByDistance.getValue() : undefined;
-
- if (!scaleByDistance) {
- // 如果没有设置距离缩放,则使用基础缩放值
- return 1.0;
- }
-
- // 解析缩放距离参数 [near, nearScale, far, farScale]
- const { near, nearValue, far, farValue } = scaleByDistance;
- if (distance <= near) {
- return nearValue;
- } else if (distance >= far) {
- return farValue;
- } else {
- // 计算中间距离的缩放值(线性插值)
- const t = (distance - near) / (far - near);
- return Cesium.Math.lerp(nearValue, farValue, t);
- }
- }
this.sdk.addIncetance(this.options.id, this)
@@ -358,7 +243,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
- that.attributeBoxState && (that.attributeBoxState = true)
}
return
}
@@ -383,7 +267,6 @@ class BillboardObject extends Base {
return img
}, false)
addCluster(that.sdk, that.entity)
- that.attributeBoxState && (that.attributeBoxState = true)
}
})
}
@@ -415,7 +298,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = height
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
- that.attributeBoxState && (that.attributeBoxState = true)
}
}
image.onerror = function (err) {
@@ -427,7 +309,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
- that.attributeBoxState && (that.attributeBoxState = true)
}
};
}
@@ -557,16 +438,16 @@ class BillboardObject extends Base {
// value: 'IP摄像头',
// key: 'camera'
// },
- // // {
- // // name: 'ISC摄像头',
- // // value: 'ISC摄像头',
- // // key: 'isc'
- // // },
- // // {
- // // name: '传感器',
- // // value: '传感器',
- // // key: 'sensor'
- // // },
+ // {
+ // name: 'ISC摄像头',
+ // value: 'ISC摄像头',
+ // key: 'isc'
+ // },
+ // {
+ // name: '传感器',
+ // value: '传感器',
+ // key: 'sensor'
+ // },
// {
// name: '全景图',
// value: '全景图',
@@ -584,36 +465,15 @@ class BillboardObject extends Base {
return this.options.show
}
set show(v) {
- if (!this.isShowView) {
+ if(!this.isShowView) {
this.options.show = v
this.originalOptions.show = v
}
- if (!this.showView || this.showView == 3) {
+ if(!this.showView || this.showView == 3) {
this.entity && (this.entity.show = this.options.show)
- if (this.attributeBoxState && this.options.show) {
- this.attributeBoxState = this.options.show
- }
- else {
- // 关闭属性框
- document.addEventListener('mouseup', this.#_destroyMouseEvent);
- document.addEventListener('mouseleave', this.#_destroyMouseEvent);
- if (this.attributeElm) {
- this.sdk.viewer._element.removeChild(this.attributeElm)
- this.attributeElm = null
- }
- this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
- }
}
else {
this.entity && (this.entity.show = false)
- // 关闭属性框
- document.addEventListener('mouseup', this.#_destroyMouseEvent);
- document.addEventListener('mouseleave', this.#_destroyMouseEvent);
- if (this.attributeElm) {
- this.sdk.viewer._element.removeChild(this.attributeElm)
- this.attributeElm = null
- }
- this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
@@ -702,26 +562,6 @@ class BillboardObject extends Base {
if (this.entity) {
this.entity.billboard.heightReference = heightMode
this.entity.label.heightReference = heightMode
- if(heightMode == Cesium.HeightReference.CLAMP_TO_GROUND) {
- if (this.sdk.viewer.scene.terrainProvider.availability) {
- Cesium.sampleTerrainMostDetailed(
- this.sdk.viewer.scene.terrainProvider,
- [
- Cesium.Cartographic.fromDegrees(
- this.options.positions.lng,
- this.options.positions.lat
- )
- ]
- ).then(position => {
- this.#_billboardHeight = position[0].height
- })
- } else {
- this.#_billboardHeight = 0
- }
- }
- else {
- this.#_billboardHeight = this.options.positions.alt
- }
}
this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
}
@@ -776,7 +616,6 @@ class BillboardObject extends Base {
}
set alt(v) {
this.options.positions.alt = Number(Number(v).toFixed(2))
- this.#_billboardHeight = this.options.positions.alt
// this.scan && (this.scan.alt = v)
// this.diffuse && (this.diffuse.alt = v)
this.renewPoint()
@@ -1877,22 +1716,6 @@ class BillboardObject extends Base {
this.cameraSelect && this.cameraSelect()
this.ISCSelect && this.ISCSelect()
this.goodsSelect && this.goodsSelect()
-
- let col = document.createElement('div')
- col.className = 'col'
- col.style.flex = '0 0 110px'
- col.innerHTML = `
- 属性框
-
- `
-
- let row = this._DialogObject._element.content.getElementsByClassName('attribute')[0].getElementsByClassName('row')[0]
- row.appendChild(col)
- let boxSwitch = col.getElementsByClassName('btn-switch')[0]
- boxSwitch.checked = this.attributeBoxState
- boxSwitch.addEventListener('change', (e) => {
- this.attributeBoxState = boxSwitch.checked
- })
let tagData = this.attributeSelect
let attributeElm = this._DialogObject._element.content.getElementsByClassName(
'attribute-select-box'
@@ -2404,7 +2227,6 @@ class BillboardObject extends Base {
this.attributeCamera = this.options.attribute.camera.content
this.attributeGoods = this.options.attribute.goods.content
this.attributeISC = this.options.attribute.ISC.content
- this.attributeBoxState = this.options.attributeBoxState
this.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
}
@@ -2412,7 +2234,6 @@ class BillboardObject extends Base {
async remove() {
await remove_entity_from_cluster(this.sdk.viewer, this.entity)
this.entity = null
- this.attributeBoxState = false
if (!this.sdk.viewer || !this.sdk.viewer.entities) {
return
}
@@ -2603,7 +2424,6 @@ class BillboardObject extends Base {
}
if (height !== undefined) {
this.options.positions.alt = Number(Number(height).toFixed(2))
- this.#_billboardHeight = this.options.positions.alt
this._elms.alt &&
this._elms.alt.forEach(item => {
item.value = this.options.positions.alt
@@ -2619,7 +2439,6 @@ class BillboardObject extends Base {
switch (this._elms.heightMode.value) {
case '海拔高度':
heightElm.value = this.options.positions.alt
- this.#_billboardHeight = this.options.positions.alt
break
case '相对地表':
if (this.sdk.viewer.scene.terrainProvider.availability) {
@@ -2635,18 +2454,15 @@ class BillboardObject extends Base {
heightElm.value = Number(
(this.options.positions.alt - position[0].height).toFixed(2)
)
- this.#_billboardHeight = this.options.positions.alt
})
} else {
heightElm.value = this.options.positions.alt
- this.#_billboardHeight = this.options.positions.alt
}
break
case '依附地表':
break
case '依附模型':
heightElm.value = this.options.positions.alt
- this.#_billboardHeight = this.options.positions.alt
break
}
}
@@ -2920,216 +2736,6 @@ class BillboardObject extends Base {
(this.originalOptions.customView = this.options.customView)
}
}
-
- get attributeBoxState() {
- return this.options.attributeBoxState
- }
-
- set attributeBoxState(state) {
- state = state ? true : false
- this.options.attributeBoxState = state
- document.addEventListener('mouseup', this.#_destroyMouseEvent);
- document.addEventListener('mouseleave', this.#_destroyMouseEvent);
- if (this.attributeElm) {
- this.sdk.viewer._element.removeChild(this.attributeElm)
- this.attributeElm = null
- }
- this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
- if (state && this.sdk && this.sdk.viewer && this.sdk.viewer._element && this.show) {
- let attributeElm = document.createElement('div')
- this.attributeElm = attributeElm
- attributeElm.className = 'billboard-attribute-box'
- attributeElm.style.top = '0px'
- attributeElm.style.left = '0px'
- attributeElm.style.width = 0
- attributeElm.style.height = 0
- // attributeElm.innerHTML = this.options.richTextContent
- this.sdk.viewer._element.appendChild(attributeElm)
- let linkHtml = ''
- let goodsHtml = ''
- let richTextHtml = ''
- for (let i = 0; i < this.options.attribute.link.content.length; i++) {
- linkHtml += `
暂无属性信息
' - } - else { - boxHtml = boxHtml + ` -