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:
@@ -71,13 +71,13 @@ ol.style.Stroke.prototype.createLiteral = function(featureOrType) {
|
||||
this.color_, feature);
|
||||
goog.asserts.assertString(color, 'color must be a string');
|
||||
|
||||
var opacity = ol.expr.evaluateFeature(
|
||||
this.opacity_, feature);
|
||||
goog.asserts.assertNumber(opacity, 'opacity must be a number');
|
||||
var opacity = Number(ol.expr.evaluateFeature(
|
||||
this.opacity_, feature));
|
||||
goog.asserts.assert(!isNaN(opacity), 'opacity must be a number');
|
||||
|
||||
var width = ol.expr.evaluateFeature(
|
||||
this.width_, feature);
|
||||
goog.asserts.assertNumber(width, 'width must be a number');
|
||||
var width = Number(ol.expr.evaluateFeature(
|
||||
this.width_, feature));
|
||||
goog.asserts.assert(!isNaN(width), 'width must be a number');
|
||||
|
||||
var literal = null;
|
||||
if (type === ol.geom.GeometryType.LINESTRING ||
|
||||
|
||||
Reference in New Issue
Block a user