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

Get ImageMap Shape tessilation right #163

Merged
merged 8 commits into from
Dec 31, 2017

Conversation

rototor
Copy link
Contributor

@rototor rototor commented Dec 26, 2017

Using https://www.sunshine2k.de/coding/java/Polygon/Kong/Kong.html

I've adapted the class for this use case. In the readme provided with the java sources the author says "please give me some credits". IANAL but I think it should be save to include the files here. But I will check back with the author.

From the given transform only the scale is used, as I could not get the concatination of the transform working correctly. This should only affect images affected by CSS-transform. Feel free to fix this, to make this work correctly with CSS-transforms.

In the sample svg-inline there is now a image map using two rectangles and a circle. Those work with Acrobat Reader with this changes. Mac OS X preview seems to ignore the quad points.

@rototor
Copy link
Contributor Author

rototor commented Dec 28, 2017

Just got the information from the author of the kong algorithm implementation that the source is licensed using MIT and that we can freely use it. We can mention him in the release notes, but we don't have to.

I'll add the changes for that and also will fix the transform / scaling stuff. So you may wait a day or two until you merge this branch, as I will future work on it.

…This allows to use the

full transform matrix to be applied on the resulting map for the link. But the rectangle box of
the link does not yet consider the transform correctly.
inside the target area. Hmm, seems to be a display bug in Acrobat...
Shape<->Link Map. Also fixes some corner cases when splitting triangles
for the links. Do not add annotations with empty quad links.

Added an example of how to use objects drawers to draw Pie and Bar
charts using JFreeChart. This tries to also provide the Shape<->Link map
for each item. But does not work at the moment... for whatever reason.
@rototor
Copy link
Contributor Author

rototor commented Dec 28, 2017

@danfickle I'm done with my changes here. Currently the transforms applied through CSS "transform" are not applied on the transform which is given to the link manager.

Because of this transformed objects have their links wrong:

image

Other than that it seems ok now. This PullRequest should now be ready for merge.

Some other thing: To test this out I've integrated JFreeChart into the examples and build some small example object drawer which allow to define graphs using objects in HTML. Should we provide such object drawers in e.g. a openhtmltopdf-objects library? Then openhtmltopdf could draw different kinds of diagrams "out of the box". What do you think?

@danfickle
Copy link
Owner

Thanks @rototor - I have no problem with extra modules to incorporate different object drawers. It seems like a pretty good idea. The only caution I have is documenting all the new feature we’re (well, mostly you - thank you) adding.

@danfickle danfickle merged commit e572617 into danfickle:open-dev-v1 Dec 31, 2017
@rototor rototor deleted the link_polygon_tesselation branch December 31, 2017 11:48
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.

2 participants