Skip to content

Commit

Permalink
feat(data-layer): add filter property for client side filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach committed Sep 7, 2020
1 parent 4d1ea82 commit d357747
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/scripts/hooks/use-globe-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ export function useGlobeLayer(
imageryProvider
);

const filterLinear = imageLayer.filter === 'linear';

// @ts-ignore
newLayer.minificationFilter = TextureMinificationFilter.NEAREST;
newLayer.minificationFilter = filterLinear
? TextureMinificationFilter.LINEAR
: TextureMinificationFilter.NEAREST;
// @ts-ignore
newLayer.magnificationFilter = TextureMagnificationFilter.NEAREST;
newLayer.magnificationFilter = filterLinear
? TextureMagnificationFilter.LINEAR
: TextureMagnificationFilter.NEAREST;
newLayer.alpha = 1;

// remove and destroy old layers if they exist
Expand Down
3 changes: 2 additions & 1 deletion src/scripts/libs/get-image-layer-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function getImageLayerData(
type: layer.type,
url: replacedUrl,
nextUrls,
zoomLevels: layer.zoomLevels || 0
zoomLevels: layer.zoomLevels || 0,
filter: layer.filter
};
}

Expand Down
1 change: 1 addition & 0 deletions src/scripts/types/globe-image-layer-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export interface GlobeImageLayerData {
url: string;
nextUrls: string[];
zoomLevels: number;
filter?: string;
}
1 change: 1 addition & 0 deletions src/scripts/types/layer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Layer {
minute?: 'numeric' | '2-digit';
second?: 'numeric' | '2-digit';
};
filter?: string;
minValue: number;
maxValue: number;
units: string;
Expand Down

0 comments on commit d357747

Please sign in to comment.