Remove ol.raster namespace

Now used only for 1 typedefs and 1 enum, it serves little purpose,
so the typedef is renamed in the ol namespace, and the enum moved to rastersource.js
This commit is contained in:
Peter Robins
2016-05-26 10:13:59 +00:00
parent e63b4d1f48
commit 395f3c0756
6 changed files with 47 additions and 45 deletions

View File

@@ -1,5 +1,11 @@
## Upgrade notes ## Upgrade notes
#### Removal of ol.raster namespace
Users compiling their code with the library and using types in the `ol.raster` namespace should note that this has now been removed. `ol.raster.Pixel` has been deleted, and the other types have been renamed as follows, and your code may need changing if you use these:
* `ol.raster.Operation` to `ol.RasterOperation`
* `ol.raster.OperationType` to `ol.RasterOperationType`
### v3.16.0 ### v3.16.0
#### Rendering change for tile sources #### Rendering change for tile sources

View File

@@ -5028,10 +5028,11 @@ olx.source.ImageVectorOptions.prototype.style;
/** /**
* @typedef {{sources: Array.<ol.source.Source>, * @typedef {{sources: Array.<ol.source.Source>,
* operation: (ol.raster.Operation|undefined), * operation: (ol.RasterOperation|undefined),
* lib: (Object|undefined), * lib: (Object|undefined),
* threads: (number|undefined), * threads: (number|undefined),
* operationType: (ol.raster.OperationType|undefined)}} * operationType: (ol.RasterOperationType|undefined)}}
* @api
*/ */
olx.source.RasterOptions; olx.source.RasterOptions;
@@ -5047,7 +5048,7 @@ olx.source.RasterOptions.prototype.sources;
/** /**
* Raster operation. The operation will be called with data from input sources * Raster operation. The operation will be called with data from input sources
* and the output will be assigned to the raster source. * and the output will be assigned to the raster source.
* @type {ol.raster.Operation|undefined} * @type {ol.RasterOperation|undefined}
* @api * @api
*/ */
olx.source.RasterOptions.prototype.operation; olx.source.RasterOptions.prototype.operation;
@@ -5078,7 +5079,7 @@ olx.source.RasterOptions.prototype.threads;
* `'pixel'` operations are assumed, and operations will be called with an * `'pixel'` operations are assumed, and operations will be called with an
* array of pixels from input sources. If set to `'image'`, operations will * array of pixels from input sources. If set to `'image'`, operations will
* be called with an array of ImageData objects from input sources. * be called with an array of ImageData objects from input sources.
* @type {ol.raster.OperationType|undefined} * @type {ol.RasterOperationType|undefined}
* @api * @api
*/ */
olx.source.RasterOptions.prototype.operationType; olx.source.RasterOptions.prototype.operationType;

View File

@@ -1,3 +0,0 @@
/**
* @namespace ol.raster
*/

View File

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

View File

@@ -1,3 +1,4 @@
goog.provide('ol.RasterOperationType');
goog.provide('ol.source.Raster'); goog.provide('ol.source.Raster');
goog.provide('ol.source.RasterEvent'); goog.provide('ol.source.RasterEvent');
goog.provide('ol.source.RasterEventType'); goog.provide('ol.source.RasterEventType');
@@ -15,7 +16,6 @@ goog.require('ol.extent');
goog.require('ol.layer.Image'); goog.require('ol.layer.Image');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.object'); goog.require('ol.object');
goog.require('ol.raster.OperationType');
goog.require('ol.renderer.canvas.ImageLayer'); goog.require('ol.renderer.canvas.ImageLayer');
goog.require('ol.renderer.canvas.TileLayer'); goog.require('ol.renderer.canvas.TileLayer');
goog.require('ol.source.Image'); goog.require('ol.source.Image');
@@ -23,10 +23,20 @@ goog.require('ol.source.State');
goog.require('ol.source.Tile'); goog.require('ol.source.Tile');
/**
* Raster operation type. Supported values are `'pixel'` and `'image'`.
* @enum {string}
*/
ol.RasterOperationType = {
PIXEL: 'pixel',
IMAGE: 'image'
};
/** /**
* @classdesc * @classdesc
* A source that transforms data from any number of input sources using an array * A source that transforms data from any number of input sources using an array
* of {@link ol.raster.Operation} functions to transform input pixel values into * of {@link ol.RasterOperation} functions to transform input pixel values into
* output pixel values. * output pixel values.
* *
* @constructor * @constructor
@@ -45,10 +55,10 @@ ol.source.Raster = function(options) {
/** /**
* @private * @private
* @type {ol.raster.OperationType} * @type {ol.RasterOperationType}
*/ */
this.operationType_ = options.operationType !== undefined ? this.operationType_ = options.operationType !== undefined ?
options.operationType : ol.raster.OperationType.PIXEL; options.operationType : ol.RasterOperationType.PIXEL;
/** /**
* @private * @private
@@ -144,7 +154,7 @@ ol.inherits(ol.source.Raster, ol.source.Image);
/** /**
* Set the operation. * Set the operation.
* @param {ol.raster.Operation} operation New operation. * @param {ol.RasterOperation} operation New operation.
* @param {Object=} opt_lib Functions that will be available to operations run * @param {Object=} opt_lib Functions that will be available to operations run
* in a worker. * in a worker.
* @api * @api
@@ -152,7 +162,7 @@ ol.inherits(ol.source.Raster, ol.source.Image);
ol.source.Raster.prototype.setOperation = function(operation, opt_lib) { ol.source.Raster.prototype.setOperation = function(operation, opt_lib) {
this.worker_ = new ol.ext.pixelworks.Processor({ this.worker_ = new ol.ext.pixelworks.Processor({
operation: operation, operation: operation,
imageOps: this.operationType_ === ol.raster.OperationType.IMAGE, imageOps: this.operationType_ === ol.RasterOperationType.IMAGE,
queue: 1, queue: 1,
lib: opt_lib, lib: opt_lib,
threads: this.threads_ threads: this.threads_

View File

@@ -26,7 +26,6 @@ goog.provide('ol.events.EventTargetLike');
goog.provide('ol.interaction.DragBoxEndConditionType'); goog.provide('ol.interaction.DragBoxEndConditionType');
goog.provide('ol.proj.ProjectionLike'); goog.provide('ol.proj.ProjectionLike');
goog.provide('ol.raster.Operation');
goog.provide('ol.style.AtlasBlock'); goog.provide('ol.style.AtlasBlock');
@@ -277,6 +276,26 @@ ol.PostRenderFunction;
ol.PreRenderFunction; ol.PreRenderFunction;
/**
* A function that takes an array of input data, performs some operation, and
* returns an array of ouput data.
* For `pixel` type operations, the function will be called with an array of
* pixels, where each pixel is an array of four numbers (`[r, g, b, a]`) in the
* range of 0 - 255. It should return a single pixel array.
* For `'image'` type operations, functions will be called with an array of
* {@link ImageData https://developer.mozilla.org/en-US/docs/Web/API/ImageData}
* and should return a single {@link ImageData
* https://developer.mozilla.org/en-US/docs/Web/API/ImageData}. The operations
* are called with a second "data" argument, which can be used for storage. The
* data object is accessible from raster events, where it can be initialized in
* "beforeoperations" and accessed again in "afteroperations".
*
* @typedef {function((Array.<Array.<number>>|Array.<ImageData>), Object):
* (Array.<number>|ImageData)}
*/
ol.RasterOperation;
/** /**
* @typedef {function(ol.Extent, number, number) : ol.ImageBase} * @typedef {function(ol.Extent, number, number) : ol.ImageBase}
*/ */
@@ -609,26 +628,6 @@ ol.interaction.SnapSegmentDataType;
ol.proj.ProjectionLike; ol.proj.ProjectionLike;
/**
* A function that takes an array of input data, performs some operation, and
* returns an array of ouput data.
* For `pixel` type operations, the function will be called with an array of
* pixels, where each pixel is an array of four numbers (`[r, g, b, a]`) in the
* range of 0 - 255. It should return a single pixel array.
* For `'image'` type operations, functions will be called with an array of
* {@link ImageData https://developer.mozilla.org/en-US/docs/Web/API/ImageData}
* and should return a single {@link ImageData
* https://developer.mozilla.org/en-US/docs/Web/API/ImageData}. The operations
* are called with a second "data" argument, which can be used for storage. The
* data object is accessible from raster events, where it can be initialized in
* "beforeoperations" and accessed again in "afteroperations".
*
* @typedef {function((Array.<Array.<number>>|Array.<ImageData>), Object):
* (Array.<number>|ImageData)}
*/
ol.raster.Operation;
/** /**
* @typedef {{x: number, y: number, width: number, height: number}} * @typedef {{x: number, y: number, width: number, height: number}}
*/ */