Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Oct 19, 2023
1 parent 2d70dd9 commit 9a88039
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/deckgl-layers/src/geojson-layer/filter-arrow-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import GL from '@luma.gl/constants';

import shaderModule from './filter-shader-module';

const VALUE_FILTERED = 1;

const defaultProps = {
getFiltered: {type: 'accessor', value: 1}
getFiltered: {type: 'accessor', value: VALUE_FILTERED}
};

export type FilterArrowExtensionProps = {
getFiltered?: () => number;
};

// Write an extension to filter arrow layer:
// an instanced attribute 'instanceFiltered' is added to the layer to indicate whether the feature has been Filtered
// the shader module is modified to discard the feature if instanceFiltered is 0
// the accessor getFiltered is used to get the value of instanceFiltered based on filteredIndex in Arrowlayer
// A simple extension to filter arrow layer based on the CPU filteredIndex, so we can avoid filtering on the raw Arrow table.
// Specifically, an attribute `filtered` is added to the layer to indicate whether the feature has been Filtered
// the shader module is modified to discard the feature if filtered value is 0
// the accessor getFiltered is used to get the value of `filtered` based on eht value `filteredIndex` in Arrowlayer
export default class FilterArrowExtension extends LayerExtension {
static defaultProps = defaultProps;
static extensionName = 'FilterArrowExtension';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export default {
fs: fs,
inject: inject,
getUniforms: () => {}
}
};

0 comments on commit 9a88039

Please sign in to comment.