Files
openlayers/src/ol/layer/layer.js
Paul Spencer 4e657e464c Add @todo observable documentation for observable properties
This PR adds documentation for observable properties, which will then be pulled into the docs correctly once #1180 is merged.  This is a first pass based on searching for definition of observable properties being defined as enums after lines ending with `Property = {`.  If there are observable properties implemented that don't follow this pattern then they are not included.

I've added simple descriptions based on what I know or could easily figure out, there may be some properties (like preload) that are not correctly described.

I've also added `readonly` annotations where I knew that a property was readonly.  I may have missed some readonly properties.

ol.layer.Base has a bunch of properties but I don't think it is exported so the documentation of these properties will not show up, so I added the documentation to ol.layer.Layer instead even though this isn't really where it should be documented.
2013-10-29 10:24:54 -04:00

95 lines
2.2 KiB
JavaScript

goog.provide('ol.layer.Layer');
goog.require('goog.asserts');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.object');
goog.require('ol.layer.Base');
goog.require('ol.source.Source');
/**
* @constructor
* @extends {ol.layer.Base}
* @param {ol.layer.LayerOptions} options Layer options.
* @todo stability experimental
* @todo observable brightness {number} the brightness of the layer
* @todo observable contrast {number} the contrast of the layer
* @todo observable hue {number} the hue of the layer
* @todo observable opacity {number} the opacity of the layer
* @todo observable saturation {number} the saturation of the layer
* @todo observable visible {boolean} the visiblity of the layer
* @todo observable maxResolution {number} the maximum resolution of the layer
* @todo observable minResolution {number} the minimum resolution of the layer
*/
ol.layer.Layer = function(options) {
var baseOptions = /** @type {ol.layer.LayerOptions} */
(goog.object.clone(options));
delete baseOptions.source;
goog.base(this, baseOptions);
/**
* @private
* @type {ol.source.Source}
*/
this.source_ = options.source;
goog.events.listen(this.source_, goog.events.EventType.CHANGE,
this.handleSourceChange_, false, this);
};
goog.inherits(ol.layer.Layer, ol.layer.Base);
/**
* @inheritDoc
*/
ol.layer.Layer.prototype.getLayersArray = function(opt_array) {
var array = (goog.isDef(opt_array)) ? opt_array : [];
array.push(this);
return array;
};
/**
* @inheritDoc
*/
ol.layer.Layer.prototype.getLayerStatesArray = function(opt_obj) {
var obj = (goog.isDef(opt_obj)) ? opt_obj : {
layers: [],
layerStates: []
};
goog.asserts.assert(obj.layers.length === obj.layerStates.length);
obj.layers.push(this);
obj.layerStates.push(this.getLayerState());
return obj;
};
/**
* @return {ol.source.Source} Source.
* @todo stability experimental
*/
ol.layer.Layer.prototype.getSource = function() {
return this.source_;
};
/**
* @inheritDoc
*/
ol.layer.Layer.prototype.getSourceState = function() {
return this.getSource().getState();
};
/**
* @private
*/
ol.layer.Layer.prototype.handleSourceChange_ = function() {
this.dispatchChangeEvent();
};