From bcd92934315bbe8d5813db55845a76cde39bb82b Mon Sep 17 00:00:00 2001 From: David Manthey Date: Wed, 29 Jun 2022 14:31:28 -0400 Subject: [PATCH] perf: Allow using the rdp functions on non-feature polygons. --- CHANGELOG.md | 12 ++++++++++++ src/polygonFeature.js | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50ad98dd5f..6c4d4b9873 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ ## Version 1.10.5 +### Improvements + +- Allow using the rdp functions on non-feature polygons ([#1234](../../pull/1234)) + +## Version 1.10.5 + +### Bug Fixes + +- Guard texture update calls ([#1233](../../pull/1233)) + +## Version 1.10.5 + ### Bug Fixes - Guard converting an empty polygon ([#1232](../../pull/1232)) diff --git a/src/polygonFeature.js b/src/polygonFeature.js index efb11ef1cd..6a06a86883 100644 --- a/src/polygonFeature.js +++ b/src/polygonFeature.js @@ -573,9 +573,11 @@ var polygonFeature = function (arg) { * get the position of each vertex. * @param {function} [polyFunc=this.style.get('polygon')] The function to * get each polygon. - * @returns {this} + * @param {boolean} [returnData=false] If truthy, return the new data array + * rather than modifying the feature. + * @returns {this|array} */ - this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc) { + this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc, returnData) { var map = m_this.layer().map(), mapgcs = map.gcs(), featuregcs = m_this.gcs(), @@ -633,6 +635,9 @@ var polygonFeature = function (arg) { } return elem; }); + if (returnData) { + return data; + } /* Set the reduced polgons as the data and use simple accessors. */ m_this.style('position', util.identityFunction);