imerss-bioinfo 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -72,8 +72,19 @@ hortis.libreMap.polygonFilter.summarise = function (filterState) {
|
|
|
72
72
|
return hortis.countSummary(filterState.length, ["polygon", "polygons"]);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Filter observations to those lying within any of the polygons drawn. The polygons arrive as component material, read
|
|
77
|
+
* through a proxy which tracks each access - since every observation is tested against every vertex of the polygons,
|
|
78
|
+
* their bare values are read instead, which is many times faster.
|
|
79
|
+
* @param {Object[]} obsRows - The observations
|
|
80
|
+
* @param {Object[]} filterState - The polygons drawn, as GeoJSON features, possibly as a proxy
|
|
81
|
+
* @param {Map<Object, Object>} pointCache - Map of each observation to its point, possibly as a proxy
|
|
82
|
+
* @return {Object[]} The observations within any of the polygons
|
|
83
|
+
*/
|
|
75
84
|
hortis.libreMap.polygonFilter.doFilter = function (obsRows, filterState, pointCache) {
|
|
76
|
-
|
|
85
|
+
const features = fluid.unwrapProxy(filterState);
|
|
86
|
+
const points = fluid.unwrapProxy(pointCache);
|
|
87
|
+
return features.length === 0 ? obsRows : obsRows.filter(row => hortis.intersectsAnyFeature(features, points.get(row)));
|
|
77
88
|
};
|
|
78
89
|
|
|
79
90
|
hortis.libreMap.polygonFilter.reset = function (that) {
|