Features can now have symbolizers

If specified, feature symbolizers take precedence over rule
based styling.
This commit is contained in:
ahocevar
2013-03-03 18:55:52 +01:00
parent 44ca6c9ff6
commit f1120287c3
3 changed files with 96 additions and 29 deletions

View File

@@ -20,6 +20,12 @@ ol.Feature = function(opt_values) {
*/
this.geometryName_;
/**
* @type {Array.<ol.style.Symbolizer>}
* @private
*/
this.symbolizers_ = null;
};
goog.inherits(ol.Feature, ol.Object);
@@ -50,6 +56,22 @@ ol.Feature.prototype.getGeometry = function() {
};
/**
* @return {Array.<ol.style.SymbolizerLiteral>} Symbolizer literals.
*/
ol.Feature.prototype.getSymbolizerLiterals = function() {
var symbolizerLiterals = null;
if (!goog.isNull(this.symbolizers_)) {
var numSymbolizers = this.symbolizers_.length;
symbolizerLiterals = new Array(numSymbolizers);
for (var i = 0; i < numSymbolizers; ++i) {
symbolizerLiterals[i] = this.symbolizers_[i].createLiteral(this);
}
}
return symbolizerLiterals;
};
/**
* @inheritDoc
* @param {string} key Key.
@@ -74,6 +96,15 @@ ol.Feature.prototype.setGeometry = function(geometry) {
};
/**
* @param {Array.<ol.style.Symbolizer>} symbolizers Symbolizers for this
* features. If set, these take precedence over layer style.
*/
ol.Feature.prototype.setSymbolizers = function(symbolizers) {
this.symbolizers_ = symbolizers;
};
/**
* @const
* @type {string}