mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-25 09:33:48 +01:00
🎨 adding any, none, has, !has, >, < and <= style filters
This commit is contained in:
parent
f705cf4cd4
commit
401335049d
@ -61,6 +61,18 @@ module.exports = class Styler
|
||||
return false for appliesTo in filters when not appliesTo feature
|
||||
true
|
||||
|
||||
when "any"
|
||||
filters = (@_compileFilter subFilter for subFilter in filter[1..])
|
||||
(feature) ->
|
||||
return true for appliesTo in filters when appliesTo feature
|
||||
false
|
||||
|
||||
when "none"
|
||||
filters = (@_compileFilter subFilter for subFilter in filter[1..])
|
||||
(feature) ->
|
||||
return false for appliesTo in filters when appliesTo feature
|
||||
true
|
||||
|
||||
when "=="
|
||||
(feature) -> feature.properties[filter[1]] is filter[2]
|
||||
|
||||
@ -77,9 +89,21 @@ module.exports = class Styler
|
||||
return false for value in filter[2..] when feature.properties[filter[1]] is value
|
||||
true
|
||||
|
||||
when "has"
|
||||
(feature) -> !!feature.properties[filter[1]]
|
||||
|
||||
when "!has"
|
||||
(feature) -> !feature.properties[filter[1]]
|
||||
|
||||
when ">"
|
||||
(feature) -> feature.properties[filter[1]] > filter[2]
|
||||
|
||||
when ">="
|
||||
(feature) -> feature.properties[filter[1]] >= filter[2]
|
||||
|
||||
when "<"
|
||||
(feature) -> feature.properties[filter[1]] < filter[2]
|
||||
|
||||
when "<="
|
||||
(feature) -> feature.properties[filter[1]] <= filter[2]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user