From a40efe90a637b48828ab0cd312645c0cd97d7608 Mon Sep 17 00:00:00 2001 From: Kai Volland Date: Wed, 27 Nov 2024 15:44:44 +0100 Subject: [PATCH 1/3] test: enhance unsupported properties test --- data/olStyles/unsupported_properties.ts | 10 ++++++++-- data/styles/unsupported_properties.ts | 4 ++++ src/OlStyleParser.spec.ts | 5 ++++- src/OlStyleParser.ts | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/data/olStyles/unsupported_properties.ts b/data/olStyles/unsupported_properties.ts index afb503c8..2d0c60fa 100644 --- a/data/olStyles/unsupported_properties.ts +++ b/data/olStyles/unsupported_properties.ts @@ -1,10 +1,16 @@ import OlStyle from 'ol/style/Style'; import OlStyleFill from 'ol/style/Fill'; +import OlStyleIcon from 'ol/style/Icon'; -const olUnsupportedProperties = new OlStyle({ +const unsupportedFill = new OlStyle({ fill: new OlStyleFill({ color: '#F1337F' }) }); +const unsupportedImage = new OlStyle({ + image: new OlStyleIcon({ + src: 'peter.png' + }) +}); -export default olUnsupportedProperties; +export default [unsupportedFill, unsupportedImage]; diff --git a/data/styles/unsupported_properties.ts b/data/styles/unsupported_properties.ts index 2f507fdb..b4204474 100644 --- a/data/styles/unsupported_properties.ts +++ b/data/styles/unsupported_properties.ts @@ -9,6 +9,10 @@ const unsupportedProperties: Style = { kind: 'Fill', color: '#F1337F', opacity: 0.5 + }, { + kind: 'Icon', + image: 'peter.png', + anchor: 'bottom-left' }] } ] diff --git a/src/OlStyleParser.spec.ts b/src/OlStyleParser.spec.ts index e6f08fe1..71a581c8 100644 --- a/src/OlStyleParser.spec.ts +++ b/src/OlStyleParser.spec.ts @@ -1316,7 +1316,10 @@ describe('OlStyleParser implements StyleParser', () => { info: 'Use fillOpacity instead.', support: 'none' } - } + }, + IconSymbolizer: { + anchor: 'none', + }, } }; const warningsGot = ['Your style contains unsupportedProperties!']; diff --git a/src/OlStyleParser.ts b/src/OlStyleParser.ts index 5ba37e7c..2829a7a8 100644 --- a/src/OlStyleParser.ts +++ b/src/OlStyleParser.ts @@ -1238,7 +1238,7 @@ export class OlStyleParser implements StyleParser { const baseProps: OlStyleIconOptions = { src: isSprite(symbolizer.image) ? symbolizer.image.source as string : symbolizer.image as string, - crossOrigin: 'anonymous', + crossOrigin: null, opacity: symbolizer.opacity as number, width: symbolizer.size as number, // Rotation in openlayers is radians while we use degree From d1d9bfecac5371e9840c65141867805777746424 Mon Sep 17 00:00:00 2001 From: Kai Volland Date: Wed, 27 Nov 2024 15:50:03 +0100 Subject: [PATCH 2/3] fix: add missing "anchor" to unsupportedProperties --- src/OlStyleParser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OlStyleParser.ts b/src/OlStyleParser.ts index 2829a7a8..4e01a127 100644 --- a/src/OlStyleParser.ts +++ b/src/OlStyleParser.ts @@ -119,6 +119,7 @@ export class OlStyleParser implements StyleParser { }, RasterSymbolizer: 'none', TextSymbolizer: { + anchor: 'none', placement: { support:'partial', info: 'point and line supported. line-center will be mapped to line.' From 8a6efd66ecd4fe587e097d4b7286cd7ccc9cfce2 Mon Sep 17 00:00:00 2001 From: Kai Volland Date: Mon, 2 Dec 2024 09:18:22 +0100 Subject: [PATCH 3/3] test: reset crossOrigin --- data/olStyles/unsupported_properties.ts | 3 ++- src/OlStyleParser.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/olStyles/unsupported_properties.ts b/data/olStyles/unsupported_properties.ts index 2d0c60fa..86819984 100644 --- a/data/olStyles/unsupported_properties.ts +++ b/data/olStyles/unsupported_properties.ts @@ -9,7 +9,8 @@ const unsupportedFill = new OlStyle({ }); const unsupportedImage = new OlStyle({ image: new OlStyleIcon({ - src: 'peter.png' + src: 'peter.png', + crossOrigin: 'anonymous' }) }); diff --git a/src/OlStyleParser.ts b/src/OlStyleParser.ts index 4e01a127..8aa48eaa 100644 --- a/src/OlStyleParser.ts +++ b/src/OlStyleParser.ts @@ -1239,7 +1239,7 @@ export class OlStyleParser implements StyleParser { const baseProps: OlStyleIconOptions = { src: isSprite(symbolizer.image) ? symbolizer.image.source as string : symbolizer.image as string, - crossOrigin: null, + crossOrigin: 'anonymous', opacity: symbolizer.opacity as number, width: symbolizer.size as number, // Rotation in openlayers is radians while we use degree