forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] only provide visiblity check when vector layer has joins (elas…
…tic#51388) (elastic#51686) * [Maps] only provide visiblity check when vector layer has joins * clean up * properly set line filter expression * use ternary statements instead of if * review feedback
- Loading branch information
Showing
5 changed files
with
102 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
x-pack/legacy/plugins/maps/public/layers/util/mb_filter_expressions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { GEO_JSON_TYPE, FEATURE_VISIBLE_PROPERTY_NAME } from '../../../common/constants'; | ||
|
||
const VISIBILITY_FILTER_CLAUSE = ['all', | ||
[ | ||
'==', | ||
['get', FEATURE_VISIBLE_PROPERTY_NAME], | ||
true | ||
] | ||
]; | ||
|
||
const CLOSED_SHAPE_MB_FILTER = [ | ||
'any', | ||
['==', ['geometry-type'], GEO_JSON_TYPE.POLYGON], | ||
['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_POLYGON] | ||
]; | ||
|
||
const VISIBLE_CLOSED_SHAPE_MB_FILTER = [ | ||
...VISIBILITY_FILTER_CLAUSE, | ||
CLOSED_SHAPE_MB_FILTER, | ||
]; | ||
|
||
const ALL_SHAPE_MB_FILTER = [ | ||
'any', | ||
['==', ['geometry-type'], GEO_JSON_TYPE.POLYGON], | ||
['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_POLYGON], | ||
['==', ['geometry-type'], GEO_JSON_TYPE.LINE_STRING], | ||
['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_LINE_STRING] | ||
]; | ||
|
||
const VISIBLE_ALL_SHAPE_MB_FILTER = [ | ||
...VISIBILITY_FILTER_CLAUSE, | ||
ALL_SHAPE_MB_FILTER, | ||
]; | ||
|
||
const POINT_MB_FILTER = [ | ||
'any', | ||
['==', ['geometry-type'], GEO_JSON_TYPE.POINT], | ||
['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_POINT] | ||
]; | ||
|
||
const VISIBLE_POINT_MB_FILTER = [ | ||
...VISIBILITY_FILTER_CLAUSE, | ||
POINT_MB_FILTER, | ||
]; | ||
|
||
export function getFillFilterExpression(hasJoins) { | ||
return hasJoins ? VISIBLE_CLOSED_SHAPE_MB_FILTER : CLOSED_SHAPE_MB_FILTER; | ||
} | ||
|
||
export function getLineFilterExpression(hasJoins) { | ||
return hasJoins ? VISIBLE_ALL_SHAPE_MB_FILTER : ALL_SHAPE_MB_FILTER; | ||
} | ||
|
||
export function getPointFilterExpression(hasJoins) { | ||
return hasJoins ? VISIBLE_POINT_MB_FILTER : POINT_MB_FILTER; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters