Cast to numbers for literals
There are times when we parse from XML without a schema (e.g. KML). In these cases, features attributes will always be strings. We can cast to number when creating literals from symbolizers and then assert `!isNaN` instead of asserting that they are numbers before.
This commit is contained in:
@@ -64,9 +64,8 @@ ol.style.Fill.prototype.createLiteral = function(featureOrType) {
|
||||
goog.asserts.assertString(
|
||||
color, 'color must be a string');
|
||||
|
||||
var opacity = ol.expr.evaluateFeature(this.opacity_, feature);
|
||||
goog.asserts.assertNumber(
|
||||
opacity, 'color must be a number');
|
||||
var opacity = Number(ol.expr.evaluateFeature(this.opacity_, feature));
|
||||
goog.asserts.assert(!isNaN(opacity), 'opacity must be a number');
|
||||
|
||||
literal = new ol.style.PolygonLiteral({
|
||||
fillColor: color,
|
||||
|
||||
Reference in New Issue
Block a user