Skip to content

Commit

Permalink
Merge pull request #723 from miccoh1994/master
Browse files Browse the repository at this point in the history
feat: support symbolizer visibility
  • Loading branch information
KaiVolland authored Jun 16, 2023
2 parents 71583bf + c4d9535 commit c7206f5
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/OlStyleParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FillSymbolizer,
Filter,
IconSymbolizer,
isGeoStylerBooleanFunction,
isGeoStylerFunction,
isGeoStylerStringFunction,
isIconSymbolizer,
Expand Down Expand Up @@ -71,16 +72,14 @@ export class OlStyleParser implements StyleParser<OlStyleLike> {
blur: 'none',
offsetAnchor: 'none',
pitchAlignment: 'none',
pitchScale: 'none',
visibility: 'none'
pitchScale: 'none'
},
FillSymbolizer: {
antialias: 'none',
fillOpacity: {
support: 'none',
info: 'Use opacity instead.'
},
visibility: 'none'
}
},
IconSymbolizer: {
allowOverlap: 'none',
Expand All @@ -101,8 +100,7 @@ export class OlStyleParser implements StyleParser<OlStyleLike> {
pitchAlignment: 'none',
rotationAlignment: 'none',
textFit: 'none',
textFitPadding: 'none',
visibility: 'none'
textFitPadding: 'none'
},
LineSymbolizer: {
blur: 'none',
Expand All @@ -111,7 +109,6 @@ export class OlStyleParser implements StyleParser<OlStyleLike> {
miterLimit: 'none',
roundLimit: 'none',
spacing: 'none',
visibility: 'none',
graphicFill: 'none',
graphicStroke: 'none',
perpendicularOffset: 'none'
Expand Down Expand Up @@ -761,8 +758,18 @@ export class OlStyleParser implements StyleParser<OlStyleLike> {

if (isWithinScale && matchesFilter) {
rule.symbolizers.forEach((symb: Symbolizer) => {
const olSymbolizer: any = this.getOlSymbolizerFromSymbolizer(symb, feature);
if (symb.visibility === false) {
return null;
}

if (isGeoStylerBooleanFunction(symb.visibility)) {
const visibility = OlStyleUtil.evaluateBooleanFunction(symb.visibility);
if (!visibility) {
return null;
}
}

const olSymbolizer: any = this.getOlSymbolizerFromSymbolizer(symb, feature);
// either an OlStyle or an ol.StyleFunction. OpenLayers only accepts an array
// of OlStyles, not ol.StyleFunctions.
// So we have to check it and in case of an ol.StyleFunction call that function
Expand Down

0 comments on commit c7206f5

Please sign in to comment.