Simplify the way we annotate observable properties

We no longer add observable annotations to the constructor.
Instead, we just mark getters (and for read/write properties
also setters) with an observable annotation.
This commit is contained in:
Andreas Hocevar
2014-05-03 16:04:25 -04:00
parent 0f072c0ec1
commit 8ee9f7cb6a
18 changed files with 246 additions and 186 deletions
-8
View File
@@ -14,14 +14,6 @@ goog.require('ol.source.Source');
* @extends {ol.layer.Base}
* @fires ol.render.Event
* @param {olx.layer.LayerOptions} options Layer options.
* @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
* @todo api
*/
ol.layer.Layer = function(options) {
+32 -16
View File
@@ -77,7 +77,8 @@ goog.inherits(ol.layer.Base, ol.Object);
/**
* @return {number|undefined} Brightness.
* @return {number|undefined} The brightness of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getBrightness = function() {
@@ -91,7 +92,8 @@ goog.exportProperty(
/**
* @return {number|undefined} Contrast.
* @return {number|undefined} The contrast of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getContrast = function() {
@@ -105,7 +107,8 @@ goog.exportProperty(
/**
* @return {number|undefined} Hue.
* @return {number|undefined} The hue of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getHue = function() {
@@ -162,7 +165,8 @@ ol.layer.Base.prototype.getLayerStatesArray = goog.abstractMethod;
/**
* @return {number|undefined} MaxResolution.
* @return {number|undefined} The maximum resolution of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getMaxResolution = function() {
@@ -176,7 +180,8 @@ goog.exportProperty(
/**
* @return {number|undefined} MinResolution.
* @return {number|undefined} The minimum resolution of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getMinResolution = function() {
@@ -190,7 +195,8 @@ goog.exportProperty(
/**
* @return {number|undefined} Opacity.
* @return {number|undefined} The opacity of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getOpacity = function() {
@@ -204,7 +210,8 @@ goog.exportProperty(
/**
* @return {number|undefined} Saturation.
* @return {number|undefined} The saturation of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getSaturation = function() {
@@ -224,7 +231,8 @@ ol.layer.Base.prototype.getSourceState = goog.abstractMethod;
/**
* @return {boolean|undefined} Visible.
* @return {boolean|undefined} The visiblity of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.getVisible = function() {
@@ -255,7 +263,8 @@ goog.exportProperty(
* [2] https://github.com/WebKit/webkit/commit/8f4765e569
* [3] https://www.w3.org/Bugs/Public/show_bug.cgi?id=15647
*
* @param {number|undefined} brightness Brightness.
* @param {number|undefined} brightness The brightness of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setBrightness = function(brightness) {
@@ -272,7 +281,8 @@ goog.exportProperty(
* grey. A value of 1 will leave the contrast unchanged. Other values are
* linear multipliers on the effect (and values over 1 are permitted).
*
* @param {number|undefined} contrast Contrast.
* @param {number|undefined} contrast The contrast of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setContrast = function(contrast) {
@@ -287,7 +297,8 @@ goog.exportProperty(
/**
* Apply a hue-rotation to the layer. A value of 0 will leave the hue
* unchanged. Other values are radians around the color circle.
* @param {number|undefined} hue Hue.
* @param {number|undefined} hue The hue of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setHue = function(hue) {
@@ -300,7 +311,8 @@ goog.exportProperty(
/**
* @param {number|undefined} maxResolution MaxResolution.
* @param {number|undefined} maxResolution The maximum resolution of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setMaxResolution = function(maxResolution) {
@@ -313,7 +325,8 @@ goog.exportProperty(
/**
* @param {number|undefined} minResolution MinResolution.
* @param {number|undefined} minResolution The minimum resolution of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setMinResolution = function(minResolution) {
@@ -326,7 +339,8 @@ goog.exportProperty(
/**
* @param {number|undefined} opacity Opacity.
* @param {number|undefined} opacity The opacity of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setOpacity = function(opacity) {
@@ -344,7 +358,8 @@ goog.exportProperty(
* values are linear multipliers of the effect (and values over 1 are
* permitted).
*
* @param {number|undefined} saturation Saturation.
* @param {number|undefined} saturation The saturation of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setSaturation = function(saturation) {
@@ -357,7 +372,8 @@ goog.exportProperty(
/**
* @param {boolean|undefined} visible Visible.
* @param {boolean|undefined} visible The visiblity of the layer.
* @todo observable
* @todo api
*/
ol.layer.Base.prototype.setVisible = function(visible) {
+6 -4
View File
@@ -28,8 +28,6 @@ ol.layer.GroupProperty = {
* @constructor
* @extends {ol.layer.Base}
* @param {olx.layer.GroupOptions=} opt_options Layer options.
* @todo observable layers {ol.Collection} collection of {@link ol.layer} layers
* that are part of this group
* @todo api
*/
ol.layer.Group = function(opt_options) {
@@ -142,7 +140,9 @@ ol.layer.Group.prototype.handleLayersRemove_ = function(collectionEvent) {
/**
* @return {ol.Collection|undefined} Collection of layers.
* @return {ol.Collection|undefined} Collection of {@link ol.layer.Layer layers}
* that are part of this group.
* @todo observable
*/
ol.layer.Group.prototype.getLayers = function() {
return /** @type {ol.Collection|undefined} */ (this.get(
@@ -155,7 +155,9 @@ goog.exportProperty(
/**
* @param {ol.Collection|undefined} layers Collection of layers.
* @param {ol.Collection|undefined} layers Collection of
* {@link ol.layer.Layer layers} that are part of this group.
* @todo observable
*/
ol.layer.Group.prototype.setLayers = function(layers) {
this.set(ol.layer.GroupProperty.LAYERS, layers);
+4 -3
View File
@@ -18,7 +18,6 @@ ol.layer.TileProperty = {
* @extends {ol.layer.Layer}
* @fires ol.render.Event
* @param {olx.layer.TileOptions} options Tile layer options.
* @todo observable preload {number} the level to preload tiles up to
* @todo api
*/
ol.layer.Tile = function(options) {
@@ -29,7 +28,8 @@ goog.inherits(ol.layer.Tile, ol.layer.Layer);
/**
* @return {number|undefined} Preload.
* @return {number|undefined} The level to preload tiles up to.
* @todo observable
*/
ol.layer.Tile.prototype.getPreload = function() {
return /** @type {number|undefined} */ (
@@ -42,7 +42,8 @@ goog.exportProperty(
/**
* @param {number} preload Preload.
* @param {number} preload The level to preload tiles up to.
* @todo observable
*/
ol.layer.Tile.prototype.setPreload = function(preload) {
this.set(ol.layer.TileProperty.PRELOAD, preload);