Files
openlayers/src/ol/layer.js
2012-07-11 21:18:47 +02:00

85 lines
1.3 KiB
JavaScript

goog.provide('ol.Layer');
goog.provide('ol.LayerProperty');
goog.require('ol.Object');
goog.require('ol.Store');
/**
* @enum {string}
*/
ol.LayerProperty = {
OPACITY: 'opacity',
VISIBLE: 'visible'
};
/**
* @constructor
* @extends {ol.Object}
* @param {ol.Store} store Store.
* @param {Object.<string, *>=} opt_values Values.
*/
ol.Layer = function(store, opt_values) {
goog.base(this);
/**
* @private
* @type {ol.Store}
*/
this.store_ = store;
this.setVisible(true);
this.setOpacity(1);
if (goog.isDef(opt_values)) {
this.setValues(opt_values);
}
};
goog.inherits(ol.Layer, ol.Object);
/**
* @return {number} Opacity.
*/
ol.Layer.prototype.getOpacity = function() {
return /** @type {number} */ (
this.get(ol.LayerProperty.OPACITY));
};
/**
* @return {ol.Store} Store.
*/
ol.Layer.prototype.getStore = function() {
return this.store_;
};
/**
* @return {boolean} Visible.
*/
ol.Layer.prototype.getVisible = function() {
return /** @type {boolean} */ (
this.get(ol.LayerProperty.VISIBLE));
};
/**
* @param {number} opacity Opacity.
*/
ol.Layer.prototype.setOpacity = function(opacity) {
this.set(ol.LayerProperty.OPACITY, opacity);
};
/**
* @param {boolean} visible Visible.
*/
ol.Layer.prototype.setVisible = function(visible) {
this.set(ol.LayerProperty.VISIBLE, visible);
};