Accept flat coordinates in LineString constructor
This commit is contained in:
@@ -272,8 +272,7 @@ GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
const flatCoordinates = pushParseAndPop([null],
|
||||
this.CURVE_PARSERS_, node, objectStack, this);
|
||||
if (flatCoordinates) {
|
||||
const lineString = new LineString(null);
|
||||
lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
|
||||
const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ);
|
||||
return lineString;
|
||||
} else {
|
||||
return undefined;
|
||||
|
||||
@@ -388,8 +388,7 @@ GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
|
||||
GMLBase.prototype.readLineString = function(node, objectStack) {
|
||||
const flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
|
||||
if (flatCoordinates) {
|
||||
const lineString = new LineString(null);
|
||||
lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
|
||||
const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ);
|
||||
return lineString;
|
||||
} else {
|
||||
return undefined;
|
||||
|
||||
@@ -553,8 +553,7 @@ function readRte(node, objectStack) {
|
||||
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (values['layoutOptions']);
|
||||
delete values['layoutOptions'];
|
||||
const layout = applyLayoutOptions(layoutOptions, flatCoordinates);
|
||||
const geometry = new LineString(null);
|
||||
geometry.setFlatCoordinates(layout, flatCoordinates);
|
||||
const geometry = new LineString(flatCoordinates, layout);
|
||||
transformWithOptions(geometry, false, options);
|
||||
const feature = new Feature(geometry);
|
||||
feature.setProperties(values);
|
||||
|
||||
@@ -168,9 +168,8 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
if (flatCoordinates.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const lineString = new LineString(null);
|
||||
const layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM;
|
||||
lineString.setFlatCoordinates(layout, flatCoordinates);
|
||||
const lineString = new LineString(flatCoordinates, layout);
|
||||
const feature = new Feature(transformWithOptions(lineString, false, opt_options));
|
||||
feature.setProperties(properties);
|
||||
return feature;
|
||||
|
||||
@@ -942,9 +942,7 @@ function readGxTrack(node, objectStack) {
|
||||
for (let i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii; ++i) {
|
||||
flatCoordinates[4 * i + 3] = whens[i];
|
||||
}
|
||||
const lineString = new LineString(null);
|
||||
lineString.setFlatCoordinates(GeometryLayout.XYZM, flatCoordinates);
|
||||
return lineString;
|
||||
return new LineString(flatCoordinates, GeometryLayout.XYZM);
|
||||
}
|
||||
|
||||
|
||||
@@ -1025,8 +1023,7 @@ function readLineString(node, objectStack) {
|
||||
const flatCoordinates =
|
||||
readFlatCoordinatesFromNode(node, objectStack);
|
||||
if (flatCoordinates) {
|
||||
const lineString = new LineString(null);
|
||||
lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
|
||||
const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ);
|
||||
lineString.setProperties(properties);
|
||||
return lineString;
|
||||
} else {
|
||||
|
||||
@@ -340,13 +340,13 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
||||
}
|
||||
} else {
|
||||
geom = geometryType === GeometryType.POINT ? new Point(flatCoordinates, GeometryLayout.XY) :
|
||||
geometryType === GeometryType.LINE_STRING ? new LineString(null) :
|
||||
geometryType === GeometryType.LINE_STRING ? new LineString(flatCoordinates, GeometryLayout.XY) :
|
||||
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 && geometryType !== GeometryType.POINT) {
|
||||
if (geometryType !== GeometryType.POLYGON && geometryType !== GeometryType.LINE_STRING && geometryType !== GeometryType.POINT) {
|
||||
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
|
||||
}
|
||||
feature = new this.featureClass_();
|
||||
|
||||
@@ -177,8 +177,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
// closed way
|
||||
geometry = new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);
|
||||
} else {
|
||||
geometry = new LineString(null);
|
||||
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
||||
geometry = new LineString(flatCoordinates, GeometryLayout.XY);
|
||||
}
|
||||
transformWithOptions(geometry, false, options);
|
||||
const feature = new Feature(geometry);
|
||||
|
||||
Reference in New Issue
Block a user