Giving vector layers the style they deserve

Now vector layers can have a style. ol.Style instances have an
apply method to get the symbolizer literals for a feature. If the
layer does not have a style defined, there is also a static
applyDefaultStyle function on ol.Style to get the default
symbolizer literals for a feature. The vector layer also got a
groupFeaturesBySymbolizerLiteral method, which returns an array
with features grouped by symbolizer, as needed by the canvas
renderer.
This commit is contained in:
ahocevar
2013-03-02 17:38:01 +01:00
parent fcd5804d2d
commit f4a4522eb4
8 changed files with 162 additions and 35 deletions
+10
View File
@@ -37,6 +37,16 @@ ol.style.LineLiteral = function(config) {
goog.inherits(ol.style.LineLiteral, ol.style.SymbolizerLiteral);
/**
* @inheritDoc
*/
ol.style.LineLiteral.prototype.equals = function(lineLiteral) {
return this.strokeStyle == lineLiteral.strokeStyle &&
this.strokeWidth == lineLiteral.strokeWidth &&
this.opacity == lineLiteral.opacity;
};
/**
* @typedef {{strokeStyle: (string|ol.Expression),
* strokeWidth: (number|ol.Expression),