Allow for empty Point & GeometryCollection

This commit is contained in:
Erik Timmers
2014-07-15 12:59:26 +02:00
parent 4c03b3b35c
commit fe8a72dce5
2 changed files with 6 additions and 4 deletions

View File

@@ -585,13 +585,15 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) {
return geometries;
}
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
};
/**
* @return {!Array.<number>} All values in a point.
* @return {Array.<number>} All values in a point.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointText_ = function() {
@@ -601,7 +603,7 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
return [];
return null;
}
this.raiseError_();
};
@@ -810,7 +812,7 @@ ol.format.WKT.Parser.GeometryConstructor_ = {
/**
* @enum {(function(): !Array)}
* @enum {(function(): Array)}
* @private
*/
ol.format.WKT.Parser.GeometryParser_ = {