Accept linestrings and flat coordinates in MultiLineString constructor
This commit is contained in:
@@ -103,8 +103,7 @@ GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
const lineStrings = pushParseAndPop([],
|
||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
const multiLineString = new MultiLineString(null);
|
||||
multiLineString.setLineStrings(lineStrings);
|
||||
const multiLineString = new MultiLineString(lineStrings);
|
||||
return multiLineString;
|
||||
} else {
|
||||
return undefined;
|
||||
|
||||
@@ -323,11 +323,7 @@ GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
||||
const lineStrings = pushParseAndPop([],
|
||||
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
const multiLineString = new MultiLineString(null);
|
||||
multiLineString.setLineStrings(lineStrings);
|
||||
return multiLineString;
|
||||
} else {
|
||||
return undefined;
|
||||
return new MultiLineString(lineStrings);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -584,8 +584,7 @@ function readTrk(node, objectStack) {
|
||||
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (values['layoutOptions']);
|
||||
delete values['layoutOptions'];
|
||||
const layout = applyLayoutOptions(layoutOptions, flatCoordinates, ends);
|
||||
const geometry = new MultiLineString(null);
|
||||
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
const geometry = new MultiLineString(flatCoordinates, layout, ends);
|
||||
transformWithOptions(geometry, false, options);
|
||||
const feature = new Feature(geometry);
|
||||
feature.setProperties(values);
|
||||
|
||||
@@ -904,9 +904,7 @@ function readGxMultiTrack(node, objectStack) {
|
||||
if (!lineStrings) {
|
||||
return undefined;
|
||||
}
|
||||
const multiLineString = new MultiLineString(null);
|
||||
multiLineString.setLineStrings(lineStrings);
|
||||
return multiLineString;
|
||||
return new MultiLineString(lineStrings);
|
||||
}
|
||||
|
||||
|
||||
@@ -1107,8 +1105,7 @@ function readMultiGeometry(node, objectStack) {
|
||||
multiGeometry = new MultiPoint(flatCoordinates, layout);
|
||||
setCommonGeometryProperties(multiGeometry, geometries);
|
||||
} else if (type == GeometryType.LINE_STRING) {
|
||||
multiGeometry = new MultiLineString(null);
|
||||
multiGeometry.setLineStrings(geometries);
|
||||
multiGeometry = new MultiLineString(geometries);
|
||||
setCommonGeometryProperties(multiGeometry, geometries);
|
||||
} else if (type == GeometryType.POLYGON) {
|
||||
multiGeometry = new MultiPolygon(null);
|
||||
|
||||
@@ -343,13 +343,9 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
||||
geometryType === GeometryType.LINE_STRING ? new LineString(flatCoordinates, GeometryLayout.XY) :
|
||||
geometryType === GeometryType.POLYGON ? new Polygon(flatCoordinates, GeometryLayout.XY, ends) :
|
||||
geometryType === GeometryType.MULTI_POINT ? new MultiPoint(flatCoordinates, GeometryLayout.XY) :
|
||||
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(null) :
|
||||
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(flatCoordinates, GeometryLayout.XY, ends) :
|
||||
null;
|
||||
}
|
||||
if (geometryType !== GeometryType.POLYGON && geometryType !== GeometryType.LINE_STRING &&
|
||||
geometryType !== GeometryType.MULTI_POINT && geometryType !== GeometryType.POINT) {
|
||||
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
|
||||
}
|
||||
feature = new this.featureClass_();
|
||||
if (this.geometryName_) {
|
||||
feature.setGeometryName(this.geometryName_);
|
||||
|
||||
Reference in New Issue
Block a user