diff --git a/package-lock.json b/package-lock.json index 2289d045b..9dc8a6b74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/vue-fontawesome": "^3.0.8", "@geoblocks/cesium-compass": "^0.5.0", - "@geoblocks/mapfishprint": "^0.2.14", + "@geoblocks/mapfishprint": "github:geoblocks/mapfishprint#932253b0e8ccc0c1d911cab8e02c5b2fc7a061af", "@geoblocks/ol-maplibre-layer": "^1.0.0", "@ivanv/vue-collapse-transition": "^1.0.2", "@mapbox/togeojson": "^0.16.2", @@ -807,9 +807,9 @@ } }, "node_modules/@geoblocks/mapfishprint": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/@geoblocks/mapfishprint/-/mapfishprint-0.2.14.tgz", - "integrity": "sha512-WuTZcxvGsKbFIvoGZGAqFacK7PZU2mQAFd/KmdsYmjIoo9UFImktO0CJtdtyYamUXJEBY/D+oihZ4x8wd5QHFA==", + "version": "0.2.15", + "resolved": "git+ssh://git@github.com/geoblocks/mapfishprint.git#932253b0e8ccc0c1d911cab8e02c5b2fc7a061af", + "integrity": "sha512-pDGhsCVdR/9J2YhDUMqHS7qTG3ixLJL8crGh9KALboLxb2eOSVKM+/KjWB4BwelQloJJMbT2woVgUq+T+OXX/g==", "optionalDependencies": { "@geoblocks/print": "0.7.8" }, diff --git a/package.json b/package.json index 0d1a3c379..acde616bd 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@fortawesome/free-solid-svg-icons": "^6.5.2", "@fortawesome/vue-fontawesome": "^3.0.8", "@geoblocks/cesium-compass": "^0.5.0", - "@geoblocks/mapfishprint": "^0.2.14", + "@geoblocks/mapfishprint": "github:geoblocks/mapfishprint#932253b0e8ccc0c1d911cab8e02c5b2fc7a061af", "@geoblocks/ol-maplibre-layer": "^1.0.0", "@ivanv/vue-collapse-transition": "^1.0.2", "@mapbox/togeojson": "^0.16.2", diff --git a/src/api/print.api.js b/src/api/print.api.js index f574e8111..3df33d042 100644 --- a/src/api/print.api.js +++ b/src/api/print.api.js @@ -64,11 +64,12 @@ class GeoAdminCustomizer extends BaseCustomizer { * strokeDashstyle to dash instead of 8 (measurement line style in the mapfishprint3 backend) * * @param {State} layerState + * @param {GeoJSONFeature} geojsonFeature * @param {MFPSymbolizerLine} symbolizer Interface for the symbolizer of a line feature * @param {Stroke} stroke Stroke style of the line feature */ // eslint-disable-next-line no-unused-vars - line(layerState, symbolizer, stroke) { + line(layerState, geojsonFeature, symbolizer, stroke) { if (symbolizer?.strokeDashstyle === '8') { symbolizer.strokeDashstyle = 'dash' } @@ -81,24 +82,15 @@ class GeoAdminCustomizer extends BaseCustomizer { * Manipulate the symbolizer of a text style of a feature before printing it. * * @param {State} layerState + * @param {GeoJSONFeature} geojsonFeature * @param {MFPSymbolizerText} symbolizer Interface for the symbolizer of a text feature * @param {Text} text Text style of the feature */ // eslint-disable-next-line no-unused-vars - text(layerState, symbolizer, text) { + text(layerState, geojsonFeature, symbolizer, text) { symbolizer.pointRadius = adjustWidth(symbolizer.pointRadius, this.printResolution) symbolizer.strokeWidth = adjustWidth(symbolizer.strokeWidth, this.printResolution) symbolizer.haloRadius = adjustWidth(symbolizer.haloRadius, this.printResolution) - // Ideally this should be done in the geoblocks/mapfishprint - // but it's quite complex to handle all the cases - try { - const fontFamily = symbolizer.fontFamily.split(' ') - symbolizer.fontWeight = fontFamily[0] - symbolizer.fontSize = parseInt(fontFamily[1]) - symbolizer.fontFamily = fontFamily[2].toUpperCase() - } catch (error) { - // Keep the font family as it is - } } /** @@ -106,11 +98,12 @@ class GeoAdminCustomizer extends BaseCustomizer { * manipulate the width and offset of the image to match the old geoadmin * * @param {State} layerState + * @param {GeoJSONFeature} geojsonFeature * @param {MFPSymbolizerPoint} symbolizer Interface for the symbolizer of a text feature * @param {Image} image Image style of the feature */ // eslint-disable-next-line no-unused-vars - point(layerState, symbolizer, image) { + point(layerState, geojsonFeature, symbolizer, image) { const scale = image.getScaleArray()[0] let size = null let anchor = null diff --git a/tests/cypress/tests-e2e/print.cy.js b/tests/cypress/tests-e2e/print.cy.js index 765ddc981..2adb4c841 100644 --- a/tests/cypress/tests-e2e/print.cy.js +++ b/tests/cypress/tests-e2e/print.cy.js @@ -486,8 +486,8 @@ describe('Testing print', () => { const textSymbolAttributes = { type: 'text', label: 'Sample Label', - fontFamily: 'HELVETICA', - fontSize: 16, + fontFamily: 'Helvetica', + fontSize: '16px', fontWeight: 'normal', labelYOffset: 44.75, } @@ -557,8 +557,8 @@ describe('Testing print', () => { const textSymbolAttributes = { type: 'text', label: 'Old Label', - fontFamily: 'HELVETICA', - fontSize: 16, + fontFamily: 'Helvetica', + fontSize: '16px', fontWeight: 'normal', labelYOffset: 0, }