Fix svg displacement#5323
Open
jyrimatti wants to merge 3 commits into
Open
Conversation
f44aca1 to
37a2e33
Compare
37a2e33 to
e450236
Compare
e450236 to
530e3a3
Compare
to verify correct behavior for anchor+rotation with/without displacement
According to org.geotools.api.style.Graphic.getDisplacement(), displacement should happen _after_ rotation. GraphicStyle2D branch was already working correctly.
530e3a3 to
a20f8e4
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Member
|
This fix can not be merged until a CLA is filed with OSGeo and a jira ticket is provided and referenced in the title of this PR |
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.
I had encountered some problems during rendering which looked like the displacement wasn't being applied correctly. I had some trouble figuring out why it doesn't happen always, but finally realized that rendering SVG icons takes a different code path than rendering raster icons. My current workaround of using a certain kind of AnchorPoint instead of a correct one with an appropriate Displacement works, but is so hideously ugly that I'd prefer having things work as they should.
This PR fixes the order of transformations in
org.geotools.renderer.lite.StyledShapePainterIconStyle2D branch.As documented in
org.geotools.api.style.Graphic.getDisplacement, the displacement should happen after rotation. The GraphicStyle2D branch seems to have it already correct.This PR also adds some tests to the raster branch (ExternalGraphicTest) to ensure the already correct behavior there when AnchorPoint, Rotation and Displacement are all being used. Another test in DrawTest is added to reproduce the actual bug and verify the fix.
The expected images (under test-data) at least in my opinion look correct, but please do let me know if I have thoroughly misunderstood something. Also please let me know if you need anything more from this PR.
Checklist
mainbranch (backports managed later; ignore for branch specific issues).For core and extension modules:
[GEOT-XYZW] Title of the Jira ticket.