Images generation
<image> tag must be defined under a <gendoc> tag.
It shall define one of the following attributes:
The drawing are correspond to the entire cell:
| A | B |
1 |
<context model='D:/…/myModel.uml'/>
<gendoc>
| |
2 |
<image … /> |
|
3 |
<gendoc> |
|
Customize image size
<image> tag provides the following attributes to handle image size customization:
keepW, keepH, maxW, maxH. They are used in association with the dimensions of the drawing area inside <image> tag:
- keepW: output image width will be the same as drawing area width
- keepH: output image height will be the same as drawing area height
- maxW: output image width will not oversize drawing area width
- maxH: output image height will not oversize drawing area height
Possible values for these attributes: false(default), true.
For the following initial image:
- Fix image width, height is computed proportionally, the image
overlap partially the next rows.
Template content |
Output |
| A | B |
1 |
<gendoc> |
|
2 |
<image object='…'
keepW=‘true’ keepH=‘false’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | |
|
- Fix image height, width is computed proportionally
Template content |
Output |
| A | B |
1 |
<gendoc> |
|
2 |
<image object='…'
keepW=‘false’ keepH=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | | |
|
- TO BE AVOIDED : Fix image height and width
Template content |
Output |
| A | B |
1 |
</gendoc> |
|
2 |
<image object='…'
keepW=‘true’ keepH=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | | |
|
- Ensure the image will not oversize a specified width
- Case 1 : Image is smaller than the drawing area
Output corresponds to origin image dimensions, and the picture
may overlap with the following rows.
Template content |
Output |
| A | B |
1 |
</gendoc> |
|
2 |
<image object='…'
maxW=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | |
|
- Case 2 : Image is larger than the drawing area
Output corresponds to drawing area dimension:
Template content
|
Output
|
| A | B |
1 |
</gendoc> |
|
2 |
<image object='…'
maxW=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | |
|
- Ensure the image will not oversize a specified height
- Case 1 : Image is smaller than the drawing area
Output corresponds to origin image dimensions
Template content
|
Output
|
| A | B |
1 |
</gendoc> |
|
2 |
<image object='…'
maxH=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | | |
|
- Case 2 : Image is larger than the drawing area
Output corresponds to drawing area dimension:
Template content
|
Output
|
| A | B |
1 |
</gendoc> |
|
2 |
<image object='…'
maxH=‘true’/> |
|
3 |
</gendoc> |
|
|
| A | B |
1 | | |
2 |
 |
|
3 | | |
|
Displaying diagrams
Attribute object shall be filled by an ID of the diagram. Diagram ID can be generated by
service getDiagram from bundle gmf, called on the diagram:
Template content
|
| A | B |
1 |
<context model='${model}' importedBundles='gmf;papyrus'/>
<gendoc>
[for (diag : Diagram| self.getPapyrusDiagrams()] |
|
2 |
<image object='[diag.getDiagram()/]' maxW='true' keepH='false'/>
|
|
3 |
[/for]
</gendoc> |
|
|
Displaying static images
<image> tag can also be used for static image generation, with the following content:
- attribute filePath shall contain the absolute path of the static image.
The following image formats are supported : GIF, JPG, JPEG, BMP, PNG, SVG
- <image> tag shall contain an empty drawing area (alignment, text adaptation, …)
- size attributes can be used : keepW, keepH,
maxW, maxH
The following example shows the display of a static image:
Template content
|
Output
|
| A | B |
1 |
<context model='${model_path}'/>
<gendoc>
Project logo is displayed below : |
|
2 |
<image filePath='D:/gendoc_logo.jpg' maxW='true'/>
|
|
3 |
</gendoc> |
|
|
| A | B |
1 | Project logo is displayed below : | |
2 |
 |
|
3 | | |
|