Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Svend Erik Nygaard on December 28, 2016, 06:46:41 am
-
PutDiagramImageToFile varies its right and bottom margin sizes from one diagram to another.
The images produced by the standard EA HTML report produces diagram images with margins 10 pixels wide.
For some diagrams PutDiagramImageToFile does the same as the standard EA HTML report – but for some other diagrams it produces larger right and bottom margins.
The problem is that when I scale the images I need to know what the algorithm behind this behavior is – otherwise I cannot get the map areas correct on the HTML page (on our own custom website).
Can anyone tell me: what is the algorithm behind EA generating different margin sizes from different diagrams?
(the images produces are much larger than those produces by the standard EA HTML report)
(PS: SaveDiagramImageToFile has the same issue)
(PS2: have not tried PutDiagramImageOnClipboard, which I would very much like to avoid for this purpose)
-
Do you have examples of diagrams that behave differently? It's likely that some object is reporting a larger bounding rect than it's visible display.
You may also find RepositoryGetDiagramImageAndMap (http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/repository3.html) helpful.
It gives you a pre-calculated image map paired with an image, so you don't need to reverse engineer how the html report creates it.
-
Hi Simon,
Yes.
The three html files below illustrate how the EA standard report diagram images differs in proportions from the corresponding images generated by PutDiagramImageToFile().
Each html file has at its top:
- first, the EA-report-generated image
- then, the PutDiagramImageToFile()-generated image
The PutDiagramImageToFile-generated image is much larger than the EA-report-generated image - but in order to ease the comparison of the two images, the html pages scales the PutDiagramImageToFile-generated image down to the same width as the EA-report-generated image.
The three html files illustrating differences:
"{947AA624-2D65-434d-B294-92604D143EEE} - putToFile has wider right margin.html"
"{35908A15-98DF-4847-B77E-3B0A84F50A66} - PutToFile has almost no right margin.html"
"{D1EC10E2-FED7-4f64-82D9-F1CF53653F09} - The two images are pretty much the same.html"
An easy way to visualize the image margins are to press ctrl-A on the html page to highlight all objects on the page - that visualizes the image area.
You can also pretty easily see that the diagram object cordinates are different (for the two of the html pages).
The images are of course also found in the folders corresponding to the html files.
In the examples here I have focused on the right margin - But I expect the the bottom margin to present somewhat similar issues.
It looks like the top and left margin are the same with the two methods.
I'm attaching a zip file with:
- the three html files and associated folders
- an XMI export (see below to locate the example diagrams)
If you import the XMI into an EA repository, you should find the three diagrams at the following paths:
"{947AA624-2D65-434d-B294-92604D143EEE} - putToFile has wider right margin.html" - .......AirportHeliport.Runway.4 - Runway Protection
"{35908A15-98DF-4847-B77E-3B0A84F50A66} - PutToFile has almost no right margin.html" - .......AirportHeliport.Runway.3 - Runway Operational Point
"{D1EC10E2-FED7-4f64-82D9-F1CF53653F09} - The two images are pretty much the same.html" - .......AirportHeliport.Airport/Heliport.5 - Apron Area Availability
(hope, I've got the above mappings right :-))
PS: About RepositoryGetDiagramImageAndMap - Thanks, I actually had not seen that. But on the other hand, I will also generate map areas for the connectors in the diagrams.
-
Uuups: I cannot find a way of attaching the example material mentioned in my previous post.
How do I attach files?
-
you can't attach files or images. You have to put them on a public site and reference them here.
Geert