二三维增加单独展示在二维或者三维的功能,贴地图片增加设置锚点功能

This commit is contained in:
zh
2025-08-09 18:20:02 +08:00
parent 656a21a6dd
commit e38dd4d029
17 changed files with 510 additions and 120 deletions

View File

@ -1,5 +1,5 @@
class BaseDialog {
constructor(container, options = {}) {
constructor(container, options = {}, only = true) {
this.container = container
this.options = { ...options }
this.options.ismove = true
@ -9,10 +9,13 @@ class BaseDialog {
this.closeCallBack = options.closeCallBack
this._element = {}
this._element_style = undefined
this.only = only
}
async init() {
this.closeAll()
if (this.only) {
this.closeAll()
}
DialogAll.push(this)
this.isDestroy = false
// body

View File

@ -94,6 +94,10 @@ function off(sdk) {
activeViewer = null
syncObject = {}
}
sdk.entityMap.forEach((item, key) => {
item.showView = undefined
})
}
async function syncData2(sdk, id, entityId) {
@ -119,7 +123,11 @@ async function syncData2(sdk, id, entityId) {
options.heightMode = 0
options.height = 0
}
if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) {
if(that.showView==3) {
options.show=false
}
let newObject = await new that.constructor(sdk2D, options)
newObject.onClick = that.onClick
newObject.onRightClick = that.onRightClick

View File

@ -433,11 +433,11 @@ class BillboardObject extends Base {
value: '链接',
key: 'link'
},
{
name: 'IP摄像头',
value: 'IP摄像头',
key: 'camera'
},
// {
// name: 'IP摄像头',
// value: 'IP摄像头',
// key: 'camera'
// },
// {
// name: 'ISC摄像头',
// value: 'ISC摄像头',
@ -448,16 +448,16 @@ class BillboardObject extends Base {
// value: '传感器',
// key: 'sensor'
// },
{
name: '全景图',
value: '全景图',
key: 'vr'
},
{
name: '物资',
value: '物资',
key: 'goods'
}
// {
// name: '全景图',
// value: '全景图',
// key: 'vr'
// },
// {
// name: '物资',
// value: '物资',
// key: 'goods'
// }
]
}
@ -465,14 +465,24 @@ class BillboardObject extends Base {
return this.options.show
}
set show(v) {
this.options.show = v
this.originalOptions.show = v
this.entity && (this.entity.show = v)
if(!this.isShowView) {
this.options.show = v
this.originalOptions.show = v
}
if(!this.showView || this.showView == 3) {
this.entity && (this.entity.show = this.options.show)
}
else {
this.entity && (this.entity.show = false)
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
this._DialogObject.showBtn.checked = this.options.show
}
this.isShowView = false
// if (v) {
// if (this.diffuseShow) {
// this.diffuseShow = true

View File

@ -223,16 +223,30 @@ class CircleDiffuse extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (!this.showView || this.showView == 3) {
this.entity.show = this.options.show
if (this.options.label.show) {
this.label.show = this.options.show
}
}
else {
this.entity.show = false
if (this.options.label.show) {
this.label.show = false
}
}
this.isShowView = false
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label.show) {
this.label.show = v
}
} else {
console.error("参数必须为boolean")
}
@ -429,7 +443,7 @@ class CircleDiffuse extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3)) {
this.label.show = v
}
else {

View File

@ -333,7 +333,7 @@ class CircleObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3)) {
this.label.show = v
}
else {

View File

@ -8,6 +8,7 @@ function html() {
<input class="input" maxlength="40" type="text" @model="name">
</div>
<div class="col">
<button class="anchor btn" @click="setAnchorPoint">调整锚点</button>
</div>
</div>
</div>
@ -27,9 +28,9 @@ function html() {
<div class="row">
<div class="col">
<span class="label">调整大小</span>
<input type="range" max="99999" min="0" step="0.1" @model="scale">
<input type="range" max="40000" min="0" step="0.1" @model="scale">
<div class="input-number input-number-unit-1" style="width: 100px;flex: 0 0 100px;margin-left: 10px;">
<input class="input" type="number" title="" min="0" max="99999" step="0.1" @model="scale">
<input class="input" type="number" title="" min="0" max="40000" step="0.1" @model="scale">
<span class="arrow"></span>
</div>
</div>

View File

@ -7,7 +7,7 @@ import MouseEvent from '../../../Event/index'
import { syncData } from '../../../Global/MultiViewportMode'
import MouseTip from '../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
class GroundImage extends Base {
/**
@ -36,6 +36,7 @@ class GroundImage extends Base {
this.options.angle = options.angle || 0
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
this.options.positions = options.positions
this.options.offset = { x: 0.5, y: 0.5 }
this.options.flipe = options.flipe || {}
this.options.flipe.x = this.options.flipe.x || false
@ -56,6 +57,13 @@ class GroundImage extends Base {
this.create()
}
get offset() {
return this.options.offset
}
set offset(v) {
this.options.offset = v
}
get angle() {
return this.options.angle
}
@ -87,8 +95,9 @@ class GroundImage extends Base {
if (!this.entity) {
return
}
const img = new Image();
img.src = this.options.url;
img.src = this.replaceHost(this.options.url, this.options.host);
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
@ -111,6 +120,10 @@ class GroundImage extends Base {
image: canvas,
transparent: true
}))
// this.offset = {
// x: Math.abs(this.offset.x - 1),
// y: this.offset.y,
// }
}
} else {
console.error("参数必须为boolean")
@ -125,8 +138,9 @@ class GroundImage extends Base {
if (!this.entity) {
return
}
const img = new Image();
img.src = this.options.url;
img.src = this.replaceHost(this.options.url, this.options.host);
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
@ -149,6 +163,10 @@ class GroundImage extends Base {
image: canvas,
transparent: true
})
// this.offset = {
// x: this.offset.x,
// y: Math.abs(this.offset.y - 1),
// }
}
} else {
console.error("参数必须为boolean")
@ -163,7 +181,7 @@ class GroundImage extends Base {
// this.options.positions.lng + 0.05, this.options.positions.lat + 0.05,
// this.options.positions.lng - 0.05, this.options.positions.lat + 0.05,
// ]
let response = await fetch(this.options.url, {
let response = await fetch(this.replaceHost(this.options.url, this.options.host), {
method: 'get',
headers: {
'Content-Type': 'application/json',
@ -174,7 +192,7 @@ class GroundImage extends Base {
// let arrayBuffer = await data.arrayBuffer()
// const str = String.fromCharCode(...new Uint8Array(arrayBuffer));
const img = new Image();
img.src = this.options.url;
img.src = this.replaceHost(this.options.url, this.options.host);
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
@ -199,11 +217,27 @@ class GroundImage extends Base {
rectangle: {
coordinates: new Cesium.CallbackProperty(() => {
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.positions.lat)) * (0.0001 * this.options.scale)
let offset = {
x: this.flipeY ? Math.abs(this.options.offset.x - 1) : this.options.offset.x,
y: this.flipeX ? Math.abs(this.options.offset.y - 1) : this.options.offset.y,
}
offset = {
lng: offset.x * ((0.0001 * this.options.scale) * 2),
lat: Math.abs(offset.y-1) * (gap * 2)
}
let fromDegreesArray = [
this.options.positions.lng - (0.0001 * this.options.scale), this.options.positions.lat - gap,
// this.options.positions.lng + 0.05, this.options.positions.lat - 0.05,
this.options.positions.lng + (0.0001 * this.options.scale), this.options.positions.lat + gap,
// this.options.positions.lng - 0.05, this.options.positions.lat + 0.05,
this.options.positions.lng - offset.lng, this.options.positions.lat - offset.lat,
(this.options.positions.lng - offset.lng) + ((0.0001 * this.options.scale) * 2), (this.options.positions.lat - offset.lat) + (gap * 2),
// this.options.positions.lng - (0.0001 * this.options.scale), this.options.positions.lat - gap,
// // this.options.positions.lng + 0.05, this.options.positions.lat - 0.05,
// this.options.positions.lng + (0.0001 * this.options.scale), this.options.positions.lat + gap,
// // this.options.positions.lng - 0.05, this.options.positions.lat + 0.05,
]
return Cesium.Rectangle.fromDegrees(...fromDegreesArray)
@ -224,8 +258,8 @@ class GroundImage extends Base {
this.entity.rectangle.height = 0
}
syncData(this.sdk, this.options.id)
if(this.options.show) {
if (this.options.show) {
setSplitDirection(0, this.options.id)
}
}
@ -253,6 +287,10 @@ class GroundImage extends Base {
this._DialogObject = null
}
if (state) {
let anchorSetDialogObject
let canvas
let point
let billboardAnchorPosition
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
title: '军标属性', left: '180px', top: '100px',
confirmCallBack: (options) => {
@ -280,6 +318,9 @@ class GroundImage extends Base {
// show: true,
// });
this.positionEditing = false
if (anchorSetDialogObject && anchorSetDialogObject.close) {
anchorSetDialogObject.close()
}
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
},
showCallBack: (show) => {
@ -315,6 +356,7 @@ class GroundImage extends Base {
]
}, true)
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' ground-image'
let contentElm = document.createElement('div');
contentElm.innerHTML = html()
this._DialogObject.contentAppChild(contentElm)
@ -322,6 +364,114 @@ class GroundImage extends Base {
this._EventBinding.on(this, all_elm)
this._elms = this._EventBinding.element
let anchorBtn = contentElm.getElementsByClassName('anchor')[0]
anchorBtn.addEventListener('click', async () => {
if (anchorSetDialogObject && anchorSetDialogObject.close) {
anchorSetDialogObject.close()
}
document.body.addEventListener('mouseup', mouseupEvent)
let DialogClientRect = _this._DialogObject._element.body.getBoundingClientRect()
let _DialogObject = await new Dialog(this.sdk, this.originalOptions, {
title: '锚点设置', left: (DialogClientRect.left + 80) + 'px', top: (DialogClientRect.top + 200) + 'px',
confirmCallBack: (options) => {
_this.offset = { x: billboardAnchorPosition.x, y: billboardAnchorPosition.y }
_DialogObject.close()
},
closeCallBack: () => {
document.body.removeEventListener('mouseup', mouseupEvent)
},
}, false)
anchorSetDialogObject = _DialogObject
_DialogObject._element.body.className = _DialogObject._element.body.className + ' anchor-point'
let contentElm = document.createElement('div');
let image = new Image()
image.src = this.replaceHost(this.options.url, this.options.host)
image.onload = function () {
let ratio = image.width / image.height
canvas = document.createElement('canvas')
let width = 150
let height = 150 / ratio
const ctx = canvas.getContext('2d', { willReadFrequently: true })
canvas.width = width
canvas.height = height;
canvas.style.display = 'block';
ctx.drawImage(image, 0, 0, width, height)
contentElm.appendChild(canvas)
_DialogObject.contentAppChild(contentElm)
point = document.createElement('span')
point.className = 'point'
contentElm.appendChild(point)
billboardAnchorPosition = { x: _this.offset.x, y: _this.offset.y }
point.style.top = `calc(${Number(billboardAnchorPosition.y) * 100}% - 6px)`
point.style.left = `calc(${Number(billboardAnchorPosition.x) * 100}% - 6px)`
canvas.addEventListener('click', (e) => {
let x = e.offsetX
let y = e.offsetY
let anchor = { x: Number((x / canvas.width).toFixed(2)), y: Number((y / canvas.height).toFixed(2)) }
if (anchor.x < 0) {
anchor.x = 0
}
if (anchor.x > 1) {
anchor.x = 1
}
if (anchor.y < 0) {
anchor.y = 0
}
if (anchor.y > 1) {
anchor.y = 1
}
billboardAnchorPosition = { x: anchor.x, y: anchor.y }
point.style.top = `calc(${billboardAnchorPosition.y * 100}% - 5px)`
point.style.left = `calc(${billboardAnchorPosition.x * 100}% - 5px)`
})
point.addEventListener('mousedown', (e) => {
_DialogObject._element.body.addEventListener('mousemove', mousemoveEvent)
})
}
})
function mousemoveEvent(e) {
getDialogBodyElm(e.target)
function getDialogBodyElm(elm) {
if (!elm) {
return
}
else if (elm === anchorSetDialogObject._element.body) {
let x = e.x - elm.getBoundingClientRect().left
let y = e.y - elm.getBoundingClientRect().top
let anchor = { x: Number(((x - 42) / canvas.width).toFixed(2)), y: Number(((y - 71) / canvas.height).toFixed(2)) }
if (anchor.x < 0) {
anchor.x = 0
}
if (anchor.x > 1) {
anchor.x = 1
}
if (anchor.y < 0) {
anchor.y = 0
}
if (anchor.y > 1) {
anchor.y = 1
}
billboardAnchorPosition = { x: anchor.x, y: anchor.y }
point.style.top = `calc(${billboardAnchorPosition.y * 100}% - 5px)`
point.style.left = `calc(${billboardAnchorPosition.x * 100}% - 5px)`
}
else {
getDialogBodyElm(elm.offsetParent)
}
}
}
function mouseupEvent() {
if (anchorSetDialogObject) {
anchorSetDialogObject._element.body.removeEventListener('mousemove', mousemoveEvent)
}
}
} else {
if (this._DialogObject && this._DialogObject.remove) {
this._DialogObject.remove()
@ -428,7 +578,7 @@ class GroundImage extends Base {
async flyTo(options = {}) {
setActiveViewer(0)
closeRotateAround(this.sdk)
closeViewFollow(this.sdk)
closeViewFollow(this.sdk)
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
let orientation = {

View File

@ -159,10 +159,18 @@ class GroundSvg extends Base {
set show(v) {
if (typeof v === "boolean") {
super.show = v
if (this.options.text && this.options.text.show && this.text) {
this.text.show = v
if (this.options.text && this.options.text.show) {
if(this.text) {
if((!this.showView || this.showView == 3)) {
this.text.show = v
}
else {
this.text.show = false
}
}
}
super.show = v
} else {
console.error("参数必须为boolean")
}
@ -308,7 +316,12 @@ class GroundSvg extends Base {
set textShow(v) {
this.options.text.show = v
if (this.show) {
this.text && (this.text.show = v)
if((!this.showView || this.showView == 3)) {
this.text && (this.text.show = v)
}
else {
this.text && (this.text.show = false)
}
if (this.options.text.position) {
setTimeout(() => {
if (this.options.text.position.alt) {

View File

@ -82,18 +82,33 @@ class Flame extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (!this.showView || this.showView == 3) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -83,18 +83,31 @@ class Fountain extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (!this.showView || this.showView == 3) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -81,18 +81,31 @@ class Smoke extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (!this.showView || this.showView == 3) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -84,18 +84,31 @@ class Spout extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (this._DialogObject && this._DialogObject.showBtn) {
if (!this.showView || this.showView == 3) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -246,16 +246,28 @@ class RadarScan extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
this.entity.show = v
if (!this.isShowView) {
this.options.show = v
}
if (!this.showView || this.showView == 3) {
this.entity.show = this.options.show
if (this.options.label.show && this.label) {
this.label.show = this.options.show
}
}
else {
this.entity.show = false
if (this.options.label.show && this.label) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label.show && this.label) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}
@ -449,7 +461,7 @@ class RadarScan extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3)) {
this.label.show = v
}
else {

View File

@ -144,37 +144,54 @@ class TrajectoryMotion extends Base {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
if (!this.isShowView) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
}
}
if (v) {
if (this.options.show) {
if (this.firstPersonView) {
this.model.show = false
}
else {
this.model.show = this.modelShow
this.model.show = (!this.showView || this.showView == 3) ? this.modelShow : false
}
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
}) : new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff00'),
dashLength: 20,
})
if ((!this.showView || this.showView == 3)) {
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
}) : new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff00'),
dashLength: 20,
})
}
else {
this.line.polyline.material = new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff00'),
dashLength: 20,
})
}
for (let i = 0; i < this.keyPoints.length; i++) {
this.keyPoints[i].show = this.keyPointShow
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? this.keyPointShow : false
}
if (this.realTimeRoute) {
this.realTimeLine && (this.realTimeLine.show = true)
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3) ? true : false)
}
this.label && (this.label.show = this.options.label.show)
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
}
else {
this.model.show = v
this.model.show = (!this.showView || this.showView == 3) ? this.options.show : false
let show = this.options.show
if ((!this.showView || this.showView == 3)) {
show = this.options.show
}
else {
show = false
}
this.realTimeLine && (this.realTimeLine.show = false)
this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({
this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
}) : new Cesium.PolylineDashMaterialProperty({
@ -182,7 +199,7 @@ class TrajectoryMotion extends Base {
dashLength: 20,
})
for (let i = 0; i < this.keyPoints.length; i++) {
this.keyPoints[i].show = v
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false
}
this.label && (this.label.show = false)
this.viewFollow = false
@ -193,6 +210,7 @@ class TrajectoryMotion extends Base {
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}
@ -656,8 +674,15 @@ class TrajectoryMotion extends Base {
}
set modelShow(v) {
this.options.model.show = v
let show = v
if (this.show && (!this.showView || this.showView == 3)) {
show = v
}
else {
show = false
}
if (this.model && this.show) {
this.model.show = v
this.model.show = show
}
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
item.checked = v
@ -723,8 +748,15 @@ class TrajectoryMotion extends Base {
this.realTimeRoute = false
}
this.options.line.show = v
let show = v
if ((!this.showView || this.showView == 3)) {
show = v
}
else {
show = false
}
if (this.line && this.show) {
this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({
this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20, //短划线长度
}) : new Cesium.PolylineDashMaterialProperty({
@ -994,7 +1026,14 @@ class TrajectoryMotion extends Base {
else {
CameraController(this.sdk, true)
if (this.model && this.modelShow && this.show) {
this.model.show = true
let show = true
if (this.show && (!this.showView || this.showView == 3)) {
show = true
}
else {
show = false
}
this.model.show = show
}
if (this._DialogObject && this._DialogObject._element.content) {
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
@ -1116,8 +1155,15 @@ class TrajectoryMotion extends Base {
}
set labelShow(v) {
this.options.label.show = v
let show = v
if (this.show && (!this.showView || this.showView == 3)) {
show = v
}
else {
show = false
}
if (this.show) {
this.label && (this.label.show = v)
this.label && (this.label.show = show)
if (this.options.label.position) {
setTimeout(() => {
if (this.options.label.position.alt) {
@ -1888,10 +1934,10 @@ class TrajectoryMotion extends Base {
this.tip && this.tip.destroy()
this.tip = null
this.ControllerObject.destroy()
if(this.firstPersonView !== this.originalOptions.firstPersonView) {
if (this.firstPersonView !== this.originalOptions.firstPersonView) {
this.firstPersonView = this.originalOptions.firstPersonView;
}
if(this.firstPersonView && this.modelShow) {
if (this.firstPersonView && this.modelShow) {
this.model && (this.model.show = false)
}
},
@ -2164,10 +2210,10 @@ class TrajectoryMotion extends Base {
this.modelAnimate = this.originalOptions.model.animate;
this.delay = this.originalOptions.delay;
(this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground);
if(this.firstPersonView !== this.originalOptions.firstPersonView) {
if (this.firstPersonView !== this.originalOptions.firstPersonView) {
this.firstPersonView = this.originalOptions.firstPersonView;
}
if(this.firstPersonView && this.modelShow) {
if (this.firstPersonView && this.modelShow) {
this.model && (this.model.show = false)
}
this.labelShow = this.originalOptions.label.show
@ -2229,7 +2275,6 @@ class TrajectoryMotion extends Base {
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '结束调整'
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn is-active'
}
console.log(this._DialogObject._element.content, this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0])
this.state = false
this.editObj = new EditGltf(this.sdk, this.model)
this.editObj.editRtation()

View File

@ -10,10 +10,12 @@ import { getHost, getToken } from "../../on";
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
import { syncData } from '../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
class Base extends Tools {
#_showView
#_isShowView
constructor(sdk, options = {}) {
super(sdk, options);
if (!sdk || !sdk.viewer) {
@ -55,6 +57,50 @@ class Base extends Tools {
// setSplitDirection(this._splitDirection, this.options.id)
// }
get showView() {
return this.#_showView
}
set showView(v) {
let sdk2D = get2DSdk().sdkD
if(!sdk2D) {
v=0
}
if (!this.#_showView && !this.show) {
return
}
if (this.sdk === sdk2D) {
this.#_showView = 0
return
}
if (v != 2 && v != 3) {
this.#_showView = 0
}
else {
this.#_showView = v
}
this.isShowView = true
// if(!this.show) {
// return
// }
if (!this.#_showView) {
this.show = true
}
else {
if (v == 2) {
this.show = false
}
else {
this.show = true
}
}
}
get name() {
return this.options.name
}
@ -72,19 +118,32 @@ class Base extends Tools {
set show(v) {
if (typeof v === "boolean") {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
if (!this.isShowView) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
}
}
this.entity && (this.entity.show = v)
if (!this.showView || this.showView == 3) {
this.entity && (this.entity.show = this.options.show)
if (this.options.label && this.options.label.show && this.label) {
this.label.show = this.options.show
}
}
else {
this.entity && (this.entity.show = false)
if (this.options.label && this.options.label.show && this.label) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show && this.label) {
this.label.show = v
this._DialogObject.showBtn.checked = this.options.show
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}
@ -263,7 +322,7 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
if(sdkD && this.sdk === sdkD) {
if (sdkD && this.sdk === sdkD) {
if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
}
@ -286,7 +345,7 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
if(sdkD && this.sdk === sdkD) {
if (sdkD && this.sdk === sdkD) {
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
}
@ -309,7 +368,7 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
if(sdkD && this.sdk === sdkD) {
if (sdkD && this.sdk === sdkD) {
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
}

View File

@ -2,13 +2,10 @@ import BaseDialog from '../../../BaseDialog';
class Dialog extends BaseDialog {
constructor(sdk, info, options, only) {
super(sdk.viewer._container, options);
super(sdk.viewer._container, options, only);
this.sdk = sdk
this.viewer = sdk.viewer
this.info = info
if (only) {
this.closeAll()
}
this._init()
}