Add OperationType enum to ol.source.Raster

This commit is contained in:
Tim Schaub
2016-12-04 14:15:00 -07:00
parent c0fe3f1e4f
commit 3d2f677f2a
2 changed files with 15 additions and 16 deletions

View File

@@ -5257,7 +5257,7 @@ olx.source.ImageVectorOptions.prototype.style;
* operation: (ol.RasterOperation|undefined),
* lib: (Object|undefined),
* threads: (number|undefined),
* operationType: (ol.RasterOperationType|undefined)}}
* operationType: (ol.source.Raster.OperationType|undefined)}}
* @api
*/
olx.source.RasterOptions;
@@ -5305,7 +5305,7 @@ olx.source.RasterOptions.prototype.threads;
* `'pixel'` operations are assumed, and operations will be called with an
* array of pixels from input sources. If set to `'image'`, operations will
* be called with an array of ImageData objects from input sources.
* @type {ol.RasterOperationType|undefined}
* @type {ol.source.Raster.OperationType|undefined}
* @api
*/
olx.source.RasterOptions.prototype.operationType;

View File

@@ -1,5 +1,4 @@
goog.provide('ol.source.Raster');
goog.provide('ol.RasterOperationType');
goog.require('ol');
goog.require('ol.transform');
@@ -21,16 +20,6 @@ goog.require('ol.source.State');
goog.require('ol.source.Tile');
/**
* Raster operation type. Supported values are `'pixel'` and `'image'`.
* @enum {string}
*/
ol.RasterOperationType = {
PIXEL: 'pixel',
IMAGE: 'image'
};
/**
* @classdesc
* A source that transforms data from any number of input sources using an array
@@ -53,10 +42,10 @@ ol.source.Raster = function(options) {
/**
* @private
* @type {ol.RasterOperationType}
* @type {ol.source.Raster.OperationType}
*/
this.operationType_ = options.operationType !== undefined ?
options.operationType : ol.RasterOperationType.PIXEL;
options.operationType : ol.source.Raster.OperationType.PIXEL;
/**
* @private
@@ -160,7 +149,7 @@ ol.inherits(ol.source.Raster, ol.source.Image);
ol.source.Raster.prototype.setOperation = function(operation, opt_lib) {
this.worker_ = new ol.ext.pixelworks.Processor({
operation: operation,
imageOps: this.operationType_ === ol.RasterOperationType.IMAGE,
imageOps: this.operationType_ === ol.source.Raster.OperationType.IMAGE,
queue: 1,
lib: opt_lib,
threads: this.threads_
@@ -512,3 +501,13 @@ ol.source.Raster.EventType = {
*/
AFTEROPERATIONS: 'afteroperations'
};
/**
* Raster operation type. Supported values are `'pixel'` and `'image'`.
* @enum {string}
*/
ol.source.Raster.OperationType = {
PIXEL: 'pixel',
IMAGE: 'image'
};