增加标注图片地址404判断
This commit is contained in:
@ -231,7 +231,20 @@ class BillboardObject extends Base {
|
||||
that._superGif = superGif
|
||||
that._superGif.id = id // 自定义id,用于判断gif实例是否改变
|
||||
|
||||
superGif.load(function () {
|
||||
superGif.load(function (status) {
|
||||
if (status == 404) {
|
||||
canvas = document.createElement('canvas')
|
||||
canvas.width = 0
|
||||
canvas.height = 0
|
||||
billboardH = 0
|
||||
if (that.entity) {
|
||||
that.entity.billboard.imgWidth = 0
|
||||
that.entity.billboard.imgHeight = 0
|
||||
that.entity.billboard.image = canvas
|
||||
addCluster(that.sdk, that.entity)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (that._superGif.id != id) {
|
||||
return
|
||||
}
|
||||
@ -286,6 +299,17 @@ class BillboardObject extends Base {
|
||||
addCluster(that.sdk, that.entity)
|
||||
}
|
||||
}
|
||||
image.onerror = function (err) {
|
||||
canvas.width = 0
|
||||
canvas.height = 0
|
||||
billboardH = 0
|
||||
if (that.entity) {
|
||||
that.entity.billboard.imgWidth = 0
|
||||
that.entity.billboard.imgHeight = 0
|
||||
that.entity.billboard.image = canvas
|
||||
addCluster(that.sdk, that.entity)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
that.entity = new Cesium.Entity({
|
||||
@ -729,7 +753,24 @@ class BillboardObject extends Base {
|
||||
let billboardH = 36
|
||||
let index = 0
|
||||
_this._frameImages = []
|
||||
superGif.load(function () {
|
||||
superGif.load(function (status) {
|
||||
if (status == 404) {
|
||||
canvas = document.createElement('canvas')
|
||||
canvas.width = 0
|
||||
canvas.height = 0
|
||||
billboardH = 0
|
||||
_this.entity.billboard.imgWidth = 0
|
||||
_this.entity.billboard.imgHeight = 0
|
||||
_this.entity && (_this.entity.billboard.image = canvas)
|
||||
_this.entity.billboard.height = new Cesium.CallbackProperty(function () {
|
||||
return 0
|
||||
}, false)
|
||||
_this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
|
||||
return new Cesium.Cartesian2(0, 0)
|
||||
}, false)
|
||||
billboardH = height * (31 / width)
|
||||
return
|
||||
}
|
||||
if (_this._superGif.id != id) {
|
||||
return
|
||||
}
|
||||
@ -802,6 +843,21 @@ class BillboardObject extends Base {
|
||||
}, false)
|
||||
billboardH = height * (31 / width)
|
||||
}
|
||||
image.onerror = function (err) {
|
||||
canvas.width = 0
|
||||
canvas.height = 0
|
||||
billboardH = 0
|
||||
_this.entity.billboard.imgWidth = 0
|
||||
_this.entity.billboard.imgHeight = 0
|
||||
_this.entity && (_this.entity.billboard.image = canvas)
|
||||
_this.entity.billboard.height = new Cesium.CallbackProperty(function () {
|
||||
return 0
|
||||
}, false)
|
||||
_this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
|
||||
return new Cesium.Cartesian2(0, 0)
|
||||
}, false)
|
||||
billboardH = height * (31 / width)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -2077,9 +2133,9 @@ class BillboardObject extends Base {
|
||||
// )
|
||||
this.entity.label.pixelOffset = new Cesium.CallbackProperty(function () {
|
||||
if (_this.options.billboard.show) {
|
||||
let billboardH =
|
||||
let billboardH = _this.entity.billboard.imgHeight ?
|
||||
_this.entity.billboard.imgHeight *
|
||||
(31 / _this.entity.billboard.imgWidth)
|
||||
(31 / _this.entity.billboard.imgWidth) : 0
|
||||
return new Cesium.Cartesian2(
|
||||
0,
|
||||
-billboardH * _this.options.billboard.scale -
|
||||
@ -2224,7 +2280,7 @@ class BillboardObject extends Base {
|
||||
.value
|
||||
) {
|
||||
this.options.attribute.vr.content.push({
|
||||
name: '全景图' ,
|
||||
name: '全景图',
|
||||
url: this._DialogObject._element.content.getElementsByClassName(
|
||||
'vr_add'
|
||||
)[0].value
|
||||
@ -2240,7 +2296,7 @@ class BillboardObject extends Base {
|
||||
|
||||
addAttributeRr(vr) {
|
||||
this.options.attribute.vr.content.push({
|
||||
name: '全景图' ,
|
||||
name: '全景图',
|
||||
url: vr
|
||||
})
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
|
Reference in New Issue
Block a user