Accept polygons and flat coordinates in MultiPolygon constructor
This commit is contained in:
@@ -122,11 +122,7 @@ GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
||||
const polygons = pushParseAndPop([],
|
||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
const multiPolygon = new MultiPolygon(null);
|
||||
multiPolygon.setPolygons(polygons);
|
||||
return multiPolygon;
|
||||
} else {
|
||||
return undefined;
|
||||
return new MultiPolygon(polygons);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -337,11 +337,7 @@ GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
||||
/** @type {Array.<module:ol/geom/Polygon>} */
|
||||
const polygons = pushParseAndPop([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
const multiPolygon = new MultiPolygon(null);
|
||||
multiPolygon.setPolygons(polygons);
|
||||
return multiPolygon;
|
||||
} else {
|
||||
return undefined;
|
||||
return new MultiPolygon(polygons);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1108,8 +1108,7 @@ function readMultiGeometry(node, objectStack) {
|
||||
multiGeometry = new MultiLineString(geometries);
|
||||
setCommonGeometryProperties(multiGeometry, geometries);
|
||||
} else if (type == GeometryType.POLYGON) {
|
||||
multiGeometry = new MultiPolygon(null);
|
||||
multiGeometry.setPolygons(geometries);
|
||||
multiGeometry = new MultiPolygon(geometries);
|
||||
setCommonGeometryProperties(multiGeometry, geometries);
|
||||
} else if (type == GeometryType.GEOMETRY_COLLECTION) {
|
||||
multiGeometry = new GeometryCollection(geometries);
|
||||
|
||||
@@ -311,7 +311,7 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
||||
values[this.layerName_] = rawFeature.layer.name;
|
||||
|
||||
const flatCoordinates = [];
|
||||
let ends = [];
|
||||
const ends = [];
|
||||
this.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
|
||||
|
||||
const geometryType = getGeometryType(type, ends.length);
|
||||
@@ -333,8 +333,7 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
||||
offset = end;
|
||||
}
|
||||
if (endss.length > 1) {
|
||||
ends = endss;
|
||||
geom = new MultiPolygon(null);
|
||||
geom = new MultiPolygon(flatCoordinates, GeometryLayout.XY, endss);
|
||||
} else {
|
||||
geom = new Polygon(flatCoordinates, GeometryLayout.XY, ends);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user