Allow operations to be updated
This commit is contained in:
@@ -37,14 +37,21 @@ goog.require('ol.source.Tile');
|
|||||||
*/
|
*/
|
||||||
ol.source.Raster = function(options) {
|
ol.source.Raster = function(options) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.raster.OperationType}
|
||||||
|
*/
|
||||||
|
this.operationType_ = goog.isDef(options.operationType) ?
|
||||||
|
options.operationType : ol.raster.OperationType.PIXEL;
|
||||||
|
|
||||||
var operations = goog.isDef(options.operations) ?
|
var operations = goog.isDef(options.operations) ?
|
||||||
options.operations : [ol.raster.IdentityOp];
|
options.operations : [ol.raster.IdentityOp];
|
||||||
|
|
||||||
this.worker_ = new ol.ext.pixelworks.Processor({
|
/**
|
||||||
operations: operations,
|
* @private
|
||||||
imageOps: options.operationType === ol.raster.OperationType.IMAGE,
|
* @type {*}
|
||||||
queue: 1
|
*/
|
||||||
});
|
this.worker_ = this.createWorker_(operations);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -124,13 +131,28 @@ ol.source.Raster = function(options) {
|
|||||||
goog.inherits(ol.source.Raster, ol.source.Image);
|
goog.inherits(ol.source.Raster, ol.source.Image);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a worker.
|
||||||
|
* @param {Array.<ol.raster.Operation>} operations The operations.
|
||||||
|
* @return {*} The worker.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.source.Raster.prototype.createWorker_ = function(operations) {
|
||||||
|
return new ol.ext.pixelworks.Processor({
|
||||||
|
operations: operations,
|
||||||
|
imageOps: this.operationType_ === ol.raster.OperationType.IMAGE,
|
||||||
|
queue: 1
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the operations.
|
* Reset the operations.
|
||||||
* @param {Array.<ol.raster.Operation>} operations New operations.
|
* @param {Array.<ol.raster.Operation>} operations New operations.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.source.Raster.prototype.setOperations = function(operations) {
|
ol.source.Raster.prototype.setOperations = function(operations) {
|
||||||
this.worker_.setOperations(operations);
|
this.worker_ = this.createWorker_(operations);
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user