Conversation
Fix incorrect label placement and rotation when map is rotated. Move label rotation logic from RotationQuadrant to GridLayer. Update GridLayer to apply rotation before offsets. Add regression test CreateMapProcessorGridFixedNumlinesLinesRotatedTest. Update existing tests and reference images to reflect correct behavior.
Restore applying label offsets in screen coordinates instead of rotated map coordinates. This ensures verticalXOffset and horizontalYOffset behave consistently regardless of map rotation. Previously, offsets were applied after rotation, causing them to be relative to the rotated grid lines, which was incorrect if users expected screen-relative shifts.
Add CreateMapProcessorGridFixedNumlinesLinesRotatedOffsetTest to verify that label offsets are applied correctly (screen-relative) when the map is rotated.
…ectors in screen coordinates Replace RotationQuadrant with new logic in GridLayer and GridUtils. Calculate text rotation and alignment dynamically based on map rotation and side. Apply indentation perpendicular to the map border (screen coordinates). Apply offsets relative to the text orientation. Update regression tests and reference images. Remove unused RotationQuadrant class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2004
Description
This PR addresses issues with Grid Layer labels when the map is rotated:
GridLayer.java.verticalXOffsetorhorizontalYOffseton a rotated map. The fix ensures offsets are applied in screen coordinates (before rotation), making them consistent regardless of map rotation.Changes
GridLayer.javato apply label rotation explicitly and apply offsets before rotation.RotationQuadrant.java.CreateMapProcessorGridFixedNumlinesLinesRotatedTest: Tests grid lines with various rotation angles.CreateMapProcessorGridFixedNumlinesLinesRotatedOffsetTest: Tests grid lines with rotation AND offsets to verify correct placement.Verification
./gradlew core:test --tests "org.mapfish.print.processor.map.CreateMapProcessorGridFixedNumlinesLinesRotatedTest"./gradlew core:test --tests "org.mapfish.print.processor.map.CreateMapProcessorGridFixedNumlinesLinesRotatedOffsetTest"