出于某种原因,每当我调用overlayChange()时,它会检查计数条件,它将count设置为24,执行里面的代码。我试图确定计数何时= 24然后将其设置为0。
overlayChange()是网页上可点击的span元素的onclick函数。
var count=0;
var name='HeatMap'.concat(count.toString());
var viewer = new Cesium.CesiumWidget('cesiumContainer');
var layers = viewer.scene.imageryLayers;
loadCesium();
function loadCesium()
{
//Cesium Active Window
layers.addImageryProvider(new Cesium.SingleTileImageryProvider({
url : 'images/'.concat(name.concat('.png')),
rectangle : Cesium.Rectangle.fromDegrees(-180.0, -90.0, 180.0, 90.0),
opacity:.3
}));
}
function overlayChange()
{
if(count = 24)
{
count = 0;
name='HeatMap';
name = name.concat(count.toString());
loadCesium();
}
else
{
name='HeatMap';
count=count+1;
name = name.concat(count.toString());
loadCesium();
}
}