showView状态保存
This commit is contained in:
@ -50,6 +50,11 @@ async function init(sdk) {
|
||||
for (let i = 0; i < imageryLayers.length; i++) {
|
||||
let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex)
|
||||
entity.show = imageryLayers[i].show
|
||||
if (imageryLayers[i]._objectState) {
|
||||
if (imageryLayers[i]._showView == 3) {
|
||||
entity.show = false
|
||||
}
|
||||
}
|
||||
}
|
||||
// sdk.viewer.entities.collectionChanged.addEventListener(syncEntities)
|
||||
// sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources)
|
||||
@ -61,6 +66,12 @@ async function init(sdk) {
|
||||
JwwStatusSwitch(sdk2, true)
|
||||
}
|
||||
|
||||
sdk.entityMap.forEach((item, key) => {
|
||||
if (item.showView == 2) {
|
||||
item.showView = 2
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
async function on(sdk) {
|
||||
if (sdk2D) {
|
||||
@ -95,9 +106,10 @@ function off(sdk) {
|
||||
syncObject = {}
|
||||
}
|
||||
sdk.entityMap.forEach((item, key) => {
|
||||
item.showView = undefined
|
||||
if (item.showView) {
|
||||
item.show = item.show
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async function syncData2(sdk, id, entityId) {
|
||||
@ -123,10 +135,10 @@ 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
|
||||
if (that.showView == 3) {
|
||||
options.show = false
|
||||
}
|
||||
let newObject = await new that.constructor(sdk2D, options)
|
||||
newObject.onClick = that.onClick
|
||||
@ -216,6 +228,9 @@ async function syncData2(sdk, id, entityId) {
|
||||
}
|
||||
let options = syncObject.tools.deepCopyObj(obj.options)
|
||||
if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) {
|
||||
if (obj.showView == 3) {
|
||||
options.show = false
|
||||
}
|
||||
let target = await new obj.constructor(sdk2D, options)
|
||||
target.onClick = obj.onClick
|
||||
target.onRightClick = obj.onRightClick
|
||||
@ -413,15 +428,15 @@ function syncImageryLayerShownOrHidden(layer, index, state) {
|
||||
let layer2d = sdk2D.viewer.imageryLayers._layers[index]
|
||||
let layer3d = sdk3D.viewer.imageryLayers._layers[index]
|
||||
console.log('layer2d', layer2d, sdk2D, layer3d)
|
||||
|
||||
|
||||
if (!layer2d) {
|
||||
return
|
||||
}
|
||||
if(layer3d._objectState) {
|
||||
if(!layer3d._showView || layer3d._showView==2) {
|
||||
if (layer3d._objectState) {
|
||||
if (!layer3d._showView || layer3d._showView == 2) {
|
||||
layer2d.show = true
|
||||
}
|
||||
if(layer3d._showView==3) {
|
||||
if (layer3d._showView == 3) {
|
||||
layer2d.show = false
|
||||
}
|
||||
}
|
||||
|
@ -100,14 +100,14 @@ function MouseRightMenu(sdk, status, callBack) {
|
||||
that = sdk.entityMap.get(entityId)
|
||||
}
|
||||
|
||||
if (that && that.picking) {
|
||||
addedMenu = `
|
||||
<span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span>
|
||||
<ul class="added" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
|
||||
<li style="padding: 3px 10px;cursor: pointer;">属性</li>
|
||||
</ul>
|
||||
`
|
||||
}
|
||||
// if (that && that.picking) {
|
||||
// addedMenu = `
|
||||
// <span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span>
|
||||
// <ul class="added" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
|
||||
// <li style="padding: 3px 10px;cursor: pointer;">属性</li>
|
||||
// </ul>
|
||||
// `
|
||||
// }
|
||||
let position = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||
menuElm = document.createElement('div')
|
||||
menuElm.id = 'custom-menu'
|
||||
|
@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
|
||||
import richText from "../../Element/richText";
|
||||
import MouseEvent from '../../../Event/index'
|
||||
import LabelObject from '../LabelObject'
|
||||
import { syncData } from '../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
|
||||
import { legp } from '../../Element/datalist';
|
||||
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
@ -223,10 +223,11 @@ class CircleDiffuse extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
this.entity.show = this.options.show
|
||||
if (this.options.label.show) {
|
||||
this.label.show = this.options.show
|
||||
@ -442,8 +443,9 @@ class CircleDiffuse extends Base {
|
||||
return this.options.label.show
|
||||
}
|
||||
set labelShow(v) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
this.options.label.show = v
|
||||
if (this.show && (!this.showView || this.showView == 3)) {
|
||||
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
|
||||
this.label.show = v
|
||||
}
|
||||
else {
|
||||
@ -1336,7 +1338,7 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
|
||||
async remove() {
|
||||
this.label.remove()
|
||||
this.label && this.label.remove()
|
||||
this.entity && this.sdk.viewer.entities.remove(this.entity)
|
||||
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
|
||||
this.entity = null
|
||||
|
@ -9,7 +9,7 @@ import { getHost, getToken } from "../../../on";
|
||||
import Base from '../index'
|
||||
import Tools from '../../../Tools'
|
||||
import { syncSplitData } from "../../../Global/SplitScreen";
|
||||
import { syncData } from '../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
||||
|
||||
class GeoJson extends Base {
|
||||
@ -52,11 +52,12 @@ class GeoJson extends Base {
|
||||
}
|
||||
|
||||
// set show(status) {
|
||||
// if (!this.isShowView) {
|
||||
// let sdkD = get2DSdk().sdkD
|
||||
// if (!this.isShowView || !sdkD) {
|
||||
// this.options.show = status
|
||||
// }
|
||||
// if (this.entity) {
|
||||
// if (!this.showView || this.showView == 3) {
|
||||
// if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
// for (let i = 0; i < this.entity.entities.values.length; i++) {
|
||||
// this.entity.entities.values[i].show = this.options.show
|
||||
// }
|
||||
|
@ -7,7 +7,7 @@ import EventBinding from './eventBinding'
|
||||
import Base from "../../index";
|
||||
import MouseEvent from '../../../../Event/index'
|
||||
import { syncPrimitives } from '../../../../Global/MultiViewportMode'
|
||||
import { syncData } from '../../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
|
||||
import MouseTip from '../../../../MouseTip'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
|
||||
@ -82,10 +82,11 @@ class Flame extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
||||
this.entity.show = this.options.show
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import { html } from "./_element";
|
||||
import EventBinding from './eventBinding'
|
||||
import Base from "../../index";
|
||||
import MouseEvent from '../../../../Event/index'
|
||||
import { syncData } from '../../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
|
||||
import MouseTip from '../../../../MouseTip'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
|
||||
@ -83,10 +83,11 @@ class Fountain extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
||||
this.entity.show = this.options.show
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import { html, css } from "./_element";
|
||||
import EventBinding from './eventBinding'
|
||||
import Base from "../../index";
|
||||
import MouseEvent from '../../../../Event/index'
|
||||
import { syncData } from '../../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
|
||||
import MouseTip from '../../../../MouseTip'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
|
||||
@ -81,10 +81,11 @@ class Smoke extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
||||
this.entity.show = this.options.show
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import Dialog from '../../../Element/Dialog';
|
||||
import { html, css } from "./_element";
|
||||
import Base from "../../index";
|
||||
import MouseEvent from '../../../../Event/index'
|
||||
import { syncData } from '../../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
|
||||
import MouseTip from '../../../../MouseTip'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global'
|
||||
@ -84,10 +84,11 @@ class Spout extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
||||
this.entity.show = this.options.show
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
|
||||
import richText from "../../Element/richText";
|
||||
import MouseEvent from '../../../Event/index'
|
||||
import LabelObject from '../LabelObject'
|
||||
import { syncData } from '../../../Global/MultiViewportMode'
|
||||
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
|
||||
import { legp } from '../../Element/datalist';
|
||||
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
@ -246,10 +246,11 @@ class RadarScan extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
this.entity.show = this.options.show
|
||||
if (this.options.label.show && this.label) {
|
||||
this.label.show = this.options.show
|
||||
@ -460,8 +461,9 @@ class RadarScan extends Base {
|
||||
return this.options.label.show
|
||||
}
|
||||
set labelShow(v) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
this.options.label.show = v
|
||||
if (this.show && (!this.showView || this.showView == 3)) {
|
||||
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
|
||||
this.label.show = v
|
||||
}
|
||||
else {
|
||||
@ -1386,7 +1388,7 @@ class RadarScan extends Base {
|
||||
}
|
||||
|
||||
async remove() {
|
||||
this.label.remove()
|
||||
this.label && this.label.remove()
|
||||
this.entity && this.sdk.viewer.entities.remove(this.entity)
|
||||
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
|
||||
this.entity = null
|
||||
|
@ -144,7 +144,8 @@ class TrajectoryMotion extends Base {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DView()
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
if (this.originalOptions) {
|
||||
this.originalOptions.show = v
|
||||
@ -155,10 +156,10 @@ class TrajectoryMotion extends Base {
|
||||
this.model.show = false
|
||||
}
|
||||
else {
|
||||
this.model.show = (!this.showView || this.showView == 3) ? this.modelShow : false
|
||||
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.modelShow : false
|
||||
}
|
||||
|
||||
if ((!this.showView || this.showView == 3)) {
|
||||
if ((!this.showView || this.showView == 3 || !sdkD)) {
|
||||
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
|
||||
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||
dashLength: 20,
|
||||
@ -174,17 +175,17 @@ class TrajectoryMotion extends Base {
|
||||
})
|
||||
}
|
||||
for (let i = 0; i < this.keyPoints.length; i++) {
|
||||
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? this.keyPointShow : false
|
||||
this.keyPoints[i].show = (!this.showView || this.showView == 3 || !sdkD) ? this.keyPointShow : false
|
||||
}
|
||||
if (this.realTimeRoute) {
|
||||
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3) ? true : false)
|
||||
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false)
|
||||
}
|
||||
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
|
||||
this.label && (this.label.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.label.show : false)
|
||||
}
|
||||
else {
|
||||
this.model.show = (!this.showView || this.showView == 3) ? this.options.show : false
|
||||
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
|
||||
let show = this.options.show
|
||||
if ((!this.showView || this.showView == 3)) {
|
||||
if ((!this.showView || this.showView == 3 || !sdkD)) {
|
||||
show = this.options.show
|
||||
}
|
||||
else {
|
||||
@ -673,9 +674,10 @@ class TrajectoryMotion extends Base {
|
||||
return this.options.model.show
|
||||
}
|
||||
set modelShow(v) {
|
||||
let sdkD = get2DView()
|
||||
this.options.model.show = v
|
||||
let show = v
|
||||
if (this.show && (!this.showView || this.showView == 3)) {
|
||||
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
|
||||
show = v
|
||||
}
|
||||
else {
|
||||
@ -749,7 +751,8 @@ class TrajectoryMotion extends Base {
|
||||
}
|
||||
this.options.line.show = v
|
||||
let show = v
|
||||
if ((!this.showView || this.showView == 3)) {
|
||||
let sdkD = get2DView()
|
||||
if ((!this.showView || this.showView == 3 || !sdkD)) {
|
||||
show = v
|
||||
}
|
||||
else {
|
||||
@ -973,6 +976,7 @@ class TrajectoryMotion extends Base {
|
||||
|
||||
set firstPersonView(v) {
|
||||
// this.state = true
|
||||
let sdkD = get2DView()
|
||||
let splitSdk = getSdk()
|
||||
if (get2DView() || splitSdk.sdkD || !this.show) {
|
||||
v = false
|
||||
@ -1027,7 +1031,7 @@ class TrajectoryMotion extends Base {
|
||||
CameraController(this.sdk, true)
|
||||
if (this.model && this.modelShow && this.show) {
|
||||
let show = true
|
||||
if (this.show && (!this.showView || this.showView == 3)) {
|
||||
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
|
||||
show = true
|
||||
}
|
||||
else {
|
||||
@ -1155,8 +1159,9 @@ class TrajectoryMotion extends Base {
|
||||
}
|
||||
set labelShow(v) {
|
||||
this.options.label.show = v
|
||||
let sdkD = get2DView()
|
||||
let show = v
|
||||
if (this.show && (!this.showView || this.showView == 3)) {
|
||||
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
|
||||
show = v
|
||||
}
|
||||
else {
|
||||
|
@ -120,7 +120,8 @@ class Base extends Tools {
|
||||
|
||||
set show(v) {
|
||||
if (typeof v === "boolean") {
|
||||
if (!this.isShowView) {
|
||||
let sdkD = get2DSdk().sdkD
|
||||
if (!this.isShowView || !sdkD) {
|
||||
this.options.show = v
|
||||
if (this.originalOptions) {
|
||||
this.originalOptions.show = v
|
||||
@ -132,7 +133,7 @@ class Base extends Tools {
|
||||
this.entity._objectState = this.options.show
|
||||
}
|
||||
}
|
||||
if (!this.showView || this.showView == 3) {
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
this.entity && (this.entity.show = this.options.show)
|
||||
if (this.options.label && this.options.label.show && this.label) {
|
||||
this.label.show = this.options.show
|
||||
@ -154,7 +155,6 @@ class Base extends Tools {
|
||||
syncSplitData(this.sdk, this.options.id)
|
||||
this.isShowView = false
|
||||
|
||||
let { sdkP, sdkD } = get2DSdk()
|
||||
if (this.type == 'layer' && sdkD) {
|
||||
let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex]
|
||||
let layer3d = this.entity
|
||||
|
Reference in New Issue
Block a user