Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-790: Update mapfishprint to include fix for empty text on annotation. - #patch #1011

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be much better to wait and have a proper release tag here to go to prod (merging this PR will push it directly to prod !)

"@geoblocks/ol-maplibre-layer": "^1.0.0",
"@ivanv/vue-collapse-transition": "^1.0.2",
"@mapbox/togeojson": "^0.16.2",
Expand Down
19 changes: 6 additions & 13 deletions src/api/print.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -81,36 +82,28 @@ 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
}
}

/**
* Manipulate the symbolizer of a point style of a feature before printing it. In this case it
* 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
Expand Down
8 changes: 4 additions & 4 deletions tests/cypress/tests-e2e/print.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down
Loading