-
Notifications
You must be signed in to change notification settings - Fork 409
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
#10322: Fix scale selector to make it compatible with different projections #10344
Conversation
…different projections Description: - fix the bug by using the updated scaleZoom value instead of the projected value
…different projections Description: - add helpful comment
@offtherailz I would like if you can schedule a call with @mahmoudadel54 to review issues requirements before moving on with this review. |
…different projections Description: - fix not compatablity projections issue - add unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I noticed that the printing result is still wrong when switching coordinates. It have to be consistent with the map.
screencast-localhost_8081-2024.06.18-18_21_32.webm
Everything have to be consistent. I'll review the code where it is fixed.
- Other useful information are not clear, please explain them better.
Hi @offtherailz After checking this issue, I found out, this is the same currently behavior in print [in DEV or QA] ---> if the print projection is one of the geographic coordinate systems [like 4326] and the 'geodetic' = true into the "overrideOptions" in print cfg, and when I edited 'geodetic' to be false, printing map with geographic projection e.g: 4326 printing works for me. geodetic.mp4 |
@offtherailz I have updated the useful information section. I hope it is more clear now |
…different projections Description: - resolve review comments related to unit tests [replace async/await with then + remove unnecessary async/await]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AS we discussed in a call @mahmoudadel54 the PR has still the inonsistencies I notified in the Preview.
As we checked, the preview looks consistent when geodetic
is set to false
, so our development will do it in that direction, assuming that geodetic
is set to false
.
Now print plugin allows to send the geodetic parameter via configuration, but it doesn't handle to change the preview to fit the final result.
…different projections Description: - fix issues of not consistent map print scales with the current map view
…different projections Description: - fix FE issue
Now it looks a lot better the preview looks to be correctly in sync with every change.
As you can see, even if the scale (200000) is correctly sent to the server, the preview looks to be a little smaller than the effective are printed. So the preview for some reason a smaller than the effective print. Sometimes nearest with the next scale: Here a sample in 4326 Debugging I noticed that the resolutions received by the map in this case are 30 while the scales are 15. |
I fixed the preview with this commit. Basically now, if Please @mahmoudadel54 look at my changes to understand what was missing and adjust tests if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the tests and do a sert of manual tests more.
…different projections Description: - resolve FE failure due to changes
@ElenaGallo please test this in DEV once deployed and let us know for the backport. |
Test passed, @mahmoudadel54 please backport to 2024.01.xx Thanks |
…different projections (geosolutions-it#10344) * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - fix the bug by using the updated scaleZoom value instead of the projected value * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - add helpful comment * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - fix not compatablity projections issue - add unit tests * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - resolve review comments related to unit tests [replace async/await with then + remove unnecessary async/await] * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - fix issues of not consistent map print scales with the current map view * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - fix FE issue * Fixed preview * geosolutions-it#10322: Fix scale selector to make it compatible with different projections Description: - resolve FE failure due to changes --------- Co-authored-by: Lorenzo Natali <[email protected]>
@ElenaGallo Backport is done ---> #10452 |
…ble with different projections (#10344) (#10452) * #10418: Share tool - the 'Add place mark and zoom to sharing link' option is not applied correctly (#10419) * #10322: Fix scale selector to make it compatible with different projections (#10344) * #10322: Fix scale selector to make it compatible with different projections Description: - fix the bug by using the updated scaleZoom value instead of the projected value * #10322: Fix scale selector to make it compatible with different projections Description: - add helpful comment * #10322: Fix scale selector to make it compatible with different projections Description: - fix not compatablity projections issue - add unit tests * #10322: Fix scale selector to make it compatible with different projections Description: - resolve review comments related to unit tests [replace async/await with then + remove unnecessary async/await] * #10322: Fix scale selector to make it compatible with different projections Description: - fix issues of not consistent map print scales with the current map view * #10322: Fix scale selector to make it compatible with different projections Description: - fix FE issue * Fixed preview * #10322: Fix scale selector to make it compatible with different projections Description: - resolve FE failure due to changes --------- Co-authored-by: Lorenzo Natali <[email protected]> --------- Co-authored-by: Lorenzo Natali <[email protected]>
@ElenaGallo I've also tested in DEV using test map here and following steps indicated here and all seems to work as expected with this fix. |
Description
In this PR, the issue of scale selector which was not compatible with different projections is resolved.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
#10322
What is the current behavior?
#10322
What is the new behavior?
Now if user opens the print modal, switches the projection to 4326 for example and select a scale from the scale selector list, it will selected successfully without choosing wrong one.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information
I have noticed some points within this issue:
1- wrong calculate scale zoom level in case user changes projection in the print modal, this causes the noticed wrong calculated scale in DD scales.
If you see this line which calculate the scaleZoom if useFixedScales = true
MapStore2/web/client/plugins/Print.jsx
Line 593 in 7443a48
it uses getNearestZoom method:
MapStore2/web/client/utils/PrintUtils.js
Lines 187 to 192 in 7443a48
MapStore2/web/client/utils/PrintUtils.js
Line 42 in 7443a48
So what I did is passing the scales of the actual correct projection to this method to get the correct calculated scaleZoom to display the correct expected scale in the scales drop down list.
2- Based on the 1st point above, the scale value of the configure print map was calculated wrongly:
MapStore2/web/client/plugins/Print.jsx
Line 594 in 7443a48
MapStore2/web/client/plugins/Print.jsx
Line 596 in 7443a48
MapStore2/web/client/plugins/Print.jsx
Line 599 in 7443a48
so here I refactored the method to calculate needed values based on the projection value
3- using 'getZoomForExtent' in 'configurePrintMap' method is not the proper way to get the mapZoom of the print map --> in some cases the change bet. main map viewer and the print map viewer >= 2 and this makes change in the print result:
MapStore2/web/client/plugins/Print.jsx
Lines 583 to 592 in 7443a48
so I used reprojectZoom method to calculate print map zoom instead using bbox and mapSize for that:
MapStore2/web/client/plugins/Print.jsx
Line 586 in 138ae35
4- when user opens the print panel, the sent projection 'prop' should be set initially to be consistent with the UI [selected projection in DD] and to be not misleading if the shown projection into UI not the initial one.
So I used initiated the projection into useEffect in Projection component at initiating the component:
MapStore2/web/client/plugins/print/Projection.jsx
Lines 68 to 75 in 138ae35