Allow for empty Point & GeometryCollection
This commit is contained in:
@@ -585,13 +585,15 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
|
|||||||
if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) {
|
if (this.match(ol.format.WKT.TokenType.RIGHT_PAREN)) {
|
||||||
return geometries;
|
return geometries;
|
||||||
}
|
}
|
||||||
|
} else if (this.isEmptyGeometry_()) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
this.raiseError_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {!Array.<number>} All values in a point.
|
* @return {Array.<number>} All values in a point.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WKT.Parser.prototype.parsePointText_ = function() {
|
ol.format.WKT.Parser.prototype.parsePointText_ = function() {
|
||||||
@@ -601,7 +603,7 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
|
|||||||
return coordinates;
|
return coordinates;
|
||||||
}
|
}
|
||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return null;
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
this.raiseError_();
|
||||||
};
|
};
|
||||||
@@ -810,7 +812,7 @@ ol.format.WKT.Parser.GeometryConstructor_ = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {(function(): !Array)}
|
* @enum {(function(): Array)}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WKT.Parser.GeometryParser_ = {
|
ol.format.WKT.Parser.GeometryParser_ = {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ ol.geom.Point.prototype.closestPointXY =
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.geom.Point.prototype.getCoordinates = function() {
|
ol.geom.Point.prototype.getCoordinates = function() {
|
||||||
return this.flatCoordinates.slice();
|
return goog.isNull(this.flatCoordinates) ? [] : this.flatCoordinates.slice();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user