Add ol.layer.Vector
This commit is contained in:
@@ -418,6 +418,22 @@
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.layer.VectorOptions
|
||||
* @property {number|undefined} brightness Brightness.
|
||||
* @property {number|undefined} contrast Contrast.
|
||||
* @property {number|undefined} hue Hue.
|
||||
* @property {number|undefined} minResolution The minimum resolution
|
||||
* (inclusive) at which this layer will be visible.
|
||||
* @property {number|undefined} maxResolution The maximum resolution
|
||||
* (exclusive) below which this layer will be visible.
|
||||
* @property {number|undefined} opacity Opacity. 0-1. Default is `1`.
|
||||
* @property {number|undefined} saturation Saturation.
|
||||
* @property {ol.source.Vector} source Source.
|
||||
* @property {ol.style.StyleFunction|undefined} styleFunction Style function.
|
||||
* @property {boolean|undefined} visible Visibility. Default is `true` (visible).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.source.BingMapsOptions
|
||||
* @property {string|undefined} culture Culture.
|
||||
|
||||
67
src/ol/layer/vectorlayer.js
Normal file
67
src/ol/layer/vectorlayer.js
Normal file
@@ -0,0 +1,67 @@
|
||||
goog.provide('ol.layer.Vector');
|
||||
|
||||
goog.require('ol.layer.Layer');
|
||||
goog.require('ol.source.Vector');
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.layer.VectorProperty = {
|
||||
STYLE_FUNCTION: 'styleFunction'
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.layer.Layer}
|
||||
* @param {ol.layer.VectorOptions=} opt_options Options.
|
||||
*/
|
||||
ol.layer.Vector = function(opt_options) {
|
||||
|
||||
var options = goog.isDef(opt_options) ?
|
||||
opt_options : /** @type {ol.layer.VectorOptions} */ ({});
|
||||
|
||||
goog.base(this, /** @type {ol.layer.LayerOptions} */ (options));
|
||||
|
||||
// FIXME veryify this
|
||||
if (goog.isDef(options.styleFunction)) {
|
||||
this.setStyleFunction(options.styleFunction);
|
||||
}
|
||||
|
||||
};
|
||||
goog.inherits(ol.layer.Vector, ol.layer.Layer);
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.style.StyleFunction|undefined} Style function.
|
||||
*/
|
||||
ol.layer.Vector.prototype.getStyleFunction = function() {
|
||||
return /** @type {ol.style.StyleFunction|undefined} */ (
|
||||
this.get(ol.layer.VectorProperty.STYLE_FUNCTION));
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.layer.Vector.prototype,
|
||||
'getStyleFunction',
|
||||
ol.layer.Vector.prototype.getStyleFunction);
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.source.Source} Vector source.
|
||||
*/
|
||||
ol.layer.Vector.prototype.getVectorSource = function() {
|
||||
return /** @type {ol.source.Vector} */ (this.getSource());
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.style.StyleFunction|undefined} styleFunction Style function.
|
||||
*/
|
||||
ol.layer.Vector.prototype.setStyleFunction = function(styleFunction) {
|
||||
this.set(ol.layer.VectorProperty.STYLE_FUNCTION, styleFunction);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.layer.Vector.prototype,
|
||||
'setStyleFunction',
|
||||
ol.layer.Vector.prototype.setStyleFunction);
|
||||
Reference in New Issue
Block a user