Skip to content

#10839: Allow printing by freely setting the scale factor#11130

Merged
offtherailz merged 4 commits intogeosolutions-it:masterfrom
mahmoudadel54:issue_10839
Jun 25, 2025
Merged

#10839: Allow printing by freely setting the scale factor#11130
offtherailz merged 4 commits intogeosolutions-it:masterfrom
mahmoudadel54:issue_10839

Conversation

@mahmoudadel54
Copy link
Copy Markdown
Contributor

This PR handles allowing printing by freely setting using zoom slider or entering a value in DD of scales if a cfg 'disableScaleLocking' for Print plugin equals true and compatable with print service in config.yml file.
This PR includes:

  • creating ZoomSliderComp
  • allow to configure disableScaleLocking for print plugin to enable disable scales lock in print to be compatable with print service
  • handle editable DD for scales by adding new scale values to list
  • handle sending the actual scale of map in case disableScaleLocking = true
  • if useFixedScales and disableScaleLocking are configured to Print plugin the priority will be for disableScaleLocking

Description

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?

#10839

What is the new behavior?
User can print with be set freely using zoom slider or entering a value in DD of scales

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

- allow to configure 'disableScaleLocking' for print plugin to enable disable scales lock in print to be compatable with print service
- handle editing DD for scales
- handle sending the actual scale of map in case disableScaleLocking = true
- add translations
@mahmoudadel54 mahmoudadel54 added this to the 2025.01.01 milestone May 22, 2025
@mahmoudadel54 mahmoudadel54 requested a review from offtherailz May 22, 2025 07:22
@mahmoudadel54 mahmoudadel54 self-assigned this May 22, 2025
@mahmoudadel54 mahmoudadel54 linked an issue May 22, 2025 that may be closed by this pull request
8 tasks
@mahmoudadel54 mahmoudadel54 changed the title #10836: Allow printing by freely setting the scale factor #10839: Allow printing by freely setting the scale factor May 22, 2025
@mahmoudadel54
Copy link
Copy Markdown
Contributor Author

After a sync meeting with @offtherailz it is requested some changes to the implementation which is:

  • when user enter a manual scale in scales list, we will update the map resolutions list due to the new added scale to include the correspond resolution
  • In order to properly document the functionality and make it consistent with the docuemntation we will:

1- add a new property named editScale = true by default (as well as useFixedScales is = false, that implies that by default disableScaleLocking=true.
2- on documentation of the plugin, let's improve useFixedScales doc, saying that if disableScaleLocking = false, useFixedScales must be true, (so we don't have errors because of scale not allowed)
3- on the new property doc editScale we say also that if disableScaleLocking = false, editScale must be false (so we don't have errors because of scale not allowed)

the 2nd point is added to issue description itself

- add editScale to be for Print cfg
- edit translation
- add jsdocs
@mahmoudadel54 mahmoudadel54 marked this pull request as ready for review May 27, 2025 06:36
Copy link
Copy Markdown
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

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

Here the functionality. To summarize also for @tdipisa .

Video.del.2025-06-16.14-18-18.mp4

I prepared this setup:

http://localhost:8081/#/context/test_10839_fractional_zoom

With the following config of the printing tool to test

{
  "cfg": {
    "geodetic": true,
    "editScale": true,
    "useFixedScales": false,
    "mapPreviewOptions": {
      "enableScalebox": true
    }
  },
  "override": {}
}

Bugs of this PR:

  • Clearable ("x" at the end of the input box) should not be there. It clears
  • The zoom slider control can be helpful, but it snaps of existing (or new inserted by thsi PR) scale values, so not useful for the specific application, but in general it can help the user to adapt the zoom. So we can do 2 things with this scale bar, I ask about this to take a decision to @tdipisa :
    • Make it always available (it doesn't regards only the case of editable scale, in fact)
    • Remove it (if not part of the PR).

Pre-existing bugs

I noticed that, setting up A4 rather then A2 the scale and the bbox remains the same. This looks incorrect, because in fact the ratio is double for A2, A3, A4. When printed the image effectively changes.

Video.del.2025-06-16.13-06-01.mp4

This is pre-existing issue, replicated here on dev

Video.del.2025-06-16.14-28-49.mp4
Video.del.2025-06-16.14-28-49.mp4

@tdipisa
Copy link
Copy Markdown
Member

tdipisa commented Jun 16, 2025

@offtherailz thank you so much.
@mahmoudadel54 let's remove the zoom slider control for now as not requested here.

- remove clear icon from scalebox list
- remove zoom slider control from print
@mahmoudadel54
Copy link
Copy Markdown
Contributor Author

Pre-existing bugs

I noticed that, setting up A4 rather then A2 the scale and the bbox remains the same. This looks incorrect, because in fact the ratio is double for A2, A3, A4. When printed the image effectively changes.

Video.del.2025-06-16.13-06-01.mp4
This is pre-existing issue, replicated here on dev

Video.del.2025-06-16.14-28-49.mp4
Video.del.2025-06-16.14-28-49.mp4

I have tried to reproduced it locally and it doesn't

print.mp4

Copy link
Copy Markdown
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

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

Parameters are sent consistently and everything looks working.

From my test:

  • in a cotnext properly configured With no fixed scales and geodedic: true.
  • added a measure of a street 53 as annotation
  • added scale 1000
  • printed in A4

mapstore-print.pdf

Everything looks consistent: 👍
(no ruler, so no precise measures, sorry 😄 )

  • image
  • image

@offtherailz offtherailz merged commit 7a278b6 into geosolutions-it:master Jun 25, 2025
6 checks passed
@offtherailz
Copy link
Copy Markdown
Member

@ElenaGallo, could you please test this on DEV ? Thank you

@offtherailz offtherailz added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jun 25, 2025
@offtherailz
Copy link
Copy Markdown
Member

When backport, @mahmoudadel54 do not forget to backport also this one:
#11245

@ElenaGallo
Copy link
Copy Markdown
Contributor

Test passed, @mahmoudadel54 please backport to 2025.01.xx. Thanks

mahmoudadel54 added a commit to mahmoudadel54/MapStore2 that referenced this pull request Jun 26, 2025
…tor (geosolutions-it#11130)

* - creating ZoomSliderComp
- allow to configure 'disableScaleLocking' for print plugin to enable disable scales lock in print to be compatable with print service
- handle editing DD for scales
- handle sending the actual scale of map in case disableScaleLocking = true
- add translations

* - fix FE failure tests via edit unit test in actions/print

* - handle saving/update resolution for editScale
- add editScale to be for Print cfg
- edit translation
- add jsdocs

* resolve review comments:
- remove clear icon from scalebox list
- remove zoom slider control from print
@mahmoudadel54
Copy link
Copy Markdown
Contributor Author

Test passed, @mahmoudadel54 please backport to 2025.01.xx. Thanks

Backport is done --> #11247

@mahmoudadel54
Copy link
Copy Markdown
Contributor Author

mahmoudadel54 commented Jun 26, 2025

When backport, @mahmoudadel54 do not forget to backport also this one: #11245

I think it was better to wait for merge backport PR for #11236 first as now the backport PR for #10839 is red @offtherailz
then I can make rebase

dsuren1 added a commit to dsuren1/MapStore2 that referenced this pull request Jun 27, 2025
* fix_icon:
  fix FE unit tests failure due to change in PR 11236 (geosolutions-it#11245)
  geosolutions-it#10839: Allow printing by freely setting the scale factor (geosolutions-it#11130)
  Annotation/Measurement not shown in the legend of the printred map geosolutions-it#11235 (geosolutions-it#11236)
@mahmoudadel54 mahmoudadel54 removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow printing by freely setting the scale factor

4 participants