Provide extent and resolution in raster events
This commit is contained in:
@@ -272,6 +272,12 @@ oli.source.ImageEvent.prototype.image;
|
|||||||
oli.source.RasterEvent = function() {};
|
oli.source.RasterEvent = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
oli.source.RasterEvent.prototype.extent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -223,9 +223,8 @@ ol.source.Raster.prototype.composeFrame_ = function(frameState) {
|
|||||||
this.renderers_[i], frameState, frameState.layerStatesArray[i]);
|
this.renderers_[i], frameState, frameState.layerStatesArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var resolution = frameState.viewState.resolution / frameState.pixelRatio;
|
|
||||||
this.dispatchEvent(new ol.source.RasterEvent(
|
this.dispatchEvent(new ol.source.RasterEvent(
|
||||||
ol.source.RasterEventType.BEFOREOPERATIONS, resolution));
|
ol.source.RasterEventType.BEFOREOPERATIONS, frameState));
|
||||||
|
|
||||||
var targetImageData = null;
|
var targetImageData = null;
|
||||||
if (this.operationType_ === ol.raster.OperationType.PIXEL) {
|
if (this.operationType_ === ol.raster.OperationType.PIXEL) {
|
||||||
@@ -256,7 +255,7 @@ ol.source.Raster.prototype.composeFrame_ = function(frameState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchEvent(new ol.source.RasterEvent(
|
this.dispatchEvent(new ol.source.RasterEvent(
|
||||||
ol.source.RasterEventType.AFTEROPERATIONS, resolution));
|
ol.source.RasterEventType.AFTEROPERATIONS, frameState));
|
||||||
|
|
||||||
context.putImageData(targetImageData, 0, 0);
|
context.putImageData(targetImageData, 0, 0);
|
||||||
|
|
||||||
@@ -396,17 +395,24 @@ ol.source.Raster.createTileRenderer_ = function(source) {
|
|||||||
* @extends {goog.events.Event}
|
* @extends {goog.events.Event}
|
||||||
* @implements {oli.source.RasterEvent}
|
* @implements {oli.source.RasterEvent}
|
||||||
* @param {string} type Type.
|
* @param {string} type Type.
|
||||||
* @param {number} resolution Map units per pixel.
|
* @param {olx.FrameState} frameState The frame state.
|
||||||
*/
|
*/
|
||||||
ol.source.RasterEvent = function(type, resolution) {
|
ol.source.RasterEvent = function(type, frameState) {
|
||||||
goog.base(this, type);
|
goog.base(this, type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map units per pixel.
|
* The raster extent.
|
||||||
|
* @type {ol.Extent}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.extent = frameState.extent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pixel resolution (map units per pixel).
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
this.resolution = resolution;
|
this.resolution = frameState.viewState.resolution / frameState.pixelRatio;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.RasterEvent, goog.events.Event);
|
goog.inherits(ol.source.RasterEvent, goog.events.Event);
|
||||||
|
|||||||
Reference in New Issue
Block a user