Closed Ants-double closed 5 years ago
/ Update/(re)draw the heatmap / CHInstance.prototype.updateLayer = function () { //only works with a Viewer instance since the cesiumWidget instance doesn't contain an entities property if (CesiumHeatmap.defaults.useEntitiesIfAvailable && this._cesium.entities) { // let materialheatmap = Cesium.CallbackProperty(function () { // return new Cesium.ImageMaterialProperty({ // image: this._heatmap._renderer.canvas, // transparent: true // }); // }, false); let tempHeatmapThis=this;
//let imagetemp=document.getElementById('radarheatmap');
//imagetemp.src=this._heatmap._renderer.canvas.toDataURL();
if (this._layer) {
//this._cesium.entities.remove(this._layer);
var cesiumairsince = this._cesium.entities.getById('cesiumwindheatmap');
if (cesiumairsince === undefined) {
this._layer = this._cesium.entities.add({
id: 'cesiumwindheatmap',
show: true,
rectangle: {
coordinates: this._rectangle,
material: new Cesium.ImageMaterialProperty({
image: new Cesium.CallbackProperty(function (time, result) {
return tempHeatmapThis._heatmap._renderer.canvas.toDataURL();
}, false),
transparent: true
})
}
});
return;
}
// cesiumairsince.material = new Cesium.ImageMaterialProperty({
// image: new Cesium.CallbackProperty(function(time, result) {
// return this._heatmap._renderer.canvas;
// }, false)})
} else {
this._layer = this._cesium.entities.add({
id: 'cesiumwindheatmap',
show: true,
rectangle: {
coordinates: this._rectangle,
material: new Cesium.ImageMaterialProperty({
image: new Cesium.CallbackProperty(function (time, result) {
return tempHeatmapThis._heatmap._renderer.canvas.toDataURL();
}, false),
transparent: true
})
}
});
}
// Work around issue with material rendering in Cesium.
// material = new Cesium.ImageMaterialProperty({
// image: this._heatmap._renderer.canvas,
// });
// if (Cesium.VERSION >= "1.21") {
// material.transparent = true;
// } else if (Cesium.VERSION >= "1.16") {
// material.alpha = 0.99;
// }
} else {
if (this._layer) {
this._cesium.scene.imageryLayers.remove(this._layer);
}
this._layer = this._cesium.scene.imageryLayers.addImageryProvider(CesiumHeatmap._getImageryProvider(this));
}
};
i change the material use ,then i is correct
I get a flash when i change the data .