if (fullRedraw)// || mapReloadCache)
{
this.clear();
}
if (!this._initialized || fullRedraw)// || mapReloadCache)
{
this.x = 0;
this.y = 0;
this.scaleX = 1;
this.scaleY = 1;
this._lastReloadedCenter = this.map.center.clone();
this._lastReloadedResolution = this.map.resolution;
this.draw();
this._previousResolution = this.map.resolution;
this._previousCenter = this.map.center.clone();
this._initialized = true;
return;
}
if (resolutionChangedCache)
{
if (!this._previousResolution)
{
this._previousResolution = this.map.resolution;
}
this.cacheAsBitmap = false;
var ratio:Number = this._previousResolution.value / this.map.resolution.value;
this.scaleLayer(ratio, new Pixel(this.map.size.w/2, this.map.size.h/2));
this._previousResolution = this.map.resolution;
resolutionChangedCache = false;
this.cacheAsBitmap = true;
}
if (centerChangedCache)
{
if (!this._previousCenter)
{
this._previousCenter = this.map.center.clone();
}
var deltaLon:Number = this.map.center.lon - this._previousCenter.lon;
var deltaLat:Number = this.map.center.lat - this._previousCenter.lat;
var deltaX:Number = deltaLon/this.map.resolution.value;
var deltaY:Number = deltaLat/this.map.resolution.value;
this.x = this.x - deltaX;
this.y = this.y + deltaY;
this._previousCenter = this.map.center.clone();
centerChangedCache = false;
}