From 01cb568a508f6423e7adbd7ade7a45ed1c796b12 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 10 Jul 2012 17:36:20 +0200 Subject: [PATCH] Rename Layer to Store and LayerRendereOptions to Layer --- src/all.js | 4 +- src/ol/layer.js | 63 +++++++++++---------- src/ol/layerrendereroptions.js | 79 -------------------------- src/ol/store.js | 80 +++++++++++++++++++++++++++ src/ol/{tilelayer.js => tilestore.js} | 14 ++--- 5 files changed, 120 insertions(+), 120 deletions(-) delete mode 100644 src/ol/layerrendereroptions.js create mode 100644 src/ol/store.js rename src/ol/{tilelayer.js => tilestore.js} (70%) diff --git a/src/all.js b/src/all.js index 1d8f95810e..cd57d0dd57 100644 --- a/src/all.js +++ b/src/all.js @@ -5,13 +5,13 @@ goog.require('ol.Bounds'); goog.require('ol.Camera'); goog.require('ol.Extent'); goog.require('ol.Layer'); -goog.require('ol.LayerRendererOptions'); goog.require('ol.Object'); goog.require('ol.Projection'); +goog.require('ol.Store'); goog.require('ol.TileBounds'); goog.require('ol.TileCoord'); goog.require('ol.TileGrid'); -goog.require('ol.TileLayer'); +goog.require('ol.TileStore'); goog.require('ol.TileUrlFunction'); goog.require('ol.TileUrlFunctionType'); goog.require('ol.TransformFunction'); diff --git a/src/ol/layer.js b/src/ol/layer.js index 759230ef04..6048010d70 100644 --- a/src/ol/layer.js +++ b/src/ol/layer.js @@ -1,18 +1,16 @@ goog.provide('ol.Layer'); -goog.require('ol.Extent'); goog.require('ol.Object'); -goog.require('ol.Projection'); +goog.require('ol.Store'); /** * @enum {string} * @private */ -ol.LayerProperty_ = { - ATTRIBUTION: 'attribution', - EXTENT: 'extent', - PROJECTION: 'projection' +ol.LayerRendererOptionsProperty_ = { + OPACITY: 'opacity', + VISIBLE: 'visible' }; @@ -20,61 +18,62 @@ ol.LayerProperty_ = { /** * @constructor * @extends {ol.Object} + * @param {ol.Store} store Store. */ -ol.Layer = function() { +ol.Layer = function(store) { goog.base(this); - this.setExtent(null); - this.setProjection(null); + /** + * @private + * @type {ol.Store} + */ + this.store_ = store; + + this.setVisible(true); + this.setOpacity(1); }; goog.inherits(ol.Layer, ol.Object); /** - * @return {string|undefined} Attribution. + * @return {number} Opacity. */ -ol.Layer.prototype.getAttribution = function() { - return /** @type {string} */ (this.get(ol.LayerProperty_.ATTRIBUTION)); +ol.Layer.prototype.getOpacity = function() { + return /** @type {number} */ ( + this.get(ol.LayerRendererOptionsProperty_.OPACITY)); }; /** - * @return {ol.Extent} Extent. + * @return {ol.Store} Store. */ -ol.Layer.prototype.getExtent = function() { - return /** @type {ol.Extent} */ (this.get(ol.LayerProperty_.EXTENT)); +ol.Layer.prototype.getStore = function() { + return this.store_; }; /** - * @return {ol.Projection} Projection. + * @return {boolean} Visible. */ -ol.Layer.prototype.getProjection = function() { - return /** @type {ol.Projection} */ (this.get(ol.LayerProperty_.PROJECTION)); +ol.Layer.prototype.getVisible = function() { + return /** @type {boolean} */ ( + this.get(ol.LayerRendererOptionsProperty_.VISIBLE)); }; /** - * @param {string|undefined} attribution Attribution. + * @param {number} opacity Opacity. */ -ol.Layer.prototype.setAttribution = function(attribution) { - this.set(ol.LayerProperty_.ATTRIBUTION, attribution); +ol.Layer.prototype.setOpacity = function(opacity) { + this.set(ol.LayerRendererOptionsProperty_.OPACITY, opacity); }; /** - * @param {ol.Extent} extent Extent. + * @param {boolean} visible Visible. */ -ol.Layer.prototype.setExtent = function(extent) { - this.set(ol.LayerProperty_.EXTENT, extent); -}; - - -/** - * @param {ol.Projection} projection Projetion. - */ -ol.Layer.prototype.setProjection = function(projection) { - this.set(ol.LayerProperty_.PROJECTION, projection); +ol.Layer.prototype.setVisible = function(visible) { + this.set(ol.LayerRendererOptionsProperty_.VISIBLE, visible); }; diff --git a/src/ol/layerrendereroptions.js b/src/ol/layerrendereroptions.js deleted file mode 100644 index ef6d02f8a7..0000000000 --- a/src/ol/layerrendereroptions.js +++ /dev/null @@ -1,79 +0,0 @@ -goog.provide('ol.LayerRendererOptions'); - -goog.require('ol.Layer'); -goog.require('ol.Object'); - - -/** - * @enum {string} - * @private - */ -ol.LayerRendererOptionsProperty_ = { - OPACITY: 'opacity', - VISIBLE: 'visible' -}; - - - -/** - * @constructor - * @extends {ol.Object} - * @param {ol.Layer} layer Layer. - */ -ol.LayerRendererOptions = function(layer) { - - goog.base(this); - - /** - * @private - * @type {ol.Layer} - */ - this.layer_ = layer; - - this.setVisible(true); - this.setOpacity(1); - -}; -goog.inherits(ol.LayerRendererOptions, ol.Object); - - -/** - * @return {ol.Layer} Layer. - */ -ol.LayerRendererOptions.prototype.getLayer = function() { - return this.layer_; -}; - - -/** - * @return {number} Opacity. - */ -ol.LayerRendererOptions.prototype.getOpacity = function() { - return /** @type {number} */ ( - this.get(ol.LayerRendererOptionsProperty_.OPACITY)); -}; - - -/** - * @return {boolean} Visible. - */ -ol.LayerRendererOptions.prototype.getVisible = function() { - return /** @type {boolean} */ ( - this.get(ol.LayerRendererOptionsProperty_.VISIBLE)); -}; - - -/** - * @param {number} opacity Opacity. - */ -ol.LayerRendererOptions.prototype.setOpacity = function(opacity) { - this.set(ol.LayerRendererOptionsProperty_.OPACITY, opacity); -}; - - -/** - * @param {boolean} visible Visible. - */ -ol.LayerRendererOptions.prototype.setVisible = function(visible) { - this.set(ol.LayerRendererOptionsProperty_.VISIBLE, visible); -}; diff --git a/src/ol/store.js b/src/ol/store.js new file mode 100644 index 0000000000..0f0d218db1 --- /dev/null +++ b/src/ol/store.js @@ -0,0 +1,80 @@ +goog.provide('ol.Store'); + +goog.require('ol.Extent'); +goog.require('ol.Object'); +goog.require('ol.Projection'); + + +/** + * @enum {string} + * @private + */ +ol.StoreProperty_ = { + ATTRIBUTION: 'attribution', + EXTENT: 'extent', + PROJECTION: 'projection' +}; + + + +/** + * @constructor + * @extends {ol.Object} + */ +ol.Store = function() { + + goog.base(this); + + this.setExtent(null); + this.setProjection(null); + +}; +goog.inherits(ol.Store, ol.Object); + + +/** + * @return {string|undefined} Attribution. + */ +ol.Store.prototype.getAttribution = function() { + return /** @type {string} */ (this.get(ol.StoreProperty_.ATTRIBUTION)); +}; + + +/** + * @return {ol.Extent} Extent. + */ +ol.Store.prototype.getExtent = function() { + return /** @type {ol.Extent} */ (this.get(ol.StoreProperty_.EXTENT)); +}; + + +/** + * @return {ol.Projection} Projection. + */ +ol.Store.prototype.getProjection = function() { + return /** @type {ol.Projection} */ (this.get(ol.StoreProperty_.PROJECTION)); +}; + + +/** + * @param {string|undefined} attribution Attribution. + */ +ol.Store.prototype.setAttribution = function(attribution) { + this.set(ol.StoreProperty_.ATTRIBUTION, attribution); +}; + + +/** + * @param {ol.Extent} extent Extent. + */ +ol.Store.prototype.setExtent = function(extent) { + this.set(ol.StoreProperty_.EXTENT, extent); +}; + + +/** + * @param {ol.Projection} projection Projetion. + */ +ol.Store.prototype.setProjection = function(projection) { + this.set(ol.StoreProperty_.PROJECTION, projection); +}; diff --git a/src/ol/tilelayer.js b/src/ol/tilestore.js similarity index 70% rename from src/ol/tilelayer.js rename to src/ol/tilestore.js index 56ce521939..d2d708da90 100644 --- a/src/ol/tilelayer.js +++ b/src/ol/tilestore.js @@ -1,6 +1,6 @@ -goog.provide('ol.TileLayer'); +goog.provide('ol.TileStore'); -goog.require('ol.Layer'); +goog.require('ol.Store'); goog.require('ol.TileCoord'); goog.require('ol.TileGrid'); goog.require('ol.TileUrlFunctionType'); @@ -9,11 +9,11 @@ goog.require('ol.TileUrlFunctionType'); /** * @constructor - * @extends {ol.Layer} + * @extends {ol.Store} * @param {ol.TileGrid} tileGrid Tile grid. * @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL. */ -ol.TileLayer = function(tileGrid, tileUrlFunction) { +ol.TileStore = function(tileGrid, tileUrlFunction) { goog.base(this); @@ -30,14 +30,14 @@ ol.TileLayer = function(tileGrid, tileUrlFunction) { this.tileUrlFunction_ = tileUrlFunction; }; -goog.inherits(ol.TileLayer, ol.Layer); +goog.inherits(ol.TileStore, ol.Store); /** * @param {ol.TileCoord} tileCoord Tile coordinate. * @return {string} Tile coord URL. */ -ol.TileLayer.prototype.getTileCoordUrl = function(tileCoord) { +ol.TileStore.prototype.getTileCoordUrl = function(tileCoord) { // FIXME maybe wrap x and y return this.tileUrlFunction_(tileCoord); }; @@ -46,6 +46,6 @@ ol.TileLayer.prototype.getTileCoordUrl = function(tileCoord) { /** * @return {ol.TileGrid} Tile grid. */ -ol.TileLayer.prototype.getTileGrid = function() { +ol.TileStore.prototype.getTileGrid = function() { return this.tileGrid_; };