Do not accept null coordinates in Point constructor

This commit is contained in:
ahocevar
2018-07-07 14:48:46 +02:00
parent da0838dde2
commit c0d04ea077
8 changed files with 31 additions and 44 deletions

View File

@@ -291,9 +291,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) {
GMLBase.prototype.readPoint = function(node, objectStack) {
const flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
const point = new Point(null);
point.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
return point;
return new Point(flatCoordinates, GeometryLayout.XYZ);
}
};

View File

@@ -1144,8 +1144,7 @@ function readPoint(node, objectStack) {
const flatCoordinates =
readFlatCoordinatesFromNode(node, objectStack);
if (flatCoordinates) {
const point = new Point(null);
point.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
const point = new Point(flatCoordinates, GeometryLayout.XYZ);
point.setProperties(properties);
return point;
} else {

View File

@@ -339,14 +339,14 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
geom = new Polygon(flatCoordinates, GeometryLayout.XY, ends);
}
} else {
geom = geometryType === GeometryType.POINT ? new Point(null) :
geom = geometryType === GeometryType.POINT ? new Point(flatCoordinates, GeometryLayout.XY) :
geometryType === GeometryType.LINE_STRING ? new LineString(null) :
geometryType === GeometryType.POLYGON ? new Polygon(flatCoordinates, GeometryLayout.XY, ends) :
geometryType === GeometryType.MULTI_POINT ? new MultiPoint (null) :
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(null) :
null;
}
if (geometryType !== GeometryType.POLYGON) {
if (geometryType !== GeometryType.POLYGON && geometryType !== GeometryType.POINT) {
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
}
feature = new this.featureClass_();