二三维增加单独展示在二维或者三维的功能,贴地图片增加设置锚点功能
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
class BaseDialog {
|
class BaseDialog {
|
||||||
constructor(container, options = {}) {
|
constructor(container, options = {}, only = true) {
|
||||||
this.container = container
|
this.container = container
|
||||||
this.options = { ...options }
|
this.options = { ...options }
|
||||||
this.options.ismove = true
|
this.options.ismove = true
|
||||||
@ -9,10 +9,13 @@ class BaseDialog {
|
|||||||
this.closeCallBack = options.closeCallBack
|
this.closeCallBack = options.closeCallBack
|
||||||
this._element = {}
|
this._element = {}
|
||||||
this._element_style = undefined
|
this._element_style = undefined
|
||||||
|
this.only = only
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
this.closeAll()
|
if (this.only) {
|
||||||
|
this.closeAll()
|
||||||
|
}
|
||||||
DialogAll.push(this)
|
DialogAll.push(this)
|
||||||
this.isDestroy = false
|
this.isDestroy = false
|
||||||
// body
|
// body
|
||||||
|
@ -94,6 +94,10 @@ function off(sdk) {
|
|||||||
activeViewer = null
|
activeViewer = null
|
||||||
syncObject = {}
|
syncObject = {}
|
||||||
}
|
}
|
||||||
|
sdk.entityMap.forEach((item, key) => {
|
||||||
|
item.showView = undefined
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function syncData2(sdk, id, entityId) {
|
async function syncData2(sdk, id, entityId) {
|
||||||
@ -119,7 +123,11 @@ async function syncData2(sdk, id, entityId) {
|
|||||||
options.heightMode = 0
|
options.heightMode = 0
|
||||||
options.height = 0
|
options.height = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) {
|
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)
|
let newObject = await new that.constructor(sdk2D, options)
|
||||||
newObject.onClick = that.onClick
|
newObject.onClick = that.onClick
|
||||||
newObject.onRightClick = that.onRightClick
|
newObject.onRightClick = that.onRightClick
|
||||||
|
@ -433,11 +433,11 @@ class BillboardObject extends Base {
|
|||||||
value: '链接',
|
value: '链接',
|
||||||
key: 'link'
|
key: 'link'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: 'IP摄像头',
|
// name: 'IP摄像头',
|
||||||
value: 'IP摄像头',
|
// value: 'IP摄像头',
|
||||||
key: 'camera'
|
// key: 'camera'
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// name: 'ISC摄像头',
|
// name: 'ISC摄像头',
|
||||||
// value: 'ISC摄像头',
|
// value: 'ISC摄像头',
|
||||||
@ -448,16 +448,16 @@ class BillboardObject extends Base {
|
|||||||
// value: '传感器',
|
// value: '传感器',
|
||||||
// key: 'sensor'
|
// key: 'sensor'
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
name: '全景图',
|
// name: '全景图',
|
||||||
value: '全景图',
|
// value: '全景图',
|
||||||
key: 'vr'
|
// key: 'vr'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '物资',
|
// name: '物资',
|
||||||
value: '物资',
|
// value: '物资',
|
||||||
key: 'goods'
|
// key: 'goods'
|
||||||
}
|
// }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,14 +465,24 @@ class BillboardObject extends Base {
|
|||||||
return this.options.show
|
return this.options.show
|
||||||
}
|
}
|
||||||
set show(v) {
|
set show(v) {
|
||||||
this.options.show = v
|
if(!this.isShowView) {
|
||||||
this.originalOptions.show = v
|
this.options.show = v
|
||||||
this.entity && (this.entity.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)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
|
||||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = this.options.show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isShowView = false
|
||||||
// if (v) {
|
// if (v) {
|
||||||
// if (this.diffuseShow) {
|
// if (this.diffuseShow) {
|
||||||
// this.diffuseShow = true
|
// this.diffuseShow = true
|
||||||
|
@ -223,16 +223,30 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
this.entity.show = v
|
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)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -429,7 +443,7 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -333,7 +333,7 @@ class CircleObject extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -8,6 +8,7 @@ function html() {
|
|||||||
<input class="input" maxlength="40" type="text" @model="name">
|
<input class="input" maxlength="40" type="text" @model="name">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<button class="anchor btn" @click="setAnchorPoint">调整锚点</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -27,9 +28,9 @@ function html() {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<span class="label">调整大小</span>
|
<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;">
|
<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>
|
<span class="arrow"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@ import MouseEvent from '../../../Event/index'
|
|||||||
import { syncData } from '../../../Global/MultiViewportMode'
|
import { syncData } from '../../../Global/MultiViewportMode'
|
||||||
import MouseTip from '../../../MouseTip'
|
import MouseTip from '../../../MouseTip'
|
||||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
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 {
|
class GroundImage extends Base {
|
||||||
/**
|
/**
|
||||||
@ -36,6 +36,7 @@ class GroundImage extends Base {
|
|||||||
this.options.angle = options.angle || 0
|
this.options.angle = options.angle || 0
|
||||||
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
|
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
|
||||||
this.options.positions = options.positions
|
this.options.positions = options.positions
|
||||||
|
this.options.offset = { x: 0.5, y: 0.5 }
|
||||||
|
|
||||||
this.options.flipe = options.flipe || {}
|
this.options.flipe = options.flipe || {}
|
||||||
this.options.flipe.x = this.options.flipe.x || false
|
this.options.flipe.x = this.options.flipe.x || false
|
||||||
@ -56,6 +57,13 @@ class GroundImage extends Base {
|
|||||||
this.create()
|
this.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get offset() {
|
||||||
|
return this.options.offset
|
||||||
|
}
|
||||||
|
set offset(v) {
|
||||||
|
this.options.offset = v
|
||||||
|
}
|
||||||
|
|
||||||
get angle() {
|
get angle() {
|
||||||
return this.options.angle
|
return this.options.angle
|
||||||
}
|
}
|
||||||
@ -87,8 +95,9 @@ class GroundImage extends Base {
|
|||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
@ -111,6 +120,10 @@ class GroundImage extends Base {
|
|||||||
image: canvas,
|
image: canvas,
|
||||||
transparent: true
|
transparent: true
|
||||||
}))
|
}))
|
||||||
|
// this.offset = {
|
||||||
|
// x: Math.abs(this.offset.x - 1),
|
||||||
|
// y: this.offset.y,
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
@ -125,8 +138,9 @@ class GroundImage extends Base {
|
|||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
@ -149,6 +163,10 @@ class GroundImage extends Base {
|
|||||||
image: canvas,
|
image: canvas,
|
||||||
transparent: true
|
transparent: true
|
||||||
})
|
})
|
||||||
|
// this.offset = {
|
||||||
|
// x: this.offset.x,
|
||||||
|
// y: Math.abs(this.offset.y - 1),
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
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,
|
||||||
// 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',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -174,7 +192,7 @@ class GroundImage extends Base {
|
|||||||
// let arrayBuffer = await data.arrayBuffer()
|
// let arrayBuffer = await data.arrayBuffer()
|
||||||
// const str = String.fromCharCode(...new Uint8Array(arrayBuffer));
|
// const str = String.fromCharCode(...new Uint8Array(arrayBuffer));
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
@ -199,11 +217,27 @@ class GroundImage extends Base {
|
|||||||
rectangle: {
|
rectangle: {
|
||||||
coordinates: new Cesium.CallbackProperty(() => {
|
coordinates: new Cesium.CallbackProperty(() => {
|
||||||
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.positions.lat)) * (0.0001 * this.options.scale)
|
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 = [
|
let fromDegreesArray = [
|
||||||
this.options.positions.lng - (0.0001 * this.options.scale), this.options.positions.lat - gap,
|
this.options.positions.lng - offset.lng, this.options.positions.lat - offset.lat,
|
||||||
// this.options.positions.lng + 0.05, this.options.positions.lat - 0.05,
|
(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,
|
||||||
|
// 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)
|
return Cesium.Rectangle.fromDegrees(...fromDegreesArray)
|
||||||
@ -224,8 +258,8 @@ class GroundImage extends Base {
|
|||||||
this.entity.rectangle.height = 0
|
this.entity.rectangle.height = 0
|
||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
if(this.options.show) {
|
if (this.options.show) {
|
||||||
|
|
||||||
setSplitDirection(0, this.options.id)
|
setSplitDirection(0, this.options.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,6 +287,10 @@ class GroundImage extends Base {
|
|||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
}
|
}
|
||||||
if (state) {
|
if (state) {
|
||||||
|
let anchorSetDialogObject
|
||||||
|
let canvas
|
||||||
|
let point
|
||||||
|
let billboardAnchorPosition
|
||||||
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||||
title: '军标属性', left: '180px', top: '100px',
|
title: '军标属性', left: '180px', top: '100px',
|
||||||
confirmCallBack: (options) => {
|
confirmCallBack: (options) => {
|
||||||
@ -280,6 +318,9 @@ class GroundImage extends Base {
|
|||||||
// show: true,
|
// show: true,
|
||||||
// });
|
// });
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
|
if (anchorSetDialogObject && anchorSetDialogObject.close) {
|
||||||
|
anchorSetDialogObject.close()
|
||||||
|
}
|
||||||
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||||
},
|
},
|
||||||
showCallBack: (show) => {
|
showCallBack: (show) => {
|
||||||
@ -315,6 +356,7 @@ class GroundImage extends Base {
|
|||||||
]
|
]
|
||||||
}, true)
|
}, true)
|
||||||
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' ground-image'
|
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' ground-image'
|
||||||
|
|
||||||
let contentElm = document.createElement('div');
|
let contentElm = document.createElement('div');
|
||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
@ -322,6 +364,114 @@ class GroundImage extends Base {
|
|||||||
this._EventBinding.on(this, all_elm)
|
this._EventBinding.on(this, all_elm)
|
||||||
this._elms = this._EventBinding.element
|
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 {
|
} else {
|
||||||
if (this._DialogObject && this._DialogObject.remove) {
|
if (this._DialogObject && this._DialogObject.remove) {
|
||||||
this._DialogObject.remove()
|
this._DialogObject.remove()
|
||||||
@ -428,7 +578,7 @@ class GroundImage extends Base {
|
|||||||
async flyTo(options = {}) {
|
async flyTo(options = {}) {
|
||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
closeViewFollow(this.sdk)
|
closeViewFollow(this.sdk)
|
||||||
|
|
||||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||||
let orientation = {
|
let orientation = {
|
||||||
|
@ -159,10 +159,18 @@ class GroundSvg extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
super.show = v
|
if (this.options.text && this.options.text.show) {
|
||||||
if (this.options.text && this.options.text.show && this.text) {
|
if(this.text) {
|
||||||
this.text.show = v
|
if((!this.showView || this.showView == 3)) {
|
||||||
|
this.text.show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.text.show = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
super.show = v
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -308,7 +316,12 @@ class GroundSvg extends Base {
|
|||||||
set textShow(v) {
|
set textShow(v) {
|
||||||
this.options.text.show = v
|
this.options.text.show = v
|
||||||
if (this.show) {
|
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) {
|
if (this.options.text.position) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.options.text.position.alt) {
|
if (this.options.text.position.alt) {
|
||||||
|
@ -82,18 +82,33 @@ class Flame extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
this.options.show = v
|
||||||
this.entity.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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
|
@ -83,18 +83,31 @@ class Fountain extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
|
this.options.show = v
|
||||||
this.entity.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) {
|
if(this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
|
@ -81,18 +81,31 @@ class Smoke extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
|
this.options.show = v
|
||||||
this.entity.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) {
|
if(this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
|
@ -84,18 +84,31 @@ class Spout extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
this.options.show = v
|
||||||
this.entity.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
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
|
@ -246,16 +246,28 @@ class RadarScan extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
this.entity.show = v
|
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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label.show && this.label) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -449,7 +461,7 @@ class RadarScan extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -144,37 +144,54 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.originalOptions) {
|
this.options.show = v
|
||||||
this.originalOptions.show = v
|
if (this.originalOptions) {
|
||||||
|
this.originalOptions.show = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (v) {
|
if (this.options.show) {
|
||||||
if (this.firstPersonView) {
|
if (this.firstPersonView) {
|
||||||
this.model.show = false
|
this.model.show = false
|
||||||
}
|
}
|
||||||
else {
|
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({
|
if ((!this.showView || this.showView == 3)) {
|
||||||
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
|
||||||
dashLength: 20,
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
dashLength: 20,
|
||||||
color: new Cesium.Color.fromCssColorString('#00ffff00'),
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
dashLength: 20,
|
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++) {
|
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) {
|
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 {
|
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.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'),
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
dashLength: 20,
|
dashLength: 20,
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
@ -182,7 +199,7 @@ class TrajectoryMotion extends Base {
|
|||||||
dashLength: 20,
|
dashLength: 20,
|
||||||
})
|
})
|
||||||
for (let i = 0; i < this.keyPoints.length; i++) {
|
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.label && (this.label.show = false)
|
||||||
this.viewFollow = false
|
this.viewFollow = false
|
||||||
@ -193,6 +210,7 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -656,8 +674,15 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
set modelShow(v) {
|
set modelShow(v) {
|
||||||
this.options.model.show = 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) {
|
if (this.model && this.show) {
|
||||||
this.model.show = v
|
this.model.show = show
|
||||||
}
|
}
|
||||||
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
|
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
|
||||||
item.checked = v
|
item.checked = v
|
||||||
@ -723,8 +748,15 @@ class TrajectoryMotion extends Base {
|
|||||||
this.realTimeRoute = false
|
this.realTimeRoute = false
|
||||||
}
|
}
|
||||||
this.options.line.show = v
|
this.options.line.show = v
|
||||||
|
let show = v
|
||||||
|
if ((!this.showView || this.showView == 3)) {
|
||||||
|
show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
if (this.line && this.show) {
|
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'),
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
dashLength: 20, //短划线长度
|
dashLength: 20, //短划线长度
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
@ -994,7 +1026,14 @@ class TrajectoryMotion extends Base {
|
|||||||
else {
|
else {
|
||||||
CameraController(this.sdk, true)
|
CameraController(this.sdk, true)
|
||||||
if (this.model && this.modelShow && this.show) {
|
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) {
|
if (this._DialogObject && this._DialogObject._element.content) {
|
||||||
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
|
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
|
||||||
@ -1116,8 +1155,15 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = 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) {
|
if (this.show) {
|
||||||
this.label && (this.label.show = v)
|
this.label && (this.label.show = 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) {
|
||||||
@ -1888,10 +1934,10 @@ class TrajectoryMotion extends Base {
|
|||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.tip = null
|
this.tip = null
|
||||||
this.ControllerObject.destroy()
|
this.ControllerObject.destroy()
|
||||||
if(this.firstPersonView !== this.originalOptions.firstPersonView) {
|
if (this.firstPersonView !== this.originalOptions.firstPersonView) {
|
||||||
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.model && (this.model.show = false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2164,10 +2210,10 @@ class TrajectoryMotion extends Base {
|
|||||||
this.modelAnimate = this.originalOptions.model.animate;
|
this.modelAnimate = this.originalOptions.model.animate;
|
||||||
this.delay = this.originalOptions.delay;
|
this.delay = this.originalOptions.delay;
|
||||||
(this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground);
|
(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;
|
this.firstPersonView = this.originalOptions.firstPersonView;
|
||||||
}
|
}
|
||||||
if(this.firstPersonView && this.modelShow) {
|
if (this.firstPersonView && this.modelShow) {
|
||||||
this.model && (this.model.show = false)
|
this.model && (this.model.show = false)
|
||||||
}
|
}
|
||||||
this.labelShow = this.originalOptions.label.show
|
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].innerHTML = '结束调整'
|
||||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn is-active'
|
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.state = false
|
||||||
this.editObj = new EditGltf(this.sdk, this.model)
|
this.editObj = new EditGltf(this.sdk, this.model)
|
||||||
this.editObj.editRtation()
|
this.editObj.editRtation()
|
||||||
|
@ -10,10 +10,12 @@ import { getHost, getToken } from "../../on";
|
|||||||
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
|
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
|
||||||
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
|
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
|
||||||
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
|
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'
|
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) {
|
||||||
@ -55,6 +57,50 @@ class Base extends Tools {
|
|||||||
// setSplitDirection(this._splitDirection, this.options.id)
|
// 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() {
|
get name() {
|
||||||
return this.options.name
|
return this.options.name
|
||||||
}
|
}
|
||||||
@ -72,19 +118,32 @@ class Base extends Tools {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.originalOptions) {
|
this.options.show = v
|
||||||
this.originalOptions.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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = this.options.show
|
||||||
}
|
|
||||||
if (this.options.label && this.options.label.show && this.label) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -263,7 +322,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.clickCallBack == null && this.options && this.options.id) {
|
if (this.clickCallBack == null && this.options && this.options.id) {
|
||||||
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
|
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
|
||||||
}
|
}
|
||||||
@ -286,7 +345,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
|
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
|
||||||
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
|
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
|
||||||
}
|
}
|
||||||
@ -309,7 +368,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
|
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
|
||||||
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
|
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,10 @@ import BaseDialog from '../../../BaseDialog';
|
|||||||
|
|
||||||
class Dialog extends BaseDialog {
|
class Dialog extends BaseDialog {
|
||||||
constructor(sdk, info, options, only) {
|
constructor(sdk, info, options, only) {
|
||||||
super(sdk.viewer._container, options);
|
super(sdk.viewer._container, options, only);
|
||||||
this.sdk = sdk
|
this.sdk = sdk
|
||||||
this.viewer = sdk.viewer
|
this.viewer = sdk.viewer
|
||||||
this.info = info
|
this.info = info
|
||||||
if (only) {
|
|
||||||
this.closeAll()
|
|
||||||
}
|
|
||||||
this._init()
|
this._init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3490,3 +3490,27 @@
|
|||||||
.YJ-custom-base-dialog.contour>.content .label {
|
.YJ-custom-base-dialog.contour>.content .label {
|
||||||
flex: unset;
|
flex: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 锚点设置 */
|
||||||
|
.YJ-custom-base-dialog.anchor-point {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.YJ-custom-base-dialog.anchor-point>.content {
|
||||||
|
padding: 14px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.YJ-custom-base-dialog.anchor-point>.content>div {
|
||||||
|
border: 1px solid #757575;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.YJ-custom-base-dialog.anchor-point>.content>div>.point {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
position: absolute;
|
||||||
|
background: #FFDF53;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid #ff7300;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user