This commit is contained in:
zh
2025-09-08 17:27:42 +08:00
parent b84a378ab9
commit d20db7c91b
7 changed files with 154 additions and 548 deletions

View File

@ -16,7 +16,7 @@ class Layer extends BaseLayer {
super(sdk, options)
this.object = {}
this.options.host = this.options.host || getHost()
this.on()
}
get type() {
@ -24,21 +24,7 @@ class Layer extends BaseLayer {
}
on() {
return this.add()
}
async add() {
let res = await this.requestResource()
let text = await res.text()
text = JSON.parse(text)
if ([0, 200].includes(text.code)) {
return this.loadLayer(text.data)
} else {
return new Promise((res, reject) => {
reject(text.msg || text.message)
})
}
return this.loadLayer(this.options)
}
async loadLayer(data) {
@ -64,11 +50,11 @@ class Layer extends BaseLayer {
Cesium.Math.toRadians(this.object.north)
),
}
// if (this.object.scheme_name === "GeographicTilingScheme") {
// if (this.object.schemaName === "GeographicTilingScheme") {
// console.log("添加GeographicTilingScheme")
// params.tilingScheme = new Cesium.GeographicTilingScheme()
// }
// if (this.object.scheme_name === "amapMercatorTilingScheme") {
// if (this.object.schemaName === "amapMercatorTilingScheme") {
// console.log("添加amapMercatorTilingScheme")
// params.tilingScheme = this.amapMercatorTilingScheme()
// }
@ -80,19 +66,19 @@ class Layer extends BaseLayer {
// } else {
// tms = new Cesium.UrlTemplateImageryProvider(params)
// }
switch (this.object.scheme_name) {
switch (this.object.schemaName) {
case "amapMercatorTilingScheme":
params.tilingScheme = this.amapMercatorTilingScheme()
break;
case "":
break;
default:
params.tilingScheme = new Cesium[this.object.scheme_name]()
params.tilingScheme = new Cesium[this.object.schemaName]()
break;
}
switch (this.object.load_method) {
case "tms":
if(this.object.url.endsWith("tilemapresource.xml")){
if (this.object.url.endsWith("tilemapresource.xml")) {
let arr = this.object.url.split("/")
arr.pop()
let url = arr.join("/")
@ -116,7 +102,7 @@ class Layer extends BaseLayer {
break;
}
if(!this.sdk || !this.sdk.viewer) {
if (!this.sdk || !this.sdk.viewer) {
return
}
if (this.options.hasOwnProperty("layer_index")) {
@ -137,7 +123,7 @@ class Layer extends BaseLayer {
this.alpha = this.options.alpha
this.brightness = this.options.brightness
if(this.options.show) {
if (this.options.show) {
setSplitDirection(0, this.options.id)
}
}

View File

@ -46,6 +46,7 @@ class BIM extends BaseTileset {
this.exportProperty(this.exportStateArray)
}
this.features = new Map()
this.on()
}
get type() {

View File

@ -32,6 +32,7 @@ class Tileset extends BaseTileset {
constructor(earth, options = {}, _Dialog = {}) {
super(earth, options)
this.picking = false
this.on()
this.Dialog = _Dialog
this._elms = {};
this._EventBinding = new EventBinding()
@ -42,7 +43,7 @@ class Tileset extends BaseTileset {
}
on() {
return this.add()
return this.loadTileset(this.options)
}
get name() {

View File

@ -74,31 +74,6 @@ class BaseTileset extends BaseSource {
this.editObj.controllerCallBack = this.rotationEditingCallBack
}
async add() {
if (this.options.url) {
return this.loadTileset({
url: this.options.url
})
} else {
let res = await this.requestResource()
let text = await res.text()
text = JSON.parse(text)
if ([0, 200].includes(text.code)) {
if (text.data.url.length)
return this.loadTileset(text.data)
else
return new Promise((res, reject) => {
reject('资源不存在')
})
} else {
return new Promise((res, reject) => {
reject(text.msg || text.message)
})
}
}
}
loadSceneTree() {
}
@ -469,7 +444,7 @@ class BaseTileset extends BaseSource {
on() {
return this.add()
return this.loadTileset(this.options)
}
setDefaultValue() {