diff --git a/src/Obj/Base/GroundImage/_element.js b/src/Obj/Base/GroundImage/_element.js
index 95acf9f..0edeb1e 100644
--- a/src/Obj/Base/GroundImage/_element.js
+++ b/src/Obj/Base/GroundImage/_element.js
@@ -1,5 +1,5 @@
function html() {
- return `
+ return `
@@ -7,14 +7,21 @@ function html() {
名称
-
-
-
+
-
+
+
+ 文字设置
+
`
diff --git a/src/Obj/Base/GroundImage/index.js b/src/Obj/Base/GroundImage/index.js
index df7f882..2544c4f 100644
--- a/src/Obj/Base/GroundImage/index.js
+++ b/src/Obj/Base/GroundImage/index.js
@@ -4,8 +4,11 @@ import { html } from "./_element";
import EventBinding from '../../Element/Dialog/eventBinding';
import Base from "../index";
import MouseEvent from '../../../Event/index'
+import { legp } from '../../Element/datalist'
import { syncData } from '../../../Global/MultiViewportMode'
+import { getGroundCover } from '../../../Global/global'
import MouseTip from '../../../MouseTip'
+import { getFontList, getFontFamily, getFontFamilyName } from '../../Element/fontSelect'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
@@ -36,11 +39,31 @@ class GroundImage extends Base {
this.options.angle = options.angle || 0
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
this.options.position = options.position
- this.options.offset = options.offset || { x: 0.5, y: 0.5 }
+ this.options.offset = options.offset || { x: 0.5, y: 1 }
+ this.options.mode = this.options.mode ? 1 : 0
+ this.options.billboard = options.billboard || {}
+ this.options.billboard.scale = this.options.billboard.scale || 1
+ this.options.billboard.near = this.options.billboard.near || this.options.billboard.near === 0 ? this.options.billboard.near : 2000
+ this.options.billboard.far = this.options.billboard.far || this.options.billboard.far === 0 ? this.options.billboard.far : 100000
+ this.options.billboard.scaleByDistance = this.options.billboard.scaleByDistance ? true : false
+
+ options.label = options.label || {}
+ this.options.label = options.label || {}
+ this.options.label.text = options.label.text || this.options.name
+ this.options.name = this.options.label.text
+ this.options.label.show =
+ options.label.show || options.label.show === false
+ ? options.label.show
+ : true
+ this.options.label.fontFamily = options.label.fontFamily || 0
+ this.options.label.fontSize = options.label.fontSize || 39
+ this.options.label.color = options.label.color || '#00ffff'
this.options.flipe = options.flipe || {}
this.options.flipe.x = this.options.flipe.x || false
this.options.flipe.y = this.options.flipe.y || false
+ this.options.heightMode =
+ options.heightMode || options.heightMode == 0 ? options.heightMode : 3
this.entity = {
id: this.options.id
@@ -48,6 +71,7 @@ class GroundImage extends Base {
this._positionEditing = false
this.Dialog = _Dialog
this._elms = {};
+ this._proj = this.sdk.proj
this.previous = {
position: { ...this.options.position }
}
@@ -57,6 +81,123 @@ class GroundImage extends Base {
this.create()
}
+ get mode() {
+ return this.options.mode
+ }
+ set mode(v) {
+ this.options.mode = v ? 1 : 0
+ let modeData = [
+ {
+ name: '贴地',
+ value: '贴地',
+ key: 0
+ },
+ {
+ name: '立体',
+ value: '立体',
+ key: 1
+ }
+ ]
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].key === this.options.mode) {
+ this._elms.mode && this._elms.mode.forEach((item) => {
+ item.value = modeData[i].value
+ })
+ break
+ }
+ }
+ let elms = this._DialogObject._element.body.getElementsByClassName('row')
+ let elms2 = this._DialogObject._element.foot.getElementsByTagName('button')
+ let elms3 = this._DialogObject._element.foot.getElementsByTagName('h4')
+ for (let i = 0; i < elms.length; i++) {
+ let mode = elms[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms[i].style.display = 'flex'
+ }
+ else {
+ elms[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms2.length; i++) {
+ let mode = elms2[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms2[i].style.display = 'block'
+ }
+ else {
+ elms2[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms3.length; i++) {
+ let mode = elms3[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms3[i].style.display = 'block'
+ }
+ else {
+ elms3[i].style.display = 'none'
+ }
+ }
+ }
+ const img = new Image();
+ img.crossOrigin = 'Anonymous';
+ img.src = this.replaceHost(this.options.url, this.options.host);
+ img.onload = () => {
+ const canvas = document.createElement('canvas');
+ const ctx = canvas.getContext('2d');
+
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ this.entity.billboard.show = true
+ this.labelShow && (this.entity.label.show = true)
+ this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
+
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
+ }
+ }
+ }
+
get offset() {
return this.options.offset
}
@@ -69,24 +210,52 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ this.entity.billboard.show = true
+ this.labelShow && (this.entity.label.show = true)
+ this.entity.rectangle.show = false
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
+
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- })
}
}
@@ -112,6 +281,70 @@ class GroundImage extends Base {
})
}
+ get billboardScale() {
+ return this.options.billboard.scale
+ }
+ set billboardScale(v) {
+ let billboardScale = Number(v.toFixed(2))
+ if (billboardScale > 99) {
+ billboardScale = 99
+ }
+ if (billboardScale < 0.1) {
+ billboardScale = 0.1
+ }
+ this.options.billboard.scale = billboardScale
+ this.renewPoint()
+ this._elms.billboardScale &&
+ this._elms.billboardScale.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get billboardScaleByDistance() {
+ return this.options.billboard.scaleByDistance
+ }
+ set billboardScaleByDistance(v) {
+ this.options.billboard.scaleByDistance = v
+ this.renewPoint()
+ this._elms.billboardScaleByDistance &&
+ this._elms.billboardScaleByDistance.forEach(item => {
+ item.checked = v
+ })
+ }
+
+ get billboardNear() {
+ return this.options.billboard.near
+ }
+ set billboardNear(v) {
+ let near = v
+ if (near > this.billboardFar) {
+ near = this.billboardFar
+ }
+ this.options.billboard.near = near
+ this.renewPoint()
+ this._elms.billboardNear &&
+ this._elms.billboardNear.forEach(item => {
+ item.value = near
+ })
+ }
+
+ get billboardFar() {
+ return this.options.billboard.far
+ }
+ set billboardFar(v) {
+ let far = v
+ if (far < this.billboardNear) {
+ far = this.billboardNear
+ }
+ this.options.billboard.far = far
+ this.renewPoint()
+ this._elms.billboardFar &&
+ this._elms.billboardFar.forEach(item => {
+ item.value = far
+ })
+ }
+
+
get flipeY() {
return this.options.flipe.y
}
@@ -129,28 +362,47 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ // this.entity.billboard.show = true
+ // this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
- }
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity && (this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- }))
- // this.offset = {
- // x: Math.abs(this.offset.x - 1),
- // y: this.offset.y,
- // }
}
} else {
console.error("参数必须为boolean")
@@ -173,24 +425,48 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ // this.entity.billboard.show = true
+ // this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
- }
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- })
+
// this.offset = {
// x: this.offset.x,
// y: Math.abs(this.offset.y - 1),
@@ -201,6 +477,265 @@ class GroundImage extends Base {
}
}
+ get heightMode() {
+ return this.options.heightMode ? this.options.heightMode : 0
+ }
+ set heightMode(v) {
+ this.options.heightMode = v ? v : 0
+ this.options.heightMode = v || v == 0 ? v : 3
+ let heightMode
+ let heightModeName = ''
+ let altBoxElm
+ if (
+ this._DialogObject &&
+ this._DialogObject._element &&
+ this._DialogObject._element.content
+ ) {
+ altBoxElm = this._DialogObject._element.content.getElementsByClassName(
+ 'alt-box'
+ )[0]
+ }
+ let heightElm
+ if (this._elms.height) {
+ heightElm = this._elms.height.getElementsByClassName('input-number')[0]
+ }
+ switch (this.options.heightMode) {
+ case '0':
+ case 0:
+ altBoxElm &&
+ (altBoxElm.className = 'input-number input-number-unit-1 alt-box')
+ // this._elms.height && (this._elms.height.style.display = 'flex')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '海拔高度'
+ break
+ case '1':
+ case 1:
+ altBoxElm &&
+ (altBoxElm.className = 'input-number input-number-unit-1 alt-box')
+ // this._elms.height && (this._elms.height.style.display = 'flex')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '相对地表'
+ break
+ case '2':
+ case 2:
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ heightModeName = '依附地表'
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ heightModeName = '依附地表'
+ heightMode = Cesium.HeightReference.CLAMP_TO_GROUND
+ // this._elms.height && (this._elms.height.style.display = 'none')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1 disabled')
+ break
+ case '3':
+ case 3:
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ // this._elms.height && (this._elms.height.style.display = 'none')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1 disabled')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '依附模型'
+ break
+ }
+ if (this.entity && this.entity.billboard) {
+ this.entity.billboard.heightReference = heightMode
+ }
+ this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
+ }
+
+ get coordinate() {
+ return this.options.coordinate
+ }
+ set coordinate(v) {
+ this.options.coordinate = v
+ // let position = this._proj.convert(
+ // [
+ // {
+ // x: this.options.position.lng,
+ // y: this.options.position.lat,
+ // z: this.options.position.alt
+ // }
+ // ],
+ // 'EPSG:4326',
+ // v
+ // ).points
+ // if (
+ // this._DialogObject &&
+ // this._DialogObject._element &&
+ // this._DialogObject._element.content &&
+ // position[0]
+ // ) {
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-x'
+ // )[0].value = position[0].x
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-y'
+ // )[0].value = position[0].y
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-z'
+ // )[0].value = position[0].z
+ // }
+ // this._elms.coordinate &&
+ // this._elms.coordinate.forEach(item => {
+ // item.value = v
+ // })
+ }
+
+ get position() {
+ return this.options.position
+ }
+
+ set position(v) {
+ this.options.position = v
+
+ this.coordinate = this.options.coordinate
+
+ if (this._textToCenter) {
+ let point = turf.point([this.options.position.lng, this.options.position.lat])
+ let targetPoint = turf.destination(point, this._textToCenter.distance, this._textToCenter.angle, { units: 'kilometers' }).geometry.coordinates
+ this.getClampToHeight({ lng: targetPoint[0], lat: targetPoint[1] }).then((height) => {
+ let textPosition = [targetPoint[0], targetPoint[1], height]
+ this.options.text.position = { lng: targetPoint[0], lat: targetPoint[1], alt: height }
+ this.text && (this.text.position = textPosition)
+ })
+ }
+
+ this._elms.lng &&
+ this._elms.lng.forEach(item => {
+ item.value = this.options.position.lng
+ })
+ this._elms.lat &&
+ this._elms.lat.forEach(item => {
+ item.value = this.options.position.lat
+ })
+
+ if (this._elms.height) {
+ let heightElm = this._elms.height.getElementsByClassName('height')[0]
+ if (heightElm) {
+ switch (this._elms.heightMode.value) {
+ case '海拔高度':
+ heightElm.value = this.options.position.alt
+ break
+ case '相对地表':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - position[0].height).toFixed(2)
+ )
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ })
+ } else {
+ heightElm.value = Number(
+ Number(this.options.position.alt).toFixed(2)
+ )
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ }
+ break
+ case '依附地表':
+ case '依附地表':
+ break
+ case '依附模型':
+ this.updateHeight()
+ break
+ }
+ }
+ }
+ }
+
+ get labelShow() {
+ return this.options.label.show
+ }
+ set labelShow(v) {
+ this.options.label.show = v
+ if (this.entity) {
+ if (this.mode == 1) {
+ this.entity.label.show = v
+ }
+ else {
+ this.entity.label.show = false
+ }
+ }
+
+ this._elms.labelShow &&
+ this._elms.labelShow.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get labelFontFamily() {
+ return this.options.label.fontFamily
+ }
+
+ set labelFontFamily(v) {
+ this.options.label.fontFamily = v || 0
+ this.renewPoint()
+
+ let name = getFontFamilyName(this.labelFontFamily) || ''
+ this._elms.labelFontFamily &&
+ this._elms.labelFontFamily.forEach(item => {
+ item.value = name
+ })
+ }
+
+ get labelFontSize() {
+ return this.options.label.fontSize
+ }
+ set labelFontSize(v) {
+ this.options.label.fontSize = v
+ this.renewPoint()
+ this._elms.labelFontSize &&
+ this._elms.labelFontSize.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get labelColor() {
+ return this.options.label.color
+ }
+ set labelColor(v) {
+ this.options.label.color = v || '#00ffff'
+ this.renewPoint()
+ if (this._elms.labelColor) {
+ this._elms.labelColor.forEach((item, i) => {
+ let colorPicker = new YJColorPicker({
+ el: item.el,
+ size: 'mini', //颜色box类型
+ alpha: true, //是否开启透明度
+ defaultColor: this.options.label.color,
+ disabled: false, //是否禁止打开颜色选择器
+ openPickerAni: 'opacity', //打开颜色选择器动画
+ sure: c => {
+ this.labelColor = c
+ }, //点击确认按钮事件回调
+ clear: () => {
+ this.labelColor = 'rgba(0,255,255,1)'
+ } //点击清空按钮事件回调
+ })
+ this._elms.labelColor[i] = colorPicker
+ })
+ }
+ }
+
async create() {
// let gap = Math.abs(Math.cos(Math.PI/180 * this.options.position.lat)) * (0.0001*this.options.scale)
// let fromDegreesArray = [
@@ -209,6 +744,15 @@ class GroundImage extends Base {
// this.options.position.lng + 0.05, this.options.position.lat + 0.05,
// this.options.position.lng - 0.05, this.options.position.lat + 0.05,
// ]
+ let _this = this
+ let heightMode
+ let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
+ switch (this.options.heightMode) {
+ case 2:
+ case '2':
+ heightMode = Cesium.HeightReference.CLAMP_TO_GROUND
+ break
+ }
let response = await fetch(this.replaceHost(this.options.url, this.options.host), {
method: 'get',
headers: {
@@ -225,6 +769,13 @@ class GroundImage extends Base {
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
+ const canvas2 = document.createElement('canvas');
+ const ctx2 = canvas2.getContext('2d');
+ let width = img.width
+ let height = img.height
+ canvas2.width = width
+ canvas2.height = height;
+ ctx2.drawImage(img, 0, 0, width, height)
// 设置画布大小
canvas.width = img.width * 2;
@@ -240,10 +791,65 @@ class GroundImage extends Base {
}
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+
+ let billboardH = height * (128 / width)
+
this.entity = this.sdk.viewer.entities.add({
id: this.options.id,
show: this.options.show,
+ position: new Cesium.CallbackProperty(() => {
+ return Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ this.options.position.alt || 0
+ )
+ }),
+ billboard: {
+ show: this.mode ? true : false,
+ image: canvas2,
+ scale: this.billboardScale,
+ disableDepthTestDistance: new Cesium.CallbackProperty(function () {
+ return getGroundCover() ? undefined : Number.POSITIVE_INFINITY
+ }, false),
+ heightReference: heightMode,
+ width: 128,
+ height: billboardH,
+ horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
+ verticalOrigin: Cesium.VerticalOrigin.TOP,
+ // pixelOffset: { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ pixelOffset: { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ },
+ label: {
+ show: this.mode ? _this.options.label.show : false,
+ text: _this.options.label.text,
+ disableDepthTestDistance: new Cesium.CallbackProperty(function () {
+ return getGroundCover() ? undefined : Number.POSITIVE_INFINITY
+ }, false),
+ heightReference: heightMode,
+ font: _this.options.label.fontSize + 'px ' + font,
+ fillColor: Cesium.Color.fromCssColorString(_this.options.label.color),
+ // verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
+ pixelOffset: new Cesium.CallbackProperty(function () {
+ if (_this.options.show) {
+ return new Cesium.Cartesian2(
+ 0,
+ -billboardH * _this.billboardScale -
+ _this.options.label.fontSize / 2 -
+ 5
+ )
+ } else {
+ return new Cesium.Cartesian2(
+ 0,
+ -_this.options.label.fontSize / 2 - 5
+ )
+ }
+ }, false),
+ outlineColor: Cesium.Color.BLACK,
+ outlineWidth: 1,
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE
+ },
rectangle: {
+ show: this.mode ? false : true,
coordinates: new Cesium.CallbackProperty(() => {
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.position.lat)) * (0.0001 * this.options.scale)
let offset = {
@@ -293,6 +899,8 @@ class GroundImage extends Base {
}, false)
},
})
+
+ this.renewPoint()
if (this.sdk.viewer._element.className === 'cesium-viewer 2d') {
this.entity.rectangle.height = 0
}
@@ -340,8 +948,8 @@ class GroundImage extends Base {
this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject.close()
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
- syncData(this.sdk, this.options.id)
- syncSplitData(this.sdk, this.options.id)
+ // syncData(this.sdk, this.options.id)
+ // syncSplitData(this.sdk, this.options.id)
},
resetCallBack: () => {
this.reset()
@@ -357,7 +965,7 @@ class GroundImage extends Base {
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
// show: true,
// });
-
+
if (anchorSetDialogObject && anchorSetDialogObject.close) {
anchorSetDialogObject.close()
}
@@ -513,6 +1121,440 @@ class GroundImage extends Base {
}
}
+ // let coordinateData = []
+ // this.epsg_map.forEach((value, key) => {
+ // coordinateData.push({
+ // name: `${value.name}(${value.epsg})`,
+ // value: key
+ // })
+ // })
+ // let coordinateDataLegpObject = legp(
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'coordinate-select-box'
+ // )[0],
+ // '.coordinate-select'
+ // )
+ // if (coordinateDataLegpObject) {
+ // coordinateDataLegpObject.legp_search(coordinateData)
+ // let coordinateDataLegpElm = this._DialogObject._element.content
+ // .getElementsByClassName('coordinate-select')[0]
+ // .getElementsByTagName('input')[0]
+ // if (!this.coordinate) {
+ // this.coordinate = coordinateData[0].value
+ // } else {
+ // this.coordinate = this.coordinate
+ // }
+ // coordinateDataLegpElm.value = this.coordinate
+ // for (let i = 0; i < coordinateData.length; i++) {
+ // if (coordinateData[i].value === coordinateData.value) {
+ // coordinateDataLegpObject.legp_searchActive(
+ // coordinateData[i].value
+ // )
+ // break
+ // }
+ // }
+ // coordinateDataLegpElm.addEventListener('input', () => {
+ // for (let i = 0; i < coordinateData.length; i++) {
+ // if (coordinateData[i].value === coordinateDataLegpElm.value) {
+ // this.coordinate = coordinateData[i].value
+ // break
+ // }
+ // }
+ // })
+ // }
+
+ let elms = contentElm.getElementsByClassName('row')
+ let elms2 = contentElm.getElementsByTagName('h4')
+ for (let i = 0; i < elms.length; i++) {
+ let mode = elms[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms[i].style.display = 'flex'
+ }
+ else {
+ elms[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms2.length; i++) {
+ let mode = elms2[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms2[i].style.display = 'block'
+ }
+ else {
+ elms2[i].style.display = 'none'
+ }
+ }
+ }
+
+ // let lng = contentElm.getElementsByClassName("lng")[0]
+ // let lat = contentElm.getElementsByClassName("lat")[0]
+ // let alt = contentElm.getElementsByClassName("alt")[0]
+ // lng.value = this.options.position.lng
+ // lat.value = this.options.position.lat
+ // alt.value = this.options.position.alt
+ // this._elms.lng = [lng]
+ // this._elms.lat = [lat]
+ // this._elms.alt = [alt]
+ // lng.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // 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)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: value,
+ // // lat: this.position.lat,
+ // // alt: this.position.alt
+ // // }
+ // this.options.position.lng = value
+ // this.coordinate = this.options.coordinate
+ // })
+ // lat.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // 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)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: this.position.lng,
+ // // lat: value,
+ // // alt: this.position.alt
+ // // }
+ // this.options.position.lat = value
+ // this.coordinate = this.options.coordinate
+ // })
+ // alt.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // 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)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: this.position.lng,
+ // // lat: this.position.lat,
+ // // alt: value
+ // // }
+ // this.options.position.alt = value
+ // this.coordinate = this.options.coordinate
+ // })
+
+ let colorPicker = new YJColorPicker({
+ el: contentElm.getElementsByClassName('labelColor')[0],
+ size: 'mini', //颜色box类型
+ alpha: true, //是否开启透明度
+ defaultColor: this.labelColor,
+ disabled: false, //是否禁止打开颜色选择器
+ openPickerAni: 'opacity', //打开颜色选择器动画
+ sure: color => {
+ this.labelColor = color
+ }, //点击确认按钮事件回调
+ clear: () => {
+ this.labelColor = 'rgba(255,255,255,1)'
+ } //点击清空按钮事件回调
+ })
+ this._elms.labelColor = [colorPicker]
+
+ setTimeout(async () => {
+ let flipeOverXBtn = this._DialogObject._element.foot.getElementsByClassName('flipe-over-x')[0]
+ let flipeOverYBtn = this._DialogObject._element.foot.getElementsByClassName('flipe-over-y')[0]
+ flipeOverXBtn.setAttribute('mode', 0)
+ flipeOverYBtn.setAttribute('mode', 0)
+ if (this.options.mode) {
+ flipeOverXBtn.style.display = 'none'
+ flipeOverYBtn.style.display = 'none'
+ }
+ else {
+ flipeOverXBtn.style.display = 'block'
+ flipeOverYBtn.style.display = 'block'
+ }
+ let modeData = [
+ {
+ name: '贴地',
+ value: '贴地',
+ key: 0
+ },
+ {
+ name: '立体',
+ value: '立体',
+ key: 1
+ }
+ ]
+ let modeDataLegpObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'mode-box'
+ )[0],
+ '.mode'
+ )
+ if (modeDataLegpObject) {
+ modeDataLegpObject.legp_search(modeData)
+ let modeDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('mode')[0]
+ .getElementsByTagName('input')[0]
+ modeDataLegpElm.value = this.mode
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].key === this.mode) {
+ modeDataLegpElm.value = modeData[i].value
+ modeDataLegpObject.legp_searchActive(modeData[i].value)
+ break
+ }
+ }
+ modeDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].value === modeDataLegpElm.value) {
+ this.mode = modeData[i].key
+ break
+ }
+ }
+ })
+ this._elms.mode = [modeDataLegpElm]
+ }
+
+
+ let heightBoxElm = this._DialogObject._element.content.getElementsByClassName('height-box')[0]
+ let heightElm = heightBoxElm.getElementsByClassName('height')[0]
+ let heightModeData = [
+ {
+ name: '海拔高度',
+ value: '海拔高度',
+ key: '0'
+ },
+ {
+ name: '相对地表',
+ value: '相对地表',
+ key: '1'
+ },
+ {
+ name: '依附地表',
+ value: '依附地表',
+ key: '2'
+ },
+ {
+ name: '依附模型',
+ value: '依附模型',
+ key: '3'
+ }
+ ]
+ let heightMode = this.heightMode
+
+ switch (heightMode) {
+ case 0:
+ case '0':
+ heightElm.value = this.options.position.alt
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - Number(position[0].height.toFixed(2))).toFixed(2)
+ )
+ })
+ } else {
+ heightElm.value = Number(this.options.position.alt.toFixed(2))
+ }
+ break
+ case 2:
+ case '2':
+ case 3:
+ case '3':
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ this.getClampToHeight(this.options.position, objectsToExclude).then(h => {
+ this.options.position.alt = Number(h.toFixed(2))
+ this.coordinate = this.options.coordinate
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ heightElm.value = this.options.position.alt
+ })
+ break
+ }
+ let heightModeObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'height-mode-box'
+ )[0],
+ '.height-mode'
+ )
+ if (heightModeObject) {
+ heightModeObject.legp_search(heightModeData)
+ let heightModeDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('height-mode')[0]
+ .getElementsByTagName('input')[0]
+ heightModeDataLegpElm.value = heightModeData[this.heightMode].value
+ for (let i = 0; i < heightModeData.length; i++) {
+ if (heightModeData[i].value == heightModeDataLegpElm.value) {
+ heightModeObject.legp_searchActive(heightModeData[i].value)
+ break
+ }
+ }
+ heightModeDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < heightModeData.length; i++) {
+ if (heightModeData[i].value === heightModeDataLegpElm.value) {
+ heightMode = heightModeData[i].key
+ switch (heightMode) {
+ case 0:
+ case '0':
+ this.options.position.alt = Number(heightElm.value)
+ this.heightMode = 0
+ // this.position = this.options.position
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ this.options.position.alt =
+ Number(heightElm.value) +
+ Number(position[0].height.toFixed(2))
+ // this.position = this.options.position
+ })
+ } else {
+ this.options.position.alt = Number(heightElm.value)
+ // this.position = this.options.position
+ }
+ this.heightMode = 1
+ break
+ case 2:
+ case '2':
+ this.heightMode = 2
+ break
+ case 3:
+ case '3':
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ this.getClampToHeight(this.options.position, objectsToExclude).then(h => {
+ this.options.position.alt = Number(h.toFixed(2))
+ // this.position = this.options.position
+ })
+ this.heightMode = 3
+ break
+ }
+ this.position = this.options.position
+ break
+ }
+ }
+ })
+
+ heightElm.addEventListener('blur', async () => {
+ switch (heightMode) {
+ case 0:
+ case '0':
+ this.options.position.alt = Number(
+ Number(heightElm.value).toFixed(2)
+ )
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ let position = await Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ )
+ this.options.position.alt =
+ Number(heightElm.value) +
+ Number(position[0].height.toFixed(2))
+ } else {
+ this.options.position.alt = Number(heightElm.value)
+
+ }
+ break
+ case 2:
+ case '2':
+ break
+ }
+ this.position = this.options.position
+ })
+ this._elms.height = heightBoxElm
+ this._elms.heightMode = heightModeDataLegpElm
+
+ this.heightMode = this.heightMode
+ }
+
+ let fontData = getFontList()
+ let fontObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'font-select-box'
+ )[0],
+ '.font-select'
+ )
+ if (fontObject) {
+ fontObject.legp_search(fontData)
+ let fontDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('font-select')[0]
+ .getElementsByTagName('input')[0]
+ fontDataLegpElm.value = fontData[this.labelFontFamily].value
+ for (let i = 0; i < fontData.length; i++) {
+ if (fontData[i].value == fontDataLegpElm.value) {
+ fontObject.legp_searchActive(fontData[i].value)
+ break
+ }
+ }
+ fontDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < fontData.length; i++) {
+ if (fontData[i].value === fontDataLegpElm.value) {
+ this.labelFontFamily = fontData[i].key
+ break
+ }
+ }
+ })
+ this._elms.labelFontFamily = [fontDataLegpElm]
+ }
+ }, 0);
} else {
if (this._DialogObject && this._DialogObject.remove) {
@@ -610,12 +1652,7 @@ class GroundImage extends Base {
position: { ...this.options.position }
}
}
- else {
- this.options.position.lng = this.previous.position.lng
- this.options.position.lat = this.previous.position.lat
- this.options.position.alt = this.previous.position.alt
- }
-
+ this.position = { ...this.previous.position }
}
}
@@ -727,6 +1764,167 @@ class GroundImage extends Base {
}
}
+ async updateHeight() {
+ let height
+ let height2
+ let point1 = new Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ 0
+ )
+ let point2 = new Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ 10000000000000
+ )
+
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ let updatedCartesians = await this.sdk.viewer.scene.clampToHeightMostDetailed([point1], objectsToExclude)
+ if (updatedCartesians && updatedCartesians[0]) {
+ height = this.cartesian3Towgs84(updatedCartesians[0], this.sdk.viewer).alt
+ }
+
+ let direction = Cesium.Cartesian3.subtract(
+ point1,
+ point2,
+ new Cesium.Cartesian3()
+ )
+ let c = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3())
+ let ray = new Cesium.Ray(point2, c)
+ let r = {}
+ let pickedObjects = this.sdk.viewer.scene.drillPickFromRay(ray)
+ for (let i = pickedObjects.length - 1; i >= 0; i--) {
+ if (pickedObjects[i].position) {
+ r = pickedObjects[i]
+ break
+ }
+ }
+ if (r && r.position) {
+ height2 = this.cartesian3Towgs84(r.position, this.sdk.viewer).alt
+ }
+ let promise
+ try {
+ promise = await Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ )
+ } catch (error) { }
+
+ if ((height2 === void 0 || height2 < promise[0].height) && promise) {
+ height2 = promise[0].height
+ }
+ if (height === void 0 || height < height2) {
+ height = height2
+ }
+ if (height !== undefined) {
+ this.options.position.alt = Number(Number(height).toFixed(2))
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ this.coordinate = this.options.coordinate
+
+ if (this._elms.height) {
+ let heightElm = this._elms.height.getElementsByClassName('height')[0]
+ if (heightElm) {
+ switch (this._elms.heightMode.value) {
+ case '海拔高度':
+ heightElm.value = this.options.position.alt
+ break
+ case '相对地表':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - position[0].height).toFixed(2)
+ )
+ })
+ } else {
+ heightElm.value = this.options.position.alt
+ }
+ break
+ case '依附地表':
+ break
+ case '依附模型':
+ heightElm.value = this.options.position.alt
+ break
+ }
+ }
+ }
+ }
+
+ // if (!this.entity.values) {
+ // this.entity.position = Cesium.Cartesian3.fromDegrees(
+ // this.options.position.lng,
+ // this.options.position.lat,
+ // this.options.position.alt
+ // )
+ // }
+ }
+
+ renewPoint() {
+ if (!this.entity.values && this.entity.billboard) {
+ let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
+ this.entity.billboard.scale = this.billboardScale
+ if (this.billboardScaleByDistance) {
+ this.entity.billboard.scaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.billboard.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.label.scaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.label.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ } else {
+ this.entity.billboard.scaleByDistance = undefined
+ this.entity.billboard.pixelOffsetScaleByDistance = undefined
+ this.entity.label.scaleByDistance = undefined
+ this.entity.label.pixelOffsetScaleByDistance = undefined
+ }
+ this.entity.label.font = this.options.label.fontSize + 'px ' + font
+ this.entity.label.fillColor = Cesium.Color.fromCssColorString(
+ this.options.label.color
+ )
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ // this.entity.billboard.pixelOffset = { x: -width * this.billboardScale * (this.flipeY ? (1 - this.options.offset.x) : this.options.offset.x), y: -height * this.billboardScale * (this.flipeX ? (1 - this.options.offset.y) : this.options.offset.y) }
+ }
+ }
+
reset() {
if (!this.entity) {
return