From 787fd4aa4434d24963fa97a0b052354a20ae8273 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 15 Jan 2019 09:00:46 +0100 Subject: [PATCH] Don't dispatch change events when reading features Based on initial work by https://github.com/Jinkwon --- src/ol/format/EsriJSON.js | 2 +- src/ol/format/GPX.js | 6 +++--- src/ol/format/GeoJSON.js | 2 +- src/ol/format/IGC.js | 2 +- src/ol/format/KML.js | 10 +++++----- src/ol/format/MVT.js | 2 +- src/ol/format/OSMXML.js | 4 ++-- src/ol/format/TopoJSON.js | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 5563aad817..2cc30850fe 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -117,7 +117,7 @@ class EsriJSON extends JSONFeature { feature.setId(/** @type {number} */(esriJSONFeature.attributes[opt_options.idField])); } if (esriJSONFeature.attributes) { - feature.setProperties(esriJSONFeature.attributes); + feature.setProperties(esriJSONFeature.attributes, true); } return feature; } diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 0b4b8bb807..fffeebed6b 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -651,7 +651,7 @@ function readRte(node, objectStack) { const geometry = new LineString(flatCoordinates, layout); transformGeometryWithOptions(geometry, false, options); const feature = new Feature(geometry); - feature.setProperties(values); + feature.setProperties(values, true); return feature; } @@ -682,7 +682,7 @@ function readTrk(node, objectStack) { const geometry = new MultiLineString(flatCoordinates, layout, ends); transformGeometryWithOptions(geometry, false, options); const feature = new Feature(geometry); - feature.setProperties(values); + feature.setProperties(values, true); return feature; } @@ -704,7 +704,7 @@ function readWpt(node, objectStack) { const geometry = new Point(coordinates, layout); transformGeometryWithOptions(geometry, false, options); const feature = new Feature(geometry); - feature.setProperties(values); + feature.setProperties(values, true); return feature; } diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 8b05f7780d..8448457c1e 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -121,7 +121,7 @@ class GeoJSON extends JSONFeature { } if (geoJSONFeature['properties']) { - feature.setProperties(geoJSONFeature['properties']); + feature.setProperties(geoJSONFeature['properties'], true); } return feature; } diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index 3c173d12cb..fb2d71f306 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -159,7 +159,7 @@ class IGC extends TextFeature { const layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM; const lineString = new LineString(flatCoordinates, layout); const feature = new Feature(transformGeometryWithOptions(lineString, false, opt_options)); - feature.setProperties(properties); + feature.setProperties(properties, true); return feature; } diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 49e0b8c3e1..dd32a1e641 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -517,7 +517,7 @@ class KML extends XMLFeature { // we do not remove the styleUrl property from the object, so it // gets stored on feature when setProperties is called - feature.setProperties(object); + feature.setProperties(object, true); return feature; } @@ -1524,7 +1524,7 @@ function readLineString(node, objectStack) { readFlatCoordinatesFromNode(node, objectStack); if (flatCoordinates) { const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ); - lineString.setProperties(properties); + lineString.setProperties(properties, true); return lineString; } else { return undefined; @@ -1545,7 +1545,7 @@ function readLinearRing(node, objectStack) { readFlatCoordinatesFromNode(node, objectStack); if (flatCoordinates) { const polygon = new Polygon(flatCoordinates, GeometryLayout.XYZ, [flatCoordinates.length]); - polygon.setProperties(properties); + polygon.setProperties(properties, true); return polygon; } else { return undefined; @@ -1638,7 +1638,7 @@ function readPoint(node, objectStack) { readFlatCoordinatesFromNode(node, objectStack); if (flatCoordinates) { const point = new Point(flatCoordinates, GeometryLayout.XYZ); - point.setProperties(properties); + point.setProperties(properties, true); return point; } else { return undefined; @@ -1676,7 +1676,7 @@ function readPolygon(node, objectStack) { ends.push(flatCoordinates.length); } const polygon = new Polygon(flatCoordinates, GeometryLayout.XYZ, ends); - polygon.setProperties(properties); + polygon.setProperties(properties, true); return polygon; } else { return undefined; diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 62088e9b39..b92205f4a7 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -216,7 +216,7 @@ class MVT extends FeatureFormat { const geometry = transformGeometryWithOptions(geom, false, this.adaptOptions(opt_options)); feature.setGeometry(geometry); feature.setId(id); - feature.setProperties(values); + feature.setProperties(values, true); } return feature; diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index 050ad80b2e..3f3aa4c4e0 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -91,7 +91,7 @@ class OSMXML extends XMLFeature { transformGeometryWithOptions(geometry, false, options); const feature = new Feature(geometry); feature.setId(values.id); - feature.setProperties(values.tags); + feature.setProperties(values.tags, true); state.features.push(feature); } if (state.features) { @@ -137,7 +137,7 @@ function readNode(node, objectStack) { transformGeometryWithOptions(geometry, false, options); const feature = new Feature(geometry); feature.setId(id); - feature.setProperties(values.tags); + feature.setProperties(values.tags, true); state.features.push(feature); } } diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index d86701e589..10f00ab865 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -350,7 +350,7 @@ function readFeatureFromGeometry(object, arcs, scale, translate, property, name, properties[property] = name; } if (properties) { - feature.setProperties(properties); + feature.setProperties(properties, true); } return feature; }