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

Rework print functionality #340

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Rework print functionality #340

merged 2 commits into from
Nov 20, 2024

Conversation

BenediktSeidlSWM
Copy link
Contributor

This pull request includes a complete rework of the printing functionality of qwc2. Instead of an HTML overlay, the new PrintSelection component renders a new layer on the map. Inside this layer, the user can now interact with the selection box. It can be moved, scaled and rotated on the map without moving the map itself. This change provides a more intuitive and flexible way to print or export parts of the map.

Additionally, a new feature has been implemented to allow printing a series of selection boxes next to each other. This "print series" feature is disabled by default, but can be turned on with the displayPrintSeries flag on the Print plugin. When enabled, the user can select additional frames (optionally with an adjustable overlap). The user can then also select whether they want to obtain a PDF with several pages, multiple PDF documents with a single page or a ZIP archive containing multiple PDF documents.

Additional changes

A new option fileNameTemplate is introduced. This option allows us to set a custom file name for the generated documents. The default value is the template used right now.

The MapExport plugin has been updated to use the new PrintSelection component. It resembles the functionality of the old implementation with little updates on the styling.

The deprecated DxfExport and RasterExport plugins are removed. They do not seem to be completely functional any more and depend on the now obsolete PrintFrame component.

Technical details

The solution of setting a modifyGeometry property on the feature in combination with the ModifyInteraction provided by openlayers is inspired by this example.

The slightly tedious logic for rendering the background when the print series overlap is enabled is due to the fact that in openlayers, if two negative linear rings of a polygon overlap, the intersection is rendered as a positive part of the polygon.

Screenshots

image
image
image
image

@tpo
Copy link
Contributor

tpo commented Nov 20, 2024

nice!!!

@manisandro manisandro merged commit 847b569 into qgis:master Nov 20, 2024
2 checks passed
@manisandro
Copy link
Member

Wow this looks nice! I'll go ahead an merge it to enable wider testing before the next 2025-lts.

@BenediktSeidlSWM
Copy link
Contributor Author

Thanks for your positive feedback! Please let me know if you find any bugs or improvements. 😄

@BenediktSeidlSWM BenediktSeidlSWM deleted the print branch November 20, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants