Shared module for raster operation type enum

This commit is contained in:
Tim Schaub
2016-12-27 14:08:23 -07:00
parent 2e3d065e34
commit e2f78a8006
3 changed files with 17 additions and 16 deletions

View File

@@ -5326,7 +5326,7 @@ olx.source.ImageVectorOptions.prototype.style;
* operation: (ol.RasterOperation|undefined),
* lib: (Object|undefined),
* threads: (number|undefined),
* operationType: (ol.source.Raster.OperationType|undefined)}}
* operationType: (ol.source.RasterOperationType|undefined)}}
* @api
*/
olx.source.RasterOptions;
@@ -5374,7 +5374,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.source.Raster.OperationType|undefined}
* @type {ol.source.RasterOperationType|undefined}
* @api
*/
olx.source.RasterOptions.prototype.operationType;

View File

@@ -1,7 +1,6 @@
goog.provide('ol.source.Raster');
goog.require('ol');
goog.require('ol.transform');
goog.require('ol.ImageCanvas');
goog.require('ol.TileQueue');
goog.require('ol.dom');
@@ -16,8 +15,10 @@ goog.require('ol.obj');
goog.require('ol.renderer.canvas.ImageLayer');
goog.require('ol.renderer.canvas.TileLayer');
goog.require('ol.source.Image');
goog.require('ol.source.RasterOperationType');
goog.require('ol.source.State');
goog.require('ol.source.Tile');
goog.require('ol.transform');
/**
@@ -42,10 +43,10 @@ ol.source.Raster = function(options) {
/**
* @private
* @type {ol.source.Raster.OperationType}
* @type {ol.source.RasterOperationType}
*/
this.operationType_ = options.operationType !== undefined ?
options.operationType : ol.source.Raster.OperationType.PIXEL;
options.operationType : ol.source.RasterOperationType.PIXEL;
/**
* @private
@@ -149,7 +150,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.source.Raster.OperationType.IMAGE,
imageOps: this.operationType_ === ol.source.RasterOperationType.IMAGE,
queue: 1,
lib: opt_lib,
threads: this.threads_
@@ -505,13 +506,3 @@ 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'
};

View File

@@ -0,0 +1,10 @@
goog.provide('ol.source.RasterOperationType');
/**
* Raster operation type. Supported values are `'pixel'` and `'image'`.
* @enum {string}
*/
ol.source.RasterOperationType = {
PIXEL: 'pixel',
IMAGE: 'image'
};