@deck.gl/aggregation-layers 8.9.5 → 8.9.7

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.
Files changed (51) hide show
  1. package/package.json +2 -2
  2. package/typed/aggregation-layer.js +151 -0
  3. package/typed/contour-layer/contour-layer.js +234 -0
  4. package/typed/contour-layer/contour-utils.js +64 -0
  5. package/typed/contour-layer/marching-squares-codes.js +337 -0
  6. package/typed/contour-layer/marching-squares.js +147 -0
  7. package/typed/cpu-grid-layer/cpu-grid-layer.js +129 -0
  8. package/typed/cpu-grid-layer/grid-aggregator.js +141 -0
  9. package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
  10. package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +141 -0
  11. package/typed/gpu-grid-layer/gpu-grid-cell-layer.js +143 -0
  12. package/typed/gpu-grid-layer/gpu-grid-layer.js +289 -0
  13. package/typed/grid-aggregation-layer.js +172 -0
  14. package/typed/grid-layer/grid-layer.js +60 -0
  15. package/typed/heatmap-layer/heatmap-layer-utils.js +78 -0
  16. package/typed/heatmap-layer/heatmap-layer.js +478 -0
  17. package/typed/heatmap-layer/max-fs.glsl.js +7 -0
  18. package/typed/heatmap-layer/max-vs.glsl.js +12 -0
  19. package/typed/heatmap-layer/triangle-layer-fragment.glsl.js +58 -0
  20. package/typed/heatmap-layer/triangle-layer-vertex.glsl.js +51 -0
  21. package/typed/heatmap-layer/triangle-layer.js +67 -0
  22. package/typed/heatmap-layer/weights-fs.glsl.js +19 -0
  23. package/typed/heatmap-layer/weights-vs.glsl.js +23 -0
  24. package/typed/hexagon-layer/hexagon-aggregator.js +112 -0
  25. package/typed/hexagon-layer/hexagon-layer.js +171 -0
  26. package/typed/index.js +33 -0
  27. package/typed/screen-grid-layer/screen-grid-cell-layer.js +159 -0
  28. package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.js +37 -0
  29. package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.js +83 -0
  30. package/typed/screen-grid-layer/screen-grid-layer.js +216 -0
  31. package/typed/types.js +1 -0
  32. package/typed/utils/aggregation-operation-utils.js +94 -0
  33. package/typed/utils/bin-sorter.js +167 -0
  34. package/typed/utils/color-utils.js +53 -0
  35. package/typed/utils/cpu-aggregator.js +417 -0
  36. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
  37. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
  38. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +31 -0
  39. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +77 -0
  40. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  41. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  42. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +562 -0
  43. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +36 -0
  44. package/typed/utils/grid-aggregation-utils.js +114 -0
  45. package/typed/utils/prop-utils.js +28 -0
  46. package/typed/utils/resource-utils.js +40 -0
  47. package/typed/utils/scale-utils.js +184 -0
  48. package/typed/heatmap-layer/heatmap-layer.orig.d.ts +0 -116
  49. package/typed/heatmap-layer/heatmap-layer.orig.d.ts.map +0 -1
  50. package/typed/heatmap-layer/heatmap-layer.patched.d.ts +0 -116
  51. package/typed/heatmap-layer/heatmap-layer.patched.d.ts.map +0 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/aggregation-layers",
3
3
  "description": "deck.gl layers that aggregate the input data into alternative representations",
4
4
  "license": "MIT",
5
- "version": "8.9.5",
5
+ "version": "8.9.7",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -40,5 +40,5 @@
40
40
  "@deck.gl/layers": "^8.0.0",
41
41
  "@luma.gl/core": "^8.0.0"
42
42
  },
43
- "gitHead": "001fc31bd3dfa02eb4a0caba299584952f2236f6"
43
+ "gitHead": "63e09fa6f5dbfc9111fb8b343444e8c3a7a0702b"
44
44
  }
@@ -0,0 +1,151 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { CompositeLayer, AttributeManager, _compareProps as compareProps } from '@deck.gl/core';
21
+ import { cssToDeviceRatio } from '@luma.gl/core';
22
+ import { filterProps } from './utils/prop-utils';
23
+ export default class AggregationLayer extends CompositeLayer {
24
+ initializeAggregationLayer(dimensions) {
25
+ super.initializeState(this.context);
26
+ this.setState({
27
+ // Layer props , when changed doesn't require updating aggregation
28
+ ignoreProps: filterProps(this.constructor._propTypes, dimensions.data.props),
29
+ dimensions
30
+ });
31
+ }
32
+ updateState(opts) {
33
+ super.updateState(opts);
34
+ const { changeFlags } = opts;
35
+ if (changeFlags.extensionsChanged) {
36
+ const shaders = this.getShaders({});
37
+ if (shaders && shaders.defines) {
38
+ shaders.defines.NON_INSTANCED_MODEL = 1;
39
+ }
40
+ this.updateShaders(shaders);
41
+ }
42
+ // Explictly call to update attributes as 'CompositeLayer' doesn't call this
43
+ this._updateAttributes();
44
+ }
45
+ updateAttributes(changedAttributes) {
46
+ // Super classes, can refer to state.changedAttributes to determine what
47
+ // attributes changed
48
+ this.setState({ changedAttributes });
49
+ }
50
+ getAttributes() {
51
+ return this.getAttributeManager().getShaderAttributes();
52
+ }
53
+ getModuleSettings() {
54
+ // For regular layer draw this happens during draw cycle (_drawLayersInViewport) not during update cycle
55
+ // For aggregation layers this is called during updateState to update aggregation data
56
+ // NOTE: it is similar to LayerPass._getModuleParameters() but doesn't inlcude `effects` it is not needed for aggregation
57
+ const { viewport, mousePosition, gl } = this.context;
58
+ const moduleSettings = Object.assign(Object.create(this.props), {
59
+ viewport,
60
+ mousePosition,
61
+ pickingActive: 0,
62
+ devicePixelRatio: cssToDeviceRatio(gl)
63
+ });
64
+ return moduleSettings;
65
+ }
66
+ updateShaders(shaders) {
67
+ // Default implemention is empty, subclasses can update their Model objects if needed
68
+ }
69
+ /**
70
+ * Checks if aggregation is dirty
71
+ * @param {Object} updateOpts - object {props, oldProps, changeFlags}
72
+ * @param {Object} params - object {dimension, compareAll}
73
+ * @param {Object} params.dimension - {props, accessors} array of props and/or accessors
74
+ * @param {Boolean} params.compareAll - when `true` it will include non layer props for comparision
75
+ * @returns {Boolean} - returns true if dimensions' prop or accessor is changed
76
+ **/
77
+ isAggregationDirty(updateOpts, params = {}) {
78
+ const { props, oldProps, changeFlags } = updateOpts;
79
+ const { compareAll = false, dimension } = params;
80
+ const { ignoreProps } = this.state;
81
+ const { props: dataProps, accessors = [] } = dimension;
82
+ const { updateTriggersChanged } = changeFlags;
83
+ if (changeFlags.dataChanged) {
84
+ return true;
85
+ }
86
+ if (updateTriggersChanged) {
87
+ if (updateTriggersChanged.all) {
88
+ return true;
89
+ }
90
+ for (const accessor of accessors) {
91
+ if (updateTriggersChanged[accessor]) {
92
+ return true;
93
+ }
94
+ }
95
+ }
96
+ if (compareAll) {
97
+ if (changeFlags.extensionsChanged) {
98
+ return true;
99
+ }
100
+ // Compare non layer props too (like extension props)
101
+ // ignoreprops refers to all Layer props other than aggregation props that need to be comapred
102
+ return compareProps({
103
+ oldProps,
104
+ newProps: props,
105
+ ignoreProps,
106
+ propTypes: this.constructor._propTypes
107
+ });
108
+ }
109
+ // Compare props of the dimension
110
+ for (const name of dataProps) {
111
+ if (props[name] !== oldProps[name]) {
112
+ return true;
113
+ }
114
+ }
115
+ return false;
116
+ }
117
+ /**
118
+ * Checks if an attribute is changed
119
+ * @param {String} name - name of the attribute
120
+ * @returns {Boolean} - `true` if attribute `name` is changed, `false` otherwise,
121
+ * If `name` is not passed or `undefiend`, `true` if any attribute is changed, `false` otherwise
122
+ **/
123
+ isAttributeChanged(name) {
124
+ const { changedAttributes } = this.state;
125
+ if (!name) {
126
+ // if name not specified return true if any attribute is changed
127
+ return !isObjectEmpty(changedAttributes);
128
+ }
129
+ return changedAttributes && changedAttributes[name] !== undefined;
130
+ }
131
+ // Private
132
+ // override Composite layer private method to create AttributeManager instance
133
+ _getAttributeManager() {
134
+ return new AttributeManager(this.context.gl, {
135
+ id: this.props.id,
136
+ stats: this.context.stats
137
+ });
138
+ }
139
+ }
140
+ AggregationLayer.layerName = 'AggregationLayer';
141
+ // Helper methods
142
+ // Returns true if given object is empty, false otherwise.
143
+ function isObjectEmpty(obj) {
144
+ let isEmpty = true;
145
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
146
+ for (const key in obj) {
147
+ isEmpty = false;
148
+ break;
149
+ }
150
+ return isEmpty;
151
+ }
@@ -0,0 +1,234 @@
1
+ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import GL from '@luma.gl/constants';
21
+ import { LineLayer, SolidPolygonLayer } from '@deck.gl/layers';
22
+ import { generateContours } from './contour-utils';
23
+ import { log } from '@deck.gl/core';
24
+ import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
25
+ import { AGGREGATION_OPERATION, getValueFunc } from '../utils/aggregation-operation-utils';
26
+ import { getBoundingBox, getGridParams } from '../utils/grid-aggregation-utils';
27
+ import GridAggregationLayer from '../grid-aggregation-layer';
28
+ const DEFAULT_COLOR = [255, 255, 255, 255];
29
+ const DEFAULT_STROKE_WIDTH = 1;
30
+ const DEFAULT_THRESHOLD = 1;
31
+ const defaultProps = {
32
+ // grid aggregation
33
+ cellSize: { type: 'number', min: 1, max: 1000, value: 1000 },
34
+ getPosition: { type: 'accessor', value: x => x.position },
35
+ getWeight: { type: 'accessor', value: 1 },
36
+ gpuAggregation: true,
37
+ aggregation: 'SUM',
38
+ // contour lines
39
+ contours: [{ threshold: DEFAULT_THRESHOLD }],
40
+ zOffset: 0.005
41
+ };
42
+ const POSITION_ATTRIBUTE_NAME = 'positions';
43
+ const DIMENSIONS = {
44
+ data: {
45
+ props: ['cellSize']
46
+ },
47
+ weights: {
48
+ props: ['aggregation'],
49
+ accessors: ['getWeight']
50
+ }
51
+ };
52
+ export default class ContourLayer extends GridAggregationLayer {
53
+ initializeState() {
54
+ super.initializeAggregationLayer({
55
+ dimensions: DIMENSIONS
56
+ });
57
+ this.setState({
58
+ contourData: {},
59
+ projectPoints: false,
60
+ weights: {
61
+ count: {
62
+ size: 1,
63
+ operation: AGGREGATION_OPERATION.SUM
64
+ }
65
+ }
66
+ });
67
+ const attributeManager = this.getAttributeManager();
68
+ attributeManager.add({
69
+ [POSITION_ATTRIBUTE_NAME]: {
70
+ size: 3,
71
+ accessor: 'getPosition',
72
+ type: GL.DOUBLE,
73
+ fp64: this.use64bitPositions()
74
+ },
75
+ // this attribute is used in gpu aggregation path only
76
+ count: { size: 3, accessor: 'getWeight' }
77
+ });
78
+ }
79
+ updateState(opts) {
80
+ super.updateState(opts);
81
+ let contoursChanged = false;
82
+ const { oldProps, props } = opts;
83
+ const { aggregationDirty } = this.state;
84
+ if (oldProps.contours !== props.contours || oldProps.zOffset !== props.zOffset) {
85
+ contoursChanged = true;
86
+ this._updateThresholdData(opts.props);
87
+ }
88
+ if (this.getNumInstances() > 0 && (aggregationDirty || contoursChanged)) {
89
+ this._generateContours();
90
+ }
91
+ }
92
+ renderLayers() {
93
+ const { contourSegments, contourPolygons } = this.state.contourData;
94
+ const LinesSubLayerClass = this.getSubLayerClass('lines', LineLayer);
95
+ const BandsSubLayerClass = this.getSubLayerClass('bands', SolidPolygonLayer);
96
+ // Contour lines layer
97
+ const lineLayer = contourSegments &&
98
+ contourSegments.length > 0 &&
99
+ new LinesSubLayerClass(this.getSubLayerProps({
100
+ id: 'lines'
101
+ }), {
102
+ data: this.state.contourData.contourSegments,
103
+ getSourcePosition: d => d.start,
104
+ getTargetPosition: d => d.end,
105
+ getColor: d => d.contour.color || DEFAULT_COLOR,
106
+ getWidth: d => d.contour.strokeWidth || DEFAULT_STROKE_WIDTH
107
+ });
108
+ // Contour bands layer
109
+ const bandsLayer = contourPolygons &&
110
+ contourPolygons.length > 0 &&
111
+ new BandsSubLayerClass(this.getSubLayerProps({
112
+ id: 'bands'
113
+ }), {
114
+ data: this.state.contourData.contourPolygons,
115
+ getPolygon: d => d.vertices,
116
+ getFillColor: d => d.contour.color || DEFAULT_COLOR
117
+ });
118
+ return [lineLayer, bandsLayer];
119
+ }
120
+ // Aggregation Overrides
121
+ /* eslint-disable max-statements, complexity */
122
+ updateAggregationState(opts) {
123
+ const { props, oldProps } = opts;
124
+ const { cellSize, coordinateSystem } = props;
125
+ const { viewport } = this.context;
126
+ const cellSizeChanged = oldProps.cellSize !== cellSize;
127
+ let gpuAggregation = props.gpuAggregation;
128
+ if (this.state.gpuAggregation !== props.gpuAggregation) {
129
+ if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.gl)) {
130
+ log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
131
+ gpuAggregation = false;
132
+ }
133
+ }
134
+ const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
135
+ this.setState({
136
+ gpuAggregation
137
+ });
138
+ const { dimensions } = this.state;
139
+ const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
140
+ const { data, weights } = dimensions;
141
+ let { boundingBox } = this.state;
142
+ if (positionsChanged) {
143
+ boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
144
+ this.setState({ boundingBox });
145
+ }
146
+ if (positionsChanged || cellSizeChanged) {
147
+ const { gridOffset, translation, width, height, numCol, numRow } = getGridParams(boundingBox, cellSize, viewport, coordinateSystem);
148
+ this.allocateResources(numRow, numCol);
149
+ this.setState({
150
+ gridOffset,
151
+ boundingBox,
152
+ translation,
153
+ posOffset: translation.slice(),
154
+ gridOrigin: [-1 * translation[0], -1 * translation[1]],
155
+ width,
156
+ height,
157
+ numCol,
158
+ numRow
159
+ });
160
+ }
161
+ const aggregationDataDirty = positionsChanged ||
162
+ gpuAggregationChanged ||
163
+ this.isAggregationDirty(opts, {
164
+ dimension: data,
165
+ compareAll: gpuAggregation // check for all (including extentions props) when using gpu aggregation
166
+ });
167
+ const aggregationWeightsDirty = this.isAggregationDirty(opts, {
168
+ dimension: weights
169
+ });
170
+ if (aggregationWeightsDirty) {
171
+ this._updateAccessors(opts);
172
+ }
173
+ if (aggregationDataDirty || aggregationWeightsDirty) {
174
+ this._resetResults();
175
+ }
176
+ this.setState({
177
+ aggregationDataDirty,
178
+ aggregationWeightsDirty
179
+ });
180
+ }
181
+ /* eslint-enable max-statements, complexity */
182
+ // Private (Aggregation)
183
+ _updateAccessors(opts) {
184
+ const { getWeight, aggregation, data } = opts.props;
185
+ const { count } = this.state.weights;
186
+ if (count) {
187
+ count.getWeight = getWeight;
188
+ count.operation = AGGREGATION_OPERATION[aggregation];
189
+ }
190
+ this.setState({ getValue: getValueFunc(aggregation, getWeight, { data }) });
191
+ }
192
+ _resetResults() {
193
+ const { count } = this.state.weights;
194
+ if (count) {
195
+ count.aggregationData = null;
196
+ }
197
+ }
198
+ // Private (Contours)
199
+ _generateContours() {
200
+ const { numCol, numRow, gridOrigin, gridOffset, thresholdData } = this.state;
201
+ const { count } = this.state.weights;
202
+ let { aggregationData } = count;
203
+ if (!aggregationData) {
204
+ aggregationData = count.aggregationBuffer.getData();
205
+ count.aggregationData = aggregationData;
206
+ }
207
+ const { cellWeights } = GPUGridAggregator.getCellData({ countsData: aggregationData });
208
+ const contourData = generateContours({
209
+ thresholdData,
210
+ cellWeights,
211
+ gridSize: [numCol, numRow],
212
+ gridOrigin,
213
+ cellSize: [gridOffset.xOffset, gridOffset.yOffset]
214
+ });
215
+ // contourData contains both iso-lines and iso-bands if requested.
216
+ this.setState({ contourData });
217
+ }
218
+ _updateThresholdData(props) {
219
+ const { contours, zOffset } = props;
220
+ const count = contours.length;
221
+ const thresholdData = new Array(count);
222
+ for (let i = 0; i < count; i++) {
223
+ const contour = contours[i];
224
+ thresholdData[i] = {
225
+ contour,
226
+ zIndex: contour.zIndex || i,
227
+ zOffset
228
+ };
229
+ }
230
+ this.setState({ thresholdData });
231
+ }
232
+ }
233
+ ContourLayer.layerName = 'ContourLayer';
234
+ ContourLayer.defaultProps = defaultProps;
@@ -0,0 +1,64 @@
1
+ import { getCode, getVertices, CONTOUR_TYPE } from './marching-squares';
2
+ // Given all the cell weights, generates contours for each threshold.
3
+ /* eslint-disable max-depth */
4
+ export function generateContours({ thresholdData, cellWeights, gridSize, gridOrigin, cellSize }) {
5
+ const contourSegments = [];
6
+ const contourPolygons = [];
7
+ const width = gridSize[0];
8
+ const height = gridSize[1];
9
+ let segmentIndex = 0;
10
+ let polygonIndex = 0;
11
+ for (const data of thresholdData) {
12
+ const { contour } = data;
13
+ const { threshold } = contour;
14
+ for (let x = -1; x < width; x++) {
15
+ for (let y = -1; y < height; y++) {
16
+ // Get the MarchingSquares code based on neighbor cell weights.
17
+ const { code, meanCode } = getCode({
18
+ cellWeights,
19
+ threshold,
20
+ x,
21
+ y,
22
+ width,
23
+ height
24
+ });
25
+ const opts = {
26
+ type: CONTOUR_TYPE.ISO_BANDS,
27
+ gridOrigin,
28
+ cellSize,
29
+ x,
30
+ y,
31
+ width,
32
+ height,
33
+ code,
34
+ meanCode,
35
+ thresholdData: data
36
+ };
37
+ if (Array.isArray(threshold)) {
38
+ opts.type = CONTOUR_TYPE.ISO_BANDS;
39
+ const polygons = getVertices(opts);
40
+ for (const polygon of polygons) {
41
+ contourPolygons[polygonIndex++] = {
42
+ vertices: polygon,
43
+ contour
44
+ };
45
+ }
46
+ }
47
+ else {
48
+ // Get the intersection vertices based on MarchingSquares code.
49
+ opts.type = CONTOUR_TYPE.ISO_LINES;
50
+ const vertices = getVertices(opts);
51
+ for (let i = 0; i < vertices.length; i += 2) {
52
+ contourSegments[segmentIndex++] = {
53
+ start: vertices[i],
54
+ end: vertices[i + 1],
55
+ contour
56
+ };
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ return { contourSegments, contourPolygons };
63
+ }
64
+ /* eslint-enable max-depth */